author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /libical/src/libicalss/icalcstpserver.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
Diffstat (limited to 'libical/src/libicalss/icalcstpserver.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libicalss/icalcstpserver.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/libical/src/libicalss/icalcstpserver.h b/libical/src/libicalss/icalcstpserver.h new file mode 100644 index 0000000..6fa2254 --- a/dev/null +++ b/libical/src/libicalss/icalcstpserver.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* -*- Mode: C -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icalcstpserver.h | ||
4 | CREATOR: eric 13 Feb 01 | ||
5 | |||
6 | $Id$ | ||
7 | |||
8 | |||
9 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
10 | |||
11 | This program is free software; you can redistribute it and/or modify | ||
12 | it under the terms of either: | ||
13 | |||
14 | The LGPL as published by the Free Software Foundation, version | ||
15 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
16 | |||
17 | Or: | ||
18 | |||
19 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
20 | the License at http://www.mozilla.org/MPL/ | ||
21 | |||
22 | The original code is icalcstp.h | ||
23 | |||
24 | ======================================================================*/ | ||
25 | |||
26 | |||
27 | #ifndef ICALCSTPS_H | ||
28 | #define ICALCSTPS_H | ||
29 | |||
30 | #include "ical.h" | ||
31 | |||
32 | |||
33 | /********************** Server (Reciever) Interfaces *************************/ | ||
34 | |||
35 | /* On the server side, the caller will recieve data from the incoming | ||
36 | socket and pass it to icalcstps_next_input. The caller then takes | ||
37 | the return from icalcstps_next_outpu and sends it out through the | ||
38 | socket. This gives the caller a point of control. If the cstp code | ||
39 | connected to the socket itself, it would be hard for the caller to | ||
40 | do anything else after the cstp code was started. | ||
41 | |||
42 | All of the server and client command routines will generate | ||
43 | response codes. On the server side, these responses will be turned | ||
44 | into text and sent to the client. On the client side, the reponse | ||
45 | is the one sent from the server. | ||
46 | |||
47 | Since each command can return multiple responses, the responses are | ||
48 | stored in the icalcstps object and are accesses by | ||
49 | icalcstps_first_response() and icalcstps_next_response() | ||
50 | |||
51 | How to use: | ||
52 | |||
53 | 1) Construct a new icalcstps, bound to your code via stubs | ||
54 | 2) Repeat forever: | ||
55 | 2a) Get string from client & give to icalcstps_next_input() | ||
56 | 2b) Repeat until icalcstp_next_output returns 0: | ||
57 | 2b1) Call icalcstps_next_output. | ||
58 | 2b2) Send string to client. | ||
59 | */ | ||
60 | |||
61 | |||
62 | |||
63 | typedef void icalcstps; | ||
64 | |||
65 | /* Pointers to the rountines that | ||
66 | icalcstps_process_incoming will call when it recognizes a CSTP | ||
67 | command in the data. BTW, the CONTINUE command is named 'cont' | ||
68 | because 'continue' is a C keyword */ | ||
69 | |||
70 | struct icalcstps_commandfp { | ||
71 | icalerrorenum (*abort)(icalcstps* cstp); | ||
72 | icalerrorenum (*authenticate)(icalcstps* cstp, char* mechanism, | ||
73 | char* data); | ||
74 | icalerrorenum (*calidexpand)(icalcstps* cstp, char* calid); | ||
75 | icalerrorenum (*capability)(icalcstps* cstp); | ||
76 | icalerrorenum (*cont)(icalcstps* cstp, unsigned int time); | ||
77 | icalerrorenum (*identify)(icalcstps* cstp, char* id); | ||
78 | icalerrorenum (*disconnect)(icalcstps* cstp); | ||
79 | icalerrorenum (*sendata)(icalcstps* cstp, unsigned int time, | ||
80 | icalcomponent *comp); | ||
81 | icalerrorenum (*starttls)(icalcstps* cstp, char* command, | ||
82 | char* data); | ||
83 | icalerrorenum (*upnexpand)(icalcstps* cstp, char* upn); | ||
84 | icalerrorenum (*unknown)(icalcstps* cstp, char* command, char* data); | ||
85 | }; | ||
86 | |||
87 | |||
88 | |||
89 | icalcstps* icalcstps_new(struct icalcstps_commandfp stubs); | ||
90 | |||
91 | void icalcstps_free(icalcstps* cstp); | ||
92 | |||
93 | int icalcstps_set_timeout(icalcstps* cstp, int sec); | ||
94 | |||
95 | /* Get the next string to send to the client */ | ||
96 | char* icalcstps_next_output(icalcstps* cstp); | ||
97 | |||
98 | /* process the next string from the client */ | ||
99 | int icalcstps_next_input(icalcstps* cstp); | ||
100 | |||
101 | #endif /* ICALCSTPS */ | ||