Debian Codegraph @

netax25/ax25io.h

raw
1 /* AX25IO - Library for io manuipulation for AX.25 programs
2 * Copyright (C) 1998 Tomi Manninen
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see
16 * <https://www.gnu.org/licenses/>.
17 */
18 #ifndef _AX25IO_H
19 #define _AX25IO_H
20
21 #define AXBUFLEN 4096
22
23 typedef struct ax25io_s {
24 int ifd; /* stdin socket index */
25 int ofd; /* stdout socket index */
26 char eol[4]; /* end-of-line sequence */
27 int eolmode; /* end-of-line translation on/off */
28 int telnetmode; /* telnet option negotiation on/off */
29 int tn_echo; /* will/wont echo */
30 int tn_linemode; /* will/wont linemode */
31 int size; /* size of the packet in input buffer */
32 int paclen; /* paclen */
33 unsigned char ibuf[AXBUFLEN]; /* input buffer */
34 unsigned char obuf[AXBUFLEN]; /* output buffer */
35 unsigned char gbuf[AXBUFLEN]; /* getline buffer */
36 int gbuf_usage; /* getline buffer usage */
37 int iptr; /* input pointer */
38 int optr; /* output pointer */
39 void *zptr; /* pointer to the compression struct */
40
41 struct ax25io_s *next; /* linked list pointer */
42 } ax25io;
43
44 #define EOLMODE_TEXT 0
45 #define EOLMODE_BINARY 1
46 #define EOLMODE_GW 2
47
48 #define AX25_EOL "\r"
49 #define NETROM_EOL AX25_EOL
50 #define ROSE_EOL AX25_EOL
51 #define INET_EOL "\r\n"
52 #define UNSPEC_EOL "\n"
53 #define INTERNAL_EOL 021271
54
55 #define ZERR_STREAM_END 1024
56 #define ZERR_STREAM_ERROR 1025
57 #define ZERR_DATA_ERROR 1026
58 #define ZERR_MEM_ERROR 1027
59 #define ZERR_BUF_ERROR 1028
60 #define ZERR_UNKNOWN 1029
61
62 extern ax25io *axio_init(int, int, int, char *);
63 extern void axio_end(ax25io *);
64 extern void axio_end_all(void);
65
66 extern int axio_compr(ax25io *, int);
67 extern int axio_paclen(ax25io *, int);
68 extern int axio_eolmode(ax25io *, int);
69 extern int axio_cmpeol(ax25io *, ax25io *);
70 extern int axio_tnmode(ax25io *, int);
71 extern int axio_flush(ax25io *);
72
73 extern int axio_getc(ax25io *);
74 extern int axio_putc(int, ax25io *);
75
76 extern char *axio_getline(ax25io *);
77 extern int axio_gets(char *, int, ax25io *);
78 extern int axio_puts(const char *, ax25io *);
79
80 extern int axio_printf(ax25io *, const char *, ...);
81
82 extern int axio_tn_do_linemode(ax25io *);
83 extern int axio_tn_will_echo(ax25io *);
84 extern int axio_tn_wont_echo(ax25io *);
85
86 #endif /* _AX25IO_H */