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

📄 ni_ppp.h

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的操作系统pSOS。包括全部源码
💻 H
字号:
/************************************************************************//*                                                                      *//*   MODULE:  ni_ppp.h                                                  *//*   PRODUCT: pNA+,  OpEN TCP/IP PPP driver                             *//*   PURPOSE: Network Interface module                                  *//*   DATE:    28 February, 1996                                         *//*                                                                      *//*----------------------------------------------------------------------*//*                                                                      *//*              Copyright 1996, Integrated Systems, Inc.                *//*                      ALL RIGHTS RESERVED                             *//*                                                                      *//*   Permission is hereby granted to licensees of Integrated Systems,   *//*   Inc. products to use or abstract this computer program for the     *//*   sole purpose of implementing a product based on Integrated         *//*   Systems, Inc. products.   No other rights to reproduce, use,       *//*   or disseminate this computer program, whether in part or in        *//*   whole, are granted.                                                *//*                                                                      *//*   Integrated Systems, Inc. makes no representation or warranties     *//*   with respect to the performance of this computer program, and      *//*   specifically disclaims any responsibility for any damages,         *//*   special or consequential, connected with the use of this program.  *//*                                                                      *//************************************************************************/#ifndef __NI_PPP_H__#define __NI_PPP_H__#include <string.h>#include "ppp.h"#include "compress.h"/*----------------------------------------------------------------------*//* Per channel control block                                            *//*----------------------------------------------------------------------*/struct ppp_pccb{    unsigned long ifno;         /* Ni number for the channel */    unsigned long usrmtu;       /* User configured MTU size */    mib_stat mibstat;           /* MIB statistics */    struct ni_funcs nifuncs;    /* NI funcs passed from above */    unsigned long pppstatus;    /* status of the PPP channel */    unsigned long linkstatus;   /* dialing state */    unsigned long ppperrno;     /* Error number for the channel */    int (*announce_packet)();   /* Announce packet entry  */    mblk_t *outputQ;            /* output queue */    long flags;         /* flags */};#define PPP_CANON_MODE       0x1 /* Link in canonical mode */#define PPP_ANNOUNCE_FLAG    0x2 /* Announce the packet up */struct  ppp_control_info {    u_int pci_flags;#define PCI_FLAGS_VJCOMP    0x1      /* VJ compression */#define PCI_FLAGS_CID       0x2      /* Cid compressed */#define PCI_FLAGS_COMPPROT  0x4      /* protocol field compression */#define PCI_FLAGS_COMPAC    0x8      /* a/c fields compresion */    struct slcompress pci_comp;          /* VJ TCP/IP header compression */};typedef struct ppp_control_info   PCI;/*----------------------------------------------------------------------*//* PPP specific ioctl's                                                 *//*----------------------------------------------------------------------*/struct ppp_ioctl{    long pi_ifno;    union     {        unsigned long   status;        struct ppp_cfg  *pcp;    } pi_u;#define pi_status pi_u.status#define pi_cfg    pi_u.pcp };/*  * Ioctls definitions for PPP NI */#define SIOCGPPPSTATUS  0xC0146999  /* get PPP status */#define SIOCSPPPSTATUS  0x80146999  /* set PPP status */#define SIOCGPPPCFG     0xC0146998  /* get PPP configuration */#define SIOCSPPPCFG     0x80146998  /* set PPP configuration */#define SIOCSPPPINIT    0x80146997  /* Re-Initialize PPP driver */#define SIOCGPPPLINKSTATUS 0xC0146996 /* Get dial status of the line *//* * SIFUP - Config the interface up. */#define SIFUP(u)        { \    struct ifreq ifr; \    ifr.ifr_ifno = PPPpccb[u].ifno; \    if (ioctl(pppsocket, SIOCGIFFLAGS, (char *) &ifr) < 0) { \        syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %x", errno); \        quit(); \    } \    ifr.ifr_flags |= IFF_UP; \    if (ioctl(pppsocket, SIOCSIFFLAGS, (char *) &ifr) < 0) { \        syslog(LOG_ERR, "ioctl(SIOCSIFFLAGS): %x", errno); \        quit(); \    } }/* * SIFDOWN - Config the interface down. */#define SIFDOWN(u)      { \    struct ifreq ifr; \    if (pppcfgtab[u].dialmode != PPP_DEMANDDIAL) { \    ifr.ifr_ifno = PPPpccb[u].ifno; \        if (ioctl(pppsocket, SIOCGIFFLAGS, (char *) &ifr) < 0) { \            syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %x", errno); \            quit(); \        } \        ifr.ifr_flags &= ~IFF_UP; \        if (ioctl(pppsocket, SIOCSIFFLAGS, (char *) &ifr) < 0) { \            syslog(LOG_ERR, "ioctl(SIOCSIFFLAGS): %x", errno); \            quit(); \     } \    } \}/* * SIFMTU - Config the interface MTU. */#ifndef ifr_mtu#define ifr_mtu ifr_metric#endif#define SIFMTU(u, m)    { \    struct ifreq ifr; \    ifr.ifr_ifno = PPPpccb[u].ifno; \    ifr.ifr_mtu = m; \    if (ioctl(pppsocket, SIOCSIFMTU, (char *) &ifr) < 0) { \        syslog(LOG_ERR, "ioctl(SIOCSIFMTU): %x", errno); \        quit(); \    } }/* * GIFMTU - Obtain interface MTU */#ifndef ifr_mtu#define ifr_mtu ifr_metric#endif#define GIFMTU(u, m)    { \    struct ifreq ifr; \    ifr.ifr_ifno = PPPpccb[u].ifno; \    ifr.ifr_mtu = m; \    if (ioctl(pppsocket, SIOCGIFMTU, (char *) &ifr) < 0) { \        syslog(LOG_ERR, "ioctl(SIOCGIFMTU): %x", errno); \        quit(); \    } }/* * SIFADDR - Config the interface IP addresses. */#define SIFADDR(u, o, h)        { \    struct ifreq ifr; \    ifr.ifr_ifno = PPPpccb[u].ifno; \    bzero((char *) &ifr.ifr_addr, sizeof(ifr.ifr_addr));  \    ifr.ifr_addr.sa_family = AF_INET; \    ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr = o; \    if (ioctl(pppsocket, SIOCSIFADDR, (char *) &ifr) < 0) { \        syslog(LOG_ERR, "ioctl(SIOCSIFADDR): %x", errno); \    } \    ((struct sockaddr_in *) &ifr.ifr_dstaddr)->sin_addr.s_addr = h; \    if (ioctl(pppsocket, SIOCSIFDSTADDR, (char *) &ifr) < 0) { \        syslog(LOG_ERR, "ioctl(SIOCSIFDSTADDR): %x", errno); \        quit(); \    } }/* * SIFMASK - Config the interface net mask */#define SIFMASK(u, m)   { \    struct ifreq ifr; \    ifr.ifr_ifno = PPPpccb[u].ifno; \    bzero((char *) &ifr.ifr_addr, sizeof(ifr.ifr_addr));  \    ifr.ifr_addr.sa_family = AF_INET; \    ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr = m; \    if (ioctl(pppsocket, SIOCSIFNETMASK, (char *) &ifr) < 0) { \        syslog(LOG_ERR, "ioctl(SIOCSIFADDR): %x", errno); \    } }/* * SIFACCOMPRESSION - Config the interface for address/control compression. */#define SIFACCOMPRESSION(u, err)        { pc->pci_flags |= PCI_FLAGS_COMPAC;}/* * CIFACCOMPRESSION - Config the interface for no address/control compression. */#define CIFACCOMPRESSION(u, err)        { pc->pci_flags &= ~PCI_FLAGS_COMPAC;}/* * CIFPCOMPRESSION - Config the interface for no protocol compression. */#define CIFPCOMPRESSION(u, err) { pc->pci_flags &= ~PCI_FLAGS_COMPPROT; }#define SIFASYNCMAP(u, a, err)  { pa->pai_asyncmap = a; }/* * SIFPCOMPRESSION - Config the interface for protocol compression. */#define SIFPCOMPRESSION(u, err) { pc->pci_flags |= PCI_FLAGS_COMPPROT; }/* * CIFADDR - Clear the interface IP addresses. */extern struct ppp_cfg pppcfgtab[];#define CIFADDR(u, o, h)        { \    struct rtentry rt; \    if (!pppcfgtab[u].dialmode) { \        bzero((char *) &rt.rt_dst, sizeof(rt.rt_dst));  \        rt.rt_dst.sa_family = AF_INET; \        ((struct sockaddr_in *) &rt.rt_dst)->sin_addr.s_addr = h; \        bzero((char *) &rt.rt_gateway, sizeof(rt.rt_gateway));  \        rt.rt_gateway.sa_family = AF_INET; \        ((struct sockaddr_in *) &rt.rt_gateway)->sin_addr.s_addr = o; \        rt.rt_flags |= RTF_HOST; \        if (ioctl(pppsocket, SIOCDELRT, (char *) &rt) < 0) { \            syslog(LOG_ERR, "ioctl(SIOCDELRT): %x", errno); \            quit(); \    } } }/*----------------------------------------------------------------------*//* prototypes - some are defined in ni_slip.c, some in async.c          *//*----------------------------------------------------------------------*/extern void ip_input(u_char *p, u_long len, char *arg, unsigned long unit);extern int ppp_queue_output(int, mblk_t *);extern int ppp_output(int);#endif /* __NI_PPP_H__ */

⌨️ 快捷键说明

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