/[svn]/hopm/trunk/src/libopm/src/libopm.h
ViewVC logotype

Contents of /hopm/trunk/src/libopm/src/libopm.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5135 - (show annotations)
Thu Dec 25 18:51:51 2014 UTC (5 years, 5 months ago) by michael
File MIME type: text/x-csrc
File size: 2272 byte(s)
- propset svn:eol-style native

1 #ifndef LIBOPM_H
2 #define LIBOPM_H
3
4 #include "config.h"
5 #include "inet.h"
6 #include "opm_common.h"
7 #include "opm.h"
8
9 #define CBLEN 5 /* Number of callback functions */
10 #define READBUFLEN 128 /* Size of conn->readbuf */
11 #define SENDBUFLEN 512 /* Size of sendbuffer in proxy.c */
12
13 typedef struct _OPM_SCAN OPM_SCAN_T;
14 typedef struct _OPM_CONNECTION OPM_CONNECTION_T;
15 typedef struct _OPM_PROTOCOL_CONFIG OPM_PROTOCOL_CONFIG_T;
16 typedef struct _OPM_PROTOCOL OPM_PROTOCOL_T;
17
18 /* Types of hard coded proxy READ/WRITE functions which are
19 setup in a table in libopm.c */
20
21 typedef int OPM_PROXYWRITE_T (OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
22 typedef int OPM_PROXYREAD_T (OPM_T *, OPM_SCAN_T *, OPM_CONNECTION_T *);
23
24 struct _OPM_SCAN {
25 opm_sockaddr addr; /* Address in byte order of remote client */
26 OPM_REMOTE_T *remote; /* Pointed to the OPM_REMOTE_T for this scan, passed by client */
27 OPM_LIST_T *connections; /* List of individual connections of this scan (1 for each protocol) */
28 };
29
30 struct _OPM_CONNECTION {
31
32 OPM_PROTOCOL_T *protocol; /* Pointer to specific protocol this connection handles */
33 unsigned short int port; /* Some protocols have multiple ports, eg. HTTP */
34
35 int fd; /* Allocated file descriptor, 0 if not yet allocated */
36 unsigned short int bytes_read; /* Bytes read so far in this connection */
37 char readbuf[READBUFLEN + 1]; /* 128 byte read buffer, anything over 128 is probably not of use */
38 unsigned short int readlen; /* Length of readbuf */
39 unsigned short int state; /* State of connection */
40 time_t creation; /* When this connection was established */
41 };
42
43 struct _OPM_PROTOCOL_CONFIG
44 {
45 OPM_PROTOCOL_T *type; /* Protocol type */
46 unsigned short int port; /* Port to connect on */
47
48 };
49
50 struct _OPM_PROTOCOL
51 {
52 int type; /* Protocol type */
53
54 OPM_PROXYWRITE_T *write_function; /* Write function handler for this protocol */
55 OPM_PROXYREAD_T *read_function; /* Read function handler for this protocol */
56 };
57
58 #endif /* LIBOPM_H */

Properties

Name Value
svn:eol-style native
svn:keywords Id

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28