⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socketd.h

📁 mcf5307实验源代码
💻 H
字号:
/*************************************************************************/
/*                                                                       */
/*    Copyright (c) 1993 - 1996 by Accelerated Technology, Inc.  NET 3.2 */
/*                                                                       */
/* 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 implicitly  */
/* accepts the terms of the license.                                     */
/*                                                                       */
/*************************************************************************/
#ifndef SOCKETD_H
#define SOCKETD_H

#include "sockdefs.h"     /* socket definitions */
#include "target.h"
#ifdef PLUS
	#include "nucleus.h"
#else
	#include "nu_defs.h"    /* added during ATI mods - 10/20/92, bgh */
#endif

#ifdef PLUS
        #define            NU_IGNORE_VALUE  -1   /* Null parameter value     */
#endif

#define      NULL_IP        0   /* Used to initialize ip addresses to NULL */

/* 32-bit structure containing 4-digit ip number */
struct id_struct
{
    uchar is_ip_addrs[4];        /* IP address number */
};

struct addr_struct
{
    int16    family;             /* family = INTERNET */
    uint16   port;               /* machine's port number */
    struct   id_struct id;       /* contains the 4-digit ip number for the host machine */
    char     *name;              /* points to machine's name */
};

struct sockaddr_struct
{
    struct id_struct ip_num;     /* the address = the ip num */
    int16  port_num;             /* the process = the port num */
    int16  pad;
};

/* this is the socket 5-tuple */
struct sock_struct
{
  struct sockaddr_struct  local_addr;
  struct sockaddr_struct  foreign_addr;
  uint16 so_options;          /* Socket options as defined by BSD.  Currently */
                              /* the only implemented option is SO_BROADCAST. */
  uint16 protocol;
  uint16 block : 1;           /* boolean: block during read flag */
  uint16 listener : 1;        /* 1 if this socket is a listener */
  int8 odh_flag;              /* used as a flag for saying that the port
                                 is being used for Optimized Data Handling.
                                 No buffer copying at low level, all handled
                                 by the user.  NU_ODH_NONE, NU_ODH_RECEIVE,
                                 NU_ODH_TRANSMIT. - 05/11/93, CLM */
  int8  pad;
};

/* task table structure - created during an NU_Listen call to
   store status on x number of connections for a single port number
   from a single task id */

struct TASK_TABLE_STRUCT
{
  struct TASK_TABLE_STRUCT *next;  /* pointer to the next task structure */
#ifdef PLUS
  NU_TASK *Task_ID;
#else
  int16 Task_ID, pad2;     /* task which is willing to accept a connection */
#endif
  short *stat_entry;       /* status of each connection */
  int16 *port_entry;       /* portlist entry number of each connection */
  int16  socketd;
  uint16 local_port_num;   /* port number of server */
  uint16 current_idx;      /* points to oldest entry in the table; a task
                              should service this connection before the others */
  uint16 total_entries;    /* number of backlog queues possible */
  int8   acceptFlag;       /* Used to indicate that the task is suspended in the
                              NU_Accept service. */
  int8   pad[3];
};

/* host structure */
typedef struct NU_Host_Ent
{
  char   *h_name;
  char   **h_alias;        /* unused */
  int16  h_addrtype;
  int16  h_length;
  char   *h_addr;          /* contains the host's 4-digit ip number */
} NU_HOSTENT;

#define NU_Get_Host_by_NAME   NU_Get_Host_By_Name
#define gethostbyname         NU_Get_Host_By_Name

/* Host information.  Used to match a host name with an address.  Used in
   hosts.c to setup information on foreign hosts. */
struct host
{
        char   name[32];
        uchar   address[4];
};

/* Defines added for the NU_Select service call. */
#define FD_BITS                 16
#define FD_ELEMENTS 	NSOCKETS/FD_BITS+1

typedef struct fd_set
{
        uint16 words[FD_ELEMENTS];
} FD_SET;

#endif  /* SOCKETD_H */

⌨️ 快捷键说明

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