summaryrefslogtreecommitdiff
path: root/pcap-septel.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap-septel.c')
-rw-r--r--pcap-septel.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/pcap-septel.c b/pcap-septel.c
index 2f0ff33beb7e..88dc89df62dc 100644
--- a/pcap-septel.c
+++ b/pcap-septel.c
@@ -194,9 +194,9 @@ septel_inject(pcap_t *handle, const void *buf _U_, size_t size _U_)
* See also pcap(3).
*/
static pcap_t *septel_activate(pcap_t* handle) {
- /* Initialize some components of the pcap structure. */
+ /* Initialize some components of the pcap structure. */
handle->linktype = DLT_MTP2;
-
+
handle->bufsize = 0;
/*
@@ -232,7 +232,7 @@ pcap_t *septel_create(const char *device, char *ebuf, int *is_ours) {
/* OK, it's probably ours. */
*is_ours = 1;
- p = pcap_create_common(device, ebuf, sizeof (struct pcap_septel));
+ p = pcap_create_common(ebuf, sizeof (struct pcap_septel));
if (p == NULL)
return NULL;
@@ -244,9 +244,9 @@ static int septel_stats(pcap_t *p, struct pcap_stat *ps) {
struct pcap_septel *handlep = p->priv;
/*handlep->stat.ps_recv = 0;*/
/*handlep->stat.ps_drop = 0;*/
-
+
*ps = handlep->stat;
-
+
return 0;
}
@@ -276,7 +276,7 @@ static int septel_setfilter(pcap_t *p, struct bpf_program *fp) {
/* Make our private copy of the filter */
if (install_bpf_program(p, fp) < 0) {
- snprintf(p->errbuf, sizeof(p->errbuf),
+ pcap_snprintf(p->errbuf, sizeof(p->errbuf),
"malloc: %s", pcap_strerror(errno));
return -1;
}
@@ -291,3 +291,31 @@ septel_setnonblock(pcap_t *p, int nonblock, char *errbuf)
fprintf(errbuf, PCAP_ERRBUF_SIZE, "Non-blocking mode not supported on Septel devices");
return (-1);
}
+
+#ifdef SEPTEL_ONLY
+/*
+ * This libpcap build supports only Septel cards, not regular network
+ * interfaces.
+ */
+
+/*
+ * There are no regular interfaces, just Septel interfaces.
+ */
+int
+pcap_platform_finddevs(pcap_if_t **alldevsp, char *errbuf)
+{
+ *alldevsp = NULL;
+ return (0);
+}
+
+/*
+ * Attempts to open a regular interface fail.
+ */
+pcap_t *
+pcap_create_interface(const char *device, char *errbuf)
+{
+ pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+ "This version of libpcap only supports Septel cards");
+ return (NULL);
+}
+#endif