diff options
Diffstat (limited to 'src/include/connector.h')
| -rw-r--r-- | src/include/connector.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/include/connector.h b/src/include/connector.h new file mode 100644 index 0000000..b1c10f1 --- /dev/null +++ b/src/include/connector.h @@ -0,0 +1,86 @@ +#ifndef CONNECTOR_H_ +#define CONNECTOR_H_ + +extern int CONNECTOR_VERSION_1_20170704; + +typedef unsigned long ulong64; +typedef unsigned int uint32; + +typedef enum +{ + APPD_SENDBACK=0, //ǰ����Ӧ�ò����ݻش����� + APPD_FILE=1, //�������ļ�����ģ����Ӧ�ò����ݷַ� +}APPD_HEADER_TYPE; + +typedef enum +{ + DEST_APPD=0, //���ݷַ�����appd + DEST_WM=1, //webmail������������WM + DEST_MLFA=2, //�ļ���������mlfa +}APPD_DESTINATION; + +typedef enum +{ + COMPLETE=0, + FRAG=1, + FRAG_END=2, +}APPD_MSG_TYPE; + +typedef struct _appd_basic_t +{ + APPD_HEADER_TYPE appd_type; //Ӧ�ò����ݻ����ļ����� + const char* service_name; //������������,'\0'���� + APPD_DESTINATION destination; //���ݽ��ճ��� + ulong64* streamid; //��̬����ָ�룬��id + uint32 streamid_num; + struct ipaddr* addr; //��̬����ָ�룬 ����Ԫ�� + uint32 addr_num; +}appd_basic_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +/*��ʼ�������connector����� ÿһ������������һ��*/ +//void* connector_start(appd_basic_t* baisc_info); +void* connector_start(appd_basic_t* baisc_info, const struct streaminfo *a_tcp); +/* msg_type:�������� COMPLETE FRAG FRAG_END*/ +void connector(void* handler, APPD_MSG_TYPE msg_type, void* simple_opt_handle, void* nested_opt_handle); +/*ÿһ����������������*/ +void connector_finish(void* handler); + + +/*��ѡ�����������������*/ +/*1. ���ü�ѡ��ĸ���������simple_opt_handle*/ +void* connector_create_simple_opt(uint32 max_size); +/*2. ���ѡ��*/ +int connector_append_simple_opt(void* simple_opt_handle, const char* opt_name, char* opt_value, uint32 opt_len); +/*3. �ͷ�*/ +void connector_free_simple_opt(void** simple_opt_handle); + + +/*Ƕ��ѡ�����������������*/ +/*1. ������������Ƕ��ѡ����ܸ���������nested_opt_handle*/ +void* connector_create_nested_opt(uint32 max_size); +/*2. ������������ij��Ƕ��ѡ��������Լ��ڲ�ѡ��ĸ���������nested_unit_handle*/ +void* connector_create_nested_opt_unit(const char* nested_unit_name, uint32 max_size); +/*3.��䵥��Ƕ��ѡ����ڲ�ѡ��*/ +/*opt_unit_handle ��connector_create_nested_opt_unit�ķ���ֵ*/ +/*����ֵ 0 OK -1 ERROR*/ +int connector_append_nested_opt_unit(void* nested_unit_handle, const char* subopt_name, char* subopt_value, uint32 subopt_len); +/*4. ������Ƕ��ѡ������Ƕ��ѡ����nested_opt_handle��*/ +/*����ֵ 0 OK -1 ERROR*/ +int connector_append_nested_opt(void* nested_opt_handle, void* nested_unit_handle); +/*5. �ͷŵ���Ƕ��ѡ��*/ +void connector_free_nested_opt_unit(void** nested_unit_handle); +/*6. �ͷ�*/ +void connector_free_nested_opt(void** nested_opt_handle); + + +#ifdef __cplusplus +} +#endif +#endif + + |
