This is all very necessary if I am to wrest tight control over frame decoding into my own hands
This commit is contained in:
parent
63f031b461
commit
1666666e9d
2 changed files with 8 additions and 4 deletions
|
@ -35,8 +35,12 @@ int patty_kiss_tnc_fd_unix(patty_kiss_tnc *tnc);
|
||||||
|
|
||||||
void patty_kiss_tnc_close(patty_kiss_tnc *tnc);
|
void patty_kiss_tnc_close(patty_kiss_tnc *tnc);
|
||||||
|
|
||||||
|
void patty_kiss_tnc_drop(patty_kiss_tnc *tnc);
|
||||||
|
|
||||||
int patty_kiss_tnc_dropped(patty_kiss_tnc *tnc);
|
int patty_kiss_tnc_dropped(patty_kiss_tnc *tnc);
|
||||||
|
|
||||||
|
void patty_kiss_tnc_flush(patty_kiss_tnc *tnc, size_t len);
|
||||||
|
|
||||||
ssize_t patty_kiss_tnc_buffer(patty_kiss_tnc *tnc);
|
ssize_t patty_kiss_tnc_buffer(patty_kiss_tnc *tnc);
|
||||||
|
|
||||||
ssize_t patty_kiss_tnc_decode(patty_kiss_tnc *tnc, void *frame, size_t *len, int *port);
|
ssize_t patty_kiss_tnc_decode(patty_kiss_tnc *tnc, void *frame, size_t *len, int *port);
|
||||||
|
|
|
@ -198,7 +198,7 @@ error_io:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tnc_drop(patty_kiss_tnc *tnc) {
|
void patty_kiss_tnc_drop(patty_kiss_tnc *tnc) {
|
||||||
memset(tnc->buf, '\0', tnc->bufsz);
|
memset(tnc->buf, '\0', tnc->bufsz);
|
||||||
memset(tnc->frame, '\0', tnc->bufsz);
|
memset(tnc->frame, '\0', tnc->bufsz);
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ int patty_kiss_tnc_dropped(patty_kiss_tnc *tnc) {
|
||||||
return tnc->dropped;
|
return tnc->dropped;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tnc_flush(patty_kiss_tnc *tnc, size_t len) {
|
void patty_kiss_tnc_flush(patty_kiss_tnc *tnc, size_t len) {
|
||||||
/*
|
/*
|
||||||
* Move everything from the buffer not processed up to this point, to the
|
* Move everything from the buffer not processed up to this point, to the
|
||||||
* beginning of the buffer.
|
* beginning of the buffer.
|
||||||
|
@ -253,14 +253,14 @@ ssize_t patty_kiss_tnc_recv(patty_kiss_tnc *tnc, void **frame, int *port) {
|
||||||
* frame.
|
* frame.
|
||||||
*/
|
*/
|
||||||
if (decoded == 0 && buffered == 0) {
|
if (decoded == 0 && buffered == 0) {
|
||||||
tnc_drop(tnc);
|
patty_kiss_tnc_drop(tnc);
|
||||||
}
|
}
|
||||||
} while (decoded == 0);
|
} while (decoded == 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flush the buffer up to the point of the next frame start.
|
* Flush the buffer up to the point of the next frame start.
|
||||||
*/
|
*/
|
||||||
tnc_flush(tnc, decoded);
|
patty_kiss_tnc_flush(tnc, decoded);
|
||||||
|
|
||||||
*frame = tnc->frame;
|
*frame = tnc->frame;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue