Changes between Version 1 and Version 2 of Packages/SNMP


Ignore:
Timestamp:
Dec 1, 2005, 2:42:33 PM (14 years ago)
Author:
ChrisJohns
Comment:

Updated the info.

Legend:

Unmodified
Added
Removed
Modified
  • Packages/SNMP

    v1 v2  
    11= SNMP =
    22
     3= NetSNMP =
    34
    4 !!! NetSNMP
    55
    6 The NetSNMP package can be used with RTEMS to provide a full agent implementation. The NetSNMP project can be found at the following link -
     6The NetSNMP package can be used with RTEMS to provide a full agent implementation. The NetSNMP project can be found at the following link
    77
    88  http://net-snmp.sourceforge.net/
    99
    1010NetSNMP implements the V1, V2 and V3 versions of the protocol which can be accessed through the SNMP library API. The package also implements a full agent and included in the agent is a MIB-II standard mib. RTEMS used the FreeBSD networking stack and part of this is the ''sysctl'' interface. NetSNMP can use this interface to obtain data about interfaces and networking stack.
     11= Building NetSNMP =
    1112
    12 !! Building NetSNMP
    1313
    1414These instruction have been tested using RTEMS 4.6.x for the M68K Coldfire processor.
     
    2828
    2929I have only tested v1 and V2.
     30= Starting NetSNMP =
    3031
    31 !! Starting NetSNMP
     32
     33The NetSNMP agent runs as a single task under RTEMS. The agents main is compiled specifically for RTEMS and is involked by calling the function:
     34
     35  int snmpd_init (rtems_task_priority priority, char* cmdline);
     36
     37The command line is the documented in the snmpd man page ([http://net-snmp.sourceforge.net/docs/man/snmpd.html]). Select the priority that suites your application. SNMP will use your processing resources and as it is typically used for monitoring a priority lower than your important real-time tasks as well as the networking stack is recommended.
     38
     39This document will refer to snmpd as the NetSNMP agent running as an RTEMS task.
     40
     41The NetSNMP uses a number of files. The most important of these is the /etc/snmpd.conf. You need to arrange to have this file created before you start snmpd. Many ways exist in RTEMS to create this file. For example code to write the file, coping directly from non-volatile storage to the IFMS, reading from a disk drive, or using the untar call.
     42
     43The standard NetSNMP configure script creates a list of modules that the agent supports. The modules active when snmpd is running is controlled by command line options. This makes sense on a Unix or Windows host. Here you build into the agent all that is supported by the host and the system administrator enables what is needed. On an embedded system this approach results in an executable that is much larger than required. To keep the image size to what you need a function called by the agent that specifies the list of agent modules you require needs to be provided. An RTEMS application may look like:
     44
     45 #include <stdio.h>
     46 #include <rtems.h>
     47 #include <rtems/untar.h>
     48 /**
     49  * NetSNMP MIBS.
     50  */
     51 void init_system_mib();
     52 void init_sysORTable();
     53 void init_at();
     54 void init_interfaces();
     55 void init_snmp_mib();
     56 void init_tcp();
     57 void init_icmp();
     58 void init_ip();
     59 void init_udp();
     60 void init_vacm_vars();
     61 void init_setSerialNo();
     62 void init_snmpEngine();
     63 void init_snmpMPDStats();
     64 void init_usmStats();
     65 void init_usmUser();
     66 void init_snmpNotifyTable();
     67 void init_snmpNotifyFilterTable();
     68 void init_snmpNotifyFilterProfileTable();
     69 void init_snmpTargetAddrEntry();
     70 void init_snmpTargetParamsEntry();
     71 void init_target_counters();
     72 void init_nsTransactionTable();
     73 void init_nsModuleTable();
     74 void init_override();
     75 void init_var_route();
     76 void init_vacm_context();
     77 void init_mib_modules ();
     78 int  snmpd_init (rtems_task_priority priority, char* cmdline);
     79 /* 
     80  * These are created by the linker when linking a binary file.
     81  */
     82 extern int _binary_net_snmp_files_tar_start;
     83 extern int _binary_net_snmp_files_tar_size;
     84 /*
     85  * We need to supply this function. It is call by the
     86  * the snmpd agent. List the modules we need. They will
     87  * be linked from the NetSNMP library.
     88  */
     89 void init_mib_modules ()
     90 {   
     91   init_system_mib();
     92   init_sysORTable();
     93   init_at();
     94   init_interfaces();
     95   init_snmp_mib();
     96   init_tcp();
     97   init_icmp();
     98   init_ip();
     99   init_udp();
     100 #if FOR_V3_ENABLE_THESE
     101   init_vacm_vars();
     102   init_setSerialNo();
     103   init_snmpEngine();
     104   init_snmpMPDStats();
     105   init_usmStats();
     106   init_usmUser();
     107   init_snmpNotifyTable();
     108   init_snmpNotifyFilterTable();
     109   init_snmpNotifyFilterProfileTable();
     110   init_snmpTargetAddrEntry();
     111   init_snmpTargetParamsEntry();
     112   init_target_counters();
     113   init_nsTransactionTable();
     114   init_nsModuleTable();
     115   init_override();
     116   init_var_route();
     117   init_vacm_context();
     118 #endif
     119 }
     120 /**
     121  * Main line.
     122  */
     123 int Init ()
     124 {
     125   /*
     126    * Place the snmpd files into the IMFS.
     127    */
     128   Untar_FromMemory ((unsigned char *) (&_binary_net_snmp_files_tar_start),
     129                     (int) &_binary_net_snmp_files_tar_size);
     130   /*
     131    * Start the BSD TCP/IP stack.
     132    */
     133   rtems_bsdnet_initialize_network ();
     134   /*
     135    * Start the Net SNMP server.
     136    */
     137   if (!snmpd_init (150, "-f -L"))
     138   {
     139     printf ("Net SNMP did not start\n")
     140    return 1;
     141   } 
     142   rtems_task_delete (RTEMS_SELF);
     143 }