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

📄 nptcp.h

📁 在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LEA_4S的驱动,位置速寻算法,语音芯片ISD4004的录放音驱动,LED页面管理等等.从启动代码到操作系统的移植以及到业
💻 H
字号:
/*
 * FILENAME: nptcp.h
 *
 * Copyright 1997 - 2000 By InterNiche Technologies Inc. All rights reserved
 *
 * File to MAP TCP's Berserkly-isms into NetPort/InterNiche IP Stack.
 *
 * MODULE: TCP
 *
 *
 * PORTABLE: yes
 */

/* Additional Copyrights: */
/* Portions Copyright 1996 by NetPort Software. All rights reserved. */


#ifndef NPTCP_H
#define  NPTCP_H

#ifdef MINI_IP
#error This file not for Mini-IP use
#endif   /* MINI_IP */

#ifndef _IPPORT_H_
#error Include ipport.h before this file
#endif   /* missing IPPORT_H */

#define  NPPORT      1     /* flag for NetPort tcp port (not UNIX) */

extern   NET iproute(ip_addr, ip_addr*);  /* prototype netport routing */



/*
 * NetPort IP routine to get this machine's IP address relative to a 
 * destination IP address.
 */
extern   u_long ip_mymach(u_long ipaddr);

/* flag for NetPort port */
#define  NPPORT   1

/* pretend we are a UNIX kernel */
#define  KERNEL      1
#define  INET_KERNEL    1

/* Strange but true: just listing these here cuts 
 * out some bozo compiler warnings:
 */
/* (yaxon del) */
/*struct ip;*/
/*struct mbuf;*/
/*struct uio;*/

void  tcp_sleep(void *);
void  tcp_wakeup(void *);
void  np_stripoptions(struct ip * ti, struct mbuf * m);
int   in_broadcast(u_long ipaddr);     /* TRUE if ipaddr is broadcast */

unshort  tcp_cksum(struct ip * pip);


#ifdef TCP_ZEROCOPY  /* zero-copy sockets extensions */
struct socket;
void     tcp_data_upcall(struct socket *);   /* internal (invoke upcall) */
int      tcp_xout(long s, PACKET pkt);       /* send */
PACKET   tcp_pktalloc(int datasize);         /* get send buffer */
void     tcp_pktfree(PACKET p);
#endif

/* Berkeley style "Internet address" */

struct in_addr
{
   unsigned long  s_addr;
};

#define  INADDR_ANY     0L

#define  TCPIPHDRSZ     40

/* Berkeley style "Socket address" */

struct sockaddr_in
{
   short    sin_family;
   u_short  sin_port;
   struct   in_addr  sin_addr;
   char     sin_zero[8];
};

struct socket; /* predeclaration */

/* BSD sockets errors */

#ifndef SOCKERRORS_ALREADY    /* allow 3rd party override */

#define     ENOBUFS        1
#define     ETIMEDOUT      2
#define     EISCONN        3
#define     EOPNOTSUPP     4
#define     ECONNABORTED   5
#define     EWOULDBLOCK    6
#define     ECONNREFUSED   7
#define     ECONNRESET     8
#define     ENOTCONN       9
#define     EALREADY       10
#define     EINVAL         11
#define     EMSGSIZE       12
#define     EPIPE          13
#define     EDESTADDRREQ   14
#define     ESHUTDOWN      15
#define     ENOPROTOOPT    16
#define     EHAVEOOB       17
#define     ENOMEM         18
#define     EADDRNOTAVAIL  19
#define     EADDRINUSE     20
#define     EAFNOSUPPORT   21
#define     EINPROGRESS    22
#define     ELOWER         23    /* lower layer (IP) error */
#define     ENOTSOCK       24    /* Includes sockets which closed while blocked */
#define     EIEIO 27 /* bad input/output on Old Macdonald's farm :-) */

#ifdef   IP_MULTICAST
#define     ETOOMANYREFS   28
#endif   /* IP_MULTICAST */

#define     EFAULT         29
#define     ENETUNREACH    30

#endif   /* SOCKERRORS_ALREADY - end 3rd party override */

#ifndef NLONG_ALREADY 
typedef u_long n_long;
#endif
#ifndef NTIME_ALREADY 
typedef u_long n_time;
#endif
#ifndef UINT_ALREADY 
typedef u_long u_int;
#endif


#ifndef MIN
#define  MIN(a,b)    (a>b?b:a)
#define  MAX(a,b)    (a>b?a:b)
#endif

/* this can be used to supress arg checking on broken compilers */
#define  __P(x)   x

#define     IFNETHDR_SIZE     MaxLnh
#define     MAXOPTLEN      256   /* size of alloc for TCP options */

#define     PR_SLOWHZ   2  /* TCP ticks per second */
#define     PR_FASTHZ   5  /* 5 fast timeouts per second */

/* IPPROTO_... definitions, from BSD <netinet/in.h> */
#define     IPPROTO_IP     0  /* added for IP multicasting changes */
#define     IPPROTO_IGMP   2  /* added for IP multicasting changes */
#define     IPPROTO_TCP    6
#define     IPPROTO_UDP    17
#define     IPPROTO_RAW    255

#define     IPPORT_RESERVED      1024
#define     IPPORT_USERRESERVED     5000  /* more BSDness */
#define     INADDR_BROADCAST     0xffffffffl /* must be masked */

extern   struct inpcb * GetTcpcbList(void);

/* keep the INET_TRACE feature for later, define away for now. -JB- */
#define  INET_TRACE(flags, text);

/* map BSD-ish IP header names to netport structure */
#define  ip_ttl   ip_time

/* fake IP route structure */
struct route
{
   unshort  unused;  /* placeholder */
};

/* ip send routine for TCP layers */
extern   int   ip_output   __P ((struct mbuf *));

/* mbuf checksumming routine */
extern   u_short  in_cksum __P ((struct mbuf *, int));


#ifdef DO_TCPTRACE
#define  SETTP(tp,action)  tp=(action)
#else
#define  SETTP(tp,action)  (action)
#endif

extern   unshort  select_wait;

int      nptcp_init(void);       /* called from tcpinit(), calls tcp_init() */
int      tcp_stat(void * pio);   /* printf TCP MIB statistics */
int      mbuf_stat(void * pio);  /* printf mbuf pool statistics */
int      sock_list(void * pio);  /* list existing sockets */
void     tcp_tick(void);         /* TCP clock tick - for timers, etc */
int      udp_usrreq(struct socket * so, struct mbuf * m, struct mbuf * nam);

#ifdef IP_RAW
int      rawip_usrreq(struct socket * so, struct mbuf * m, struct mbuf * nam);
#endif /* IP_RAW */

int      tcp_bsdconnstat(void * pio);  /* BSD-ish TCP connection stats */
int      tcp_bsdsendstat(void * pio);  /* BSD-ish TCP send stats */
int      tcp_bsdrcvstat (void * pio);  /* BSD-ish TCP receive stats */

/* end of file nptcp.h */

#endif   /* NPTCP_H */


⌨️ 快捷键说明

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