blob: 71a8c9d5174791a89c06206c12159132e3548756 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#ifndef _sia_h_
#define _sia_h_
#define SIA_TIMEOUT 3 // standard says 2.5s
#define SIA_FN_ACCOUNT_ID 0x23
#define SIA_FN_ORIGIN_ID 0x26
#define SIA_FN_END_OF_DATA 0x30
#define SIA_FN_WAIT 0x31
#define SIA_FN_ABORT 0x32
#define SIA_FN_RES_3 0x33
#define SIA_FN_RES_4 0x34
#define SIA_FN_RES_5 0x35
#define SIA_FN_ACK_AND_STANDBY 0x36
#define SIA_FN_ACK_AND_DISCONNECT 0x37
#define SIA_FN_ACKNOLEDGE 0x38
#define SIA_FN_ALT_ACKNOLEDGE 0x08 //JMM I can't imagine how someone made that mistake :)
#define SIA_FN_REJECT 0x39
#define SIA_FN_ALT_REJECT 0x09
#define SIA_FN_REMOTE_LOGIN 0x3f
#define SIA_FN_CONFIGURATION 0x40
#define SIA_FN_ASCII 0x41
#define SIA_FN_CONTROL 0x43
#define SIA_FN_ENVIRONMENTAL 0x45
#define SIA_FN_VIDEO 0x49
#define SIA_FN_LISTEN_IN 0x4c
#define SIA_FN_NEW_EVENT 0x4e
#define SIA_FN_OLD_EVENT 0x4f
#define SIA_FN_PROGRAM 0x50
#define SIA_FN_VCHN_REQUEST 0x56
#define SIA_FN_EXTENDED 0x58
#define SIA_FN_VCHN_FRAME 0x76
#define SIA_MAX_DATA_LENGTH 0x3f
#define SIA_MAX_BLOCK_LENGTH (2 + SIA_MAX_DATA_LENGTH + 1)
typedef union {
unsigned char block[SIA_MAX_BLOCK_LENGTH];
struct {
unsigned char length : 6;
unsigned char request_ack: 1;
unsigned char reverse_channel: 1;
unsigned char function;
unsigned char data[];
};
} SIA_Block;
/* sia.c */
extern int sia_fn_valid (SIA_Block *s);
extern int sia_fn_permits_ack (unsigned char fn);
extern unsigned int sia_data_length (SIA_Block *s);
extern unsigned int sia_length (SIA_Block *s);
extern int sia_parity_valid (SIA_Block *s);
extern void sia_set_parity (SIA_Block *s);
extern ssize_t sia_write (int fd, SIA_Block *s);
extern ssize_t sia_acknoledge (int fd);
extern int sia_ack_if_needed (int fd, SIA_Block *s);
extern int sia_parse (unsigned char *buf, unsigned len, SIA_Block *b);
extern int sia_rx_with_timeout (int fd, SIA_Block *b, int timeout);
extern int sia_rx_with_timeout_ignore_log (int fd, SIA_Block *b, int timeout);
extern int sia_login (int fd, SIA_Block *b);
#endif /* _sia_h_ */
|