summaryrefslogtreecommitdiff
path: root/include/hybbx/packet_radio.h
blob: 51f79a01439120bbea75c822dcea58709c8c3fd7 (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
#ifndef HYBBX_PACKET_RADIO_H
#define HYBBX_PACKET_RADIO_H

#include "hybbx/types.h"

#ifdef __cplusplus
extern "C" {
#endif

/** Default line speed for packet radio (2400 baud). */
#define HYBBX_PACKET_RADIO_DEFAULT_BAUD 2400

/** Default USB AX.25 TNC/modem device (Linux). */
#define HYBBX_PACKET_RADIO_DEFAULT_DEVICE_USB "/dev/ttyUSB0"

#if defined(_WIN32)
#define HYBBX_PACKET_RADIO_DEFAULT_DEVICE_SERIAL "COM1"
#elif defined(__AMIGA__)
#define HYBBX_PACKET_RADIO_DEFAULT_DEVICE_SERIAL "serial.device"
#else
#define HYBBX_PACKET_RADIO_DEFAULT_DEVICE_SERIAL "/dev/ttyS0"
#endif

typedef enum hybbx_packet_radio_device_type {
    HYBBX_PACKET_RADIO_DEVICE_USB = 1,
    HYBBX_PACKET_RADIO_DEVICE_SERIAL = 2
} hybbx_packet_radio_device_type_t;

struct hybbx_packet_radio_config;

/**
 * Parse a semicolon-separated key=value transport config string.
 * Missing keys receive HyBBX defaults (TNC2C, USB, KISS @ 2400 baud).
 * Full config type: include hybbx/tnc.h.
 */
hybbx_result_t hybbx_packet_radio_config_parse(const char *config,
                                               struct hybbx_packet_radio_config *out);

void hybbx_packet_radio_config_free(struct hybbx_packet_radio_config *config);

/**
 * Non-zero when @p config starts a local TNC (device/tnc/protocol/circuit_host).
 * Main bridge-registry rows (link_id only) return zero.
 */
int hybbx_packet_radio_section_is_local_edge(const char *config);

/**
 * Return non-zero when @p baud is valid for packet radio configuration.
 * HyBBX accepts any positive host baud rate; TNC2C documents 300..38400.
 */
int hybbx_packet_radio_baud_valid(unsigned int baud);

#ifdef __cplusplus
}
#endif

#endif /* HYBBX_PACKET_RADIO_H */
git clone -b <branch> https://cgit.mode42.com/<repo>.git
git clone -b <branch> git://cgit.mode42.com/<repo>.git

info@mode42.com