File: kissdump.c

package info (click to toggle)
ax25-apps 0.0.8-rc4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,168 kB
  • sloc: sh: 11,124; ansic: 10,264; makefile: 287
file content (57 lines) | stat: -rw-r--r-- 1,196 bytes parent folder | download | duplicates (2)
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
/* Tracing routines for KISS TNC
 * Copyright 1991 Phil Karn, KA9Q
 */
#include <stdio.h>
#include "listen.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;
	}
}