#include #include #include #include #include #include #include #include #define LNSIZE 80 /* max length of an input line */ #define IFCOUNT 15 /* max number of interfaces per host */ #define BUFSIZE 4096 /* max size of a record */ #define MAXOBJECTS 10000 /* max number of objects in linked list */ /* contains all the interfaces for a single object */ /* only for machines with multiple interfaces, like firewalls or gateways. */ typedef struct interface { char ipaddr[LNSIZE]; /* IP address of interface */ char netmask[LNSIZE]; /* netmask of interface */ char ifname[LNSIZE]; /* interface name (if0, nf0:1, ... ) */ } interface; /* linked list structure to store all objects in objects.C */ typedef struct objlist { int objcount; /* object number */ char *group[LNSIZE]; /* stores objects of type 'group' */ char objname[LNSIZE]; /* host, network, or group name of object */ char type[LNSIZE]; /* contains type of object */ char ipaddr[LNSIZE]; /* IP address of object */ char netmask[LNSIZE]; /* netmask of object */ char gateways[LNSIZE]; /* gateway for this object */ char broadcast[LNSIZE]; /* broadcast for this object */ struct interface iface[IFCOUNT];/* dynamic array of all object's interfaces */ struct objlist *nodelink; /* pointer to next structure element */ } objlist; /* defines pointers to linked list of each individual entry of service */ objlist *ohead, *oprev, *opresent, *onext, *otail; void find_obj(char *objectsC); /* Allocate initial memory for the objects structure */ void initobjlist(void); /* print out one object found by calling dumpnet() */ void dumpnetobj(int verbose); /* determine if we are printing one object or all of them, as defined * by the -n argument */ void dumpnet(char *netname, int verbose); /* find the next object among the list */ void find_group(char *grpname); /* This routine parses the objects fed to it from the find_obj() * and breaks it into tokens to be inserted into linked list */ void parse_obj(FILE *fp, int objcount, char *objname); /* used to turn hostname/group into IP address and other information */ int resolv_dst(char *rule_dst); int resolv_svc(char *rule_svc); void dump_resolv(int verbose);