1 | #ifndef NET_INTERNALS_H
|
---|
2 | #define NET_INTERNALS_H
|
---|
3 |
|
---|
4 | #include "cr_bufpool.h"
|
---|
5 | #include "cr_threads.h"
|
---|
6 |
|
---|
7 | #ifndef WINDOWS
|
---|
8 | #include <sys/time.h>
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | /*
|
---|
12 | * DevNull network interface
|
---|
13 | */
|
---|
14 | extern void crDevnullInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
15 | extern void crDevnullConnection( CRConnection *conn );
|
---|
16 | extern int crDevnullRecv( void );
|
---|
17 | extern CRConnection** crDevnullDump( int *num );
|
---|
18 |
|
---|
19 |
|
---|
20 | /*
|
---|
21 | * File network interface
|
---|
22 | */
|
---|
23 | extern void crFileInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
24 | extern void crFileConnection( CRConnection *conn );
|
---|
25 | extern int crFileRecv( void );
|
---|
26 | extern CRConnection** crFileDump( int *num );
|
---|
27 |
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * TCP/IP network interface
|
---|
31 | */
|
---|
32 | typedef enum {
|
---|
33 | CRTCPIPMemory,
|
---|
34 | CRTCPIPMemoryBig
|
---|
35 | } CRTCPIPBufferKind;
|
---|
36 |
|
---|
37 | #define CR_TCPIP_BUFFER_MAGIC 0x89134532
|
---|
38 |
|
---|
39 | typedef struct CRTCPIPBuffer {
|
---|
40 | unsigned int magic;
|
---|
41 | CRTCPIPBufferKind kind;
|
---|
42 | unsigned int len;
|
---|
43 | unsigned int allocated;
|
---|
44 | unsigned int pad; /* may be clobbered by crTCPIPSend() */
|
---|
45 | } CRTCPIPBuffer;
|
---|
46 |
|
---|
47 | typedef struct {
|
---|
48 | int initialized;
|
---|
49 | int num_conns;
|
---|
50 | CRConnection **conns;
|
---|
51 | CRBufferPool *bufpool;
|
---|
52 | #ifdef CHROMIUM_THREADSAFE
|
---|
53 | CRmutex mutex;
|
---|
54 | CRmutex recvmutex;
|
---|
55 | #endif
|
---|
56 | CRNetReceiveFuncList *recv_list;
|
---|
57 | CRNetCloseFuncList *close_list;
|
---|
58 | CRSocket server_sock;
|
---|
59 | } cr_tcpip_data;
|
---|
60 |
|
---|
61 | extern cr_tcpip_data cr_tcpip;
|
---|
62 |
|
---|
63 | extern void crTCPIPInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
64 | extern void crTCPIPConnection( CRConnection *conn );
|
---|
65 | extern int crTCPIPRecv( void );
|
---|
66 | extern CRConnection** crTCPIPDump( int *num );
|
---|
67 | extern int crTCPIPDoConnect( CRConnection *conn );
|
---|
68 | extern void crTCPIPDoDisconnect( CRConnection *conn );
|
---|
69 | extern int crTCPIPErrno( void );
|
---|
70 | extern char *crTCPIPErrorString( int err );
|
---|
71 | extern void crTCPIPAccept( CRConnection *conn, const char *hostname, unsigned short port );
|
---|
72 | extern void crTCPIPWriteExact( CRConnection *conn, const void *buf, unsigned int len );
|
---|
73 | extern void crTCPIPFree( CRConnection *conn, void *buf );
|
---|
74 | extern void *crTCPIPAlloc( CRConnection *conn );
|
---|
75 | extern void crTCPIPReadExact( CRConnection *conn, void *buf, unsigned int len );
|
---|
76 | extern int __tcpip_write_exact( CRSocket sock, const void *buf, unsigned int len );
|
---|
77 | extern int __tcpip_read_exact( CRSocket sock, void *buf, unsigned int len );
|
---|
78 | extern void __tcpip_dead_connection( CRConnection *conn );
|
---|
79 | extern int __crSelect( int n, fd_set *readfds, int sec, int usec );
|
---|
80 |
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * UDP network interface
|
---|
84 | */
|
---|
85 | extern void crUDPTCPIPInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
86 | extern void crUDPTCPIPConnection( CRConnection *conn );
|
---|
87 | extern int crUDPTCPIPRecv( void );
|
---|
88 |
|
---|
89 | /*
|
---|
90 | * VirtualBox HGCM
|
---|
91 | */
|
---|
92 | #ifdef VBOX_WITH_HGCM
|
---|
93 | extern void crVBoxHGCMInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
94 | extern void crVBoxHGCMConnection( CRConnection *conn
|
---|
95 | #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
|
---|
96 | , struct VBOXUHGSMI *pHgsmi
|
---|
97 | #endif
|
---|
98 | );
|
---|
99 | extern int crVBoxHGCMRecv(
|
---|
100 | #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
|
---|
101 | CRConnection *conn
|
---|
102 | #else
|
---|
103 | void
|
---|
104 | #endif
|
---|
105 | );
|
---|
106 | #ifdef IN_GUEST
|
---|
107 | extern uint32_t crVBoxHGCMHostCapsGet(void);
|
---|
108 | #endif
|
---|
109 | extern CRConnection** crVBoxHGCMDump( int *num );
|
---|
110 | extern void crVBoxHGCMTearDown(void);
|
---|
111 | #endif
|
---|
112 |
|
---|
113 | /*
|
---|
114 | * TEAC network interface
|
---|
115 | */
|
---|
116 | #ifdef TEAC_SUPPORT
|
---|
117 | extern void crTeacInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl,
|
---|
118 | unsigned int mtu );
|
---|
119 | extern void crTeacConnection( CRConnection *conn );
|
---|
120 | extern int crTeacRecv( void );
|
---|
121 | extern void crTeacSetRank( int );
|
---|
122 | extern void crTeacSetContextRange( int, int );
|
---|
123 | extern void crTeacSetNodeRange( const char *, const char * );
|
---|
124 | extern void crTeacSetKey( const unsigned char *key, const int keyLength );
|
---|
125 | #endif /* TEAC_SUPPORT */
|
---|
126 |
|
---|
127 |
|
---|
128 | /*
|
---|
129 | * Tcscomm network interface
|
---|
130 | */
|
---|
131 | #ifdef TCSCOMM_SUPPORT
|
---|
132 | extern void crTcscommInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl,
|
---|
133 | unsigned int mtu );
|
---|
134 | extern void crTcscommConnection( CRConnection *conn );
|
---|
135 | extern int crTcscommRecv( void );
|
---|
136 | #endif /* TCSCOMM_SUPPORT */
|
---|
137 |
|
---|
138 |
|
---|
139 | /*
|
---|
140 | * SDP network interface
|
---|
141 | */
|
---|
142 | #ifdef SDP_SUPPORT
|
---|
143 | extern const char *crGetSDPHostnameSuffix(void);
|
---|
144 | extern void crSDPInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
145 | extern void crSDPConnection( CRConnection *conn );
|
---|
146 | extern int crSDPRecv( void );
|
---|
147 | extern CRConnection** crSDPDump( int *num );
|
---|
148 | #endif /* SDP_SUPPORT */
|
---|
149 |
|
---|
150 |
|
---|
151 | /*
|
---|
152 | * Infiniband network interface
|
---|
153 | */
|
---|
154 | #ifdef IB_SUPPORT
|
---|
155 | extern void crIBInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
156 | extern void crIBConnection( CRConnection *conn );
|
---|
157 | extern int crIBRecv( void );
|
---|
158 | extern CRConnection** crIBDump( int *num );
|
---|
159 | #endif /* IB_SUPPORT */
|
---|
160 |
|
---|
161 |
|
---|
162 | /*
|
---|
163 | * GM network interface
|
---|
164 | */
|
---|
165 | #ifdef GM_SUPPORT
|
---|
166 | extern void crGmInit( CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu );
|
---|
167 | extern void crGmConnection( CRConnection *conn );
|
---|
168 | extern int crGmRecv( void );
|
---|
169 | extern CRConnection** crGmDump( int *num );
|
---|
170 | extern int crGmDoConnect( CRConnection *conn );
|
---|
171 | extern void crGmDoDisconnect( CRConnection *conn );
|
---|
172 | extern int crGmErrno( void );
|
---|
173 | extern char *crGmErrorString( int err );
|
---|
174 | extern void crGmAccept( CRConnection *conn, const char *hostname, unsigned short port );
|
---|
175 | extern void crGmSendExact( CRConnection *conn, const void *buf, unsigned int len );
|
---|
176 | extern void crGmFree( CRConnection *conn, void *buf );
|
---|
177 | extern void *crGmAlloc( CRConnection *conn );
|
---|
178 | extern void crGmReadExact( CRConnection *conn, void *buf, unsigned int len );
|
---|
179 | extern void crGmBogusRecv( CRConnection *conn, void *buf, unsigned int len );
|
---|
180 | extern void crGmHandleNewMessage( CRConnection *conn, CRMessage *msg, unsigned int len );
|
---|
181 | extern void crGmInstantReclaim( CRConnection *conn, CRMessage *msg );
|
---|
182 | extern unsigned int crGmNodeId( void );
|
---|
183 | extern unsigned int crGmPortNum( void );
|
---|
184 | #endif /* GM_SUPPORT */
|
---|
185 |
|
---|
186 |
|
---|
187 | extern CRConnection** crNetDump( int *num );
|
---|
188 |
|
---|
189 | #endif /* NET_INTERNALS_H */
|
---|