Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/directconn.h @ 30435:bcb5e6c2e5a3
Re-indent directconn.h, and fix a typo.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 18 Mar 2010 03:29:28 +0000 |
parents | b1cda3f8fdc9 |
children | 4e532eedcab4 |
comparison
equal
deleted
inserted
replaced
30434:b1cda3f8fdc9 | 30435:bcb5e6c2e5a3 |
---|---|
35 #include "slplink.h" | 35 #include "slplink.h" |
36 #include "slpmsg.h" | 36 #include "slpmsg.h" |
37 | 37 |
38 typedef enum | 38 typedef enum |
39 { | 39 { |
40 DC_STATE_CLOSED, /*< No socket opened yet */ | 40 DC_STATE_CLOSED, /*< No socket opened yet */ |
41 DC_STATE_FOO, /*< Waiting for FOO message */ | 41 DC_STATE_FOO, /*< Waiting for FOO message */ |
42 DC_STATE_HANDSHAKE, /*< Waiting for handshake message */ | 42 DC_STATE_HANDSHAKE, /*< Waiting for handshake message */ |
43 DC_STATE_HANDSHAKE_REPLY, /*< Waiting for handshake reply message */ | 43 DC_STATE_HANDSHAKE_REPLY, /*< Waiting for handshake reply message */ |
44 DC_STATE_ESTABILISHED /*< Handshake complete */ | 44 DC_STATE_ESTABLISHED /*< Handshake complete */ |
45 } MsnDirectConnState; | 45 } MsnDirectConnState; |
46 | 46 |
47 typedef enum | 47 typedef enum |
48 { | 48 { |
49 DC_PROCESS_OK = 0, | 49 DC_PROCESS_OK = 0, |
54 } MsnDirectConnProcessResult; | 54 } MsnDirectConnProcessResult; |
55 | 55 |
56 typedef struct _MsnDirectConnPacket MsnDirectConnPacket; | 56 typedef struct _MsnDirectConnPacket MsnDirectConnPacket; |
57 | 57 |
58 struct _MsnDirectConnPacket { | 58 struct _MsnDirectConnPacket { |
59 guint32 length; | 59 guint32 length; |
60 guchar *data; | 60 guchar *data; |
61 | 61 |
62 void (*sent_cb)(struct _MsnDirectConnPacket*); | 62 void (*sent_cb)(struct _MsnDirectConnPacket*); |
63 MsnMessage *msg; | 63 MsnMessage *msg; |
64 }; | 64 }; |
65 | 65 |
66 struct _MsnDirectConn | 66 struct _MsnDirectConn |
67 { | 67 { |
68 MsnDirectConnState state; /**< Direct connection status */ | 68 MsnDirectConnState state; /**< Direct connection status */ |
69 MsnSlpLink *slplink; /**< The slplink using this direct connection */ | 69 MsnSlpLink *slplink; /**< The slplink using this direct connection */ |
70 MsnSlpCall *slpcall; /**< The slpcall which initiated the direct connection */ | 70 MsnSlpCall *slpcall; /**< The slpcall which initiated the direct connection */ |
71 char *msg_body; /**< The body of message sent by send_connection_info_msg_cb */ | 71 char *msg_body; /**< The body of message sent by send_connection_info_msg_cb */ |
72 MsnSlpMessage *prev_ack; /**< The saved SLP ACK message */ | 72 MsnSlpMessage *prev_ack; /**< The saved SLP ACK message */ |
73 | 73 |
74 guchar nonce[16]; /**< The nonce used for direct connection handshake */ | 74 guchar nonce[16]; /**< The nonce used for direct connection handshake */ |
75 gchar nonce_hash[37]; /**< The hash of nonce */ | 75 gchar nonce_hash[37]; /**< The hash of nonce */ |
76 | 76 |
77 PurpleNetworkListenData *listen_data; /**< The pending socket creation request */ | 77 PurpleNetworkListenData *listen_data; /**< The pending socket creation request */ |
78 PurpleProxyConnectData *connect_data; /**< The pending connection attempt */ | 78 PurpleProxyConnectData *connect_data; /**< The pending connection attempt */ |
79 int listenfd; /**< The socket we're listening for incoming connections */ | 79 int listenfd; /**< The socket we're listening for incoming connections */ |
80 guint listenfd_handle; /**< The timeout handle for incoming connection */ | 80 guint listenfd_handle; /**< The timeout handle for incoming connection */ |
81 guint connect_timeout_handle; /**< The timeout handle for outgoing connection */ | 81 guint connect_timeout_handle; /**< The timeout handle for outgoing connection */ |
82 | 82 |
83 int fd; /**< The direct connection socket */ | 83 int fd; /**< The direct connection socket */ |
84 guint recv_handle; /**< The incoming data callback handle */ | 84 guint recv_handle; /**< The incoming data callback handle */ |
85 guint send_handle; /**< The outgoing data callback handle */ | 85 guint send_handle; /**< The outgoing data callback handle */ |
86 | 86 |
87 gchar *in_buffer; /**< The receive buffer */ | 87 gchar *in_buffer; /**< The receive buffer */ |
88 int in_size; /**< The receive buffer size */ | 88 int in_size; /**< The receive buffer size */ |
89 int in_pos; /**< The first free position in receive buffer */ | 89 int in_pos; /**< The first free position in receive buffer */ |
90 GQueue *out_queue; /**< The outgoing packet queue */ | 90 GQueue *out_queue; /**< The outgoing packet queue */ |
91 int msg_pos; /**< The position of next byte to be sent in the actual packet */ | 91 int msg_pos; /**< The position of next byte to be sent in the actual packet */ |
92 | 92 |
93 MsnSlpHeader header; /**< SLP header for parsing / serializing */ | 93 MsnSlpHeader header; /**< SLP header for parsing / serializing */ |
94 | 94 |
95 /**< The callback used for sending information to the peer about the opened scoket */ | 95 /** The callback used for sending information to the peer about the opened socket */ |
96 void (*send_connection_info_msg_cb)(struct _MsnDirectConn*); | 96 void (*send_connection_info_msg_cb)(MsnDirectConn *); |
97 | 97 |
98 gchar *ext_ip; /**< Our external IP address */ | 98 gchar *ext_ip; /**< Our external IP address */ |
99 int ext_port; /**< Our external port */ | 99 int ext_port; /**< Our external port */ |
100 | 100 |
101 guint timeout_handle; | 101 guint timeout_handle; |
102 gboolean progress; | 102 gboolean progress; |
103 | 103 |
104 //int num_calls; /**< The number of slpcalls using this direct connection */ | 104 //int num_calls; /**< The number of slpcalls using this direct connection */ |
105 }; | 105 }; |
106 | 106 |
107 #define DC_CONNECT_TIMEOUT 5 | 107 #define DC_CONNECT_TIMEOUT 5 |
108 #define DC_TIMEOUT 60 | 108 #define DC_TIMEOUT 60 |
109 | 109 |
112 */ | 112 */ |
113 void | 113 void |
114 msn_dc_enqueue_msg(MsnDirectConn *dc, MsnMessage *msg); | 114 msn_dc_enqueue_msg(MsnDirectConn *dc, MsnMessage *msg); |
115 | 115 |
116 /* | 116 /* |
117 * Creates initializes and returns a new MsnDirectConn structure. | 117 * Creates, initializes, and returns a new MsnDirectConn structure. |
118 */ | 118 */ |
119 MsnDirectConn* | 119 MsnDirectConn * |
120 msn_dc_new(MsnSlpCall *slplink); | 120 msn_dc_new(MsnSlpCall *slplink); |
121 | 121 |
122 /* | 122 /* |
123 * Destroys an MsnDirectConn structure. Frees every buffer allocated earlier | 123 * Destroys an MsnDirectConn structure. Frees every buffer allocated earlier |
124 * restores saved callbacks, etc. | 124 * restores saved callbacks, etc. |
168 gboolean | 168 gboolean |
169 msn_dc_outgoing_connection_timeout_cb(gpointer data); | 169 msn_dc_outgoing_connection_timeout_cb(gpointer data); |
170 | 170 |
171 /* | 171 /* |
172 * This callback will be called when the listening socket is successfully | 172 * This callback will be called when the listening socket is successfully |
173 * created and it's parameters (IP/port) are available. | 173 * created and its parameters (IP/port) are available. |
174 */ | 174 */ |
175 void | 175 void |
176 msn_dc_listen_socket_created_cb(int listenfd, gpointer data); | 176 msn_dc_listen_socket_created_cb(int listenfd, gpointer data); |
177 | 177 |
178 #endif /* MSN_DIRECTCONN_H */ | 178 #endif /* MSN_DIRECTCONN_H */ |