5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2003 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
28 unsigned char data[16 * 16];
32 /* SilcMap command context. */
34 /* Map command datas */
52 unsigned int color_set : 1;
53 unsigned int lcolor_set : 1;
56 unsigned int writemap : 1;
57 unsigned int writehtml : 1;
58 unsigned int writemaphtml : 1;
60 unsigned int draw_line : 1;
61 unsigned int draw_text : 1;
62 unsigned int draw_circle : 1;
63 unsigned int draw_rectangle : 1;
64 } *SilcMapCommand, SilcMapCommandStruct;
66 /* The SilcMap context. */
69 SilcClient client; /* SILC Client context */
70 char *conffile; /* Config file name */
71 SilcDList conns; /* Connections */
72 SilcUInt32 conns_num; /* Number of created connections */
73 SilcUInt32 conn_num; /* Current number of processed connections */
76 unsigned char *bitmap; /* Loaded bitmap image */
77 SilcUInt32 bitsilc_map_size; /* Size of bitmap */
78 SilcUInt32 width; /* Bitmap width in pixels */
79 SilcUInt32 height; /* Bitmap height in pixels */
80 SilcUInt32 maxcolor; /* Max color value in bitmap */
81 MapFonts font; /* Current font */
84 SilcMapCommandStruct writemap;
85 SilcMapCommandStruct writehtml;
86 SilcMapCommandStruct writemaphtml;
87 SilcMapCommandStruct cut;
90 /* SilcMap connecetion context. */
92 /* Server and connection details */
102 char *writemaphtml_url;
105 unsigned int connect : 1;
106 unsigned int starttime : 1;
107 unsigned int uptime : 1;
108 unsigned int clients : 1;
109 unsigned int channels : 1;
110 unsigned int server_ops : 1;
111 unsigned int router_ops : 1;
112 unsigned int cell_clients : 1;
113 unsigned int cell_channels : 1;
114 unsigned int cell_servers : 1;
115 unsigned int all_clients : 1;
116 unsigned int all_channels : 1;
117 unsigned int all_servers : 1;
118 unsigned int all_routers : 1;
119 unsigned int all_server_ops : 1;
120 unsigned int all_router_ops : 1;
121 unsigned int motd : 1;
122 unsigned int down : 1;
123 unsigned int stats_received : 1;
124 unsigned int motd_received : 1;
128 SilcUInt32 starttime;
132 SilcUInt32 server_ops;
133 SilcUInt32 router_ops;
134 SilcUInt32 cell_clients;
135 SilcUInt32 cell_channels;
136 SilcUInt32 cell_servers;
137 SilcUInt32 all_clients;
138 SilcUInt32 all_channels;
139 SilcUInt32 all_servers;
140 SilcUInt32 all_routers;
141 SilcUInt32 all_server_ops;
142 SilcUInt32 all_router_ops;
150 char *down_text_color;
157 SilcClientConnection conn;
158 } *SilcMapConnection;
160 extern SilcClientOperations silc_map_client_ops;
162 SilcMap silc_map_alloc(const char *conffile);
163 void silc_map_free(SilcMap map);
164 bool silc_map_commands_parse(SilcMap map, const char *filename);
165 void silc_map_connect(SilcMap map, SilcMapConnection mapconn);
166 bool silc_map_load_ppm(SilcMap map, const char *filename);
167 bool silc_map_write_ppm(SilcMap map, const char *filename);
168 bool silc_map_cut(SilcMap map, SilcInt32 x, SilcInt32 y,
169 SilcUInt32 width, SilcUInt32 height,
171 bool silc_map_draw(SilcMap map,
172 SilcInt32 x, SilcInt32 y,
173 const unsigned char *bitmap,
174 SilcUInt32 width, SilcUInt32 height);
175 bool silc_map_draw_raw(SilcMap map,
176 SilcInt32 x, SilcInt32 y,
177 const unsigned char *bitmap,
178 SilcUInt32 width, SilcUInt32 height,
179 SilcInt16 r, SilcInt16 g, SilcInt16 b);
180 bool silc_map_draw_line(SilcMap map, SilcUInt32 width,
181 SilcInt32 a_x, SilcInt32 a_y,
182 SilcInt32 b_x, SilcInt32 b_y,
183 SilcInt16 r, SilcInt16 g, SilcInt16 b);
184 bool silc_map_draw_text(SilcMap map, const char *text,
185 SilcInt32 x, SilcInt32 y,
186 SilcInt16 r, SilcInt16 g, SilcInt16 b);
187 bool silc_map_draw_circle(SilcMap map, SilcInt32 x, SilcInt32 y,
188 SilcInt16 r, SilcInt16 g, SilcInt16 b,
189 const char *label, SilcInt32 lposx, SilcInt32 lposy,
190 SilcInt16 lr, SilcInt16 lg, SilcInt16 lb);
191 bool silc_map_draw_rectangle(SilcMap map, SilcInt32 x, SilcInt32 y,
192 SilcInt16 r, SilcInt16 g, SilcInt16 b,
193 const char *label, SilcInt32 lposx,
195 SilcInt16 lr, SilcInt16 lg, SilcInt16 lb);
196 double silc_map_parse_pos(char *pos);
197 int silc_map_lon2x(SilcMap map, char *latitude);
198 int silc_map_lat2y(SilcMap map, char *longitude);
199 bool silc_map_parse_color(const char *color,
200 SilcInt16 *r, SilcInt16 *g, SilcInt16 *b);
201 bool silc_map_load_font(SilcMap map, const char *filename);
202 bool silc_map_writehtml(SilcMap map, SilcMapConnection mapconn);
203 bool silc_map_writehtml_index(SilcMap map);
204 bool silc_map_writemaphtml(SilcMap map);
206 #endif /* SILCMAP_H */