| 1 |
/* LIBAX25 - Library for AX.25 programs |
| 2 |
* Copyright (C) 1997-1999 Jonathan Naylor, Tomi Manninen, Jean-Paul Roubelat |
| 3 |
* and Alan Cox. |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Library General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, see |
| 17 |
* <https://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
/* |
| 20 |
* Callsign conversion functions, converts callsigns into network bit |
| 21 |
* shifted format and vica versa. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef _AXLIB_H |
| 25 |
#define _AXLIB_H |
| 26 |
|
| 27 |
#include <netax25/ax25.h> |
| 28 |
#include <netrose/rose.h> |
| 29 |
|
| 30 |
#ifndef TRUE |
| 31 |
#define TRUE 1 |
| 32 |
#endif |
| 33 |
|
| 34 |
#ifndef FALSE |
| 35 |
#define FALSE 0 |
| 36 |
#endif |
| 37 |
|
| 38 |
#ifdef __cplusplus |
| 39 |
extern "C" { |
| 40 |
#endif |
| 41 |
|
| 42 |
/* |
| 43 |
* Libax25 version. |
| 44 |
*/ |
| 45 |
extern char libax25_version[]; |
| 46 |
|
| 47 |
/* |
| 48 |
* The special "null" address, used as the default callsign in routing and |
| 49 |
* in other places. |
| 50 |
*/ |
| 51 |
extern ax25_address null_ax25_address; |
| 52 |
|
| 53 |
/* |
| 54 |
* This function converts an ASCII representation of a callsign into network |
| 55 |
* format. It returns -1 on error, 0 otherwise. |
| 56 |
*/ |
| 57 |
extern int ax25_aton_entry(const char *, char *); |
| 58 |
|
| 59 |
/* |
| 60 |
* This converts a string with optional digipeaters into a structure understood |
| 61 |
* by the kernel code. |
| 62 |
* |
| 63 |
* The string should be in the format: |
| 64 |
* |
| 65 |
* callsign [[V | VIA] callsign ...] |
| 66 |
* |
| 67 |
* On error a -1 is returned, otherwise the length of the structure is returned. |
| 68 |
*/ |
| 69 |
extern int ax25_aton(const char *, struct full_sockaddr_ax25 *); |
| 70 |
|
| 71 |
/* |
| 72 |
* Similar to convert_call above except the callsign(s) are not held in a |
| 73 |
* string but in a NULL terminated array of pointers to the strings. |
| 74 |
* On error a -1 is returned, otherwise the length of the structure is returned. |
| 75 |
*/ |
| 76 |
extern int ax25_aton_arglist(const char ** , struct full_sockaddr_ax25 *); |
| 77 |
|
| 78 |
/* |
| 79 |
* This function converts an ASCII representation of a Rose address into |
| 80 |
* network format. It returns -1 on error, 0 otherwise. The address must be |
| 81 |
* ten numbers long. |
| 82 |
*/ |
| 83 |
extern int rose_aton(const char *, char *); |
| 84 |
|
| 85 |
/* |
| 86 |
* This function returns the textual representation of a callsign in |
| 87 |
* network format. The data returned is in a statically allocated area, and |
| 88 |
* subsequent calls will destroy previous callsigns returned. |
| 89 |
*/ |
| 90 |
extern char *ax25_ntoa(const ax25_address *); |
| 91 |
|
| 92 |
/* |
| 93 |
* This function returns the textual representation of a Rose address in |
| 94 |
* network format. The data returned is in a statically allocated area, and |
| 95 |
* subsequent calls will destroy previous callsigns returned. |
| 96 |
*/ |
| 97 |
extern char *rose_ntoa(const rose_address *); |
| 98 |
|
| 99 |
/* |
| 100 |
* Compares two AX.25 callsigns in network format. Returns a 0 if they are |
| 101 |
* identical, 1 if they differ, or 2 if only the SSIDs differ. |
| 102 |
*/ |
| 103 |
extern int ax25_cmp(const ax25_address *, const ax25_address *); |
| 104 |
|
| 105 |
/* |
| 106 |
* Compares two Rose addresses in network format. Returns a 0 if they are |
| 107 |
* identical, 1 if they differ. |
| 108 |
*/ |
| 109 |
extern int rose_cmp(const rose_address *, const rose_address *); |
| 110 |
|
| 111 |
/* |
| 112 |
* Validates an AX.25 callsign, returns TRUE if it is valid, or FALSE if it |
| 113 |
* is not. The callsign should be AX.25 shifted format. |
| 114 |
*/ |
| 115 |
extern int ax25_validate(const char *); |
| 116 |
|
| 117 |
/* |
| 118 |
* Converts the giver string to upper case. It returns a pointer to the |
| 119 |
* original string. |
| 120 |
*/ |
| 121 |
extern char *strupr(char *); |
| 122 |
|
| 123 |
/* |
| 124 |
* Converts the giver string to lower case. It returns a pointer to the |
| 125 |
* original string. |
| 126 |
*/ |
| 127 |
extern char *strlwr(char *); |
| 128 |
|
| 129 |
|
| 130 |
#ifdef __cplusplus |
| 131 |
} |
| 132 |
#endif |
| 133 |
|
| 134 |
#endif |