1
/*********************************************************************
6
* Status: Experimental.
7
* Author: Dag Brattli <dagb@cs.uit.no>
8
* Created at: Sun Jun 6 13:40:30 1999
9
* Modified at: Fri Jun 11 10:47:08 1999
10
* Modified by: Dag Brattli <dagb@cs.uit.no>
12
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License as
16
* published by the Free Software Foundation; either version 2 of
17
* the License, or (at your option) any later version.
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29
********************************************************************/
35
static char *ircomm_service_type[] =
48
static char *ircomm_port_type[] =
55
static inline guint bytes_to_uint(unsigned char *buf)
58
ret = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
62
void parse_ircomm_params(guint8 clen, GNetBuf *buf, GString *str)
69
pi = buf->data[n] & 0x7f; /* Remove critical bit */
74
pv_byte = buf->data[n+2];
75
g_string_sprintfa(str, "Service Type=");
76
if (pv_byte & IRCOMM_CENTRONICS)
77
g_string_sprintfa(str, "CENTRONICS ");
78
if (pv_byte & IRCOMM_9_WIRE)
79
g_string_sprintfa(str, "NINE_WIRE ");
80
if (pv_byte & IRCOMM_3_WIRE)
81
g_string_sprintfa(str, "THREE_WIRE ");
82
if (pv_byte & IRCOMM_3_WIRE_RAW)
83
g_string_sprintfa(str, "THREE_WIRE_RAW ");
84
if (!(pv_byte & IRCOMM_VALID_SERVICES))
85
g_string_sprintfa(str, "N/A ");
88
pv_byte = buf->data[n+2];
89
g_string_sprintfa(str, "Port Type=");
90
if (pv_byte & IRCOMM_SERIAL)
91
g_string_sprintfa(str, "SERIAL ");
92
if (pv_byte & IRCOMM_PARALLEL)
93
g_string_sprintfa(str, "PARALLEL ");
94
if (!(pv_byte & IRCOMM_VALID_PORT_TYPES))
95
g_string_sprintfa(str, "N/A ");
98
pv_byte = bytes_to_uint(&(buf->data[n+2]));
99
g_string_sprintfa(str, "Data Rate=%d ", pv_byte);
102
g_string_sprintfa(str, "Data Format=%02x ",
106
g_string_sprintfa(str, "Flow Control=%02x ",
110
g_string_sprintfa(str, "XON/XOFF=%02x,%02x ",
111
buf->data[n+2], buf->data[n+3]);
114
g_string_sprintfa(str, "DTEline State=%02x ",
122
g_netbuf_pull(buf, clen);
125
void parse_ircomm_connect(GNetBuf *buf, GString *str)
127
parse_ircomm_ttp(buf, str);
130
void parse_ircomm_lmp(GNetBuf *buf, GString *str)
132
/* Kill "unused" warning */
135
g_string_append(str, "IrCOMM (IrLPT) ");
140
void parse_ircomm_ttp(GNetBuf *buf, GString *str)
145
/* Check for empty frames - Jean II */
146
len = g_netbuf_get_len(buf);
152
g_netbuf_pull(buf, 1);
155
g_string_append(str, "\n\tIrCOMM ");
156
parse_ircomm_params(clen, buf, str);
158
g_string_append(str, "IrCOMM ");