home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / lan / soss.arj / INCLUDE / UDP.H < prev   
C/C++ Source or Header  |  1991-04-11  |  1KB  |  52 lines

  1. /* Copyright 1986 by Carnegie Mellon */
  2. /*  Copyright 1983 by the Massachusetts Institute of Technology  */
  3.  
  4. #ifndef UDP_H            /* DDP */
  5. #define UDP_H    1        /* DDP */
  6.  
  7. #include <ip.h>
  8.  
  9. /* UDP Header structure */
  10.  
  11. struct udp {
  12.     unsigned ud_srcp;    /* source port */
  13.     unsigned ud_dstp;    /* dest port */
  14.     unsigned ud_len;        /* length of UDP packet */
  15.     unsigned ud_cksum;    /* UDP checksum */
  16.     };
  17.  
  18. /* The UDP Connection structure */
  19. struct udp_conn {
  20.     struct udp_conn *u_next;
  21.     unsigned    u_lport;    /* local port */
  22.     unsigned    u_fport;    /* foreign port */
  23.     in_name        u_fhost;    /* foreign host */
  24.     int        (*u_rcv)();    /* incoming packet handler */
  25.     unsigned    u_data;        /* fooish thing */
  26.     int        (*u_durcv)();    /* incoming dest. unreach. handler */
  27.     };
  28.  
  29. typedef    struct udp_conn *UDPCONN;
  30.  
  31. /* Some goodly constants, macros and an external */
  32. #define    UDPPROT    17    /* UDP Internet protocol number */
  33. #define    UDPLEN    sizeof(struct udp)
  34.  
  35. #define udp_head(pip)    ((struct udp *)in_data((pip)))
  36. #define udp_data(pup)    ((char *)(pup) + sizeof(struct udp))
  37.  
  38. #define udp_free(pkt)    in_free((pkt))
  39.  
  40. /* Name user return codes */
  41. #define NAMETROUBLE    2L    /* Name user couldn't send request */
  42. #define    NAMETMO        1L    /* Name user timed out on all requests */
  43. #define    NAMEUNKNOWN    0L    /* Name not known */
  44.  
  45. extern UDPCONN    udp_open();
  46. extern unsigned udp_socket();
  47. extern unsigned udpxsum();
  48. extern PACKET udp_alloc();
  49.  
  50. extern UDPCONN firstudp;
  51. #endif                /* DDP */
  52.