summaryrefslogtreecommitdiffstats
path: root/axlib.h
blob: 1164059e1bc3b193fce167436a77da6b97d57003 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* LIBAX25 - Library for AX.25 programs
 * Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat
 * and Alan Cox.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
/*
 * Callsign conversion functions, converts callsigns into network bit
 * shifted format and vica versa.
 */
 
#ifndef _AXLIB_H
#define	_AXLIB_H

#include <netax25/ax25.h>
#include <netrose/rose.h>

#ifndef	TRUE
#define	TRUE	1
#endif

#ifndef	FALSE
#define	FALSE	0
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Libax25 version.
 */
extern char libax25_version[];

/*
 * The special "null" address, used as the default callsign in routing and
 * in other places.
 */
extern ax25_address null_ax25_address;

/*
 * This function converts an ASCII representation of a callsign into network
 * format. It returns -1 on error, 0 otherwise.
 */
extern int ax25_aton_entry(const char *, char *);

/*
 * This converts a string with optional digipeaters into a structure understood
 * by the kernel code.
 *
 * The string should be in the format:
 *
 * callsign [[V | VIA] callsign ...]
 *
 * On error a -1 is returned, otherwise the length of the structure is returned.
 */
extern int ax25_aton(const char *, struct full_sockaddr_ax25 *);

/*
 * Similar to convert_call above except the callsign(s) are not held in a
 * string but in a NULL terminated array of pointers to the strings.
 * On error a -1 is returned, otherwise the length of the structure is returned.
 */
extern int ax25_aton_arglist(const char ** , struct full_sockaddr_ax25 *);

/*
 * This function converts an ASCII representation of a Rose address into
 * network format. It returns -1 on error, 0 otherwise. The address must be
 * ten numbers long.
 */
extern int rose_aton(const char *, char *);

/*
 * This function returns the textual representation of a callsign in
 * network format. The data returned is in a statically allocated area, and
 * subsequent calls will destroy previous callsigns returned.
 */
extern char *ax25_ntoa(const ax25_address *);

/*
 * This function returns the textual representation of a Rose address in
 * network format. The data returned is in a statically allocated area, and
 * subsequent calls will destroy previous callsigns returned.
 */
extern char *rose_ntoa(const rose_address *);

/*
 * Compares two AX.25 callsigns in network format. Returns a 0 if they are
 * identical, 1 if they differ, or 2 if only the SSIDs differ.
 */
extern int ax25_cmp(const ax25_address *, const ax25_address *);

/*
 * Compares two Rose addresses in network format. Returns a 0 if they are
 * identical, 1 if they differ.
 */
extern int rose_cmp(const rose_address *, const rose_address *);

/*
 * Validates an AX.25 callsign, returns TRUE if it is valid, or FALSE if it
 * is not. The callsign should be AX.25 shifted format.
 */
extern int ax25_validate(const char *);

/*
 * Converts the giver string to upper case. It returns a pointer to the
 * original string.
 */
extern char *strupr(char *);

/*
 * Converts the giver string to lower case. It returns a pointer to the
 * original string.
 */
extern char *strlwr(char *);


#ifdef __cplusplus
}
#endif

#endif