diff options
author | Federico Mena Quintero <federico@src.gnome.org> | 2000-12-12 07:01:26 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-12-12 07:01:26 +0800 |
commit | 26eee7328031f78b063ab71265ef4fddc8619c72 (patch) | |
tree | 65334073d42b48a4c23f2d7d20a6813c2113f57c /libical/src/libicalss/icalcstp.h | |
parent | 5ccacd6a5bbeb2d91aea706f37cc5f96ee3144fb (diff) | |
download | gsoc2013-evolution-26eee7328031f78b063ab71265ef4fddc8619c72.tar gsoc2013-evolution-26eee7328031f78b063ab71265ef4fddc8619c72.tar.gz gsoc2013-evolution-26eee7328031f78b063ab71265ef4fddc8619c72.tar.bz2 gsoc2013-evolution-26eee7328031f78b063ab71265ef4fddc8619c72.tar.lz gsoc2013-evolution-26eee7328031f78b063ab71265ef4fddc8619c72.tar.xz gsoc2013-evolution-26eee7328031f78b063ab71265ef4fddc8619c72.tar.zst gsoc2013-evolution-26eee7328031f78b063ab71265ef4fddc8619c72.zip |
Fix fucking CVS conflicts because fucking CVS is a fucking big doofus - Federico
svn path=/trunk/; revision=6920
Diffstat (limited to 'libical/src/libicalss/icalcstp.h')
-rw-r--r-- | libical/src/libicalss/icalcstp.h | 174 |
1 files changed, 100 insertions, 74 deletions
diff --git a/libical/src/libicalss/icalcstp.h b/libical/src/libicalss/icalcstp.h index fea6c89616..63f5af913f 100644 --- a/libical/src/libicalss/icalcstp.h +++ b/libical/src/libicalss/icalcstp.h @@ -29,43 +29,15 @@ #include "ical.h" -typedef void* icalcstp; - -typedef struct icalcstp_stubs; - -icalcstp* icalcstp_new(icalcstp_stubs* stubs, - int incoming, int outgoing); - -void* icalcstp_free(icalcstp* cstp); - -/* Send or recieve data directly to/from the network. These calls are - needed for the AUTHENTICATE command and possibly others */ -ssize_t icalcstp_send(icalcstp* cstp, char* msg); -ssize_t icalcstp_recieve(icalcstp* cstp, char* msg); - -int icalcstp_set_timeout(icalcstp* cstp, int sec); - -typedef struct icalcstp_response { - icalrequeststatus code - char *arg; /* These strings are owned by libical */ - char *debug_text; - char *more_text; - void* result; -} icalcstp_response; - /********************** Server (Reciever) Interfaces *************************/ /* On the server side, the caller will recieve data from the incoming - socket and pass it to icalcstp_process_incoming. The caller then - takes the return from _process_incoming and sends it out through - the socket. This gives the caller a point of control. If the cstp - code connected to the socket itself, it would be hard for the - caller to do anything else after the cstp code was started. - - However, some commands will use the sockets directly, though the - _send and _recieve routines. Example is Authenticate and Starttls, - which need several exchanges of data + socket and pass it to icalcstps_next_input. The caller then takes + the return from icalcstps_next_outpu and sends it out through the + socket. This gives the caller a point of control. If the cstp code + connected to the socket itself, it would be hard for the caller to + do anything else after the cstp code was started. All of the server abd client command routines will generate response codes. On the server side, these responses will be turned @@ -73,63 +45,117 @@ typedef struct icalcstp_response { is the one sent from the server. Since each command can return multiple responses, the responses are - stored in the icalcstp object and are accesses by - icalcstp_first_response() and icalcstp_next_response() + stored in the icalcstps object and are accesses by + icalcstps_first_response() and icalcstps_next_response() + + How to use: + + 1) Construct a new icalcstps, bound to your code via stubs + 2) Repeat forever: + 2a) Get string from client & give to icalcstps_next_input() + 2b) Call icalcstps_next_output. Send string to client. */ - -/* Process a single line of incomming data */ -char* icalcstp_process_incoming(icalcstp* cstp, char* string); + +typedef void icalcstps; /* Er, they aren't really stubs, but pointers to the rountines that - icalcstp_process_incoming will call when it recognizes a CSTP + icalcstps_process_incoming will call when it recognizes a CSTP command in the data. BTW, the CONTINUE command is named 'cont' because 'continue' is a C keyword */ - -struct icalcstp_server_stubs { - icalerrorenum (*abort)(icalcstp* cstp); - icalerrorenum (*authenticate)(icalcstp* cstp, char* mechanism, +struct icalcstps_stubs { + icalerrorenum (*abort)(icalcstps* cstp); + icalerrorenum (*authenticate)(icalcstps* cstp, char* mechanism, char* data); - icalerrorenum (*calidexpand)(icalcstp* cstp, char* calid); - icalerrorenum (*capability)(icalcstp* cstp); - icalerrorenum (*cont)(icalcstp* cstp, unsigned int time); - icalerrorenum (*identify)(icalcstp* cstp, char* id); - icalerrorenum (*disconnect)(icalcstp* cstp); - icalerrorenum (*sendata)(icalcstp* cstp, unsigned int time, + icalerrorenum (*calidexpand)(icalcstps* cstp, char* calid); + icalerrorenum (*capability)(icalcstps* cstp); + icalerrorenum (*cont)(icalcstps* cstp, unsigned int time); + icalerrorenum (*identify)(icalcstps* cstp, char* id); + icalerrorenum (*disconnect)(icalcstps* cstp); + icalerrorenum (*sendata)(icalcstps* cstp, unsigned int time, icalcomponent *comp); - icalerrorenum (*starttls)(icalcstp* cstp, char* command, + icalerrorenum (*starttls)(icalcstps* cstp, char* command, char* data); - icalerrorenum (*upnexpand)(icalcstp* cstp, char* upn); - icalerrorenum (*unknown)(icalcstp* cstp, char* command, char* data); -} + icalerrorenum (*upnexpand)(icalcstps* cstp, char* upn); + icalerrorenum (*unknown)(icalcstps* cstp, char* command, char* data); +}; + + +icalcstps* icalcstps_new(struct icalcstps_stubs stubs); + +void icalcstps_free(icalcstps* cstp); + +int icalcstps_set_timeout(icalcstps* cstp, int sec); + +/* Get the next string to send to the client */ +char* icalcstps_next_output(icalcstps* cstp); + +/* process the next string from the client */ +int icalcstps_next_input(icalcstps* cstp); + /********************** Client (Sender) Interfaces **************************/ -/* On the client side, the cstp code is connected directly to the - socket, because the callers point of control is at the interfaces - below. */ - -icalerrorenum icalcstp_abort(icalcstp* cstp); -icalerrorenum icalcstp_authenticate(icalcstp* cstp, char* mechanism, - char* data); -icalerrorenum icalcstp_capability(icalcstp* cstp); -icalerrorenum icalcstp_calidexpand(icalcstp* cstp,char* calid); -icalerrorenum icalcstp_continue(icalcstp* cstp, unsigned int time); -icalerrorenum icalcstp_disconnect(icalcstp* cstp); -icalerrorenum icalcstp_identify(icalcstp* cstp, char* id); -icalerrorenum icalcstp_starttls(icalcstp* cstp, char* command, - char* data); -icalerrorenum icalcstp_senddata(icalcstp* cstp, unsigned int time, - icalcomponent *comp); -icalerrorenum icalcstp_upnexpand(icalcstp* cstp,char* calid); -icalerrorenum icalcstp_sendata(icalcstp* cstp, unsigned int time, - icalcomponent *comp); +/* How to use: + + 1) Construct a new icalcstpc + 2) Issue a command + 3) Repeat until both call icalcstpc_next_output and + icalcstpc_next_input return 0: + 3a) Call icalcstpc_next_output. Send string to server. + 3b) Get string from server, & give to icalcstp_next_input() + 4) Iterate with icalcstpc_first_response & icalcstp_next_response to + get the servers responses + 5) Repeat at #2 +*/ -icalcstp_response icalcstp_first_response(icalcstp* cstp); -icalcstp_response icalcstp_next_response(icalcstp* cstp); +typedef void* icalcstpc; +/* Response code sent by the server. */ +typedef struct icalcstpc_response { + icalrequeststatus code; + char *arg; /* These strings are owned by libical */ + char *debug_text; + char *more_text; + void* result; +} icalcstpc_response; + +icalcstps* icalcstpc_new(); + +void* icalcstpc_free(icalcstpc* cstpc); + +int icalcstpc_set_timeout(icalcstpc* cstp, int sec); + + +/* Get the next string to send to the server */ +char* icalcstpc_next_output(icalcstpc* cstp); + +/* process the next string from the server */ +int icalcstpc_next_input(icalcstpc* cstp); + +/* After icalcstpc_next_input returns a 0, there are responses + ready. use these to get them */ +icalcstpc_response icalcstpc_first_response(icalcstpc* cstp); +icalcstpc_response icalcstpc_next_response(icalcstpc* cstp); + +/* Issue a command */ +icalerrorenum icalcstpc_abort(icalcstpc* cstp); +icalerrorenum icalcstpc_authenticate(icalcstpc* cstp, char* mechanism, + char* init_data, char* f(char*) ); +icalerrorenum icalcstpc_capability(icalcstpc* cstp); +icalerrorenum icalcstpc_calidexpand(icalcstpc* cstp,char* calid); +icalerrorenum icalcstpc_continue(icalcstpc* cstp, unsigned int time); +icalerrorenum icalcstpc_disconnect(icalcstpc* cstp); +icalerrorenum icalcstpc_identify(icalcstpc* cstp, char* id); +icalerrorenum icalcstpc_starttls(icalcstpc* cstp, char* command, + char* init_data, char* f(char*)); +icalerrorenum icalcstpc_senddata(icalcstpc* cstp, unsigned int time, + icalcomponent *comp); +icalerrorenum icalcstpc_upnexpand(icalcstpc* cstp,char* calid); +icalerrorenum icalcstpc_sendata(icalcstpc* cstp, unsigned int time, + icalcomponent *comp); #endif /* !ICALCSTP_H */ |