tcpvars.c

来自「mcf5307实验源代码」· C语言 代码 · 共 396 行 · 第 1/2 页

C
396
字号
/*                                                                          */
/*                                                                          */
/****************************************************************************/

/* List of buffers that contain packets that are waiting to be demuxed. */
struct pqueue_hdr  buffer_list;

/* List of available buffers. */
struct pqueue_hdr  buffer_freelist;

/* This list contains the buffers that have been removed from the in window
   but which the user has not yet deallocated.  When the user deallocates
   A packet on this list it goes back onto the buffer_freelist. */
struct pqueue_hdr  odh_list;

struct transq_hdr trans_list;
struct transq_hdr trans_freelist;


/****************************************************************************/
/*                                                                          */
/*                                Scon                                      */
/*                                                                          */
/*      Preinitialized data for maintaining characteristics of our          */
/*      local node.                                                         */
/*                                                                          */
/*                                                                          */
/****************************************************************************/

/* Initialized in etherinit. */
struct config Scon;

/****************************************************************************/
/*                                                                          */
/*                              defmachinfo                                 */
/*                                                                          */
/*      Preinitialized data for the "machine list".  The machine list       */
/*      contains information about potential hosts.  It is used as a        */
/*      shortcut to preclude specifying machine parameters for well         */
/*      known hosts.                                                        */
/*                                                                          */
/****************************************************************************/
struct machinfo defmachinfo[] =
{
    {
        /* NEW MACHINE - #0 */
        /* start uchars */
        "mobile",               /* session name */
        "mobile",               /* host name */
        /* FOR TEST ONLY - should be 192,9,200,1 - ATI MODS - 11/30/92, bgh */
        192,9,200,1,            /* host ip # */
        0,                      /* gateway level */
        0,                      /* name server level */
        1,                      /* half duplex for IBM machines */
        0,
        23,                     /* TCP port number default = 23 (telnet) */
        40,                     /* machine number */
        HAVEIP,                 /* status of this machine entry */
        17,                     /* initial retransmit timeout */
        20,                     /* timeout for opening connection - in seconds */
        WINDOWSIZE,             /* window to allow for this host */
        MAX_SEGMENT_LEN,        /* maximum receivable segment size (in) */
        MAX_SEGMENT_LEN,        /* maximum transfer unit MTU (out) */
        /* start struct machinfo ptr */
        NU_NULL
    },                          /* linked list ptr to next */

    /* NEW MACHINE - #1 */
    /* start uchars */
    {
        "mobile",              /* session name */
        "mobile",              /* host name */
        192,9,200,1,           /* host ip # */
        0,                     /* gateway level */
        0,                     /* name server level */
        1,                     /* half duplex for IBM machines */
        0,
        23,                    /* TCP port number default = 23 (telnet) */
        40,                    /* machine number */
        HAVEIP,                /* status of this machine entry */
        17,                    /* initial retransmit timeout */
        20,                    /* timeout for opening connection - in seconds */
        WINDOWSIZE,            /* window to allow for this host */
        MAX_SEGMENT_LEN,       /* maximum receivable segment size (in) */
        MAX_SEGMENT_LEN,       /* maximum transfer unit MTU (out) */
        /* start struct machinfo ptr */
        NU_NULL
    },                         /* linked list ptr to next */
    /* NEW MACHINE - #2  DEFAULT */
    /* start uchars */
    {
        "default",             /* session name */
        "default",             /* host name */
        192,9,200,1,           /* host ip # */
        0,                     /* gateway level */
        0,                     /* name server level */
        1,                     /* half duplex for IBM machines */
        23,                    /* TCP port number default = 23 (telnet) */
        0,
        40,                    /* machine number */
        HAVEIP,                /* status of this machine entry */
        17,                    /* initial retransmit timeout */
        20,                    /* timeout for opening connection - in seconds */
        WINDOWSIZE,            /* window to allow for this host */
        MAX_SEGMENT_LEN,       /* maximum receivable segment size (in) */
        MAX_SEGMENT_LEN,       /* maximum transfer unit MTU (out) */
        /* start struct machinfo ptr */
        NU_NULL
    }                          /* linked list ptr to next */
};

/*  Global machine information pointers.  Smachlist points to the head of
    the list of predefined hosts (see previous table definition).  Smptr
    points to the machine currently being accessed.  Sns points to the
    machine which is the current domain server.  */
struct machinfo *Smachlist = NU_NULL, *Smptr = NU_NULL;
struct machinfo *Sns = NU_NULL;

/*
 * Define the timerlist control pointers.  These are globally used to
 * maintain the system timer list that is used for retry timeouts and
 * the like.
 */
struct tqhdr tcp_timerlist, tcptimer_freelist;

/*
 * Define the portlist table.  This is a critical structure in Nucleus NET
 * as it maintains information about all open connections.
 */
struct port *portlist[NPORTS];        /* allocate like iobuffers in UNIX */

/*
 * Define the UDP portlist table.  This is a critical structure in Nucleus NET
 * as it maintains information about all open UDP ports.
 */
struct uport *uportlist[NUPORTS];      /* allocate like iobuffers in UNIX */

/*  uport is anaglogous to the portlist for UDP activity.  */
struct uport ulist;                    /* buffer for UDP */

/*
 * According to the TCP standard, checksums for TCP must include the IP
 * numbers of both the sender and receiver.  The tcps structure allows
 * this information to be concatenated with the incoming tcp packet for
 * checksumming purposes.
 */
struct pseudotcp tcps;

/*
 * The Address Resolution protocol allows us to broadcast an ethernet
 * message specifying the IP number of the host we are looking for.  The
 * host in-turn sends an ethernet message back to us containing his
 * ethernet address.  That information is stored for further use in the
 * ARP cache.  We also "listen" on the network for other ARP requests
 * that are not necessarily to us, but allow us to attach an IP number
 * to an ethernet address.  acache maintains all of this information.
 */
struct acache arpc[CACHELEN];       /* cache for hardware addresses */

/*
 * Arp is a global definition of the ARP packet used to determine IP
 * number to ethernet address translation (see previous comment).
 * See PROTOCOL.H for its definition and PROTINIT.C for its initialization.
 */
ARPKT arp;

/* 
 * Blankd is a predefined physical (ethernet) header for all outgoing
 * packets to the network.  See PROTOCOL.H for its definition and
 * PROTINIT.C for its initialization.
 */
DLAYER blankd;

/* 
 * Blankip is a predefined IP (Internet Protocol) header for all outgoing
 * packets to the network that use IP.  See PROTOCOL.H for its definition and
 * PROTINIT.C for its initialization.
 */
IPKT blankip;

/* 
 * The following structure is used to define the socket list for Nucleus NET.
 * Sockets are requried for all TCP connections.
 */
struct sock_struct *socket_list[NSOCKETS] = {NU_NULL};

/*
 * Task list entries are maintained on NU_Listen calls to ensure that
 * the proper number of attempted connections can be queued up while
 * one is being processed.
 */
struct TASK_TABLE_STRUCT *Task_Head;  /* pointer to the first task structure */
struct TASK_TABLE_STRUCT *Task_Tail;  /* pointer to the last task structure */


FPBUF   frag[IPF_BUFFERS];

⌨️ 快捷键说明

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