Added "size-request" signal to passwd entry.
[irreco.git] / irtrans / shlib / src / network.h
bloba2f8cc9f579c9c47376c39aa5653c2ef44856cba
1 #define PROTOCOL_VERSION 209
3 #define MAX_IR_DEVICES 256
6 #define COMMAND_SEND 1
7 #define COMMAND_LRNREM 2
8 #define COMMAND_LRNTIM 3
9 #define COMMAND_LRNCOM 4
10 #define COMMAND_CLOSE 5
11 #define COMMAND_STATUS 6
12 #define COMMAND_RESEND 7
13 #define COMMAND_LRNRAW 8
14 #define COMMAND_LRNRPT 9
15 #define COMMAND_LRNTOG 10
16 #define COMMAND_SETSTAT 11
17 #define COMMAND_LRNLONG 12
18 #define COMMAND_LRNRAWRPT 13
19 #define COMMAND_RELOAD 14
20 #define COMMAND_LCD 15
21 #define COMMAND_LEARNSTAT 16
22 #define COMMAND_TEMP 17
23 #define COMMAND_GETREMOTES 18
24 #define COMMAND_GETCOMMANDS 19
25 #define COMMAND_STORETRANS 20
26 #define COMMAND_LOADTRANS 21
27 #define COMMAND_SAVETRANS 22
28 #define COMMAND_FLASHTRANS 23
29 #define COMMAND_FUNCTIONS 24
30 #define COMMAND_TESTCOM 25
31 #define COMMAND_LONGSEND 26
32 #define COMMAND_SHUTDOWN 27
33 #define COMMAND_SENDCCF 28
34 #define COMMAND_LCDINIT 29
35 #define COMMAND_SETSWITCH 30
36 #define COMMAND_STATUSEX 31
37 #define COMMAND_RESET 32
38 #define COMMAND_DEVICEDATA 33
39 #define COMMAND_STARTCLOCK 34
40 #define COMMAND_LCDSTATUS 35
41 #define COMMAND_FUNCTIONEX 36
42 #define COMMAND_MCE_CHARS 37
43 #define COMMAND_SUSPEND 38
44 #define COMMAND_RESUME 39
45 #define COMMAND_DELETECOM 40
46 #define COMMAND_EMPTY 41
47 #define COMMAND_SETSTAT2 42
48 #define COMMAND_STATUSEXN 43
49 #define COMMAND_BRIGHTNESS 44
50 #define COMMAND_DEFINECHAR 45
51 #define COMMAND_STOREIRDB 46
52 #define COMMAND_FLASHIRDB 47
53 #define COMMAND_SAVEIRDB 48
54 #define COMMAND_LOADIRDB 49
55 #define COMMAND_LED 50
56 #define COMMAND_TRANSFILE 51
57 #define COMMAND_IRDBFILE 52
58 #define COMMAND_LISTBUS 53
59 #define COMMAND_SENDCCFSTR 54
60 #define COMMAND_LEARNDIRECT 55
61 #define COMMAND_TESTCOMEX 56
62 #define COMMAND_SENDCCFSTRS 57
63 #define COMMAND_SETSTATEX 58
64 #define COMMAND_DELETEREM 59
65 #define COMMAND_READ_ANALOG 60
66 #define COMMAND_RS232_SEND 61
67 #define COMMAND_SENDCCFLONG 62
69 #define COMMAND_ASCII 65
72 #define COMMAND_SENDSTRING 's' // 115
74 #define STATUS_MESSAGE 1
75 #define STATUS_TIMING 2
76 #define STATUS_DEVICEMODE 3
77 #define STATUS_RECEIVE 4
78 #define STATUS_LEARN 5
79 #define STATUS_REMOTELIST 6
80 #define STATUS_COMMANDLIST 7
81 #define STATUS_TRANSLATE 8
82 #define STATUS_FUNCTION 9
83 #define STATUS_DEVICEMODEEX 10
84 #define STATUS_DEVICEDATA 11
85 #define STATUS_LCDDATA 12
86 #define STATUS_FUNCTIONEX 13
87 #define STATUS_DEVICEMODEEXN 14
88 #define STATUS_IRDB 15
89 #define STATUS_TRANSLATIONFILE 16
90 #define STATUS_IRDBFILE 17
91 #define STATUS_BUSLIST 18
92 #define STATUS_LEARNDIRECT 19
93 #define STATUS_IRDBFLASH 20
94 #define STATUS_ANALOGINPUT 21
96 #define STATUS_ASCII 65
98 #define FILE_MODE_SAVE 0
99 #define FILE_MODE_SAVEAS 1
100 #define FILE_MODE_OVERWRITE 2
103 #pragma pack(1)
105 typedef struct {
106 uint32_t clientid;
107 int16_t statuslen;
108 int16_t statustype;
109 int16_t adress;
110 uint8_t align[2];
111 IRDATA ird;
112 } IRDATA_BUFFER;
114 typedef struct {
115 uint8_t mode;
116 uint8_t time_cnt;
117 uint8_t ir_repeat;
118 uint8_t repeat_pause;
119 uint16_t pause_len[TIME_LEN];
120 uint16_t pulse_len[TIME_LEN];
121 uint8_t data[CODE_LEN];
122 } TIMINGDATA;
124 typedef struct {
125 uint8_t netcommand;
126 uint8_t mode;
127 uint16_t timeout;
128 int32_t adress;
129 int8_t remote[80];
130 int8_t command[20];
131 uint8_t trasmit_freq;
132 } OLD_NETWORKCOMMAND;
135 typedef struct {
136 uint8_t netcommand;
137 uint8_t mode;
138 uint8_t lcdcommand;
139 uint8_t timeout;
140 int32_t adress;
141 uint8_t wid;
142 uint8_t hgt;
143 int8_t framebuffer[200];
144 } OLD_LCDCOMMAND;
147 typedef struct {
148 uint8_t netcommand;
149 uint8_t mode;
150 uint16_t timeout;
151 int32_t adress;
152 int32_t protocol_version;
153 int8_t remote[80];
154 int8_t command[20];
155 uint8_t trasmit_freq;
156 } NETWORKCOMMAND;
158 typedef struct {
159 uint8_t netcommand;
160 uint8_t mode;
161 uint16_t timeout;
162 int32_t adress;
163 int32_t protocol_version;
164 int8_t hotremote[80];
165 int8_t hotcommand[20];
166 int8_t hotremote_2[80];
167 int8_t hotcommand_2[20];
168 int32_t targetmask;
169 uint8_t extmode;
170 uint8_t extmode_2;
171 uint8_t extmode_3;
172 uint8_t extmode_4;
173 uint8_t wakeup_mac[6];
174 } MODUSCOMMAND;
177 // Adress:
178 // xxxx ffff Netmask
179 // xxx1 xxxx Netmask active Flag
180 // xxx6 xxxx LED select
181 // x7f8 xxxx Bus Select
182 // 38xx xxxx Extended LED select
183 // 8xxx xxxx Extended LED enable
184 // 4xxx xxxx Bus Broadcast
186 // xxxxxxxx xxxxxxxx 11111111 11111111 Netmask (wie bisher genutzt)
187 // xxxxxxxx xxxxxxx1 xxxxxxxx xxxxxxxx Netmask aktiv (wie bisher genutzt)
188 // xxxxxxxx xxxxx11x xxxxxxxx xxxxxxxx LED Auswahl (intern / extern)
189 // xxxxx111 11111xxx xxxxxxxx xxxxxxxx Bus Auswahl (mehrere USB / LAN Module; max: 0-255 = 256 Stück)
190 // 1x111xxx xxxxxxxx xxxxxxxx xxxxxxxx Auswahl mehrer externer LEDs - bis zu 8
191 // x1xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx Broadcast über alle USB / LAN Module
194 typedef struct {
195 uint32_t clientid;
196 int16_t statuslen;
197 int16_t statustype;
198 int8_t memsize[32];
199 int8_t flashsize[8];
200 int8_t remotes[8];
201 int8_t commands[8];
202 int8_t actions[8];
203 } IRDB_FLASHINFO;
206 typedef struct {
207 uint8_t netcommand;
208 uint8_t mode;
209 uint16_t timeout;
210 int32_t adress;
211 int32_t protocol_version;
212 uint8_t len;
213 uint8_t align;
214 uint16_t align2;
215 uint8_t data[256];
216 } SERCOMMAND;
219 typedef struct {
220 uint8_t netcommand;
221 uint8_t mode;
222 uint16_t timeout;
223 int32_t adress;
224 int32_t protocol_version;
225 uint16_t ccf_data[256];
226 } CCFCOMMAND;
228 typedef struct {
229 uint8_t netcommand;
230 uint8_t mode;
231 uint16_t timeout;
232 int32_t adress;
233 int32_t protocol_version;
234 uint16_t ccf_data[450];
235 } LONGCCFCOMMAND;
238 typedef struct {
239 uint8_t netcommand;
240 uint8_t mode;
241 uint16_t timeout;
242 int32_t adress;
243 int32_t protocol_version;
244 char ccf_data[1100];
245 byte repeatmode;
246 } CCFSTRINGCOMMAND;
248 typedef struct {
249 uint8_t netcommand;
250 uint8_t mode;
251 uint16_t timeout;
252 int32_t adress;
253 int32_t protocol_version;
254 char ccf_data[980];
255 byte repeatmode;
256 } CCFSTRINGCOMMAND_SHORT;
259 typedef struct {
260 uint8_t netcommand;
261 uint8_t mode;
262 uint8_t lcdcommand;
263 uint8_t timeout;
264 int32_t adress;
265 int32_t protocol_version;
266 uint8_t wid;
267 uint8_t hgt;
268 int8_t framebuffer[200];
269 } LCDCOMMAND;
272 typedef struct {
273 uint8_t netcommand;
274 uint8_t mode;
275 uint16_t timeout;
276 int32_t adress;
277 int32_t protocol_version;
278 int32_t number;
279 uint8_t setup;
280 uint8_t type;
281 uint8_t accelerator_timeout;
282 uint8_t accelerator_repeat;
283 uint16_t wait_timeout;
284 uint8_t remote_num;
285 uint8_t group_num;
286 int8_t remote[80];
287 int8_t command[20];
288 int32_t source_mask;
289 int32_t target_mask;
290 uint8_t multi_num;
291 uint8_t include_names;
292 uint8_t dummy[2];
293 } TRANSLATECOMMAND;
296 typedef struct {
297 int32_t send_mask;
298 uint8_t device_mode;
299 uint8_t extended_mode;
300 uint8_t extended_mode2;
301 uint8_t align;
302 uint16_t switch_mode;
303 uint16_t align2;
304 uint32_t features;
305 uint16_t align3;
306 int8_t version[10];
307 int8_t remote[80];
308 int8_t command[20];
309 } MODELINE;
311 typedef struct {
312 int32_t send_mask;
313 uint8_t device_mode;
314 uint8_t extended_mode;
315 uint8_t extended_mode2;
316 uint8_t align;
317 uint16_t switch_mode;
318 uint16_t switch_mode2;
319 uint32_t features;
320 uint8_t extended_mode3;
321 uint8_t extended_mode4;
322 int8_t version[10];
323 int8_t remote[80];
324 int8_t command[20];
325 int8_t remote2[80];
326 int8_t command2[20];
327 } MODELINEN;
329 typedef struct {
330 uint32_t clientid;
331 int16_t statuslen;
332 int16_t statustype;
333 int16_t adress;
334 uint8_t align[2];
335 int8_t data[32768];
336 } STATUSBUFFER;
338 typedef struct {
339 uint32_t clientid;
340 int16_t statuslen;
341 int16_t statustype;
342 int16_t adress;
343 uint8_t align[2];
344 int8_t data[256];
345 } DATABUFFER;
347 typedef struct {
348 uint32_t clientid;
349 int16_t statuslen;
350 int16_t statustype;
351 int32_t serno;
352 int32_t functions;
353 } FUNCTIONBUFFER;
355 typedef struct {
356 uint32_t clientid;
357 int16_t statuslen;
358 int16_t statustype;
359 ANALOG_INPUTS inputs;
360 } ANALOGBUFFER;
362 typedef struct {
363 uint32_t clientid;
364 int16_t statuslen;
365 int16_t statustype;
366 int32_t serno;
367 int32_t functions;
368 int8_t version[8];
369 } FUNCTIONBUFFEREX;
372 typedef struct {
373 uint32_t target_mask;
374 uint32_t source_mask;
375 int8_t name[80];
376 } REMOTELINE;
379 typedef struct {
380 uint32_t clientid;
381 int16_t statuslen;
382 int16_t statustype;
383 int16_t offset;
384 int16_t count_buffer;
385 int16_t count_total;
386 int16_t count_remaining;
387 REMOTELINE remotes[40];
388 } REMOTEBUFFER;
390 typedef struct {
391 uint32_t clientid;
392 int16_t statuslen;
393 int16_t statustype;
394 int16_t offset;
395 int16_t count_buffer;
396 int16_t count_total;
397 int16_t count_remaining;
398 int8_t commands[200][20];
399 } COMMANDBUFFER;
401 typedef struct {
402 uint32_t clientid;
403 int16_t statuslen;
404 int16_t statustype;
405 int16_t offset;
406 int16_t count_buffer;
407 int16_t count_total;
408 int16_t count_remaining;
409 TRANSLATECOMMAND trdata[30];
410 } TRANSLATEBUFFER;
413 typedef struct {
414 uint8_t netcommand;
415 uint8_t mode;
416 uint16_t timeout;
417 int32_t adress;
418 int32_t protocol_version;
419 int32_t number;
420 uint8_t relais;
421 uint8_t type;
422 uint8_t action_type;
423 uint8_t action_len;
424 int32_t remote_num;
425 int32_t command_num;
426 uint32_t ip;
427 uint16_t port;
428 uint16_t align;
429 int8_t remote[80];
430 int8_t command[20];
431 uint8_t action[256];
432 } IRDBCOMMAND;
434 typedef struct {
435 uint8_t netcommand;
436 uint8_t mode;
437 uint16_t timeout;
438 int32_t adress;
439 int32_t protocol_version;
440 int32_t number;
441 uint8_t active;
442 uint8_t type;
443 uint8_t dummy[2];
444 uint8_t default_action[100];
445 uint8_t err_status[20];
446 uint8_t ok_status[20];
447 uint8_t inputmode[4];
448 uint8_t min[4];
449 uint8_t max[4];
450 uint8_t hyst[4];
451 uint8_t minledsel[4];
452 uint8_t maxledsel[4];
453 int32_t minmask[4];
454 int32_t maxmask[4];
455 int8_t minremote[4][80];
456 int8_t mincommand[4][50];
457 int8_t maxremote[4][80];
458 int8_t maxcommand[4][50];
459 } IRDBHEADER;
463 typedef struct {
464 uint32_t clientid;
465 int16_t statuslen;
466 int16_t statustype;
467 int16_t offset;
468 int16_t count_buffer;
469 int16_t count_total;
470 int16_t count_remaining;
471 IRDBCOMMAND dbdata[12];
472 } IRDBBUFFER;
474 typedef struct {
475 uint32_t clientid;
476 int16_t statuslen;
477 int16_t statustype;
478 int16_t offset;
479 int16_t count_buffer;
480 int16_t count_total;
481 int16_t count_remaining;
482 IRDBHEADER header;
483 } IRDBHEADERBUFFER;
485 typedef struct {
486 uint32_t clientid;
487 int16_t statuslen;
488 int16_t statustype;
489 int16_t adress;
490 uint8_t align[2];
491 MODELINE stat[16];
492 } NETWORKMODE;
494 typedef struct {
495 uint32_t clientid;
496 int16_t statuslen;
497 int16_t statustype;
498 int16_t adress;
499 uint8_t align;
500 uint8_t count;
501 uint8_t dev_adr[8];
502 MODELINE stat[8][16];
503 } NETWORKMODEEX;
505 typedef struct {
506 uint32_t clientid;
507 int16_t statuslen;
508 int16_t statustype;
509 int16_t adress;
510 uint8_t offset;
511 uint8_t count;
512 uint8_t dev_adr[8];
513 MODELINEN stat[8][16];
514 } NETWORKMODEEXN;
516 typedef struct {
517 uint32_t clientid;
518 int16_t statuslen;
519 int16_t statustype;
520 int16_t adress;
521 uint16_t netstatus;
522 uint16_t statuslevel;
523 uint8_t align[2];
524 int8_t message[256];
525 } NETWORKSTATUS;
527 typedef struct {
528 uint32_t clientid;
529 int16_t statuslen;
530 int16_t statustype;
531 int16_t adress;
532 uint16_t netstatus;
533 uint16_t statuslevel;
534 uint8_t align;
535 uint8_t virtual_col;
536 uint8_t numcol;
537 uint8_t numrows;
538 uint8_t clockflag;
539 } NETWORKLCDSTAT;
541 typedef struct {
542 uint32_t clientid;
543 int16_t statuslen;
544 int16_t statustype;
545 int16_t adress;
546 uint8_t align[2];
547 TIMINGDATA timing;
548 } NETWORKTIMING;
550 typedef struct {
551 uint32_t clientid;
552 int16_t statuslen;
553 int16_t statustype;
554 int16_t adress;
555 uint16_t command_num;
556 int8_t remote[80];
557 int8_t command[20];
558 int8_t data[200];
559 } NETWORKRECV;
562 typedef struct {
563 uint32_t clientid;
564 int16_t statuslen;
565 int16_t statustype;
566 int16_t adress;
567 int16_t learnok;
568 int8_t remote[80];
569 int16_t num_timings;
570 int16_t num_commands;
571 int8_t received[CODE_LEN];
572 } NETWORKLEARNSTAT;
575 typedef struct {
576 SOCKET fd;
577 int32_t type;
578 int32_t mode;
579 uint32_t clientid;
580 uint32_t callno;
581 int8_t ip[20];
582 WSAEVENT event;
583 FILE *fp;
584 char filename[84];
585 int32_t timing;
586 uint8_t resend_load;
587 IRDATA ird;
588 NETWORKLEARNSTAT learnstatus;
589 int8_t restdata[sizeof (LCDCOMMAND)];
590 int32_t restlen;
591 int32_t restread;
592 } NETWORKCLIENT;
595 #define MODE_ASCII 1
598 #define TCP_PORT 21000
599 #define IRTRANS_PORT 21000
600 #define LIRC_PORT 8765
601 #define UDP_PORT 21000
602 #define WEB_PORT 80
603 #define ALTERNATE_WEB 8080
604 #define XAP_PORT 3639
607 #ifdef WIN32
608 #define CLIENT_COUNT MAXIMUM_WAIT_OBJECTS - 3
609 #endif
611 #ifdef LINUX
612 #define CLIENT_COUNT 64
613 #endif