home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / NRS.H < prev    next >
C/C++ Source or Header  |  1994-04-17  |  2KB  |  54 lines

  1. #ifndef _NRS_H
  2. #define _NRS_H
  3.   
  4. #ifndef _GLOBAL_H
  5. #include "global.h"
  6. #endif
  7.   
  8. #ifndef _MBUF_H
  9. #include "mbuf.h"
  10. #endif
  11.   
  12. #ifndef _IFACE_H
  13. #include "iface.h"
  14. #endif
  15.   
  16. #define NRS_MAX 5       /* Maximum number of Nrs channels */
  17.   
  18. /* SLIP definitions */
  19. #define NRS_ALLOC   40  /* Receiver allocation increment */
  20.   
  21. #define STX 0x02        /* frame start */
  22. #define ETX 0x03        /* frame end */
  23. #define DLE 0x10        /* data link escape */
  24. #define NUL 0x0         /* null character */
  25.   
  26. /* packet unstuffing state machine */
  27. #define NRS_INTER   0       /* in between packets */
  28. #define NRS_INPACK  1       /* we've seen STX, and are in a the packet */
  29. #define NRS_ESCAPE  2       /* we've seen a DLE while in NRS_INPACK */
  30. #define NRS_CSUM    3       /* we've seen an ETX, and are waiting for the checksum */
  31.   
  32. /* net/rom serial protocol control structure */
  33. struct nrs {
  34.     char state;     /* Receiver State control flag */
  35.     unsigned char csum; /* Accumulating checksum */
  36.     struct mbuf *rbp;   /* Head of mbuf chain being filled */
  37.     struct mbuf *rbp1;  /* Pointer to mbuf currently being written */
  38.     char *rcp;      /* Write pointer */
  39.     int16 rcnt;     /* Length of mbuf chain */
  40.     struct mbuf *tbp;   /* Transmit mbuf being sent */
  41.     long errors;        /* Checksum errors detected */
  42.     long packets ;      /* Number of packets received successfully */
  43.     struct iface *iface ;   /* Associated interface structure */
  44.     int (*send) __ARGS((int,struct mbuf *));/* Routine to send mbufs */
  45.     int (*get) __ARGS((int));/* Routine to fetch input chars */
  46. };
  47.   
  48. extern struct nrs Nrs[];
  49. /* In nrs.c: */
  50. int nrs_raw __ARGS((struct iface *iface,struct mbuf *bp));
  51. void nrs_recv __ARGS((int dev,void *v1,void *v2));
  52.   
  53. #endif  /* _NRS_H */
  54.