Remove all usages of patty_ax25_frame_format
This commit is contained in:
parent
478d22936b
commit
fba41f93df
3 changed files with 14 additions and 23 deletions
|
@ -19,11 +19,6 @@ enum patty_ax25_frame_cr {
|
|||
PATTY_AX25_FRAME_RESPONSE
|
||||
};
|
||||
|
||||
enum patty_ax25_frame_format {
|
||||
PATTY_AX25_FRAME_NORMAL = 0,
|
||||
PATTY_AX25_FRAME_EXTENDED = 1
|
||||
};
|
||||
|
||||
typedef struct _patty_ax25_frame {
|
||||
patty_ax25_address dest;
|
||||
patty_ax25_address src;
|
||||
|
@ -45,7 +40,6 @@ typedef struct _patty_ax25_frame {
|
|||
size_t size;
|
||||
} patty_ax25_frame;
|
||||
|
||||
int patty_ax25_frame_decode(patty_ax25_frame *frame,
|
||||
void *data, size_t len, enum patty_ax25_frame_format format);
|
||||
int patty_ax25_frame_decode(patty_ax25_frame *frame, void *data, size_t len);
|
||||
|
||||
#endif /* _PATTY_AX25_FRAME_H */
|
||||
|
|
|
@ -107,7 +107,7 @@ int main(int argc, char **argv) {
|
|||
while ((len = patty_kiss_tnc_recv(tnc, &data, &port)) > 0) {
|
||||
patty_ax25_frame frame;
|
||||
|
||||
if (patty_ax25_frame_decode(&frame, data, len, PATTY_AX25_FRAME_NORMAL) < 0) {
|
||||
if (patty_ax25_frame_decode(&frame, data, len) < 0) {
|
||||
perror("Unable to decode frame");
|
||||
|
||||
exit(127);
|
||||
|
@ -121,10 +121,7 @@ int main(int argc, char **argv) {
|
|||
fprintf(stderr, " nr %d", PATTY_AX25_CONTROL_SEQ_RECV(frame.control));
|
||||
}
|
||||
|
||||
if (frame.payload) {
|
||||
fprintf(stderr, " proto %02x", frame.proto);
|
||||
}
|
||||
|
||||
fprintf(stderr, " proto %02x", frame.proto);
|
||||
fprintf(stderr, " %ld bytes\n", len);
|
||||
|
||||
hexdump_fprint(stderr, data, len);
|
||||
|
|
22
src/frame.c
22
src/frame.c
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <patty/ax25.h>
|
||||
|
||||
static ssize_t frame_decode_station(patty_ax25_address *address, void *data, off_t offset, enum patty_ax25_frame_format format) {
|
||||
static ssize_t frame_decode_station(patty_ax25_address *address, void *data, off_t offset) {
|
||||
int i, space = 0;
|
||||
uint8_t ssid = ((uint8_t *)data + offset)[6];
|
||||
|
||||
|
@ -59,7 +59,7 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t frame_decode_hops(patty_ax25_frame *frame, void *data, off_t start, enum patty_ax25_frame_format format) {
|
||||
static ssize_t frame_decode_hops(patty_ax25_frame *frame, void *data, off_t start) {
|
||||
ssize_t decoded;
|
||||
off_t offset = start;
|
||||
|
||||
|
@ -70,7 +70,7 @@ static ssize_t frame_decode_hops(patty_ax25_frame *frame, void *data, off_t star
|
|||
* frame.
|
||||
*/
|
||||
for (i=0; i<PATTY_AX25_MAX_HOPS; i++) {
|
||||
if ((decoded = frame_decode_station(&frame->repeaters[i], data, offset, format)) < 0) {
|
||||
if ((decoded = frame_decode_station(&frame->repeaters[i], data, offset)) < 0) {
|
||||
goto error;
|
||||
} else {
|
||||
offset += decoded;
|
||||
|
@ -101,11 +101,11 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t frame_decode_address(patty_ax25_frame *frame, void *data, off_t start, enum patty_ax25_frame_format format) {
|
||||
static ssize_t frame_decode_address(patty_ax25_frame *frame, void *data, off_t start) {
|
||||
off_t offset = start;
|
||||
ssize_t decoded;
|
||||
|
||||
if ((decoded = frame_decode_station(&frame->dest, data, offset, format)) < 0) {
|
||||
if ((decoded = frame_decode_station(&frame->dest, data, offset)) < 0) {
|
||||
goto error;
|
||||
} else {
|
||||
offset += decoded;
|
||||
|
@ -115,7 +115,7 @@ static ssize_t frame_decode_address(patty_ax25_frame *frame, void *data, off_t s
|
|||
* It would be considered erroneous if the destination address did have the
|
||||
* extension bit set to 1.
|
||||
*/
|
||||
if ((decoded = frame_decode_station(&frame->src, data, offset, format)) < 0) {
|
||||
if ((decoded = frame_decode_station(&frame->src, data, offset)) < 0) {
|
||||
goto error;
|
||||
} else {
|
||||
offset += decoded;
|
||||
|
@ -140,7 +140,7 @@ static ssize_t frame_decode_address(patty_ax25_frame *frame, void *data, off_t s
|
|||
* decoding repeater addresses.
|
||||
*/
|
||||
if (!frame->src.last) {
|
||||
if ((decoded = frame_decode_hops(frame, data, offset, format)) < 0) {
|
||||
if ((decoded = frame_decode_hops(frame, data, offset)) < 0) {
|
||||
goto error;
|
||||
} else {
|
||||
offset += decoded;
|
||||
|
@ -153,7 +153,7 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t frame_decode_payload(patty_ax25_frame *frame, void *data, off_t offset, enum patty_ax25_frame_format format) {
|
||||
static ssize_t frame_decode_payload(patty_ax25_frame *frame, void *data, off_t offset) {
|
||||
uint8_t control = ((uint8_t *)data + offset)[0];
|
||||
size_t decoded = 0;
|
||||
|
||||
|
@ -204,7 +204,7 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
int patty_ax25_frame_decode(patty_ax25_frame *frame, void *data, size_t size, enum patty_ax25_frame_format format) {
|
||||
int patty_ax25_frame_decode(patty_ax25_frame *frame, void *data, size_t size) {
|
||||
ssize_t decoded;
|
||||
off_t offset = 0;
|
||||
|
||||
|
@ -215,7 +215,7 @@ int patty_ax25_frame_decode(patty_ax25_frame *frame, void *data, size_t size, en
|
|||
/*
|
||||
* First, decode the variable-length Address field.
|
||||
*/
|
||||
if ((decoded = frame_decode_address(frame, data, offset, format)) < 0) {
|
||||
if ((decoded = frame_decode_address(frame, data, offset)) < 0) {
|
||||
goto error_decode;
|
||||
} else {
|
||||
offset += decoded;
|
||||
|
@ -225,7 +225,7 @@ int patty_ax25_frame_decode(patty_ax25_frame *frame, void *data, size_t size, en
|
|||
* Now, decode the remaining Control Field, optional Protocol Identifier
|
||||
* field, and payload that may follow.
|
||||
*/
|
||||
if ((decoded = frame_decode_payload(frame, data, offset, format)) < 0) {
|
||||
if ((decoded = frame_decode_payload(frame, data, offset)) < 0) {
|
||||
goto error_decode;
|
||||
} else {
|
||||
offset += decoded;
|
||||
|
|
Loading…
Add table
Reference in a new issue