Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6iobuffer.h
Go to the documentation of this file.
1 
14 #ifndef P6IOBUFFER_H__
15 #define P6IOBUFFER_H__ 1
16 
17 #include "p6err.h" // Error and type definitions
18 #include "p6comdef.h" // [p6]COM definitions
19 #include "p6errorinfo.h" // Definition only, not supported by p6Loader
20 #include "p6runtimeapi.h" // Platform runtime API definitions
21 #include "p6comhlpr.h" // [p6]COM helper macros
22 
23 namespace P6R {
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
30  {
41  P6COMMETHOD getUsed(P6R::P6UINT32 *pcBytesInUse) = 0;
42 
51  P6COMMETHOD setUsed(P6R::P6UINT32 cBytesInUse) = 0;
52 
62  P6COMMETHOD size(P6R::P6UINT32 *pcSize) = 0;
63 
89  P6COMMETHOD append(const P6R::P6UINT8 *pBuffer,P6R::P6UINT32 cBuffer,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
90 
119  P6COMMETHOD appendStr(const P6R::P6CHAR *pszString,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
120 
132  P6COMMETHOD consume(P6R::P6UINT32 cSize) = 0;
133 
146  P6COMMETHOD getBufPtr(P6R::P6UINT8 **ppBuffer,P6R::P6UINT32 *pcSize,P6R::P6UINT32 *pcUsed) = 0;
147 
155  //P6COMMETHOD appendBuffer(P6R::p6IoBuffer *pBuffers) = 0;
156  //P6COMMETHOD prependBuffer(P6R::p6IoBuffer *pBuffers) = 0;
157  //P6COMMETHOD next(P6R::p6IoBuffer **ppBuffers) = 0;
158  };
159  // {49DD087D-5C56-49F1-A76C-5E717E88048A}
160  #define IF_p6IIoBuffer {0x49DD087D,0x5C56,0x49F1,{0xA7,0x6C,0x5E,0x71,0x7E,0x88,0x04,0x8A}}
161 
162  #define P6PKTCUROFFSET ((P6UINT32) -1)
163 
174  interface p6IPacket : p6ICom
175  {
184  P6COMMETHOD reset() = 0;
185 
211  P6COMMETHOD append(const P6R::P6UINT8 *pBuffer,P6R::P6UINT32 cBuffer,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
212 
241  P6COMMETHOD appendStr(const P6R::P6CHAR *pszString,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
242 
258  P6COMMETHOD consume(P6R::P6UINT32 cSize) = 0;
259 
280  P6COMMETHOD set8(const P6R::P6UINT8 val,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
281 
302  P6COMMETHOD set16(const P6R::P6UINT16 val,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
303 
324  P6COMMETHOD set32(const P6R::P6UINT32 val,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
325 
346  P6COMMETHOD set64(const P6R::P6UINT64 val,const P6R::P6UINT32 nOffset,P6R::P6UINT32 *pUsed) = 0;
347 
371  P6COMMETHOD extract(P6R::P6UINT8 *pBuffer,P6R::P6UINT32 cBuffer,const P6R::P6UINT32 nOffset) = 0;
372 
392  P6COMMETHOD get8(P6R::P6UINT8 *pVal,const P6R::P6UINT32 nOffset) = 0;
393 
413  P6COMMETHOD get16(P6R::P6UINT16 *pVal,const P6R::P6UINT32 nOffset) = 0;
414 
434  P6COMMETHOD get32(P6R::P6UINT32 *pVal,const P6R::P6UINT32 nOffset) = 0;
435 
454  P6COMMETHOD get64(P6R::P6UINT64 *pVal,const P6R::P6UINT32 nOffset) = 0;
455 
466  P6COMMETHOD seek(P6R::P6UINT32 nOffset) = 0;
467 
479  P6COMMETHOD setUsed(P6R::P6UINT32 cBytesInUse) = 0;
480 
492  P6COMMETHOD getUsed(P6R::P6UINT32 *pcBytesInUse) = 0;
493 
505  P6COMMETHOD size(P6R::P6UINT32 *pcSize) = 0;
506 
526  P6COMMETHOD copyData(P6R::p6IPacket *pSourcePacket,P6R::P6UINT32 nSourceOffset,P6R::P6UINT32 cSourceLength) = 0;
527 
538  P6COMMETHOD setDestAddr(P6R::P6NETADDR *pAddr) = 0;
539 
550  P6COMMETHOD getDestAddr(P6R::P6NETADDR *pAddr) = 0;
551 
562  P6COMMETHOD setSourceAddr(P6R::P6NETADDR *pAddr) = 0;
563 
574  P6COMMETHOD getSourceAddr(P6R::P6NETADDR *pAddr) = 0;
575  };
576 
577  // {BDD25E55-FEE7-4115-ABB2-D5A918D19450}
578  #define IF_p6IPacket {0xBDD25E55,0xFEE7,0x4115,{0xAB,0xB2,0xD5,0xA9,0x18,0xD1,0x94,0x50}}
579 
580 
582  static const P6IOBFFLAGS P6IOBF_NOFLAGS = 0x00000000;
583  static const P6IOBFFLAGS P6IOBF_USEHEAP = 0x00000001;
584  static const P6IOBFFLAGS P6IOBF_ZEROMEM = 0x00000002;
585  static const P6IOBFFLAGS P6IOBF_SETFREEMEM = 0x00000004;
586  static const P6IOBFFLAGS P6IOBF_ENABLEFENCES = 0x00000008;
596  {
597 
613  P6COMMETHOD initialize(const P6R::P6WCHAR *pwszFactoryName,P6R::P6UINT32 cBufferSize,P6R::P6UINT32 cInitial,P6R::P6UINT32 cGrowby,P6R::P6IOBFFLAGS fFlags) = 0;
614 
624  P6COMMETHOD alloc(P6R::p6IIoBuffer **ppBuffer) = 0;
625 
651  P6R::P6UINT32 *pcActual,
652  P6R::P6UINT32 *pcInitial,
653  P6R::P6UINT32 *pcGrowby,
654  P6R::P6UINT32 *pcTotal,
655  P6R::P6UINT32 *pcFree,
656  P6R::P6UINT32 *pcHighWater) = 0;
657 
658  };
659  // {56ABFCAE-FCBD-438F-BD94-0467700BDFA1}
660  #define IF_p6IIoBufferFactory {0x56ABFCAE,0xFCBD,0x438F,{0xBD,0x94,0x04,0x67,0x70,0x0B,0xDF,0xA1}}
661 
662  // {5A234D2E-FFA9-4022-A37E-4EF576F110EA}
663  #define COMP_p6IoBufferFactory {0x5A234D2E,0xFFA9,0x4022,{0xA3,0x7E,0x4E,0xF5,0x76,0xF1,0x10,0xEA}}
664 
665 #ifdef __cplusplus
666 }
667 #endif
668 
669 } // namespace
670 
671 #endif
672 
virtual P6R::P6ERR getUsed(P6R::P6UINT32 *pcBytesInUse)=0
Retrieves the number of bytes in-use in the packet buffer.
virtual P6R::P6ERR setDestAddr(P6R::P6NETADDR *pAddr)=0
Stores the specified P6NETADDR in the packet as the destination address meta-data.
virtual P6R::P6ERR set64(const P6R::P6UINT64 val, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Writes or appends a 64 bit value into the packet.
virtual P6R::P6ERR consume(P6R::P6UINT32 cSize)=0
Consumes the specified number of bytes of data, adjusting the reported amount of data used accordingl...
P6R::P6UINT32 P6IOBFFLAGS
Definition: p6iobuffer.h:581
virtual P6R::P6ERR appendStr(const P6R::P6CHAR *pszString, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Appends the specified NULL terminated narrow ascii string to the the I/O buffer, begining at the curr...
unsigned int P6UINT32
Definition: p6types.h:40
Standard error codes.
virtual P6R::P6ERR initialize(const P6R::P6WCHAR *pwszFactoryName, P6R::P6UINT32 cBufferSize, P6R::P6UINT32 cInitial, P6R::P6UINT32 cGrowby, P6R::P6IOBFFLAGS fFlags)=0
Initialized the factory for use.
virtual P6R::P6ERR append(const P6R::P6UINT8 *pBuffer, P6R::P6UINT32 cBuffer, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Appends the specified data to the packet, begining at the current packet offset and increments the cu...
virtual P6R::P6ERR set8(const P6R::P6UINT8 val, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Writes or appends an 8 bit value into the packet.
virtual P6R::P6ERR getUsed(P6R::P6UINT32 *pcBytesInUse)=0
Returns the number of bytes in the buffer which are taken up by data.
virtual P6R::P6ERR get8(P6R::P6UINT8 *pVal, const P6R::P6UINT32 nOffset)=0
Gets an 8 bit value from the specified offset or from the current offset.
This factory interface is responsible for creating and managing memory pooled Io Buffers (p6IIoBuffer...
Definition: p6iobuffer.h:595
virtual P6R::P6ERR set32(const P6R::P6UINT32 val, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Writes or appends a 32 bit value into the packet.
virtual P6R::P6ERR setSourceAddr(P6R::P6NETADDR *pAddr)=0
Stores the specified P6NETADDR in the packet as the source address meta-data.
virtual P6R::P6ERR getBufPtr(P6R::P6UINT8 **ppBuffer, P6R::P6UINT32 *pcSize, P6R::P6UINT32 *pcUsed)=0
Returns a pointer to the p6IIoBuffer's internal buffer.
unsigned char P6UINT8
Definition: p6types.h:30
virtual P6R::P6ERR set16(const P6R::P6UINT16 val, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Writes or appends a 16 bit value into the packet.
virtual P6R::P6ERR size(P6R::P6UINT32 *pcSize)=0
Returns the total size of the buffer in bytes.
virtual P6R::P6ERR size(P6R::P6UINT32 *pcSize)=0
Retrieves the size of packet buffer in bytes.
unsigned short int P6UINT16
Definition: p6types.h:34
P6COM runtime interfaces definitions.
wchar_t P6WCHAR
Wide character type see p6i18n.h.
Definition: p6types.h:76
virtual P6R::P6ERR setUsed(P6R::P6UINT32 cBytesInUse)=0
This method sets the number of bytes in-use in the buffer.
virtual P6R::P6ERR alloc(P6R::p6IIoBuffer **ppBuffer)=0
This method allocates a p6IIoBuffer from the pool and returns it to the caller.
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:96
P6COM base interface definitions.
virtual P6R::P6ERR getDestAddr(P6R::P6NETADDR *pAddr)=0
Gets the destination address meta-data frok the packet.
p6IErrorInfo interface definition
virtual P6R::P6ERR getStats(P6R::P6UINT32 *pcBlock, P6R::P6UINT32 *pcActual, P6R::P6UINT32 *pcInitial, P6R::P6UINT32 *pcGrowby, P6R::P6UINT32 *pcTotal, P6R::P6UINT32 *pcFree, P6R::P6UINT32 *pcHighWater)=0
Retrieves current statistical information for the buffer factories underlying memory pool...
virtual P6R::P6ERR setUsed(P6R::P6UINT32 cBytesInUse)=0
Set the number of bytes taken up by data in the buffer.
P6ULONGLONG P6UINT64
Definition: p6types.h:49
virtual P6R::P6ERR appendStr(const P6R::P6CHAR *pszString, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Appends the specified NULL terminated narrow ascii string to the the I/O buffer, begining at the curr...
virtual P6R::P6ERR reset()=0
Resets the current packet offset back to the begining.
virtual P6R::P6ERR get64(P6R::P6UINT64 *pVal, const P6R::P6UINT32 nOffset)=0
Gets a 64 bit value from the specified offset or from the current offset.
#define P6COMMETHOD
Definition: p6types.h:872
virtual P6R::P6ERR getSourceAddr(P6R::P6NETADDR *pAddr)=0
Gets the source address meta-data frok the packet.
virtual P6R::P6ERR append(const P6R::P6UINT8 *pBuffer, P6R::P6UINT32 cBuffer, const P6R::P6UINT32 nOffset, P6R::P6UINT32 *pUsed)=0
Appends the specified data to the packet, begining at the current packet offset and increments the cu...
virtual P6R::P6ERR consume(P6R::P6UINT32 cSize)=0
Consumes the specified number of bytes of data, adjusting the reported amount of data used accordingl...
virtual P6R::P6ERR extract(P6R::P6UINT8 *pBuffer, P6R::P6UINT32 cBuffer, const P6R::P6UINT32 nOffset)=0
Gets the specified number of bytes from the packet and stores them in the provided buffer...
virtual P6R::P6ERR get16(P6R::P6UINT16 *pVal, const P6R::P6UINT32 nOffset)=0
Gets a 16 bit value from the specified offset or from the current offset.
P6R Component runtime helper macros, templated, etc.
A generic memory-pooled binary packet component.
Definition: p6iobuffer.h:174
virtual P6R::P6ERR seek(P6R::P6UINT32 nOffset)=0
This method changes the packets current offset to the specified offset.
virtual P6R::P6ERR get32(P6R::P6UINT32 *pVal, const P6R::P6UINT32 nOffset)=0
Gets a 32 bit value from the specified offset or from the current offset.
char P6CHAR
Narrow character type.
Definition: p6types.h:71
virtual P6R::P6ERR copyData(P6R::p6IPacket *pSourcePacket, P6R::P6UINT32 nSourceOffset, P6R::P6UINT32 cSourceLength)=0
This method is used to copy bytes into the current packet, starting at the current offset from the sp...