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

📄 allports.c

📁 在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LEA_4S的驱动,位置速寻算法,语音芯片ISD4004的录放音驱动,LED页面管理等等.从启动代码到操作系统的移植以及到业
💻 C
📖 第 1 页 / 共 2 页
字号:

#ifdef IN_MENUS
   Printu_Net(prompt);
#endif

#ifdef UDPSTEST
   e=udp_echo_init();
   if ( e == SUCCESS )
   {
      exit_hook(udp_echo_cleanup);
   }
   else
      dprintf("Error %d starting UDP Echo server.\n",e);
#endif

#ifdef RIP_SUPPORT
   e=rip_init();
   if ( e == SUCCESS )
   {
      exit_hook(rip_cleanup);
   }
   else
      dprintf("Error %d starting RIP server.\n",e);
#endif

#if (defined(INCLUDE_SNMPV1) || defined(INCLUDE_SNMPV2C))
   e = snmp_init();
   if (e)
   {
      dprintf("Error %d initializing SNMP agent.\n",e);
   }
#endif   /* INCLUDE_SNMPV1 || INCLUDE_SNMPV2C */

#ifdef INCLUDE_SNMPV3
   e=v3_init();
   if ( e == SUCCESS )
   {
      exit_hook(v3_cleanup);
   }
   else
      dprintf("Error %d starting SNMPv3 agent.\n",e);
#endif

#ifdef FTP_CLIENT
   fc_callback=ftpc_callback;
#endif

/* The following initializations take place when SUPERLOOP is enabled.
 * Otherwise they would be done in the respective task.
 */

#ifdef SUPERLOOP

#ifdef WEBPORT
   e = http_init(); /* start up http server */
   if (e)
      dprintf("Error %d starting HTTP server.\n",e);
#endif   /* WEBPORT */

#ifdef FTP_SERVER
   e = ftps_init();
   if ( e == SUCCESS )
   {
      exit_hook(ftps_cleanup);
   }
   else
      dprintf("Error %d starting FTP server.\n",e);
#endif   /* FTP_SERVER */

#ifdef TELNET_SVR
   e=tel_init();
   if ( e == SUCCESS )
   {
      exit_hook(tel_cleanup);
   }
   else
      dprintf("Error %d starting TELNET server.\n",e);
#endif

#ifdef TCP_ECHOTEST
   e=tcp_echo_init();
   if ( e == SUCCESS )
   {
      exit_hook(tcp_echo_cleanup);
   }
   else
      dprintf("Error %d starting TCP Echo server.\n",e);
#endif
#endif   /* SUPERLOOP */

   USE_ARG(e);    /* Avoid compiler warnings */
   USE_ARG(i);

} /* end of netmain_init() */


#ifdef FULL_ICMP
char * icmpdu_types[] = {
   "NET",
   "HOST",
   "PROT",
   "PORT",
   "FRAG",
   "SRC",
};

/* FUNCTION: imcp_port_du()
 *
 * PARAM1: void * pio
 *
 * RETURNS: 
 */

void
icmp_port_du(PACKET p, struct destun * pdp)
{
   dprintf("got ICMP %s UNREACHABLE from %s\n", 
      icmpdu_types[pdp->dtype], print_ipad(p->fhost) );
   dprintf(prompt);
}
#endif   /* FULL_ICMP */



/* FUNCTION: station_state()
 *
 * state() - printf some info about the current state of the user 
 * settable station variables. 
 * 
 * PARAM1: void * pio
 *
 * RETURNS: 
 */

int
station_state(void * pio)
{
   int i;
   
#ifndef NO_INET_STACK
   NET ifp;

   for (i = 0, ifp = (NET)netlist.q_head; ifp; ifp = ifp->n_next, i++)
   {
      ns_printf(pio, "iface %d-%s IP addr:%s  ", 
       i, ifp->name, print_ipad(ifp->n_ipaddr) );
      ns_printf(pio, "subnet:%s  ", print_ipad(ifp->snmask) );
      ns_printf(pio, "gateway:%s\n", print_ipad(ifp->n_defgw) );
   }
#endif   /* NO_INET_STACK */

   ns_printf(pio, "current tick count %lu\n", cticks);
#ifdef PING_APP
   ns_printf(pio, "ping delay time:  %u ms.\n", pingdelay*56);
   ns_printf(pio, "ping host:        %s\n", print_ipad(activehost));
#endif

#ifdef USE_MODEM
   ns_printf(pio, "current dialout number is %s\n", mdm_dial_string);
#endif   /* USE_MODEM */

#ifdef USE_PPP
   ns_printf(pio, "current dial-in user name is %s\n", pppcfg.username);
   ns_printf(pio, "current dial-in password is %s\n", pppcfg.password);
#endif   /* USE_PPP */

   task_stats(pio);

   return 0;
}

