⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constants.h

📁 SyncML手册及其编程
💻 H
📖 第 1 页 / 共 2 页
字号:
/*** Internal states for objects and headers.*/typedef enum {	STATE_BUILDING,   STATE_SENDING,   STATE_SENT,   STATE_ERROR} ObxSendState;typedef int                               ObxRc;typedef unsigned char                     ObxCommand;typedef struct iobxListNode               ObxListNode;typedef struct iobxList                   ObxList;typedef struct iobxIterator               ObxIterator;typedef struct iobxHandle                 ObxHandle;typedef struct iobxCommonFrameHeader      ObxCommonFrameHeader;typedef struct iobxConnectHeader          ObxConnectHeader;typedef struct iobxHeader                 ObxHeader;typedef struct iobxTransport              ObxTransport;typedef struct iobxObject                 ObxObject;typedef struct iobxBuffer                 ObxBuffer;typedef struct iobxConnectMeta            ObxConnectMeta;typedef struct iobxSetPathMeta            ObxSetPathMeta;typedef struct iobxStream                 ObxStream;/******************************************************************************* Meta information**** Some headers have 'meta' data that is appropriate.** Two cases of these involve the CONNECT request and SETPATH request.*****************************************************************************/struct iobxConnectMeta {   unsigned char  version;   unsigned char  flags;   short          max_packet_length;};struct iobxSetPathMeta {   unsigned char  flags;   unsigned char  constants;};typedef union {      ObxConnectMeta *connectMeta;  /* Fields associated with a connect object.        */      ObxSetPathMeta *setPathMeta;  /* Fields associated with a set path object.       */   } ObjectMeta;/******************************************************************************* Obex Object**** Represents an obex object (i.e. connect request, response ect.).** Obex objects consist of indentifiers and a list of headers.*****************************************************************************/struct iobxObject {   ObxList        *headers;         /* List of headers being sent or received.   */   ObxCommand     cmd;			      /* Command associated with this object.      */   ObxSendState   state;            /* Building,sending,sent                     */   ObjectMeta     meta;             /* Some commands have meta data associated   */   short          stream;           /* Streaming object.                         */};/******************************************************************************* Obex Header**** Obex headers are structures containing all required info to form a header...** bytes.. len..identiers.. etc.  Each object can contain several of these.*****************************************************************************/struct iobxHeader {	unsigned char  identifier;          /* Header id                        */   ObxSendState   state;               /* private: Building,sending,sent   */   union {      unsigned int   fourBytevalue;    /* OBEX_HEADER_ENCODING_INT         */      unsigned char  byteValue;        /* OBEX_HEADER_ENCODING_BYTE        */      ObxBuffer      *unicodeValue;    /* OBEX_HEADER_ENCODING_UNICODE     */      ObxBuffer      *byteSequenceValue; /* OBEX_HEADER_ENCODING_BYTE_SEQ  */   } value;                            /* Depends on header encoding       */};/***************************************************************************** Obex transport**** Defines a structure representing a base transport to be used.** Several pre-defined transports are available.  Exposing this struct allows** authors to register custom transports instead of using a pre-defined** transport block.*****************************************************************************/struct iobxTransport {   /* ************************************** */   /* Init/terminate transport wide          */   /* ************************************** */   /*   ** Initialize the transport.  The inbound meta data will differ for each   ** transport type.  Should be called once, prior to any other calls.   */   ObxRc (*initialize)( const char *meta );   /*   ** Clean up all internals   */   ObxRc (*terminate)( void );   /*   ** Create a connection   */   ObxRc (*open)( void **connectionid );   /* ************************************** */   /* When transport is acting as server     */   /* ************************************** */   /*   ** Do any preperation for accepting inbound connections (i.e. acting as a server).   ** For the INET transport this would include a bind() and listen().  Other transports   ** may have other needs.   */   ObxRc (*listen)( void **connectionid );   /*   ** Accept an inbound connection from a peer transport.  This call should block until   ** a connection has been established.   ** When a connection has been accepted, the passed 'connectionid' is set.  This will be   ** provided by the caller on all subsuquent calls made against the active connection.   */   ObxRc (*accept)( void **connectionid );   /* ************************************** */   /* When transport is acting as client     */   /* ************************************** */   /*   ** Initiate a connection to a remote peer transport.   ** When a connection has been created, the passed 'connectionid' is set.  This will be   ** provided by the caller on all subsuquent calls made against the active connection.   */   ObxRc (*connect)( void **connectionid );   /* ************************************** */   /* Functions used on connected transports */   /* ************************************** */   /*   ** Send 'length' bytes of data from 'buf', set the actual number   ** written in 'wrote'.   ** Note that the inbound 'connectionid' was created by either a connect() or accept() call.   */   ObxRc (*send)( void **connectionid, const void *buf, int length, int *wrote, short allowShort );   /*   ** Receive 'length' bytes of data and place into 'buf', set the actual   ** number of bytes read in 'actual'.   ** Note that the inbound 'connectionid' was created by either a connect() or accept() call.   */   ObxRc (*recv)( void **connectionid, void *buf, int length, int *actual, short allowShort );   /*   ** Clean up all internals, subsuquent use of this 'connectionid' should result in an error.   ** Note that the inbound 'connectionid' was created by either a connect() or accept() call.   */   ObxRc (*close)( void **connectionid );};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -