summaryrefslogtreecommitdiff
path: root/src/include/connector.h
blob: b1c10f19be5bf26aab57741af5b4934db1ace153 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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