sockdefs.h

来自「mcf5307实验源代码」· C头文件 代码 · 共 186 行

H
186
字号
/****************************************************************************/
/*                                                                          */
/*      Copyright (c) 1993 - 1996 by Accelerated Technology, Inc.           */
/*                                                                          */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the subject */
/* matter of this material.  All manufacturing, reproduction, use and sales */
/* rights pertaining to this subject matter are governed by the license     */
/* agreement.  The recipient of this software implicity accepts the terms   */
/* of the license.                                                          */
/*                                                                          */
/****************************************************************************/
/****************************************************************************/
/*                                                                          */
/* FILENAME                                                 VERSION         */
/*                                                                          */
/*      sockdefs                                              3.2           */
/*                                                                          */
/* DESCRIPTION                                                              */
/*                                                                          */
/*      This include file will define socket type error return codes, socket*/
/*      options, and socket protocol types.                                 */
/*                                                                          */
/* AUTHOR                                                                   */
/*                                                                          */
/*      Craig L. Meredith, Accelerated Technology Inc.                      */
/*                                                                          */
/* DATA STRUCTURES                                                          */
/*                                                                          */
/*  global compenent data stuctures defined in this file                    */
/*                                                                          */
/* FUNCTIONS                                                                */
/*                                                                          */
/*      No functions defined in this file                                   */
/*                                                                          */
/* DEPENDENCIES                                                             */
/*                                                                          */
/*      No other file dependencies                                          */
/*                                                                          */
/* HISTORY                                                                  */
/*                                                                          */
/*      NAME                            DATE            REMARKS             */
/*                                                                          */
/*      Craig L. Meredith       04/10/93        Initial version.            */
/*      Craig L. Meredith       08/17/93        Added header, Neil's mods.  */
/*      Scott Murrill           03/18/97        Added NU_NONE macro as a    */
/*                                              catch-all for unused        */
/*                                              parameters (SPR 275)        */
/*                                                                          */
/****************************************************************************/

#ifndef SOCKDEFS_H
#define SOCKDEFS_H

/* A generic catch-all for unused parameters. */
#define NU_NONE         0

/* FAMILY equates */
#define NU_FAMILY_UNIX 0        /* Unix */
#define NU_FAMILY_IP   1        /* Internet                  - valid entry */
#define NU_FAMILY_XNS  2        /* Xerox NS */

/* TYPE equates */
#define NU_TYPE_STREAM    0     /* stream Socket             - valid entry */
#define NU_TYPE_DGRAM     1     /* datagram Socket           - valid entry */
#define NU_TYPE_RAW       2     /* raw Socket                - valid entry */
#define NU_TYPE_SEQPACKET 3     /* sequenced packet Socket */
#define NU_TYPE_RDM       4     /* reliably delivered msg Socket */

/* PROTOCOL equates */
#define NU_PROTO_INVALID  0
#define NU_PROTO_TCP      1
#define NU_PROTO_UDP      2
#define NU_PROTO_ICMP     3

/* total number of socket descriptors */
#define NSOCKETS                 90

/***************************  SOCKET OPTIONS  *****************************/
/* SOCKET OPTION control flags */
#define NU_SETFLAG        1
#define NU_BLOCK          1

/* PROTOCOL LEVELS */
#define NU_SOCKET_LEVEL   0

/* Get SOCKET OPTION errors */
#define NU_BAD_SOCKETD    0
#define NU_BAD_LEVEL      1
#define NU_BAD_OPTION     2
   
/* SOCKET OPTIONS */
#define SO_BROADCAST      (1<<0)  /* permission to transmit broadcast messages? */
#ifdef SGJ
   /* These socket options are not currently supported.  So for the time being
      they have been removed. */
   #define NU_SOCK_DEBUG     0    /* status of debugging info */
   #define NU_SOCK_REUSEADDR 1    /* allow local address reuse? */
   #define NU_SOCK_KEEPALIVE 2    /* status of connection keep-alive */
   #define NU_SOCK_DONTROUTE 3    /* bypass routing for outgoing messages? */
   #define NU_SOCK_LINGER    4    /* linger on close if data present? */
   #define NU_SOCK_OOBINLINE 6    /* receive out-of-band data in band? */
   #define NU_SOCK_SNDBUF    7    /* buffer size for output */
   #define NU_SOCK_RCVBUF    8    /* buffer size for input */
   #define NU_SOCK_TYPE      9    /* type of socket */
   #define NU_SOCK_ERROR    10    /* get & clear the last error for the socket */
