Chapter 9, Developing SMUX peers for SNMP agents
Global declarations

Global declarations

Next, your peer program will have to declare this global variable in the foomib.c file:

    char   *myname = "foosmuxd";
replacing the string ``foo'' with the identifying string you chose for your peer.

Now, for each MIB module managed by this peer, put one entry in the triples[] table. In this example, there is only the one foo MIB module for the sake of simplicity. init_foo and sync_foo are functions implemented in this file for the foo MIB module.

    int init_foo(), sync_foo();

struct triple triples[] = { {"foo", NULL, readWrite, init_foo, sync_foo}, {NULL} };

Then, for each single instance leaf object in your MIB, create a variable with the same name. Use the appropriate C data type. If the variable is read-write, also make a ``new_name'' variable of the same data type. The ``new_name'' is used by the SMUX peer to implement an SMUX ``commit'' or ``rollback'' SOutPDU.
   static char             *productName;
   static int              boardStatus;
   static int              new_boardStatus;
   static struct in_addr	exampleIpAddr;
   static struct in_addr	new_exampleIpAddr;
   static int	        newflag_exampleIpAddr;
   static OID              exampleObjectID;
   static OID              new_exampleObjectID;
   static int              numberLines;
Next, create a structure for each table in your MIB. For each element of the structure use the same name as in the MIB. Use the appropriate C data type. If the variable is read-write, also make a ``new_name'' variable of the same data type. The ``new_name'' is used by the peer to implement an SMUX ``commit'' or ``rollback'' SOutPDU.
    struct sltable {
  	 int             serialLineNumber;
  	 int             serialLineBaudRate;
  	 int             new_serialLineBaudRate;
  	 char            serialLineTermLocation[LOCATIONSIZE];
  	 char            new_serialLineTermLocation[LOCATIONSIZE];
  	 int             newflag_serialLineTermLocation;
    }                serialLineTable[MAXTABLESIZE];