]>
Commit | Line | Data |
---|---|---|
dbd300df GL |
1 | /* ------------------------------------------------------------------------- |
2 | * Project: GSocket (Generic Socket) for WX | |
3 | * Name: gsockunx.h | |
4 | * Purpose: GSocket Unix header | |
5 | * CVSID: $Id$ | |
6 | * ------------------------------------------------------------------------- | |
7 | */ | |
a324a7bc GL |
8 | #ifndef __GSOCK_UNX_H |
9 | #define __GSOCK_UNX_H | |
10 | ||
d422d01e RR |
11 | #include "wx/setup.h" |
12 | ||
13 | #if wxUSE_SOCKETS | |
14 | ||
15 | #include "wx/gsocket.h" | |
16 | ||
17 | #ifdef __cplusplus | |
18 | extern "C" { | |
19 | #endif /* __cplusplus */ | |
20 | ||
a324a7bc GL |
21 | |
22 | /* Definition of GSocket */ | |
23 | struct _GSocket { | |
24 | int m_fd; | |
25 | GAddress *m_local, *m_peer; | |
26 | GSocketError m_error; | |
27 | ||
dc26b37a | 28 | bool m_non_blocking, m_server, m_stream, m_oriented; |
aa6d9706 | 29 | bool m_establishing; |
39b91eca | 30 | unsigned long m_timeout; |
a324a7bc | 31 | |
39b91eca | 32 | /* Callbacks */ |
98781fa3 | 33 | GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; |
a324a7bc GL |
34 | char *m_data[GSOCK_MAX_EVENT]; |
35 | ||
36 | /* IO calls associated */ | |
37 | bool m_iocalls[GSOCK_MAX_EVENT]; | |
38 | ||
39 | char *m_gui_dependent; | |
40 | }; | |
41 | ||
42 | /* Definition of GAddress */ | |
43 | struct _GAddress { | |
44 | struct sockaddr *m_addr; | |
45 | size_t m_len; | |
46 | ||
47 | GAddressType m_family; | |
48 | int m_realfamily; | |
49 | ||
50 | GSocketError m_error; | |
51 | }; | |
52 | ||
53 | void _GSocket_Enable(GSocket *socket, GSocketEvent event); | |
54 | void _GSocket_Disable(GSocket *socket, GSocketEvent event); | |
4c28d606 | 55 | void _GSocket_Configure_Callbacks(GSocket *socket); |
a324a7bc GL |
56 | int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size); |
57 | int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size); | |
58 | int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size); | |
59 | int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size); | |
39b91eca GL |
60 | void _GSocket_Install_Callback(GSocket *socket, GSocketEvent count); |
61 | void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent count); | |
a324a7bc GL |
62 | void _GSocket_Detected_Read(GSocket *socket); |
63 | void _GSocket_Detected_Write(GSocket *socket); | |
64 | void _GSocket_GUI_Init(GSocket *socket); | |
65 | void _GSocket_GUI_Destroy(GSocket *socket); | |
e00f35bb GL |
66 | |
67 | /* Translaters returns false when memory is exhausted */ | |
54e575f9 GL |
68 | GSocketError _GAddress_translate_from(GAddress *address, |
69 | struct sockaddr *addr, int len); | |
70 | GSocketError _GAddress_translate_to(GAddress *address, | |
71 | struct sockaddr **addr, int *len); | |
a324a7bc | 72 | |
e00f35bb GL |
73 | /* Initialisers returns FALSE when an error happened in the initialisation */ |
74 | ||
a324a7bc | 75 | /* Internet address family */ |
54e575f9 | 76 | GSocketError _GAddress_Init_INET(GAddress *address); |
a324a7bc | 77 | /* Local address family */ |
54e575f9 | 78 | GSocketError _GAddress_Init_UNIX(GAddress *address); |
a324a7bc | 79 | |
d422d01e RR |
80 | #ifdef __cplusplus |
81 | } | |
82 | #endif /* __cplusplus */ | |
83 | ||
84 | #endif | |
85 | /* wxUSE_SOCKETS */ | |
86 | ||
a324a7bc | 87 | #endif |
d422d01e | 88 | /* __GSOCK_UNX_H */ |