1 #ifndef CONN_H_INCLUDED
2 #define CONN_H_INCLUDED
4 #include "xmlrpc-c/abyss.h"
8 #define BUFFER_SIZE 4096
11 struct _TConn * nextOutstandingP;
12 /* Link to the next connection in the list of outstanding
17 /* Index into the connection buffer (buffer[], below) where
18 the next byte read on the connection will go.
21 /* Index into the connection buffer (buffer[], below) where
22 the next byte to be delivered to the user is.
24 uint32_t inbytes,outbytes;
27 abyss_bool hasOwnThread;
30 /* We have done all the processing there is to do on this
31 connection, other than possibly notifying someone that we're
32 done. One thing this signifies is that any thread or process
33 that the connection spawned is dead or will be dead soon, so
34 one could reasonably wait for it to be dead, e.g. with
35 pthread_join(). Note that one can scan a bunch of processes
36 for 'finished' status, but sometimes can't scan a bunch of
42 char buffer[BUFFER_SIZE];
45 typedef struct _TConn TConn;
47 TConn * ConnAlloc(void);
49 void ConnFree(TConn * const connectionP);
52 ConnCreate(TConn ** const connectionPP,
53 TServer * const serverP,
54 TSocket * const connectedSocketP,
55 TThreadProc * const job,
56 TThreadDoneFn * const done,
57 enum abyss_foreback const foregroundBackground,
58 abyss_bool const useSigchld,
59 const char ** const errorP);
62 ConnProcess(TConn * const connectionP);
65 ConnKill(TConn * const connectionP);
68 ConnWaitAndRelease(TConn * const connectionP);
71 ConnWrite(TConn * const connectionP,
72 const void * const buffer,
76 ConnRead(TConn * const c,
77 uint32_t const timems);
80 ConnReadInit(TConn * const connectionP);
83 ConnReadHeader(TConn * const connectionP,
84 char ** const headerP);
87 ConnWriteFromFile(TConn * const connectionP,
92 uint32_t const buffersize,
96 ConnServer(TConn * const connectionP);