aboutsummaryrefslogtreecommitdiffstats
path: root/dict/pdictclient.h
blob: 1fa60d92bb7bae542b97d799c1264044203b13ce (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef _PDICTCLIENT_H_
#define _PDICTCLIENT_H_

#include "pdict.h"

typedef struct pdc_session pdc_session_t;
typedef int pdc_listen_id_t;

int CCONV pdc_init(void);

pdc_session_t * CCONV 
pdc_session_alloc(int readfd, 
				  int(*readfunc)(int, void *, unsigned int, char *, int), 
				  int writefd,
				  int(*writefunc)(int, const void *, unsigned int, char *, int),
				  int(*closefunc)(int, char *, int), 
				  void *cleanupPtr,
				  void (*cleanupFunc)(void *));

void 
pdc_session_free(pdc_session_t *pdcs);

//int CCONV pdc_set(pdc_session_t *pdcs, const char *key, const char *val, int len, int remove_on_close, char *errdesc, int errlen);
void CCONV pdc_async_set(pdc_session_t *pdcs, 
						 const char *key, 
						 const char *val, 
						 int len, 
						 int remove_on_close, 
						 void (*error)(const char *errdesc, void *arg), 
						 void *arg);

pdc_listen_id_t CCONV 
pdc_listen(pdc_session_t *pdcs, 
		   const char *pattern, 
		   void (*cb)(const char *, const char *, unsigned int, pdict_reason_t, void *), 
		   void *ptr, 
		   char *errdesc, 
		   int errlen);

int CCONV 
pdc_disable_periodic_reports(pdc_session_t *pdc, 
							 char *errdesc, 
							 int errlen);

void CCONV 
pdc_async_disable_periodic_reports(pdc_session_t *pdc, 
								   void (*error)(const char *errdesc, void *arg), 
								   void *arg);

int CCONV 
pdc_enable_periodic_reports(pdc_session_t *pdc, 
							int periodms, 
							char *errdesc, 
							int errlen);

void CCONV 
pdc_async_enable_periodic_reports(pdc_session_t *pdc, 
								  int periodms, 
								  void (*error)(const char *errdesc, void *arg), 
								  void *arg);

int CCONV 
pdc_ignore(pdc_session_t *pdcs, 
		   pdc_listen_id_t id, 
		   char *errdesc, 
		   int errlen);

void CCONV 
pdc_async_ignore(pdc_session_t *pdcs, 
				 pdc_listen_id_t id, 
				 void (*error)(const char *errdesc, void *arg), 
				 void *arg);

int CCONV 
pdc_flush(pdc_session_t *pdc, 
		  char *errdesc, 
		  int errlen);

int CCONV 
pdc_quit(pdc_session_t *pdc, 
		 char *errdesc, 
		 int errlen);

int CCONV 
pdc_remove(pdc_session_t *pdc, 
		   const char *pattern, 
		   char *errdesc, 
		   int errlen);

void CCONV
pdc_async_remove(pdc_session_t *pdcs, 
				 const char *pattern, 
				 void (*error)(const char *errdesc, void *arg), 
				 void *arg);

int CCONV 
pdc_get(pdc_session_t *pdcs, 
		const char *pattern, 
		char *results, 
		int resultslen, 
		char *errdesc, 
		int errlen);

int CCONV 
pdc_get_server_session_id(pdc_session_t *pdc, 
						  int *id, 
						  char *errdesc, 
						  int errlen);

int CCONV 
pdc_readthread_join(pdc_session_t *pdcs, 
					void **status);

void CCONV 
pdc_async_authorize(pdc_session_t *pdcs, 
					const char *version, 
					char *password, 
					void (*success) (void *arg, void (*error)(const char *errdesc, void *arg)), 
					void (*error)(const char *errdesc, void *arg), 
					void *arg);

void
cleanup_pending(pdc_session_t *pdcs, void *arg);

void
wait_pending(pdc_session_t *pdcs);

#endif