SysIo  1.9.0
Embedded Library and tools

Detailed Description

Ce module fournit les fonctions permettant de transmettre des informations sur des liaisons Ax25.

Collaboration diagram for Liaisons Ax25:

Modules

 Contrôleur de noeud terminal Ax25
 
 Interface C++
 

Classes

struct  xAx25
 
struct  xAx25Frame
 
struct  xAx25Node
 

Macros

#define AX25_CALL_LEN   6
 
#define AX25_CTRL_UI   0x03
 
#define AX25_FRAME_BUF_LEN   ((AX25_CALL_LEN+1)*(2+AX25_MAX_RPT)+AX25_INFO_LEN+4)
 
#define AX25_INFO_LEN   256
 
#define AX25_MAX_RPT   8
 
#define AX25_PID_NOLAYER3   0xF0
 

HDLC flags.

These should be moved in a separated HDLC related file one day...

enum  eAx25Error {
  AX25_SUCCESS = 0, AX25_FILE_ACCESS_ERROR = -1, AX25_ILLEGAL_CALLSIGN = -2, AX25_INVALID_FRAME = -3,
  AX25_CRC_ERROR = -4, AX25_NOT_ENOUGH_MEMORY = -5, AX25_NOT_ENOUGH_REPEATER = -6, AX25_OBJECT_NOT_FOUND = -7,
  AX25_FILE_NOT_FOUND = -8, AX25_ILLEGAL_REPEATER = -9, AX25_NO_FRAME_RECEIVED = -10
}
 
typedef struct xAx25Node xAx25Node
 
typedef struct xAx25Frame xAx25Frame
 
typedef struct xAx25 xAx25
 
xAx25NodexAx25NodeNew (void)
 
void vAx25NodeDelete (xAx25Node *n)
 
int iAx25NodeClear (xAx25Node *n)
 
int iAx25NodeSetCallsign (xAx25Node *n, const char *callsign)
 
char * xAx25NodeToStr (const xAx25Node *p)
 
int iAx25NodePrint (const xAx25Node *n)
 
int iAx25NodeFilePrint (const xAx25Node *n, FILE *f)
 
xAx25FramexAx25FrameNew (void)
 
void vAx25FrameDelete (xAx25Frame *frame)
 
int iAx25FrameClear (xAx25Frame *frame)
 
int iAx25FrameSetSrc (xAx25Frame *frame, const char *callsign, uint8_t ssid)
 
int iAx25FrameSetDst (xAx25Frame *frame, const char *callsign, uint8_t ssid)
 
int iAx25FrameAddRepeater (xAx25Frame *frame, const char *callsign, uint8_t ssid)
 
int iAx25FrameSetRepeaterFlag (xAx25Frame *frame, uint8_t index, bool flag)
 
int iAx25FrameSetInfo (xAx25Frame *frame, const void *info, size_t info_len)
 
char * xAx25FrameToStr (const xAx25Frame *frame)
 
int iAx25FrameFilePrint (const xAx25Frame *frame, FILE *f)
 
int iAx25FramePrint (const xAx25Frame *frame)
 
xAx25xAx25New (void)
 
void vAx25Delete (xAx25 *p)
 
int iAx25Clear (xAx25 *p)
 
int iAx25SetFdin (xAx25 *p, int fdin)
 
int iAx25SetFdout (xAx25 *p, int fdout)
 
bool bAx25Poll (xAx25 *ax25)
 
int iAx25Send (xAx25 *ax25, const xAx25Frame *frame)
 
int iAx25Read (xAx25 *ax25, xAx25Frame *frame)
 
int iAx25Error (xAx25 *ax25)
 
#define HDLC_FLAG   0x7E
 
#define HDLC_RESET   0x7F
 
#define AX25_ESC   0x1B
 

Macro Definition Documentation

#define AX25_CALL_LEN   6

#include <ax25.h>

Maximum number of characters in a AX25 callsign.

Definition at line 40 of file ax25.h.

#define AX25_CTRL_UI   0x03

#include <ax25.h>

Control field: UI This is the only value used in this lib so it is not possible to manage frames of another type.

Definition at line 57 of file ax25.h.

#define AX25_FRAME_BUF_LEN   ((AX25_CALL_LEN+1)*(2+AX25_MAX_RPT)+AX25_INFO_LEN+4)

#include <ax25.h>

AX25 frame lenght without leading and trailling flags.

Definition at line 50 of file ax25.h.

#define AX25_INFO_LEN   256

#include <ax25.h>

Maximum number of bytes in a AX25 info field.

Definition at line 45 of file ax25.h.

#define AX25_MAX_RPT   8

#include <ax25.h>

Maximum number of Repeaters in a AX25 message.

Definition at line 35 of file ax25.h.

#define AX25_PID_NOLAYER3   0xF0

#include <ax25.h>

Protocol ID: No layer 3 protocol This is the only value used in this lib so it is not possible to manage frames of another type.

Definition at line 64 of file ax25.h.

Typedef Documentation

typedef struct xAx25 xAx25

#include <ax25.h>

AX25 Controller Class

typedef struct xAx25Frame xAx25Frame

#include <ax25.h>

AX25 Frame Class Used to handle AX25 sent/received messages.

typedef struct xAx25Node xAx25Node

#include <ax25.h>

AX25 Node Class

Enumeration Type Documentation

enum eAx25Error

#include <ax25.h>

List of error codes returned by the functions.

Definition at line 78 of file ax25.h.

78  {
79 
80  AX25_SUCCESS = 0,
81  AX25_FILE_ACCESS_ERROR = -1,
82  AX25_ILLEGAL_CALLSIGN = -2,
83  AX25_INVALID_FRAME = -3,
84  AX25_CRC_ERROR = -4,
85  AX25_NOT_ENOUGH_MEMORY = -5,
86  AX25_NOT_ENOUGH_REPEATER = -6,
87  AX25_OBJECT_NOT_FOUND = -7,
88  AX25_FILE_NOT_FOUND = -8,
89  AX25_ILLEGAL_REPEATER = -9,
90  AX25_NO_FRAME_RECEIVED = -10
91 
92 } eAx25Error;
eAx25Error
Definition: ax25.h:78

Function Documentation

bool bAx25Poll ( xAx25 ax25)

#include <ax25.h>

Check if there are any AX25 messages to be processed. This function read available characters from the medium and search for any AX25 messages. If a message is found, this function return true and the message can be read with iAx25Read(). This function may be blocking if there are no available chars and the FILE used in ax25 to access the medium is configured in blocking mode.

Parameters
ax25AX25 object to operate on.
Returns
true if , negative value on error
int iAx25Clear ( xAx25 p)

#include <ax25.h>

Clear all fields of the object

Returns
AX25_SUCCESS, negative value on error
int iAx25Error ( xAx25 ax25)

#include <ax25.h>

Retruns the last error code.

int iAx25FrameAddRepeater ( xAx25Frame frame,
const char *  callsign,
uint8_t  ssid 
)

#include <ax25.h>

Adds a repeater to the frame

Parameters
frameAX25 frame object to operate on.
callsignCall string, max 6 character
SSID(secondary station ID) for the call
Returns
Index of the new repeater (0 to AX25_MAX_RPT-1), negative value on error
int iAx25FrameClear ( xAx25Frame frame)

#include <ax25.h>

Clear the frame

src and dst are cleared with iAx25NodeClear() All the repeaters are removed. The ctrl is set to AX25_CTRL_UI, the pid to AX25_PID_NOLAYER3.

Returns
AX25_SUCCESS, negative value on error
int iAx25FrameFilePrint ( const xAx25Frame frame,
FILE *  f 
)

#include <ax25.h>

Print a AX25 message in TNC-2 packet monitor format in a file

Parameters
fa file channel where the message will be printed.
framethe message to be printed.
int iAx25FramePrint ( const xAx25Frame frame)

#include <ax25.h>

Print a AX25 message in TNC-2 packet monitor format.

Parameters
framethe message to be printed.
int iAx25FrameSetDst ( xAx25Frame frame,
const char *  callsign,
uint8_t  ssid 
)

#include <ax25.h>

Sets the destination address of frame

Parameters
frameAX25 frame object to operate on.
callsignCall string, max 6 character
SSID(secondary station ID) for the call
Returns
AX25_SUCCESS, negative value on error
int iAx25FrameSetInfo ( xAx25Frame frame,
const void *  info,
size_t  info_len 
)

#include <ax25.h>

Sets the info field of frame

