|
FB1UGR > AX25 18.05.98 06:55l 147 Lines 3300 Bytes #-9792 (0) @ WW
BID : 18492_ON4KTK
Read: DL3MGQ DC1MJK DC1MAT GUEST DF1SI
Subj: Re: SV1ETK and ax25 programming
Path: DB0ZKA<DB0LX<DB0RBS<DB0SEL<DB0ZDF<DB0AIS<DB0IZ<DB0QS<DB0ACC<DB0ACH<
PI8JOP<PI8ZAA<PI8HWB<ON6AR<ON1CED<ON4KTK
Sent: 980517/1842Z @:ON4KTK.WVL.BEL.EU #:18492 [Kortrijk] FBB7.00f $:18492_ON4K
From: FB1UGR@ON4KTK.WVL.BEL.EU
To : AX25@WW
Hello Friend,
in the KISS mode, there are several things you should know:
First, your TNC will communicate with your serial port thru the
slip protocol, so you have to handle it. The KISS frame is encapsuled
into the slip frame, it's quiet easy to decode it. Once you decoded
your KISS data, then you can proceed with the remaining information
such as the callsign, the commands and so on...
The internal representation of the callsign is fearly tricky: all
of the bits have been shifted to the left, ie 00110110 became
1101100.
So if you want to be able to read the callsigns contained in a KISS
packet, you must first shift the 6 bytes to the right.
I suggest you to read first a suitable documentation before any reliable
ax25 programming attempt. Linux and NOS sources are the one I used to
analyze in order to code my Amiga program called LISTEN that display
incoming AX25 frames.
Below, you will find the C functions I used to code/decode the AX25
callsigns.
Good luck and best 73 from Thibaut FB1UGR.
------------------------------------------------------------------------------
| ("`-''-/").___..--''"`-._ |
| Thibaut MAQUET `6_ 6 ) `-. ( ).`-.__.`) |
| Qth: F59110 LA MADELEINE FRANCE (_Y_.)' ._ ) `._ `. ``-..-' |
| Ax25:fb1ugr@on4ktk.#wvl.bel.eu _..`--'_..-_/ /--'_.' ,' |
| E-mail:maquet@mail.dotcom.fr (il),-'' (li),' ((!.-' |
------------------------------------------------------------------------------
/*
* Callsign functions
*
* (c) 1996, Thibaut MAQUET FB1UGR
* e-mail: tmaquet@access-it.net
*
*************************************************************
*
* 05-03-97 :Rewrote functions for more compatibility with
* other environments
* 10-11-96 :First release
*
*/
#define MORE_CALLSIGN -1
#define LAST_CALLSIGN 0
#define LAPB_COMMAND 0
#define LAPB_RESPONSE 1
#define C 0x80
typedef signed char Bool;
typedef unsigned char Ubyte;
Bool callsgndec(Ubyte *,Ubyte *,int *,int *);
void callsgncod(Ubyte *,Ubyte *,char ,char ,char );
/*
* Decode callsign and ssid
*
* Return MORE_CALLSIGN if the frame was repeated
*
* Also check for command and response frame
*
*/
Bool callsgndec(Ubyte *ptr,Ubyte *call,int *ssid,int *cmdrsp)
{
int i;
for (i=0;i<6;i++)
{
*call=(*ptr>>1)&0xff;
ptr++;
call++;
}
if(*ptr&C)
*cmdrsp=LAPB_COMMAND;
else
*cmdrsp=LAPB_RESPONSE;
*call=0;
if (*ptr&0x1e)
*ssid=(int)((*ptr>>1)&0x0f);
else
*ssid=0;
if (*ptr&1)
return LAST_CALLSIGN;
return MORE_CALLSIGN;
}
/*
* Code a callsign
*/
void callsgncod(Ubyte *ptr,Ubyte *call,char ssid,char via,char cmdrsp)
{
int i,j=0;
char *p=ptr;
for (i=0;i<6;i++)
{
if (*p==0)
j=1;
if (j)
*p=0;
p++;
}
for (i=0;i<6;i++)
{
*ptr= *ptr >= 'a' && *ptr <= 'z' ? *ptr&=0x5f : *ptr;
if ( (*ptr < '0' || *ptr > '9') && (*ptr < 'A' || *ptr > 'Z') )
*ptr=' ';
*call++=(*ptr<<1)&0xff;
ptr++;
}
*call=ssid<<1;
if (via==LAST_CALLSIGN)
*call |= 1;
if (cmdrsp==LAPB_COMMAND)
*call |= 0xE0;
else
*call |= 0x60;
*++call=0;
}
Read previous mail | Read next mail
| |