aboutsummaryrefslogtreecommitdiffstats
path: root/caputils
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2015-02-13 13:43:32 -0500
committerBill Meier <wmeier@newsguy.com>2015-02-13 18:45:23 +0000
commit6040bcd5f8b83c3ba4d1cd96730bb695a232e75d (patch)
treecbb0e767937b71a5ce11ee184a7ba000cfa31598 /caputils
parent82f081dd64d6d193f23716a388b9c45f90431454 (diff)
caputils/*.c: As needed: Add editor modelines & Fix indentation
Change-Id: I081446fbbc242c01f8ac9dede575c3ea77421c42 Reviewed-on: https://code.wireshark.org/review/7103 Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'caputils')
-rw-r--r--caputils/capture-pcap-util-unix.c61
-rw-r--r--caputils/capture-pcap-util.c85
-rw-r--r--caputils/capture-wpcap.c137
-rw-r--r--caputils/capture_win_ifnames.c12
-rw-r--r--caputils/iface_monitor.c17
-rw-r--r--caputils/ws80211_utils.c13
6 files changed, 201 insertions, 124 deletions
diff --git a/caputils/capture-pcap-util-unix.c b/caputils/capture-pcap-util-unix.c
index cdc55a04f0..a39ba0a020 100644
--- a/caputils/capture-pcap-util-unix.c
+++ b/caputils/capture-pcap-util-unix.c
@@ -75,31 +75,31 @@ struct rtentry;
#ifdef HAVE_PCAP_REMOTE
GList *
get_remote_interface_list(const char *hostname, const char *port,
- int auth_type, const char *username,
- const char *passwd, int *err, char **err_str)
+ int auth_type, const char *username,
+ const char *passwd, int *err, char **err_str)
{
- struct pcap_rmtauth auth;
- char source[PCAP_BUF_SIZE];
- char errbuf[PCAP_ERRBUF_SIZE];
- GList *result;
-
- if (pcap_createsrcstr(source, PCAP_SRC_IFREMOTE, hostname, port,
- NULL, errbuf) == -1) {
- *err = CANT_GET_INTERFACE_LIST;
- if (err_str != NULL)
- *err_str = cant_get_if_list_error_message(errbuf);
- return NULL;
- }
-
- auth.type = auth_type;
- auth.username = g_strdup(username);
- auth.password = g_strdup(passwd);
-
- result = get_interface_list_findalldevs_ex(source, &auth, err, err_str);
- g_free(auth.username);
- g_free(auth.password);
-
- return result;
+ struct pcap_rmtauth auth;
+ char source[PCAP_BUF_SIZE];
+ char errbuf[PCAP_ERRBUF_SIZE];
+ GList *result;
+
+ if (pcap_createsrcstr(source, PCAP_SRC_IFREMOTE, hostname, port,
+ NULL, errbuf) == -1) {
+ *err = CANT_GET_INTERFACE_LIST;
+ if (err_str != NULL)
+ *err_str = cant_get_if_list_error_message(errbuf);
+ return NULL;
+ }
+
+ auth.type = auth_type;
+ auth.username = g_strdup(username);
+ auth.password = g_strdup(passwd);
+
+ result = get_interface_list_findalldevs_ex(source, &auth, err, err_str);
+ g_free(auth.username);
+ g_free(auth.password);
+
+ return result;
}
#endif
@@ -520,3 +520,16 @@ get_runtime_caplibs_version(GString *str _U_)
}
#endif /* HAVE_LIBPCAP */
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c
index 1c2cd2c36e..a648eff0ba 100644
--- a/caputils/capture-pcap-util.c
+++ b/caputils/capture-pcap-util.c
@@ -104,7 +104,7 @@
*/
static void
add_unix_interface_ifinfo(if_info_t *if_info, const char *name,
- const char *description _U_)
+ const char *description _U_)
{
CFStringRef name_CFString;
CFArrayRef interfaces;
@@ -188,7 +188,7 @@ add_unix_interface_ifinfo(if_info_t *if_info, const char *name,
*/
static void
add_unix_interface_ifinfo(if_info_t *if_info, const char *name,
- const char *description _U_)
+ const char *description _U_)
{
char *wireless_path;
ws_statb64 statb;
@@ -226,7 +226,7 @@ add_unix_interface_ifinfo(if_info_t *if_info, const char *name,
*/
void
add_unix_interface_ifinfo(if_info_t *if_info, const char *name _U_,
- const char *description)
+ const char *description)
{
if_info->friendly_name = g_strdup(description);
}
@@ -421,8 +421,8 @@ if_info_ip(if_info_t *if_info, pcap_if_t *d)
#ifdef HAVE_PCAP_REMOTE
GList *
get_interface_list_findalldevs_ex(const char *source,
- struct pcap_rmtauth *auth,
- int *err, char **err_str)
+ struct pcap_rmtauth *auth,
+ int *err, char **err_str)
{
GList *il = NULL;
pcap_if_t *alldevs, *dev;
@@ -540,36 +540,36 @@ struct dlt_choice {
#define DLT_CHOICE_SENTINEL { NULL, NULL, 0 }
static struct dlt_choice dlt_choices[] = {
- DLT_CHOICE(DLT_NULL, "BSD loopback"),
- DLT_CHOICE(DLT_EN10MB, "Ethernet"),
- DLT_CHOICE(DLT_IEEE802, "Token ring"),
- DLT_CHOICE(DLT_ARCNET, "ARCNET"),
- DLT_CHOICE(DLT_SLIP, "SLIP"),
- DLT_CHOICE(DLT_PPP, "PPP"),
- DLT_CHOICE(DLT_FDDI, "FDDI"),
- DLT_CHOICE(DLT_ATM_RFC1483, "RFC 1483 IP-over-ATM"),
- DLT_CHOICE(DLT_RAW, "Raw IP"),
- DLT_CHOICE(DLT_SLIP_BSDOS, "BSD/OS SLIP"),
- DLT_CHOICE(DLT_PPP_BSDOS, "BSD/OS PPP"),
- DLT_CHOICE(DLT_ATM_CLIP, "Linux Classical IP-over-ATM"),
- DLT_CHOICE(DLT_PPP_SERIAL, "PPP over serial"),
- DLT_CHOICE(DLT_PPP_ETHER, "PPPoE"),
- DLT_CHOICE(DLT_C_HDLC, "Cisco HDLC"),
- DLT_CHOICE(DLT_IEEE802_11, "802.11"),
- DLT_CHOICE(DLT_FRELAY, "Frame Relay"),
- DLT_CHOICE(DLT_LOOP, "OpenBSD loopback"),
- DLT_CHOICE(DLT_ENC, "OpenBSD encapsulated IP"),
- DLT_CHOICE(DLT_LINUX_SLL, "Linux cooked"),
- DLT_CHOICE(DLT_LTALK, "Localtalk"),
- DLT_CHOICE(DLT_PFLOG, "OpenBSD pflog file"),
- DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"),
- DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"),
- DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"),
- DLT_CHOICE(DLT_IEEE802_11_RADIO, "802.11 plus BSD radio information header"),
+ DLT_CHOICE(DLT_NULL, "BSD loopback"),
+ DLT_CHOICE(DLT_EN10MB, "Ethernet"),
+ DLT_CHOICE(DLT_IEEE802, "Token ring"),
+ DLT_CHOICE(DLT_ARCNET, "ARCNET"),
+ DLT_CHOICE(DLT_SLIP, "SLIP"),
+ DLT_CHOICE(DLT_PPP, "PPP"),
+ DLT_CHOICE(DLT_FDDI, "FDDI"),
+ DLT_CHOICE(DLT_ATM_RFC1483, "RFC 1483 IP-over-ATM"),
+ DLT_CHOICE(DLT_RAW, "Raw IP"),
+ DLT_CHOICE(DLT_SLIP_BSDOS, "BSD/OS SLIP"),
+ DLT_CHOICE(DLT_PPP_BSDOS, "BSD/OS PPP"),
+ DLT_CHOICE(DLT_ATM_CLIP, "Linux Classical IP-over-ATM"),
+ DLT_CHOICE(DLT_PPP_SERIAL, "PPP over serial"),
+ DLT_CHOICE(DLT_PPP_ETHER, "PPPoE"),
+ DLT_CHOICE(DLT_C_HDLC, "Cisco HDLC"),
+ DLT_CHOICE(DLT_IEEE802_11, "802.11"),
+ DLT_CHOICE(DLT_FRELAY, "Frame Relay"),
+ DLT_CHOICE(DLT_LOOP, "OpenBSD loopback"),
+ DLT_CHOICE(DLT_ENC, "OpenBSD encapsulated IP"),
+ DLT_CHOICE(DLT_LINUX_SLL, "Linux cooked"),
+ DLT_CHOICE(DLT_LTALK, "Localtalk"),
+ DLT_CHOICE(DLT_PFLOG, "OpenBSD pflog file"),
+ DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"),
+ DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"),
+ DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"),
+ DLT_CHOICE(DLT_IEEE802_11_RADIO, "802.11 plus BSD radio information header"),
DLT_CHOICE(DLT_APPLE_IP_OVER_IEEE1394, "Apple IP-over-IEEE 1394"),
- DLT_CHOICE(DLT_ARCNET_LINUX, "Linux ARCNET"),
- DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"),
- DLT_CHOICE(DLT_IEEE802_11_RADIO_AVS, "802.11 plus AVS radio information header"),
+ DLT_CHOICE(DLT_ARCNET_LINUX, "Linux ARCNET"),
+ DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"),
+ DLT_CHOICE(DLT_IEEE802_11_RADIO_AVS, "802.11 plus AVS radio information header"),
DLT_CHOICE_SENTINEL
};
@@ -638,12 +638,25 @@ free_if_capabilities(if_capabilities_t *caps)
const char *
linktype_val_to_name(int dlt)
{
- return pcap_datalink_val_to_name(dlt);
+ return pcap_datalink_val_to_name(dlt);
}
int linktype_name_to_val(const char *linktype)
{
- return pcap_datalink_name_to_val(linktype);
+ return pcap_datalink_name_to_val(linktype);
}
#endif /* HAVE_LIBPCAP */
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/caputils/capture-wpcap.c b/caputils/capture-wpcap.c
index 3fdff7d052..6e60dfa48d 100644
--- a/caputils/capture-wpcap.c
+++ b/caputils/capture-wpcap.c
@@ -93,11 +93,11 @@ static int (*p_pcap_setbuff) (pcap_t *, int dim);
static int (*p_pcap_next_ex) (pcap_t *, struct pcap_pkthdr **pkt_header, const u_char **pkt_data);
#ifdef HAVE_PCAP_REMOTE
static pcap_t* (*p_pcap_open) (const char *, int, int, int,
- struct pcap_rmtauth *, char *);
+ struct pcap_rmtauth *, char *);
static int (*p_pcap_findalldevs_ex) (char *, struct pcap_rmtauth *,
- pcap_if_t **, char *);
+ pcap_if_t **, char *);
static int (*p_pcap_createsrcstr) (char *, int, const char *, const char *,
- const char *, char *);
+ const char *, char *);
#endif
#ifdef HAVE_PCAP_SETSAMPLING
static struct pcap_samp* (*p_pcap_setsampling)(pcap_t *);
@@ -142,7 +142,7 @@ load_wpcap(void)
SYM(pcap_setfilter, FALSE),
SYM(pcap_geterr, FALSE),
SYM(pcap_compile, FALSE),
- SYM(pcap_compile_nopcap, FALSE),
+ SYM(pcap_compile_nopcap, FALSE),
SYM(pcap_lookupnet, FALSE),
#ifdef HAVE_PCAP_REMOTE
SYM(pcap_open, FALSE),
@@ -192,7 +192,7 @@ load_wpcap(void)
SYM(pcap_free_datalinks, TRUE),
#endif
#ifdef HAVE_BPF_IMAGE
- SYM(bpf_image, FALSE),
+ SYM(bpf_image, FALSE),
#endif
{ NULL, NULL, FALSE }
};
@@ -326,7 +326,7 @@ pcap_geterr(pcap_t *a)
int
pcap_compile(pcap_t *a, struct bpf_program *b, const char *c, int d,
- bpf_u_int32 e)
+ bpf_u_int32 e)
{
g_assert(has_wpcap);
return p_pcap_compile(a, b, c, d, e);
@@ -334,7 +334,7 @@ pcap_compile(pcap_t *a, struct bpf_program *b, const char *c, int d,
int
pcap_compile_nopcap(int a, int b, struct bpf_program *c, const char *d, int e,
- bpf_u_int32 f)
+ bpf_u_int32 f)
{
g_assert(has_wpcap);
return p_pcap_compile_nopcap(a, b, c, d, e, f);
@@ -350,23 +350,23 @@ pcap_lookupnet(const char *a, bpf_u_int32 *b, bpf_u_int32 *c, char *d)
pcap_t*
pcap_open_live(const char *a, int b, int c, int d, char *e)
{
- if (!has_wpcap) {
- g_snprintf(e, PCAP_ERRBUF_SIZE,
- "unable to load WinPcap (wpcap.dll); can't open %s to capture",
- a);
- return NULL;
- }
- return p_pcap_open_live(a, b, c, d, e);
+ if (!has_wpcap) {
+ g_snprintf(e, PCAP_ERRBUF_SIZE,
+ "unable to load WinPcap (wpcap.dll); can't open %s to capture",
+ a);
+ return NULL;
+ }
+ return p_pcap_open_live(a, b, c, d, e);
}
#ifdef HAVE_PCAP_OPEN_DEAD
pcap_t*
pcap_open_dead(int a, int b)
{
- if (!has_wpcap) {
- return NULL;
- }
- return p_pcap_open_dead(a, b);
+ if (!has_wpcap) {
+ return NULL;
+ }
+ return p_pcap_open_dead(a, b);
}
#endif
@@ -374,10 +374,10 @@ pcap_open_dead(int a, int b)
char *
bpf_image(const struct bpf_insn *a, int b)
{
- if (!has_wpcap) {
- return NULL;
- }
- return p_bpf_image(a, b);
+ if (!has_wpcap) {
+ return NULL;
+ }
+ return p_bpf_image(a, b);
}
#endif
@@ -385,28 +385,28 @@ bpf_image(const struct bpf_insn *a, int b)
pcap_t*
pcap_open(const char *a, int b, int c, int d, struct pcap_rmtauth *e, char *f)
{
- if (!has_wpcap) {
- g_snprintf(f, PCAP_ERRBUF_SIZE,
- "unable to load WinPcap (wpcap.dll); can't open %s to capture",
- a);
- return NULL;
- }
- return p_pcap_open(a, b, c, d, e, f);
+ if (!has_wpcap) {
+ g_snprintf(f, PCAP_ERRBUF_SIZE,
+ "unable to load WinPcap (wpcap.dll); can't open %s to capture",
+ a);
+ return NULL;
+ }
+ return p_pcap_open(a, b, c, d, e, f);
}
int
pcap_findalldevs_ex(char *a, struct pcap_rmtauth *b, pcap_if_t **c, char *d)
{
- g_assert(has_wpcap);
- return p_pcap_findalldevs_ex(a, b, c, d);
+ g_assert(has_wpcap);
+ return p_pcap_findalldevs_ex(a, b, c, d);
}
int
pcap_createsrcstr(char *a, int b, const char *c, const char *d, const char *e,
- char *f)
+ char *f)
{
- g_assert(has_wpcap);
- return p_pcap_createsrcstr(a, b, c, d, e, f);
+ g_assert(has_wpcap);
+ return p_pcap_createsrcstr(a, b, c, d, e, f);
}
#endif
@@ -414,11 +414,11 @@ pcap_createsrcstr(char *a, int b, const char *c, const char *d, const char *e,
struct pcap_samp *
pcap_setsampling(pcap_t *a)
{
- g_assert(has_wpcap);
- if (p_pcap_setsampling != NULL) {
- return p_pcap_setsampling(a);
- }
- return NULL;
+ g_assert(has_wpcap);
+ if (p_pcap_setsampling != NULL) {
+ return p_pcap_setsampling(a);
+ }
+ return NULL;
}
#endif
@@ -433,9 +433,9 @@ void
pcap_freecode(struct bpf_program *a)
{
g_assert(has_wpcap);
- if(p_pcap_freecode) {
- p_pcap_freecode(a);
- }
+ if(p_pcap_freecode) {
+ p_pcap_freecode(a);
+ }
}
#ifdef HAVE_PCAP_FINDALLDEVS
@@ -678,31 +678,31 @@ int pcap_next_ex (pcap_t *a, struct pcap_pkthdr **b, const u_char **c)
#ifdef HAVE_PCAP_REMOTE
GList *
get_remote_interface_list(const char *hostname, const char *port,
- int auth_type, const char *username,
- const char *passwd, int *err, char **err_str)
+ int auth_type, const char *username,
+ const char *passwd, int *err, char **err_str)
{
- struct pcap_rmtauth auth;
- char source[PCAP_BUF_SIZE];
- char errbuf[PCAP_ERRBUF_SIZE];
- GList *result;
+ struct pcap_rmtauth auth;
+ char source[PCAP_BUF_SIZE];
+ char errbuf[PCAP_ERRBUF_SIZE];
+ GList *result;
- if (pcap_createsrcstr(source, PCAP_SRC_IFREMOTE, hostname, port,
- NULL, errbuf) == -1) {
- *err = CANT_GET_INTERFACE_LIST;
- if (err_str != NULL)
- *err_str = cant_get_if_list_error_message(errbuf);
- return NULL;
- }
+ if (pcap_createsrcstr(source, PCAP_SRC_IFREMOTE, hostname, port,
+ NULL, errbuf) == -1) {
+ *err = CANT_GET_INTERFACE_LIST;
+ if (err_str != NULL)
+ *err_str = cant_get_if_list_error_message(errbuf);
+ return NULL;
+ }
- auth.type = auth_type;
- auth.username = g_strdup(username);
- auth.password = g_strdup(passwd);
+ auth.type = auth_type;
+ auth.username = g_strdup(username);
+ auth.password = g_strdup(passwd);
- result = get_interface_list_findalldevs_ex(source, &auth, err, err_str);
- g_free(auth.username);
- g_free(auth.password);
+ result = get_interface_list_findalldevs_ex(source, &auth, err, err_str);
+ g_free(auth.username);
+ g_free(auth.password);
- return result;
+ return result;
}
#endif
@@ -988,3 +988,16 @@ get_runtime_caplibs_version(GString *str _U_)
}
#endif /* HAVE_LIBPCAP */
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/caputils/capture_win_ifnames.c b/caputils/capture_win_ifnames.c
index a85b6d3916..f0222562ab 100644
--- a/caputils/capture_win_ifnames.c
+++ b/caputils/capture_win_ifnames.c
@@ -367,3 +367,15 @@ get_windows_interface_friendly_name(const char *interface_devicename)
/**************************************************************************************/
#endif
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/caputils/iface_monitor.c b/caputils/iface_monitor.c
index 683a9cc25e..c0bd51668a 100644
--- a/caputils/iface_monitor.c
+++ b/caputils/iface_monitor.c
@@ -239,7 +239,7 @@ iface_mon_get_sock(void)
/*
* Size of buffer for kernel network event.
*/
-#define NET_EVENT_DATA_SIZE (KEV_MSG_HEADER_SIZE + sizeof (struct net_event_data))
+#define NET_EVENT_DATA_SIZE (KEV_MSG_HEADER_SIZE + sizeof (struct net_event_data))
void
iface_mon_event(void)
@@ -341,7 +341,7 @@ iface_mon_event(void)
* interface" when it goes up; on Lion (and possibly Mountain
* Lion), an interface doesn't have to be up in order to
* have a BPF device attached to it.
- */
+ */
break;
}
}
@@ -373,3 +373,16 @@ iface_mon_event(void)
#endif /* HAVE_LIBNL */
#endif /* HAVE_LIBPCAP */
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/caputils/ws80211_utils.c b/caputils/ws80211_utils.c
index 0e411c33a3..7fbcd7a8f2 100644
--- a/caputils/ws80211_utils.c
+++ b/caputils/ws80211_utils.c
@@ -884,3 +884,16 @@ const gchar *ws80211_chan_type_to_str(int type _U_)
return NULL;
}
#endif /* HAVE_LIBNL && HAVE_NL80211 */
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */