ax25.c File Reference

Simple AX25 data link layer implementation. More...

#include "ax25.h"
#include "cfg/cfg_ax25.h"
#include <cfg/compiler.h>
#include <kern/kfile.h>
#include <algo/crc_ccitt.h>
#include <cfg/log.h>
#include <string.h>
#include <ctype.h>

Go to the source code of this file.

Functions

void ax25_poll (AX25Ctx *ctx)
 Check if there are any AX25 messages to be processed.
void ax25_sendVia (AX25Ctx *ctx, const AX25Call *path, size_t path_len, const void *_buf, size_t len)
 Send an AX25 frame on the channel through a specific path.
void ax25_print (KFile *ch, const AX25Msg *msg)
 Print a AX25 message in TNC-2 packet monitor format.
void ax25_init (AX25Ctx *ctx, KFile *channel, ax25_callback_t hook)
 Init the AX25 protocol decoder.

Detailed Description

Simple AX25 data link layer implementation.

For now, only UI frames without any Layer 3 protocol are handled. This however is enough to send/receive APRS packets.

Author:
Francesco Sacchi <batt@develer.com>

Definition in file ax25.c.


Function Documentation

void ax25_init ( AX25Ctx ctx,
KFile channel,
ax25_callback_t  hook 
)

Init the AX25 protocol decoder.

Parameters:
ctx AX25 context to init.
channel Used to gain access to the physical medium
hook Callback function called when a message is received

Definition at line 299 of file ax25.c.

void ax25_poll ( AX25Ctx ctx  ) 

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 it is decoded and the linked callback executed. This function may be blocking if there are no available chars and the KFile used in ctx to access the medium is configured in blocking mode.

Parameters:
ctx AX25 context to operate on.

Definition at line 125 of file ax25.c.

void ax25_print ( KFile ch,
const AX25Msg msg 
)

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

Parameters:
ch a kfile channel where the message will be printed.
msg the message to be printed.

Definition at line 273 of file ax25.c.

void ax25_sendVia ( AX25Ctx ctx,
const AX25Call path,
size_t  path_len,
const void *  _buf,
size_t  len 
)

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

Parameters:
ctx AX25 context to operate on.
path An array of callsigns used as path,
See also:
AX25_PATH for an handy way to create a path.
Parameters:
path_len callsigns path lenght.
_buf payload buffer.
len length of the payload.

Definition at line 227 of file ax25.c.