summaryrefslogtreecommitdiff
path: root/pcap-septel.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2013-05-30 06:41:26 +0000
committerXin LI <delphij@FreeBSD.org>2013-05-30 06:41:26 +0000
commit59ed76438047aa730b3a617abd873b84457fc4fd (patch)
treedcf9aa60c012e16ad8a4bb83641d382d572050f8 /pcap-septel.c
parent3ca61f8b14e648b24f10072d662c12fb35fc4b44 (diff)
downloadsrc-test2-59ed76438047aa730b3a617abd873b84457fc4fd.tar.gz
src-test2-59ed76438047aa730b3a617abd873b84457fc4fd.zip
Notes
Diffstat (limited to 'pcap-septel.c')
-rw-r--r--pcap-septel.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/pcap-septel.c b/pcap-septel.c
index 8cc2403ac7ff..e0be766f7cc4 100644
--- a/pcap-septel.c
+++ b/pcap-septel.c
@@ -38,23 +38,14 @@ static const char rcsid[] _U_ =
#include <sys/types.h>
#include <unistd.h>
-#ifdef HAVE_SEPTEL_API
#include <msg.h>
#include <ss7_inc.h>
#include <sysgct.h>
#include <pack.h>
#include <system.h>
-#endif /* HAVE_SEPTEL_API */
-#ifdef SEPTEL_ONLY
-/* This code is required when compiling for a Septel device only. */
#include "pcap-septel.h"
-/* Replace septel function names with pcap equivalent. */
-#define septel_create pcap_create
-#define septel_platform_finddevs pcap_platform_finddevs
-#endif /* SEPTEL_ONLY */
-
static int septel_setfilter(pcap_t *p, struct bpf_program *fp);
static int septel_stats(pcap_t *p, struct pcap_stat *ps);
static int septel_setnonblock(pcap_t *p, int nonblock, char *errbuf);
@@ -221,9 +212,23 @@ static pcap_t *septel_activate(pcap_t* handle) {
return 0;
}
-pcap_t *septel_create(const char *device, char *ebuf) {
+pcap_t *septel_create(const char *device, char *ebuf, int *is_ours) {
+ const char *cp;
pcap_t *p;
+ /* Does this look like the Septel device? */
+ cp = strrchr(device, '/');
+ if (cp == NULL)
+ cp = device;
+ if (strcmp(cp, "septel") != 0) {
+ /* Nope, it's not "septel" */
+ *is_ours = 0;
+ return NULL;
+ }
+
+ /* OK, it's probably ours. */
+ *is_ours = 1;
+
p = pcap_create_common(device, ebuf);
if (p == NULL)
return NULL;
@@ -243,7 +248,7 @@ static int septel_stats(pcap_t *p, struct pcap_stat *ps) {
int
-septel_platform_finddevs(pcap_if_t **devlistp, char *errbuf)
+septel_findalldevs(pcap_if_t **devlistp, char *errbuf)
{
unsigned char *p;
const char description[512]= "Intel/Septel device";