3
3
* Author: Brent Hendricks
4
4
* Project: GGZ Core Client Lib
6
* $Id: net.h,v 1.37 2003/01/22 13:50:00 dr_maux Exp $
6
* $Id: net.h 7889 2006-03-07 09:57:32Z josef $
8
8
* Code for performing network I/O
10
10
* Copyright (C) 2000 Brent Hendricks.
12
* This program is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation; either version 2 of the License, or
15
* (at your option) any later version.
17
* This program is distributed in the hope that it will be useful,
12
* This library is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU Lesser General Public
14
* License as published by the Free Software Foundation; either
15
* version 2.1 of the License, or (at your option) any later version.
17
* This library is distributed in the hope that it will be useful,
18
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
* Lesser General Public License for more details.
22
* You should have received a copy of the GNU Lesser General Public
23
* License along with this library; if not, write to the Free Software
24
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
32
#include "protocol.h"
35
struct _GGZNet* _ggzcore_net_new(void);
36
void _ggzcore_net_init(struct _GGZNet *net,
37
struct _GGZServer *server,
35
typedef struct _GGZNet GGZNet;
37
GGZNet *_ggzcore_net_new(void);
38
void _ggzcore_net_init(GGZNet * net,
40
unsigned int use_tls);
42
int _ggzcore_net_set_dump_file(struct _GGZNet *net, const char* filename);
43
void _ggzcore_net_set_fd(struct _GGZNet *net, int fd);
45
void _ggzcore_net_free(struct _GGZNet *net);
47
const char* _ggzcore_net_get_host(struct _GGZNet *net);
48
unsigned int _ggzcore_net_get_port(struct _GGZNet *net);
49
int _ggzcore_net_get_fd(struct _GGZNet *net);
50
int _ggzcore_net_get_tls(struct _GGZNet *net);
52
int _ggzcore_net_connect(struct _GGZNet *net);
54
void _ggzcore_net_disconnect(struct _GGZNet *net);
41
unsigned int port, unsigned int use_tls);
43
int _ggzcore_net_set_dump_file(GGZNet * net, const char *filename);
44
void _ggzcore_net_set_fd(GGZNet * net, int fd);
46
void _ggzcore_net_free(GGZNet * net);
48
const char *_ggzcore_net_get_host(GGZNet * net);
49
unsigned int _ggzcore_net_get_port(GGZNet * net);
50
int _ggzcore_net_get_fd(GGZNet * net);
51
int _ggzcore_net_get_tls(GGZNet * net);
53
int _ggzcore_net_connect(GGZNet * net);
55
void _ggzcore_net_disconnect(GGZNet * net);
56
57
/* Functions for sending data/requests to server */
57
int _ggzcore_net_send_login(struct _GGZNet *net);
58
int _ggzcore_net_send_channel(struct _GGZNet *net);
59
int _ggzcore_net_send_motd(struct _GGZNet *net);
60
int _ggzcore_net_send_list_types(struct _GGZNet *net,
62
int _ggzcore_net_send_list_rooms(struct _GGZNet *net,
65
int _ggzcore_net_send_join_room(struct _GGZNet *net,
66
const unsigned int room_num);
68
int _ggzcore_net_send_list_players(struct _GGZNet *net);
69
int _ggzcore_net_send_list_tables(struct _GGZNet *net,
73
int _ggzcore_net_send_chat(struct _GGZNet *net,
58
int _ggzcore_net_send_login(GGZNet * net, GGZLoginType login_type,
59
const char *handle, const char *password, const char *email,
60
const char *language);
61
int _ggzcore_net_send_channel(GGZNet * net, const char *id);
62
int _ggzcore_net_send_motd(GGZNet * net);
63
int _ggzcore_net_send_list_types(GGZNet * net, const char verbose);
64
int _ggzcore_net_send_list_rooms(GGZNet * net,
65
const int type, const char verbose);
66
int _ggzcore_net_send_join_room(GGZNet * net, const unsigned int room_num);
68
int _ggzcore_net_send_list_players(GGZNet * net);
69
int _ggzcore_net_send_list_tables(GGZNet * net,
70
const int type, const char global);
72
int _ggzcore_net_send_chat(GGZNet * net,
74
73
const GGZChatType op,
78
int _ggzcore_net_send_table_launch(struct _GGZNet *net, struct _GGZTable *table);
79
int _ggzcore_net_send_table_join(struct _GGZNet *net, const unsigned int num,
74
const char *player, const char *msg);
76
int _ggzcore_net_send_player_info(GGZNet * net, int seat_num);
78
int _ggzcore_net_send_table_launch(GGZNet * net, struct _GGZTable *table);
79
int _ggzcore_net_send_table_join(GGZNet * net, const unsigned int num,
81
int _ggzcore_net_send_table_leave(struct _GGZNet *net, int force,
83
int _ggzcore_net_send_table_reseat(GGZNet *net,
86
int _ggzcore_net_send_table_seat_update(GGZNet *net, GGZTable *table,
87
struct _GGZSeat *seat);
88
int _ggzcore_net_send_table_desc_update(GGZNet *net, GGZTable *table,
81
int _ggzcore_net_send_table_leave(GGZNet * net, int force, int spectator);
82
int _ggzcore_net_send_table_reseat(GGZNet * net,
83
GGZReseatType opcode, int seat_num);
84
int _ggzcore_net_send_table_seat_update(GGZNet * net, GGZTable * table,
86
int _ggzcore_net_send_table_desc_update(GGZNet * net, GGZTable * table,
90
int _ggzcore_net_send_table_boot_update(GGZNet *net, GGZTable *table,
91
struct _GGZSeat *seat);
93
int _ggzcore_net_send_game_data(struct _GGZNet *net, int size, char *buffer);
95
int _ggzcore_net_send_logout(struct _GGZNet *net);
88
int _ggzcore_net_send_table_boot_update(GGZNet * net, GGZTable * table,
91
int _ggzcore_net_send_game_data(GGZNet * net, int size, char *buffer);
93
int _ggzcore_net_send_logout(GGZNet * net);
98
96
/* Functions for reading data from server */
99
int _ggzcore_net_data_is_pending(struct _GGZNet *net);
100
int _ggzcore_net_read_data(struct _GGZNet *net);
97
int _ggzcore_net_data_is_pending(GGZNet * net);
98
int _ggzcore_net_read_data(GGZNet * net);
102
100
#endif /* __NET_H__ */