Files
mars_nwe_pcab/nds/fragger.h

20 lines
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef MARS_NDS_FRAGGER_H
#define MARS_NDS_FRAGGER_H
#include <stddef.h>
#include <stdint.h>
#define NDS_END UINT32_C(0xffffffff)
#define NDS_LIMIT (64u*1024u)
/* Experimental NCP 104/2 payload transport, not an NDS server. The caller
* must own one state per authenticated transport connection/task, serialize
* requests, handle NCP retransmissions, and reset on disconnect/timeout.
* No authentication or directory operations are supplied by this module. */
struct nds_frag { uint32_t handle,verb,reply_limit,wire_limit; size_t expected,received,sent,reply_len; unsigned phase; int32_t status; unsigned char request[NDS_LIMIT],reply[NDS_LIMIT]; };
typedef int32_t (*nds_dispatch)(void *,uint32_t,const unsigned char *,size_t,unsigned char *,size_t,size_t *);
void nds_frag_reset(struct nds_frag *s);
/* p begins with subfunction byte 2, excludes NCP header/function byte.
* out excludes NCP reply header. 0 success, -1 malformed/state error;
* caller must return a nonzero NCP completion on error, never success. */
int nds_frag_step(struct nds_frag *,uint32_t new_handle,const unsigned char *,size_t,unsigned char *,size_t,size_t *,nds_dispatch,void *);
#endif