SNMP Subagent Programmer's Guide

Static Directory Program
2-40 119728—SNMP Subagent Programmer’s Guide
Programming Tutorials
Example 2-7. Static Directory Include File dirH
#ifndef DIRH
#define DIRH
#include "smitypeH"
#include "syspubH"
...
/*The data structures that model the group that contains the table
*are linked up as follows:
* +-----------+
* | directory |
* +-----------+
* |
* v
* +------+ +------+ +------+
* | file |---->| file |---->| file |----> NULL
* +------+ +------+ +------+
*/
struct directory { <--
10
DisplayString dir_name;
struct file_entry *files;
};
struct file_entry
{
DisplayString file_name;
struct file_entry *next;
};
/*
* function prototypes
/*
void build_files(struct directory *dir); <--
11
int comp_files(DisplayString *f1,
DisplayString *f2);
void free_files(struct file_entry *files);
void *safe_malloc(int size);
...