- Adapted indenation to new agreed upon system

- Added support for second generation scriptcontext based counter
This commit is contained in:
koennecke
2009-02-13 09:00:03 +00:00
parent a3dcad2bfa
commit 91d4af0541
405 changed files with 88101 additions and 88173 deletions

View File

@@ -4,40 +4,41 @@
typedef struct __AsyncUnit AsyncUnit, *pAsyncUnit;
typedef struct __async_txn AsyncTxn, *pAsyncTxn;
typedef int (*AsyncTxnHandler)(pAsyncTxn pTxn);
typedef int (*AsyncTxnHandler) (pAsyncTxn pTxn);
typedef struct __async_protocol AsyncProtocol, *pAsyncProtocol;
pAsyncProtocol AsyncProtocolCreate(SicsInterp *pSics, const char* protocolName,
ObjectFunc pFunc, KillFunc pKFunc);
pAsyncProtocol AsyncProtocolCreate(SicsInterp * pSics,
const char *protocolName,
ObjectFunc pFunc, KillFunc pKFunc);
int AsyncProtocolAction(SConnection *pCon, SicsInterp *pSics,
int AsyncProtocolAction(SConnection * pCon, SicsInterp * pSics,
void *pData, int argc, char *argv[]);
int AsyncProtocolFactory(SConnection *pCon, SicsInterp *pSics,
void *pData, int argc, char *argv[]);
int AsyncProtocolFactory(SConnection * pCon, SicsInterp * pSics,
void *pData, int argc, char *argv[]);
typedef enum {
ATX_NULL=0,
ATX_TIMEOUT=-1,
ATX_ACTIVE=1,
ATX_COMPLETE=2,
ATX_DISCO=3
ATX_NULL = 0,
ATX_TIMEOUT = -1,
ATX_ACTIVE = 1,
ATX_COMPLETE = 2,
ATX_DISCO = 3
} ATX_STATUS;
struct __async_txn {
pAsyncUnit unit; /**< unit that transaction is associated with */
int txn_state; /**< protocol handler transaction parse state */
ATX_STATUS txn_status; /**< status of the transaction OK, Error, ... */
int txn_timeout; /**< transaction timeout in milliseconds */
char* out_buf; /**< output buffer for sendCommand */
int out_len; /**< length of data to be sent */
int out_idx; /**< index of next character to transmit */
char* inp_buf; /**< input buffer for transaction response */
int inp_len; /**< length of input buffer */
int inp_idx; /**< index of next character (number already received) */
pAsyncUnit unit; /**< unit that transaction is associated with */
int txn_state; /**< protocol handler transaction parse state */
ATX_STATUS txn_status; /**< status of the transaction OK, Error, ... */
int txn_timeout; /**< transaction timeout in milliseconds */
char *out_buf; /**< output buffer for sendCommand */
int out_len; /**< length of data to be sent */
int out_idx; /**< index of next character to transmit */
char *inp_buf; /**< input buffer for transaction response */
int inp_len; /**< length of input buffer */
int inp_idx; /**< index of next character (number already received) */
AsyncTxnHandler handleResponse; /**< Txn response handler of command sender */
void* cntx; /**< opaque context used by command sender */
void *cntx; /**< opaque context used by command sender */
/* The cntx field may be used by protocol handler from sendCommand
* as long as it is restored when response is complete
*/
@@ -48,15 +49,16 @@ struct __async_txn {
*/
struct __async_protocol {
pObjectDescriptor pDes;
char* protocolName;
char *protocolName;
char *sendTerminator;
char *replyTerminator;
void* privateData;
int (* sendCommand)(pAsyncProtocol p, pAsyncTxn txn);
int (* handleInput)(pAsyncProtocol p, pAsyncTxn txn, int ch);
int (* handleEvent)(pAsyncProtocol p, pAsyncTxn txn, int event);
int (* prepareTxn)(pAsyncProtocol p, pAsyncTxn txn, const char* cmd, int cmd_len, int rsp_len);
void (* killPrivate)(pAsyncProtocol p);
void *privateData;
int (*sendCommand) (pAsyncProtocol p, pAsyncTxn txn);
int (*handleInput) (pAsyncProtocol p, pAsyncTxn txn, int ch);
int (*handleEvent) (pAsyncProtocol p, pAsyncTxn txn, int event);
int (*prepareTxn) (pAsyncProtocol p, pAsyncTxn txn, const char *cmd,
int cmd_len, int rsp_len);
void (*killPrivate) (pAsyncProtocol p);
};
#endif /* ASYNCPROTOCOL */
#endif /* ASYNCPROTOCOL */