#ifdef FTP_CLIENT
/* If FC_USECALLBACK is enabled in ftpclnt.h, and if fc_callback 
 * is defined, then FTP Client will call fc_callback when 
 * its state changes. FC_USECALLBACK is enabled by default. 
 */

void ftpc_callback(void *fc,int logstate, int cmdstate)
{
   /*
   dprintf("logstate=%d, cmdstate=%d\n",logstate,cmdstate);
   */

   USE_VOID(fc);
   USE_ARG(logstate);
   USE_ARG(cmdstate);
}

#endif 


#ifndef NO_INET_STACK   /* these functions are pretty stack-centric */


/* FUNCTION: sysuptime()
 * 
 * sysuptime() - return MIB-2 sys group compatable "sysUptime" value
 *
 * PARAM1: 
 *
 * RETURNS: 
 */

unsigned long
sysuptime()
{
   return ((cticks/TPS)*100);    /* 100ths of a sec since boot time */
}


/* FUNCTION: packet_check() - check for incoming packet 
 * Process incoming packets.
 *
 * inside_pktdemux is nonzero while processing a received packet. 
 * It is used for reentrancy protection. 
 *
 * PARAM1: 
 *
 * RETURNS: 
 */


static int inside_pktdemux = 0; 

void
packet_check(void)
{
   if(inside_pktdemux != 0)   /* check re-entrancy flag */
      return;           /* do not re-enter pktdemux(), packet will wait... */
   inside_pktdemux++;   /* set re-entrany flag */
   pktdemux();          /* process low level packet input */
   inside_pktdemux--;   /* clear re-entrany flag */
}

#ifdef IP_MULTICAST
/* This is a dummy routine that is replaced by the porting engineer with
 * a routine by the same name in the Ethernet driver.  The purpose of this
 * routine is to convert IP multicast addresses to their Ethernet multicast
 * addresses and program the chip with the appropriate Ethernet multicast
 * filters.  In the case of PPP, this dummy routine can be used.
 */


/* FUNCTION: mcastlist()
 * 
 * PARAM1: struct in_multi *multi_ptr
 *
 * RETURNS: 
 */

int
mcastlist(struct in_multi * multi_ptr)
{
   USE_ARG(multi_ptr);

   return 0;
}
#endif   /* IP_MULTICAST */

/********* For Superloop AND Netmain builds *********************/

#ifdef USE_PPP
extern   int   ppp_setup(void);
#endif   /* USE_PPP */

#ifdef USE_MODEM
extern   int   prep_modem(void);
#endif   /* USE_MODEM */

int prep_modules(void)
{
int e = 0;

#ifdef USE_PPP
   e = ppp_setup();
   if (e != 0)
   {
      dprintf("PPP Module setup failed\n");
      panic("prep_modules");
   }
#endif   /* USE_PPP */

#ifdef USE_MODEM
   e = prep_modem();
   if (e != 0)
   {
      dprintf("Modem Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* USE_MODEM */

#ifdef TELNET_SVR
   e = prep_telnet();
   if (e != 0)
   {
      dprintf("Telnet Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* TELNET_SVR */

#ifdef DHCP_SERVER
   e = prep_dhcpsrv();
   if (e != 0)
   {
      dprintf("DHCP Server Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* DHCP_SERVER */

#ifdef NATRT
   e = prep_natrt();
   if (e != 0)
   {
      dprintf("Nat Router Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* NATRT */

#ifdef RIP_SUPPORT
   e = prep_rip();
   if (e != 0)
   {
      dprintf("Rip Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* RIP_SUPPORT */

#ifdef INCLUDE_SNMP
   e = prep_snmp();
   if (e != 0)
   {
      dprintf("SNMP Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* INCLUDE_SNMP */

#ifdef SMTP_ALERTS
   e = prep_smtp();
   if (e != 0)
   {
      dprintf("SMTP Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* SMTP_ALERTS */

#ifdef VFS_FILES
   e = prep_vfs();
   if (e != 0)
   {
      dprintf("VFS Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* VFS_FILES */


#ifdef FTP_CLIENT
   e = prep_ftpc();
   if (e != 0)
   {
      dprintf("FTP Client Module prep failed\n");
      panic("prep_modules");
   }
#endif   /* FTP_CLIENT */

   return 0;
}

#endif   /* NO_INET_STACK */

⌨️ 快捷键说明

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