Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6eventq.h
Go to the documentation of this file.
1 
15 #ifndef P6EVENTQ_H__
16 #define P6EVENTQ_H__ 1
17 
18 #include "p6queue.h"
19 #include "p6net.h"
20 #include "p6file.h"
21 #include "p6iobuffer.h"
22 
23 
24 #ifdef __cplusplus
25 namespace P6R {
26 extern "C" {
27 #endif
28 
29 #if 0
30 
40  typedef P6R::P6UINT32 P6EQCODE;
41  #define P6EQTYPE(code) ((code) & 0xffff)
42  #define P6EQTYPEOP(code) (((code) >> 16 ) & 0xffff)
44  typedef enum {
45  P6TIOO_ACCEPT,
46  P6TIOO_CONNECT,
47  P6TIOO_READ,
48  P6TIOO_WRITE,
49  P6TIOO_CLOSE,
50  P6TIOO_MAX
51  } P6TYPEIOOP;
52 
53  typedef enum {
54  P6TTO_TIMEOUT,
55  P6TTO_MAX
56  } P6TYPETIMEROP;
57 
58 
59 #endif
60 
71 
72  #define P6EQTYPE(type) ((P6UINT32)(type) & 0xffff)
73  #define P6EQOP(op) (((P6UINT32)(op) >> 16 ) & 0xffff)
74  #define P6EQMAKEEVENT(type,op) ((P6EVENTTYPE)((((P6UINT32)(op) & 0xffff)<<16)|(((P6UINT32)(type) & 0xffff))))
75 
76  typedef enum {
77  P6ET_IO = 1,
78  P6ET_TIMER = 2,
79  P6ET_MSG = 3,
80  P6ET_USER = 400,
82  } P6EQIOTYPE;
83 
84  typedef enum {
87  P6IO_READ = 2,
88  P6IO_WRITE = 3,
89  P6IO_CLOSE = 4,
91  } P6IOOP;
92 
93  typedef enum {
94  P6TO_FIRED = 0,
96  } P6TIMEROP;
97 
105  #undef INTERFACE
106  #define INTERFACE p6IEventQHooks
108  {
125  P6DECLCOMMETHOD(validateAccept)(P6THIS_ P6NETADDR *pLocalAddr,P6NETADDR *pRemoteAddr) P6PURE;
126 
127  P6DECLCOMMETHOD(validateConnect)(P6THIS_ P6NETADDR *pRemoteAddr) P6PURE;
128  };
129 
130 
132  #define P6IOUSERFLAGS(flags) ((flags) & 0xffff)
133  #define P6IORESERVEDFLAGS(flags) ((flags) >> 16 ) & 0xffff)
135  static const P6IOFLAG P6IOF_NONE = 0x00000000;
136  static const P6IOFLAG P6IOF_RESERVEDMASK = 0xFFFF0000;
138  static const P6IOFLAG P6IOF_USERMASK = 0x0000FFFF;
153  typedef struct {
163  P6NETADDR m_address;
168  } P6IOCONTEXT;
169 
170 
176  static const P6EVENTQFLAG P6EQF_NONE = 0x00000000;
177  static const P6EVENTQFLAG P6EQF_ENABLELOG = 0x00000001;
178  static const P6EVENTQFLAG P6EQF_LOGXML = 0x00000002;
180 
237  #undef INTERFACE
238  #define INTERFACE p6IEventQ
240  {
265  P6DECLCOMMETHOD(initialize)(P6THIS_ const P6WCHAR *pwszQueueName,
266  const P6WCHAR *pwszEventSourceDefFile,
267  p6IIoBufferFactory *pFactory,
268  p6IEventQHooks *pHooks,
269  P6EVENTQFLAG fFlags) P6PURE;
281  P6DECLCOMMETHOD(getName)(P6THIS_ P6WCHAR *pBuffer,P6INT32 cBuffer) P6PURE;
282 
292  P6DECLCOMMETHOD(getBufferFactory)(P6THIS_ p6IIoBufferFactory **ppFactory) P6PURE;
293 
300  P6DECLCOMMETHOD(start)(P6THIS) P6PURE;
301 
309 
320  P6DECLCOMMETHOD(enableLogging)(P6THIS_ P6BOOL bEnable) P6PURE;
321 
334  P6DECLCOMMETHOD(postEvent)(P6THIS_ P6EVENTTYPE nType,P6QPRIORITY nPriority,p6ICom *pIoIface,p6IIoBuffer *pIoBuffer,P6IOCONTEXT *pIoContext,P6VOID *pHandleContext) P6PURE;
335 
361  P6DECLCOMMETHOD(getNextEvent)(P6THIS_ P6EVENTTYPE *pnType,
362  p6ICom **ppIoIface,
363  p6IIoBuffer **ppIoBuffer,
364  P6IOCONTEXT **ppIoContext,
365  P6VOID **ppHandleContext,
366  P6INTERVAL tTimeout) P6PURE;
367 
368 
369 
370 
371  };
372  // {B54E9FA6-1475-4BED-89E3-D203349579D9}
373  #define IF_p6IEventQ {0xB54E9FA6,0x1475,0x4BED,{0x89,0xE3,0xD2,0x03,0x34,0x95,0x79,0xD9}}
374 
375  // {E021593C-7B84-45C4-B08B-5CE58598D669}
376  #define COMP_p6EventQ {0xE021593C,0x7B84,0x45C4,{0xB0,0x8B,0x5C,0xE5,0x85,0x98,0xD6,0x69}}
377 
378 
379  #undef INTERFACE
380  #define INTERFACE p6IEventQIO
382  {
398  P6DECLCOMMETHOD(associate)(P6THIS_ p6ICom *pIoIface,P6VOID *pHandleContext) P6PURE;
399 
417  P6DECLCOMMETHOD(disassociate)(P6THIS_ p6ICom *pIoIface,P6VOID **ppHandleContext) P6PURE;
418 
435  P6DECLCOMMETHOD(postAccept)(P6THIS_ p6ICom *pIoIface) P6PURE;
436 
451  P6DECLCOMMETHOD(postConnect)(P6THIS_ p6ICom *pIoIface,P6IOCONTEXT *pIoContext) P6PURE;
452 
488  P6DECLCOMMETHOD(postRead)(P6THIS_ p6ICom *pIoIface,p6IIoBuffer *pIoBuffer,P6IOCONTEXT *pIoContext) P6PURE;
489 
525  P6DECLCOMMETHOD(postWrite)(P6THIS_ p6ICom *pIoIface,p6IIoBuffer *pIoBuffer,P6IOCONTEXT *pIoContext) P6PURE;
526  P6DECLCOMMETHOD(postClose)(P6THIS_ p6ICom *pIoIface,P6IOCONTEXT *pIoContext) P6PURE;
527 
528  };
529  // {9E6C7695-8BD8-423B-81C1-363CCE16FE31}
530  #define IF_p6IEventQIO {0x9E6C7695,0x8BD8,0x423B,{0x81,0xC1,0x36,0x3C,0xCE,0x16,0xFE,0x31}}
531 
532  #undef INTERFACE
533  #define INTERFACE p6IEventQTimer
535  {
537  P6DECLCOMMETHOD(postIntervalTimer)(P6THIS_ P6R::P6INTERVAL *pnExpireInterval,P6R::P6QPRIORITY nPriority,P6R::P6VOID *pHandleContext,P6R::P6UINT32 *pTimerId) P6PURE;
538  P6DECLCOMMETHOD(postWaitTimer)(P6THIS_ P6R::P6TIME *pnTime,P6R::P6QPRIORITY nPriority,P6R::P6VOID *pHandleContext,P6R::P6UINT32 *pTimerId) P6PURE;
539  P6DECLCOMMETHOD(cancelTimer)(P6THIS_ P6R::P6UINT32 nTimerId,P6R::P6VOID **ppHandleContext) P6PURE;
540  };
541 
542  // {C9AF6A73-F5EE-4F0D-83E5-01485E6D038A}
543  #define IF_p6IEventQTimer {0xC9AF6A73,0xF5EE,0x4F0D,{0x83,0xE5,0x01,0x48,0x5E,0x6D,0x03,0x8A}}
544 
545 
546 
551  #undef INTERFACE
552  #define INTERFACE p6IEventQFactory
554  {
578  P6DECLCOMMETHOD(createIOQ)(P6THIS_ const P6WCHAR *pwszName,
579  P6EVENTQFLAG fEQFlags,
580  P6UINT32 cBufferSize,
581  P6UINT32 cInitial,
582  P6UINT32 cGrowby,
583  P6IOBFFLAGS fIOBFlags,
584  p6IEventQ **ppQueue) P6PURE;
585  };
586  // {A5D9B7B1-FB97-41D8-B09F-95D772B0F64A}
587  #define IF_p6IEventQFactory {0xA5D9B7B1,0xFB97,0x41D8,{0xB0,0x9F,0x95,0xD7,0x72,0xB0,0xF6,0x4A}}
588 
589  // {0675CF7E-3BFA-459E-9E43-0AF7B9ADE722}
590  #define COMP_p6EventQFactory {0x0675CF7E,0x3BFA,0x459E,{0x9E,0x43,0x0A,0xF7,0xB9,0xAD,0xE7,0x22}}
591 
592 
593 
594 
596  static const P6IOSOURCEFLAG P6IOSF_NONE = 0x00000000;
597  static const P6IOSOURCEFLAG P6IOSF_ENABLELOG = 0x00000001;
598 
615  #undef INTERFACE
616  #define INTERFACE p6IEventSource
618  {
620 
642  P6DECLCOMMETHOD(initialize)(P6THIS_ p6IEventQ *pIfQueue,p6IEventQHooks *pHooks,p6IIoBufferFactory *pFactory,P6IOSOURCEFLAG fFlags) P6PURE;
643 
653  P6DECLCOMMETHOD(start)(P6THIS) P6PURE;
654 
664 
672  P6DECLCOMMETHOD(enableLogging)(P6THIS_ P6BOOL bEnable) P6PURE;
673 
674 
687  P6DECLCOMMETHOD(isSupportedInterface)(P6THIS_ p6ICom *pIface) P6PURE;
688 
697  P6DECLCOMMETHOD(associate)(P6THIS_ p6ICom *pIoIface,P6VOID *pHandleContext) P6PURE;
698 
706  P6DECLCOMMETHOD(disassociate)(P6THIS_ p6ICom *pIoIface) P6PURE;
707 
723  P6DECLCOMMETHOD(postAccept)(P6THIS_ p6ICom *pIoIface) P6PURE;
724 
740  P6DECLCOMMETHOD(postConnect)(P6THIS_ p6ICom *pIoIface,P6IOCONTEXT *pIoContext) P6PURE;
741 
753  P6DECLCOMMETHOD(postRead)(P6THIS_ p6ICom *pIoIface,p6IIoBuffer *pIoBuffer,P6IOCONTEXT *pIoContext) P6PURE;
754 
766  P6DECLCOMMETHOD(postWrite)(P6THIS_ p6ICom *pIoIface,p6IIoBuffer *pIoBuffer,P6IOCONTEXT *pIoContext) P6PURE;
767 
776  P6DECLCOMMETHOD(postClose)(P6THIS_ p6ICom *pIoIface,P6IOCONTEXT *pIoContext) P6PURE;
777  };
778 
779  // {F8F6A0A2-815C-4472-9D6F-5140FBC71861}
780  #define IF_p6IEventSource {0xF8F6A0A2,0x815C,0x4472,{0x9D,0x6F,0x51,0x40,0xFB,0xC7,0x18,0x61}}
781 
782 #ifdef __cplusplus
783 }
784 } // namespace
785 #endif
786 
787 #endif
A p6IMessage event.
Definition: p6eventq.h:79
uint64_t P6UINT64
Definition: p6types.h:79
P6UINT32 P6EVENTQFLAG
P6EVENTQFLAG.
Definition: p6eventq.h:175
File I/O interfaces.
An IO event.
Definition: p6eventq.h:77
uint32_t P6UINT32
Definition: p6types.h:77
P6UINT64 m_cTransfer
When an I/O operation is posted, the number of bytes to read/write (or zero) is placed here...
Definition: p6eventq.h:154
P6UINT32 P6EVENTTYPE
Definition: p6eventq.h:70
#define P6DECLAREICOM
Definition: p6defs.h:191
I/O Buffer Interfaces.
P6IOFLAG m_fFlags
Control flags, see P6R::P6IOFLAG.
Definition: p6eventq.h:167
#define P6PURE
Definition: p6defs.h:192
A timer event.
Definition: p6eventq.h:78
Connect completion.
Definition: p6eventq.h:86
unsigned char P6BOOL
Boolean type.
Definition: p6types.h:133
This factory interface is responsible for creating and managing memory pooled Io Buffers (p6IIoBuffer...
Definition: p6iobuffer.h:605
This interface is used by p6IEventQ to perform I/O operations.
Definition: p6eventq.h:617
Write completion.
Definition: p6eventq.h:88
P6R::P6UINT32 P6IOFLAG
Definition: p6eventq.h:131
wchar_t P6WCHAR
Wide character type see p6i18n.h.
Definition: p6types.h:111
P6UINT32 P6IOSOURCEFLAG
Definition: p6eventq.h:595
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:97
This range of flags are available for the applications use and is typically used for maintaining prot...
Definition: p6eventq.h:153
Close compoletion.
Definition: p6eventq.h:89
P6EQIOTYPE
Definition: p6eventq.h:76
P6NETADDR m_address
For operations that take/return a network address.
Definition: p6eventq.h:163
P6UINT32 m_reserved1
Must be zero.
Definition: p6eventq.h:166
P6IOOP
Definition: p6eventq.h:84
P6ERR m_err
The result status of the operation on completion.
Definition: p6eventq.h:165
P6TIMEROP
Definition: p6eventq.h:93
P6UINT32 P6ERR
COM err return type see P6ERR.h.
Definition: p6types.h:141
This interface is passed into an p6IEventQ which will use it provide notifications and filter of acti...
Definition: p6eventq.h:107
Read completion.
Definition: p6eventq.h:87
Timer fired.
Definition: p6eventq.h:94
#define P6DECLCOMMETHOD(method)
Definition: p6defs.h:189
Accept completion.
Definition: p6eventq.h:85
P6INT64 P6TIME
The wallclock time represented as the number of microseconds since midnight January 1 1970 UTC...
Definition: p6types.h:259
P6UINT64 m_offset
The offset at which to begin the I/O request.
Definition: p6eventq.h:160
P6UINT32 P6IOBFFLAGS
Definition: p6iobuffer.h:589
#define P6THIS_
Definition: p6defs.h:193
P6VOID * m_pUser1
User supplied data for this I/O operation.
Definition: p6eventq.h:164
P6QPRIORITY
Definition: p6queue.h:37
A user generated event.
Definition: p6eventq.h:80
void P6VOID
Definition: p6types.h:109
int32_t P6INT32
Definition: p6types.h:76
#define P6THIS
Definition: p6defs.h:194
#define P6DECLAREIF_(iface, baseif)
Definition: p6defs.h:188
Aysynchronous, theaded priority queuing interfaces.