Parameters
frameAX25 frame object to operate on.
callsignCall string, max 6 character
SSID(secondary station ID) for the call
Returns
AX25_SUCCESS, negative value on error
int iAx25FrameSetRepeaterFlag ( xAx25Frame frame,
uint8_t  index,
bool  flag 
)

#include <ax25.h>

Sets the repeater flag

Parameters
frameAX25 frame object to operate on.
indexindex of repeater
flagnew flag value
Returns
AX25_SUCCESS, negative value on error
int iAx25FrameSetSrc ( xAx25Frame frame,
const char *  callsign,
uint8_t  ssid 
)

#include <ax25.h>

Sets the source address of frame

Parameters
frameAX25 frame object to operate on.
callsignCall string, max 6 character
SSID(secondary station ID) for the call
Returns
AX25_SUCCESS, negative value on error
int iAx25NodeClear ( xAx25Node n)

#include <ax25.h>

Initialize all fields of the node

Parameters
nnode object to operate on.
Returns
AX25_SUCCESS, negative value on error
int iAx25NodeFilePrint ( const xAx25Node n,
FILE *  f 
)

#include <ax25.h>

Print the node in the file

Parameters
nnode object to operate on.
Returns
AX25_SUCCESS, negative value on error
int iAx25NodePrint ( const xAx25Node n)

#include <ax25.h>

Print the node

Parameters
nnode object to operate on.
Returns
AX25_SUCCESS, negative value on error
int iAx25NodeSetCallsign ( xAx25Node n,
const char *  callsign 
)

#include <ax25.h>

Sets callsign of the node

Parameters
nnode object to operate on.
callsignthe new callsign (only the first 6 characters will be stored)
Returns
AX25_SUCCESS, negative value on error
int iAx25Read ( xAx25 ax25,
xAx25Frame frame 
)

#include <ax25.h>

Read the last AX25 frame received on the channel.

Parameters
ax25AX25 object to operate on.
framecopy of the last received message
Returns
AX25_SUCCESS, negative value on error
int iAx25Send ( xAx25 ax25,
const xAx25Frame frame 
)

#include <ax25.h>

Send an AX25 frame on the channel through a specific frame.

Parameters
ax25AX25 object to operate on.
framemassage to send
Returns
AX25_SUCCESS, negative value on error
int iAx25SetFdin ( xAx25 p,
int  fdin 
)

#include <ax25.h>

Sets the file descriptor used to gain access to the physical medium in input

Parameters
fdinfile descriptor
Returns
xAx25 initialized object, NULL if error.
int iAx25SetFdout ( xAx25 p,
int  fdout 
)

#include <ax25.h>

Sets the file descriptor used to gain access to the physical medium in output

Parameters
fdoutfile descriptor
Returns
xAx25 initialized object, NULL if error.
void vAx25Delete ( xAx25 p)

#include <ax25.h>

Delete a xAx25 object

Parameters
pobject to operate on.
void vAx25FrameDelete ( xAx25Frame frame)

#include <ax25.h>

Delete a xAx25Node object

Parameters
nnode object to operate on.
void vAx25NodeDelete ( xAx25Node n)

#include <ax25.h>

Delete a xAx25Node object

Parameters
nnode object to operate on.
xAx25Frame* xAx25FrameNew ( void  )

#include <ax25.h>

Create and initialize a new xAx25Frame object

This object should be deleted with vAx25FrameDelete()

Returns
pointer on the object, NULL on error
char* xAx25FrameToStr ( const xAx25Frame frame)

#include <ax25.h>

Convert a frame to a string for display

Parameters
frameAX25 frame object to operate on.
Returns
The characters string should be deleted with free();
xAx25* xAx25New ( void  )

#include <ax25.h>

Create and initialize a new xAx25 object

This object should be deleted with vAx25Delete()

Returns
pointer on the object, NULL on error
xAx25Node* xAx25NodeNew ( void  )

#include <ax25.h>

Create and initialize a new xAx25Node object

This object should be deleted with vAx25NodeDelete()

Returns
pointer on the object, NULL on error
char* xAx25NodeToStr ( const xAx25Node p)

#include <ax25.h>

Convert a node to a string for display

The format is AAAAAA-S* where AAAAAA is the callsign, S the ssid if no null and * is the has-been-repeated inficator.

Parameters
nnode object to operate on.
Returns
The characters string should be deleted with free();