abyss_conn.h
Go to the documentation of this file.00001 #ifndef CONN_H_INCLUDED
00002 #define CONN_H_INCLUDED
00003
00004 #include <xmlrpc-c/abyss.h>
00005 #include "abyss_socket.h"
00006 #include "abyss_file.h"
00007
00008 #define BUFFER_SIZE 4096
00009
00010 struct _TConn {
00011 struct _TConn * nextOutstandingP;
00012
00013
00014
00015 TServer * server;
00016 uint32_t buffersize;
00017
00018
00019
00020 uint32_t bufferpos;
00021
00022
00023
00024 uint32_t inbytes,outbytes;
00025 TSocket * socketP;
00026 TIPAddr peerip;
00027 abyss_bool hasOwnThread;
00028 TThread * threadP;
00029 abyss_bool finished;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 const char * trace;
00040 TThreadProc * job;
00041 TThreadDoneFn * done;
00042 char buffer[BUFFER_SIZE];
00043 };
00044
00045 typedef struct _TConn TConn;
00046
00047 TConn * ConnAlloc(void);
00048
00049 void ConnFree(TConn * const connectionP);
00050
00051 void
00052 ConnCreate(TConn ** const connectionPP,
00053 TServer * const serverP,
00054 TSocket * const connectedSocketP,
00055 TThreadProc * const job,
00056 TThreadDoneFn * const done,
00057 enum abyss_foreback const foregroundBackground,
00058 abyss_bool const useSigchld,
00059 const char ** const errorP);
00060
00061 abyss_bool
00062 ConnProcess(TConn * const connectionP);
00063
00064 abyss_bool
00065 ConnKill(TConn * const connectionP);
00066
00067 void
00068 ConnWaitAndRelease(TConn * const connectionP);
00069
00070 abyss_bool
00071 ConnWrite(TConn * const connectionP,
00072 const void * const buffer,
00073 uint32_t const size);
00074
00075 abyss_bool
00076 ConnRead(TConn * const c,
00077 uint32_t const timems);
00078
00079 void
00080 ConnReadInit(TConn * const connectionP);
00081
00082 abyss_bool
00083 ConnReadHeader(TConn * const connectionP,
00084 char ** const headerP);
00085
00086 abyss_bool
00087 ConnWriteFromFile(TConn * const connectionP,
00088 TFile * const file,
00089 uint64_t const start,
00090 uint64_t const end,
00091 void * const buffer,
00092 uint32_t const buffersize,
00093 uint32_t const rate);
00094
00095 TServer *
00096 ConnServer(TConn * const connectionP);
00097
00098 #endif