?? commsdms.h
字號:
/*
COMM112.H
Communication model for sdms project
112
1996.9.10
*/
#ifndef COMM112_H
#define COMM112_H
#define MAX_TCP_STREAM_NAME 25 /* Null char included */
#define MAX_TCP_STREAM_BUFFER 5120 /* Max buffer size is 5K bytes */
/* Max. bytes read from tcp buffer per time -- 0.5K */
#define TCP_MAX_READ 512
#define MAX_SERVICE_NAME 20 /* Null char included */
#define MAX_HOST_NAME 20 /* Null char included */
/* TCP stream node type definitions */
#define TCP_NOTUSED 0
#define TCP_SERVER 1
#define TCP_CHILD 2
#define TCP_CLIENT 3
/* TCP stream node status definitions */
#define TCP_NULL_STATUS 0
#define TCP_WAIT_CONNECT 1
#define TCP_CONNECTED 2
#define TCP_WAIT_RETRY 3
/* define default STX and ETX */
#define TCP_STX 0x02
#define TCP_ETX 0x03
/*
The CAPI TCP stream node definition
*/
struct TCP_Stream_Node_t
{
short int type; /* valid values:
1. TCP_SERVER the node is waiting for connection.
2. TCP_CLIENT the node is to make a connection.
3. TCP_CHILD the node is generated by server node.
4. TCP_NOTUSED the node is not used.
*/
char hname[MAX_HOST_NAME]; /* host name for the node */
char sname[MAX_SERVICE_NAME]; /* service name for the node */
int socket; /* TCP socket */
char sin[16]; /* the sizeof(struct sockaddr_in) is 16 bytes */
short int status; /* valid values:
1. TCP_CONNECTED for Client Node
2. TCP_WAIT_CONNECT for Server Node, Client Node
3. TCP_WAIT_RETRY for Server Node, Client Node
*/
char name[MAX_TCP_STREAM_NAME]; /* the node's name */
short int head; /* stream buffer's head pointer */
short int tail; /* stream buffer's tail pointer */
char stx[32]; /* Add by Jason, 97.8.19 */
char etx[32]; /* Add by Jason, 97.8.19 */
int format; /* format=1: default stx&etx, Add by Jason, 97.11.15 */
char buffer[MAX_TCP_STREAM_BUFFER]; /* stream buffer */
int (*accept_fn)(struct TCP_Stream_Node_t *srv_node,char *new_node_name);/* the accept function for server node */
struct TCP_Stream_Node_t *next; /* pointer to next node */
};
/*
CAPI internal packet queue node definition
*/
struct CAPI_Q_NODE_t
{
int length; /* max. length is 32767 */
char stream_name[MAX_TCP_STREAM_NAME];
char *content;
struct CAPI_Q_NODE_t *next;
};
/* exported functions */
/* void InitCAPI(void(*record_e)(char *errmsg),char *errlogfile,int rt,int mps); */
/* Modified by Jason, 97.11.15 */
void InitCAPI(void(*record_e)(char *errmsg),char *errlogfile,int rt);
/* int CreateTcpStream(int type,char *name,char *hname,char *sname,
int(*accept_fn)(struct TCP_Stream_Node_t *srv_node,char *new_node_name)); */
/* Add stx & etx by Jason, 97.08.19 */
/* Add format by Jason, 97.11.15
format = 1 : default stx & etx
format = 0 : not default stx & etx,
when SendTcpPacket, stx & etx would not be added to packet automaticly
*/
int CreateTcpStream(int type,char *name,char *hname,char *sname, char *stx, char *etx,
int(*accept_fn)(struct TCP_Stream_Node_t *srv_node,char *new_node_name));
int SelectTcpStream(char *packet,char *name);
int SendTcpPacket(char *packet,char *name);
int CAPINodeStatus(char *name);
void ChangeETX(char *name, char *ETX); /* Add by Jason, 97.11.15 */
void ChangeSTX(char *name, char *STX); /* Add by Jason, 97.11.15 */
void ClearCAPI(void);
int ClearNode(char *name);
/* exported viriables */
//extern char comm_err_msg[];
#endif
/* end of file */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -