#define SFAT_ERROR -1
#define SFAT_BUFSZ 1024
-typedef enum
+enum ServiceClient
{
ATTRIBUTE_SERVICE,
ATTRIBUTE_CLIENT
-} ServiceClient;
+};
#define APPLICATION_ENTRY_PORT 0x01
#define APPLICATION_ENTRY_IPPROTO 0x02
#define APPLICATION_ENTRY_APPLICATION 0x08
#define APPLICATION_ENTRY_VERSION 0x10
-typedef struct _ApplicationEntry
+struct ApplicationEntry
{
- struct _ApplicationEntry* next;
+ ApplicationEntry* next;
uint16_t port;
uint16_t ipproto;
uint16_t protocol;
uint8_t fields;
-} ApplicationEntry;
-
-typedef ApplicationEntry ApplicationList;
+};
#define HOST_INFO_OS 1
#define HOST_INFO_VENDOR 2
{
sfip_t ipAddr;
HostInfo hostInfo;
- ApplicationList* services;
- ApplicationList* clients;
+ ApplicationEntry* services;
+ ApplicationEntry* clients;
};
int SFAT_AddHost(HostAttributeEntry*);
HostAttributeEntry* SFAT_CreateHostEntry(void);
ApplicationEntry* SFAT_CreateApplicationEntry(void);
-#endif /* SFTARGET_DATA_H */
+#endif
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//--------------------------------------------------------------------------
-/*
- * Author: Steven Sturges
- * sftarget_hostentry.c
- */
+// sftarget_hostentry.c author Steven Sturges
#include "sftarget_hostentry.h"
-int hasService(const HostAttributeEntry* host_entry,
- int ipprotocol,
- int protocol,
- int application)
+#if 0
+static bool hasService(const HostAttributeEntry* host_entry,
+ int ipprotocol, int protocol, int application)
{
ApplicationEntry* service;
if (!host_entry)
- return SFTARGET_NOMATCH;
+ return false;
for (service = host_entry->services; service; service = service->next)
{
{
if (!application)
{
- /* match of ipproto, proto.
- * application not speicifed */
- return SFTARGET_MATCH;
+ /* match of ipproto, proto. application not speicifed */
+ return true;
}
}
else if (!protocol)
{
- /* match of ipproto.
- * protocol not speicifed */
- return SFTARGET_MATCH;
+ /* match of ipproto. protocol not speicifed */
+ return true;
}
}
/* No ipprotocol specified, huh? */
}
- return SFTARGET_NOMATCH;
+ return false;
}
-int hasClient(const HostAttributeEntry* host_entry,
- int ipprotocol,
- int protocol,
- int application)
+static bool hasClient(const HostAttributeEntry* host_entry,
+ int ipprotocol, int protocol, int application)
{
ApplicationEntry* client;
if (!host_entry)
- return SFTARGET_NOMATCH;
+ return false;
for (client = host_entry->clients; client; client = client->next)
{
{
if (!application)
{
- /* match of ipproto, proto.
- * application not speicifed */
- return SFTARGET_MATCH;
+ /* match of ipproto, proto. application not speicifed */
+ return true;
}
}
else if (!protocol)
{
- /* match of ipproto.
- * protocol not speicifed */
- return SFTARGET_MATCH;
+ /* match of ipproto. protocol not speicifed */
+ return true;
}
}
/* No ipprotocol specified, huh? */
}
- return SFTARGET_NOMATCH;
-}
-
-int hasProtocol(const HostAttributeEntry* host_entry,
- int ipprotocol,
- int protocol,
- int application)
-{
- int ret = SFTARGET_NOMATCH;
-
- ret = hasService(host_entry, ipprotocol, protocol, application);
- if (ret == SFTARGET_MATCH)
- return ret;
-
- ret = hasClient(host_entry, ipprotocol, protocol, application);
- if (ret == SFTARGET_MATCH)
- return ret;
-
- return ret;
+ return false;
}
-uint16_t getFragPolicy(const HostAttributeEntry* host_entry)
+bool hasProtocol(const HostAttributeEntry* host_entry,
+ int ipprotocol, int protocol, int application)
{
- if (!host_entry)
- return SFAT_UNKNOWN_FRAG_POLICY;
+ if ( hasService(host_entry, ipprotocol, protocol, application) )
+ return true;
- return host_entry->hostInfo.fragPolicy;
-}
-
-uint16_t getStreamPolicy(const HostAttributeEntry* host_entry)
-{
- if (!host_entry)
- return SFAT_UNKNOWN_STREAM_POLICY;
+ if ( hasClient(host_entry, ipprotocol, protocol, application) )
+ return true;
- return host_entry->hostInfo.streamPolicy;
+ return false;
}
+#endif
int getApplicationProtocolId(const HostAttributeEntry* host_entry,
int ipprotocol,
#include "target_based/sftarget_reader.h"
#include "target_based/sftarget_data.h"
-#define SFTARGET_MATCH 1
-#define SFTARGET_NOMATCH 0
-
/* API for HostAttributeEntry 'class' */
-// FIXIT-L used locally only
-int hasService(const HostAttributeEntry* hostEntry,
- int ipprotocol,
- int protocol,
- int application);
-
-// FIXIT-L used locally only
-int hasClient(const HostAttributeEntry* hostEntry,
- int ipprotocol,
- int protocol,
- int application);
-
-// FIXIT-L not used anywhere
-int hasProtocol(const HostAttributeEntry* hostEntry,
- int ipprotocol,
- int protocol,
- int application);
-
-// FIXIT-L not used anywhere
-int getProtocol(const HostAttributeEntry* hostEntry,
- int ipprotocol,
- uint16_t port);
-
-int getApplicationProtocolId(const HostAttributeEntry* host_entry,
- int ipprotocol,
- uint16_t port,
- char direction);
+#if 0
+bool hasProtocol(const HostAttributeEntry*, int ipprotocol, int protocol, int application);
+#endif
-// FIXIT-L not used anywhere
-#define SFAT_UNKNOWN_STREAM_POLICY 0
-uint16_t getStreamPolicy(const HostAttributeEntry* host_entry);
-#define SFAT_UNKNOWN_FRAG_POLICY 0
-uint16_t getFragPolicy(const HostAttributeEntry* host_entry);
+int getApplicationProtocolId(
+ const HostAttributeEntry*, int ipprotocol, uint16_t port, char direction);
#endif