| |
1 #ifndef __CC_NETWORK_H__ |
| |
2 #define __CC_NETWORK_H__ |
| |
3 |
| |
4 #include "account.h" |
| |
5 #include "conversation.h" |
| |
6 #include "crazychat.h" |
| |
7 |
| |
8 /* --- begin constant definition --- */ |
| |
9 |
| |
10 #define DEFAULT_CC_PORT 6543 |
| |
11 |
| |
12 #define CRAZYCHAT_INVITE_CODE "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \ |
| |
13 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \ |
| |
14 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \ |
| |
15 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \ |
| |
16 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" \ |
| |
17 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" |
| |
18 #define CRAZYCHAT_ACCEPT_CODE "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" \ |
| |
19 "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" \ |
| |
20 "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" \ |
| |
21 "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" \ |
| |
22 "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" \ |
| |
23 "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" |
| |
24 #define CRAZYCHAT_READY_CODE "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" \ |
| |
25 "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" \ |
| |
26 "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" \ |
| |
27 "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" \ |
| |
28 "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" \ |
| |
29 "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" |
| |
30 |
| |
31 /* --- begin function declarations --- */ |
| |
32 |
| |
33 /** |
| |
34 * Creates a new CrazyChat session if one doesn't exist and sends the invite. |
| |
35 * @param cc global crazychat data structure |
| |
36 * @param name the peer name |
| |
37 * @param account the gaim account |
| |
38 */ |
| |
39 void cc_net_send_invite(struct crazychat *cc, char *name, GaimAccount *account); |
| |
40 |
| |
41 /** |
| |
42 * Pops up the CrazyChat invitation accept window if a CrazyChat session does |
| |
43 * not exist yet for this peer. |
| |
44 * @param account gaim account |
| |
45 * @param cc global crazychat data structure |
| |
46 * @param name the peer name |
| |
47 * @param peer_ip the peer's ip address |
| |
48 * @param peer_port the peer's tcp port |
| |
49 */ |
| |
50 void cc_net_recv_invite(GaimAccount *account, struct crazychat *cc, char *name, |
| |
51 const char *peer_ip, const char *peer_port); |
| |
52 |
| |
53 /** |
| |
54 * Accepts the CrazyChat invitation and sends the response. |
| |
55 * @param session the CrazyChat session |
| |
56 */ |
| |
57 void cc_net_send_accept(struct cc_session *session); |
| |
58 |
| |
59 /** |
| |
60 * Receives a CrazyChat accept message, and if appropriate, creates a server |
| |
61 * socket and sends the ready message. |
| |
62 * @param account the gaim account which received the message |
| |
63 * @param cc global crazychat data structure |
| |
64 * @param name the peer name |
| |
65 * @param peer_ip the peer's ip address |
| |
66 */ |
| |
67 void cc_net_recv_accept(GaimAccount *account, struct crazychat *cc, char *name, |
| |
68 const char *peer_ip); |
| |
69 |
| |
70 /** |
| |
71 * Receives a CrazyChat ready message, and if appropriate, connects to peer |
| |
72 * @param account the gaim account which received the message |
| |
73 * @param cc global crazychat data structure |
| |
74 * @param name the peer name |
| |
75 */ |
| |
76 void cc_net_recv_ready(GaimAccount *account, struct crazychat *cc, char *name); |
| |
77 |
| |
78 #endif |