A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
Diff: tcp/tcb.c
- Revision:
- 83:08c983006a6e
- Parent:
- 80:4ef1500fca1d
- Child:
- 88:1ba13e6062a3
diff -r 20781198d26d -r 08c983006a6e tcp/tcb.c --- a/tcp/tcb.c Thu Nov 15 18:42:42 2018 +0000 +++ b/tcp/tcb.c Sat Nov 17 15:49:03 2018 +0000 @@ -38,15 +38,13 @@ } return NULL; } -void TcbGetNext(struct tcb** ppTcb) +struct tcb* TcbGetNext(struct tcb* pTcb) { - if (!*ppTcb) //Initialise if passed NULL - { - *ppTcb = tcbs; - return; - } - ++*ppTcb; //Increment - if (*ppTcb >= tcbs + TCB_COUNT) *ppTcb = tcbs; + if (!pTcb) return tcbs; //Initialise if passed NULL + ++pTcb; //Increment + if (pTcb < tcbs + TCB_COUNT) return pTcb; + else return tcbs; + } uint32_t TcbElapsed = 0;