-
Notifications
You must be signed in to change notification settings - Fork 0
/
irlmp.h
175 lines (143 loc) · 6.04 KB
/
irlmp.h
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
Copyright (C) 2002-2003 Gerd Rausch, BlauLogic (http://blaulogic.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Except as contained in this notice, neither the name of BlauLogic
nor the name(s) of the author(s) may be used to endorse or promote
products derived from this software without specific prior written
permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR(S) OR BLAULOGIC BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (C) 2006-2007 Mathieu Albinet, [email protected]
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
o Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
o Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
o The names of the authors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* 19-02-07 MA Added IrIAP definitions */
/* 19-02-07 MA Changed IrIAS node structure */
/* 19-02-07 MA Changed irlmp2_handle_ctl_frame call*/
#ifndef _IRLMP_H
#define _IRLMP_H
#include <inttypes.h>
#include "irlap.h"
#define IRLMP_HINT0_PNP 0x01
#define IRLMP_HINT0_PDA 0x02
#define IRLMP_HINT0_COMPUTER 0x04
#define IRLMP_HINT0_PRINTER 0x08
#define IRLMP_HINT0_MODEM 0x10
#define IRLMP_HINT0_FAX 0x20
#define IRLMP_HINT0_LAN 0x40
#define IRLMP_HINT0_EXTENSION 0x80
#define IRLMP_HINT1_TELEPHONY 0x01
#define IRLMP_HINT1_FILE_SERVER 0x02
#define IRLMP_HINT1_COMM 0x04
#define IRLMP_HINT1_MESSAGE 0x08
#define IRLMP_HINT1_HTTP 0x10
#define IRLMP_HINT1_OBEX 0x20
#define IRLMP_HINT1_EXTENSION 0x80
#define IRLMP_CHARSET_ASCII 0x00
#define IRLMP_CHARSET_ISO8859_1 0x01
#define IRLMP_CHARSET_ISO8859_2 0x02
#define IRLMP_CHARSET_ISO8859_3 0x03
#define IRLMP_CHARSET_ISO8859_4 0x04
#define IRLMP_CHARSET_ISO8859_5 0x05
#define IRLMP_CHARSET_ISO8859_6 0x06
#define IRLMP_CHARSET_ISO8859_7 0x07
#define IRLMP_CHARSET_ISO8859_8 0x08
#define IRLMP_CHARSET_ISO8859_9 0x09
#define IRLMP_CHARSET_UNICODE 0xFF
#define IRLMP_DLSAP_C_MASK 0x80
#define IRLMP_OP_A_MASK 0x80
#define IRLMP_OP_CONNECT 0x01
#define IRLMP_OP_DISCONNECT 0x02
#define IRLMP_OP_ACCESS_MODE 0x03
#define IRIAP_CTL_LST_MASK 0x80
#define IRIAP_CTL_ACK_MASK 0x40
#define IRLMP_OP_LM_GETINFOBASEDETAILS 0x01
#define IRLMP_OP_LM_GETOBJECTS 0x02
#define IRLMP_OP_LM_GETVALUE 0x03
#define IRLMP_OP_LM_GETVALUEBYCLASS 0x04
#define IRLMP_OP_LM_GETOBJECTINFO 0x05
#define IRLMP_OP_LM_GETATTRIBUTENAMES 0x06
#define IRLMP_RESP_UNSUPPORTED 0xFF
#define IRIAP_RESP_GVBCL_SUCCESS 0x00
#define IRIAP_RESP_GVBCL_NOSUCHCLASS 0x01
#define IRIAP_RESP_GVBCL_NOSUCHATTR 0x02
#define IRIAP_VALUE_TYPE_MISSING 0x00
#define IRIAP_VALUE_TYPE_INTEGER 0x01
#define IRIAP_VALUE_TYPE_OCTET_SEQUENCE 0x02
#define IRIAP_VALUE_TYPE_USER_STRING 0x03
#define IRIAP_USER_STRING_MAX_LENGTH 255
typedef struct IrIAS_Node {
char *class_name;
char *attr_name;
uint8_t value_type;
uint16_t obj_id;
uint16_t integer;
uint8_t *name;
} IrIAS_Node;
typedef struct IrLMP_Head {
IrLAP_Head irlap;
uint8_t dlsap_sel;
uint8_t slsap_sel;
} IrLMP_Head;
typedef struct IrLMP_Ctl {
uint8_t opcode;
uint8_t info[0];
} IrLMP_Ctl;
typedef struct IrLMP_Frame {
IrLMP_Head head;
union {
IrLMP_Ctl ctl;
uint8_t info[0];
} u;
} IrLMP_Frame;
uint16_t irlmp_get_dev_info(uint8_t *dev_info_p, uint8_t service_hint1);
uint8_t irlmp1_connect(IrLAP_Context *context_p, IrLAP_Frame *resp_p,
IrLAP_Device_Addr addr_p,
uint8_t service_hint1,
char *ias_class_name, char *ias_lsap_name,
uint8_t slsap_sel, uint8_t *dlsap_sel_p);
int16_t irlmp1_send_receive_i_frame(IrLAP_Context *context_p,
IrLMP_Frame *req_p, uint16_t req_size,
uint8_t slsap_sel, uint8_t dlsap_sel,
IrLAP_Frame *resp_p);
void irlmp2_reply(IrLAP_Context *context_p, IrLMP_Frame *req_p, IrLMP_Frame *resp_p, uint16_t size);
void irlmp2_handle_ctl_frame(IrLAP_Context *context_p, IrLMP_Frame *req_p, int16_t info_size);
int16_t irlmp2_receive_frame(IrLAP_Context *context_p, IrLAP_Frame *frame_p,
IrLAP_Frame *last_resp_p, uint16_t last_resp_size,
uint8_t service_hint1,
IrIAS_Node **ias_nodes_p);
#endif /* _IRLMP_H */