]>
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 | */ | |
483249fc | 8 | |
a324a7bc GL |
9 | #ifndef __GSOCK_UNX_H |
10 | #define __GSOCK_UNX_H | |
11 | ||
483249fc | 12 | #ifndef __GSOCKET_STANDALONE__ |
d422d01e | 13 | #include "wx/setup.h" |
483249fc | 14 | #endif |
d422d01e | 15 | |
483249fc | 16 | #if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) |
d422d01e | 17 | |
483249fc | 18 | #ifndef __GSOCKET_STANDALONE__ |
d422d01e | 19 | #include "wx/gsocket.h" |
483249fc GRG |
20 | #else |
21 | #include "gsocket.h" | |
22 | #endif | |
23 | ||
d422d01e RR |
24 | |
25 | #ifdef __cplusplus | |
26 | extern "C" { | |
27 | #endif /* __cplusplus */ | |
28 | ||
a324a7bc GL |
29 | |
30 | /* Definition of GSocket */ | |
483249fc GRG |
31 | struct _GSocket |
32 | { | |
a324a7bc | 33 | int m_fd; |
483249fc GRG |
34 | GAddress *m_local; |
35 | GAddress *m_peer; | |
a324a7bc GL |
36 | GSocketError m_error; |
37 | ||
483249fc GRG |
38 | bool m_non_blocking; |
39 | bool m_server; | |
40 | bool m_stream; | |
41 | bool m_oriented; | |
aa6d9706 | 42 | bool m_establishing; |
39b91eca | 43 | unsigned long m_timeout; |
a324a7bc | 44 | |
39b91eca | 45 | /* Callbacks */ |
483249fc | 46 | GSocketEventFlags m_detected; |
98781fa3 | 47 | GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; |
a324a7bc GL |
48 | char *m_data[GSOCK_MAX_EVENT]; |
49 | ||
a324a7bc GL |
50 | char *m_gui_dependent; |
51 | }; | |
52 | ||
53 | /* Definition of GAddress */ | |
483249fc GRG |
54 | struct _GAddress |
55 | { | |
a324a7bc GL |
56 | struct sockaddr *m_addr; |
57 | size_t m_len; | |
58 | ||
59 | GAddressType m_family; | |
60 | int m_realfamily; | |
61 | ||
62 | GSocketError m_error; | |
63 | }; | |
64 | ||
483249fc GRG |
65 | /* Input / Output */ |
66 | ||
67 | GSocketError _GSocket_Input_Timeout(GSocket *socket); | |
68 | GSocketError _GSocket_Output_Timeout(GSocket *socket); | |
a324a7bc GL |
69 | int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size); |
70 | int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size); | |
71 | int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size); | |
72 | int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size); | |
483249fc GRG |
73 | |
74 | /* Callbacks */ | |
75 | ||
76 | void _GSocket_Enable(GSocket *socket, GSocketEvent event); | |
77 | void _GSocket_Disable(GSocket *socket, GSocketEvent event); | |
a324a7bc GL |
78 | void _GSocket_Detected_Read(GSocket *socket); |
79 | void _GSocket_Detected_Write(GSocket *socket); | |
483249fc | 80 | |
a324a7bc GL |
81 | void _GSocket_GUI_Init(GSocket *socket); |
82 | void _GSocket_GUI_Destroy(GSocket *socket); | |
483249fc GRG |
83 | void _GSocket_Enable_Events(GSocket *socket); |
84 | void _GSocket_Disable_Events(GSocket *socket); | |
85 | void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event); | |
86 | void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event); | |
87 | ||
88 | /* GAddress */ | |
e00f35bb | 89 | |
54e575f9 GL |
90 | GSocketError _GAddress_translate_from(GAddress *address, |
91 | struct sockaddr *addr, int len); | |
92 | GSocketError _GAddress_translate_to(GAddress *address, | |
93 | struct sockaddr **addr, int *len); | |
a324a7bc | 94 | |
54e575f9 | 95 | GSocketError _GAddress_Init_INET(GAddress *address); |
54e575f9 | 96 | GSocketError _GAddress_Init_UNIX(GAddress *address); |
a324a7bc | 97 | |
d422d01e RR |
98 | #ifdef __cplusplus |
99 | } | |
483249fc | 100 | #endif /* __cplusplus */ |
d422d01e | 101 | |
483249fc | 102 | #endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ |
d422d01e | 103 | |
483249fc | 104 | #endif /* __GSOCK_UNX_H */ |