-
Notifications
You must be signed in to change notification settings - Fork 7
/
kissdump.c
61 lines (53 loc) · 1.23 KB
/
kissdump.c
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
/* Tracing routines for KISS TNC
* Copyright 1991 Phil Karn, KA9Q
* adapted for ldspe in 2006
by Lieven De Samblanx, ON7LDS.
*/
#include <stdio.h>
#include "utils.h"
#define PARAM_DATA 0
#define PARAM_TXDELAY 1
#define PARAM_PERSIST 2
#define PARAM_SLOTTIME 3
#define PARAM_TXTAIL 4
#define PARAM_FULLDUP 5
#define PARAM_HW 6
#define PARAM_RETURN 15 /* Should be 255, but is ANDed with 0x0F */
void ki_dump(unsigned char *data, int length, int hexdump)
{
int type;
int val;
type = data[0] & 0xf;
if (type == PARAM_DATA) {
ax25_dump(data + 1, length - 1, hexdump);
return;
}
val = data[1];
switch (type) {
case PARAM_TXDELAY:
lprintf(T_KISS, "TX Delay: %lu ms\n", val * 10L);
break;
case PARAM_PERSIST:
lprintf(T_KISS, "Persistence: %u/256\n", val + 1);
break;
case PARAM_SLOTTIME:
lprintf(T_KISS, "Slot time: %lu ms\n", val * 10L);
break;
case PARAM_TXTAIL:
lprintf(T_KISS, "TX Tail time: %lu ms\n", val * 10L);
break;
case PARAM_FULLDUP:
lprintf(T_KISS, "Duplex: %s\n",
val == 0 ? "Half" : "Full");
break;
case PARAM_HW:
lprintf(T_KISS, "Hardware %u\n", val);
break;
case PARAM_RETURN:
lprintf(T_KISS, "RETURN\n");
break;
default:
lprintf(T_KISS, "code %u arg %u\n", type, val);
break;
}
}