#endif /* SGJ */

/* Levels used in the call to NU_Setsockopt */
#define SOL_SOCKET       1

/*******************  SOCKET ERROR CODES  ****************************/

#define NU_ARP_FAILED           -26     /*  ARP failed to resolve addr. */
#define NU_INVALID_PROTOCOL     -27     /*  Invalid network protocol */
#define NU_NO_DATA_TRANSFER     -28     /*  Data was not written/read
                                            during send/receive function */
#define NU_NO_PORT_NUMBER       -29     /*  No local port number was stored
                                            in the socket descriptor */
#define NU_NO_TASK_MATCH        -30     /*  No task/port number combination
                                            existed in the task table */
#define NU_NO_SOCKET_SPACE      -31     /*  The socket structure list was full
                                            when a new socket descriptor was
                                            requested */
#define NU_NO_ACTION            -32     /*  No action was processed by
                                            the function */
#define NU_NOT_CONNECTED        -33     /*  A connection has been closed
                                            by the network.  */
#define NU_INVALID_SOCKET       -34     /*  The socket ID passed in was
                                            not in a valid range.  */
#define NU_NO_SOCK_MEMORY       -35     /*  Memory allocation failed for
                                            internal sockets structure.  */
#define NU_NOT_A_TASK           -36     /*  Attempt was made to make a
                                            sockets call from an interrupt
                                            without doing context save.  */
#define NU_INVALID_ADDRESS      -37     /*  An incomplete address was sent */
#define NU_NO_HOST_NAME         -38     /*  No host name specified in a  */
#define NU_RARP_INIT_FAILED     -39     /*  During initialization RARP failed. */
#define NU_BOOTP_INIT_FAILED    -40     /*  During initialization BOOTP failed. */
#define NU_INVALID_PORT         -41     /*  The port number passed in was
                                            not in a valid range. */
#define NU_NO_BUFFERS           -42     /*  There were no buffers to place */
                                        /*  the outgoing packet in. */
#define NU_NOT_ESTAB            -43     /*  A connection is open but not in
                                            an established state. */
#define NU_ODH_DISABLED         -44     /*  A service was requested which
                                            requires ODH to be enabled but
                                            it currently is not. */
#define NU_INVALID_BUF_PTR      -45     /*  The buffer pointer is invalid */
#define NU_WINDOW_FULL          -46     /*  The foreign host's in window is
                                            full. */
#define NU_NO_SOCKETS           -47     /*  No sockets were specified. */
#define NU_NO_DATA              -48     /*  None of the specified sockets were
                                            data ready.  NU_Select. */

/* The following errors are reported by the NU_Setsockopt and NU_Getsockopt
   service calls. */
#define NU_INVALID_LEVEL        -49     /*  The specified level is invalid. */
#define NU_INVALID_OPTION       -50     /*  The specified option is invalid. */
#define NU_INVAL                -51     /*  General purpose error condition. */
#define NU_ACCES                -52     /*  The attempted operation is not   */
                                        /*  allowed on the  socket           */

#define NU_CLOSING              -55     /*  The other side in a TCP connection*/
                                        /*  has sent a FIN */
#define NU_MEM_ALLOC            -56     /* Failed to allocate memory. */

/* These error codes are returned by DNS. */
#define NU_INVALID_LABEL        -57     /* Indicates a domain name with an
                                           invalid label.                   */
#define NU_FAILED_QUERY         -58     /* No response received for a DNS
                                           Query. */
#define NU_DNS_ERROR            -59     /* A general DNS error status. */
#define NU_NOT_A_HOST           -60     /* The host name was not found. */
#define NU_INVALID_PARM         -61     /* The host name was not found. */

/* The following defines are to be used for the Operator Data Handling (ODH)
   for making the TCP/IP not do the buffer coping, and instead send the
   current buffer pointer back to the user.  This will help for the higher
   speed through put for data transfer. */
#define NU_ODH_DISABLE   0   /* Do not use ODH transfer code */
#define NU_ODH_RECEIVE   1   /* Set the ODH transfer code for receive only */
#define NU_ODH_TRANSMIT  2   /* Set the ODH transfer code for transmit only */
#define NU_ODH_ENABLE    3   /* Set the ODH transfer for both rec/trans */

#endif  /* SOCKDEFS_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?