At least now, we can discern between commands and responses
This commit is contained in:
parent
aa294b2710
commit
5fe656762f
2 changed files with 20 additions and 0 deletions
|
@ -38,6 +38,11 @@ enum patty_ax25_frame_type {
|
|||
PATTY_AX25_FRAME_UNNUMBERED
|
||||
};
|
||||
|
||||
enum patty_ax25_frame_cr {
|
||||
PATTY_AX25_FRAME_COMMAND,
|
||||
PATTY_AX25_FRAME_RESPONSE
|
||||
};
|
||||
|
||||
typedef struct _patty_ax25_address {
|
||||
char callsign[7];
|
||||
|
||||
|
@ -60,6 +65,7 @@ typedef struct _patty_ax25_frame {
|
|||
|
||||
enum patty_ax25_version version;
|
||||
enum patty_ax25_frame_type type;
|
||||
enum patty_ax25_frame_cr cr;
|
||||
|
||||
uint8_t control;
|
||||
uint8_t proto;
|
||||
|
|
14
src/ax25.c
14
src/ax25.c
|
@ -121,6 +121,20 @@ static ssize_t frame_decode_address(patty_ax25_frame *frame, void *data, off_t s
|
|||
offset += decoded;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine whether the current frame is a Command or Response, and which
|
||||
* version of AX.25 this frame adheres to.
|
||||
*/
|
||||
if (PATTY_AX25_ADDRESS_SSID_C(frame->src.ssid)) {
|
||||
frame->cr = PATTY_AX25_FRAME_RESPONSE;
|
||||
frame->version = PATTY_AX25_ADDRESS_SSID_C(frame->dest.ssid)?
|
||||
PATTY_AX25_OLD: PATTY_AX25_2_0;
|
||||
} else {
|
||||
frame->cr = PATTY_AX25_FRAME_COMMAND;
|
||||
frame->version = PATTY_AX25_ADDRESS_SSID_C(frame->src.ssid)?
|
||||
PATTY_AX25_OLD: PATTY_AX25_2_0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the source address is not the final address in the frame, begin
|
||||
* decoding repeater addresses.
|
||||
|
|
Loading…
Add table
Reference in a new issue