summaryrefslogtreecommitdiff
path: root/rpcapd/rpcapd.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-10-29 14:00:27 -0700
committerGuy Harris <guy@alum.mit.edu>2017-10-29 14:00:39 -0700
commit13c73e7cceeb8e4e16dc838c5428b0c5b679ec97 (patch)
tree6a4004181ebf5da64087cfbcd2b4a6e954c05d4d /rpcapd/rpcapd.c
parentd639d63de704710f04acaf935169e15c7a152bc8 (diff)
downloadlibpcap-13c73e7cceeb8e4e16dc838c5428b0c5b679ec97.tar.gz
Remove trailing white space.
Diffstat (limited to 'rpcapd/rpcapd.c')
-rwxr-xr-xrpcapd/rpcapd.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/rpcapd/rpcapd.c b/rpcapd/rpcapd.c
index 0eef6ab7..4a57740a 100755
--- a/rpcapd/rpcapd.c
+++ b/rpcapd/rpcapd.c
@@ -2,32 +2,32 @@
* Copyright (c) 2002 - 2003
* NetGroup, Politecnico di Torino (Italy)
* All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
* are met:
- *
- * 1. Redistributions of source code must retain the above copyright
+ *
+ * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Politecnico di Torino nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Politecnico di Torino nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
@@ -103,7 +103,7 @@ static void printusage(void)
" Default: use both IPv4 and IPv6 waiting sockets\n\n"
" -l <host_list> a file that contains a list of hosts that are allowed\n"
" to connect to this server (if more than one, list them one per line).\n"
- " We suggest to use literal names (instead of numeric ones) in\n"
+ " We suggest to use literal names (instead of numeric ones) in\n"
" order to avoid problems with different address families.\n\n"
" -n permit NULL authentication (usually used with '-l')\n\n"
" -a <host,port> run in active mode when connecting to 'host' on port 'port'\n"
@@ -197,7 +197,7 @@ int main(int argc, char *argv[], char *envp[])
tmpport = pcap_strtok_r(NULL, RPCAP_HOSTLIST_SEP, &lasts);
strlcpy(activelist[i].address, tmpaddress, MAX_LINE);
-
+
if ((tmpport == NULL) || (strcmp(tmpport, "DEFAULT") == 0)) // the user choose a custom port
strlcpy(activelist[i].port, RPCAP_DEFAULT_NETPORT_ACTIVE, MAX_LINE);
else
@@ -207,7 +207,7 @@ int main(int argc, char *argv[], char *envp[])
i++;
}
-
+
if (i > MAX_ACTIVE_LIST)
SOCK_ASSERT("Only MAX_ACTIVE_LIST active connections are currently supported.", 1);
@@ -258,7 +258,7 @@ int main(int argc, char *argv[], char *envp[])
// First child continues
// Set daemon mode
setsid();
-
+
// generated under unix with 'kill -HUP', needed to reload the configuration
signal(SIGHUP, fileconf_read);
@@ -327,11 +327,11 @@ void main_startup(void)
while ((i < MAX_ACTIVE_LIST) && (activelist[i].address[0] != 0))
{
activelist[i].ai_family = mainhints.ai_family;
-
+
#ifdef USE_THREADS
/* GV we need this to create the thread as detached. */
/* GV otherwise, the thread handle is not destroyed */
- pthread_attr_init(&detachedAttribute);
+ pthread_attr_init(&detachedAttribute);
pthread_attr_setdetachstate(&detachedAttribute, PTHREAD_CREATE_DETACHED);
if (pthread_create(&threadId, &detachedAttribute, (void *) &main_active, (void *) &activelist[i]))
@@ -399,7 +399,7 @@ void main_startup(void)
#ifdef USE_THREADS
/* GV we need this to create the thread as detached. */
/* GV otherwise, the thread handle is not destroyed */
- pthread_attr_init(&detachedAttribute);
+ pthread_attr_init(&detachedAttribute);
pthread_attr_setdetachstate(&detachedAttribute, PTHREAD_CREATE_DETACHED);
if (pthread_create(&threadId, &detachedAttribute, (void *) &main_passive, (void *) socktemp))
@@ -440,7 +440,7 @@ void main_startup(void)
It is not called when we are running as a daemon on UNIX, since
we do not define a signal in order to terminate gracefully the daemon.
- This function makes a fast cleanup (it does not clean everything, as
+ This function makes a fast cleanup (it does not clean everything, as
you can see from the fact that it uses kill() on UNIX), closes
the main socket, free winsock resources (on Win32) and exits the
program.
@@ -456,7 +456,7 @@ void main_cleanup(int sign)
SOCK_ASSERT(PROGRAM_NAME " is closing.\n", 1);
// FULVIO (bug)
- // Here we close only the latest 'sockmain' created; if we opened more than one waiting sockets,
+ // Here we close only the latest 'sockmain' created; if we opened more than one waiting sockets,
// only the latest one is closed correctly.
if (sockmain)
closesocket(sockmain);
@@ -464,9 +464,9 @@ void main_cleanup(int sign)
/*
This code is executed under the following conditions:
- - SIGTERM: we're under UNIX, and the user kills us with 'kill -15'
+ - SIGTERM: we're under UNIX, and the user kills us with 'kill -15'
(no matter is we're a daemon or in a console mode)
- - SIGINT: we're in console mode and the user sends us a Ctrl+C
+ - SIGINT: we're in console mode and the user sends us a Ctrl+C
(SIGINT signal), no matter if we're UNIX or Win32
In all these cases, we have to terminate the program.
@@ -503,7 +503,7 @@ static void main_cleanup_childs(int sign)
It must be in a separate function because:
- if we're in 'console' mode, we have to put the main thread waiting for a Ctrl+C
(in order to be able to stop everything)
- - if we're in daemon mode, the main program must terminate and a new child must be
+ - if we're in daemon mode, the main program must terminate and a new child must be
created in order to create the daemon
\param ptr: it keeps the main socket handler (what's called 'sockmain' in the main()), that
@@ -545,7 +545,7 @@ static void main_passive(void *ptr)
fromlen = sizeof(struct sockaddr_storage);
sockctrl = accept(sockmain, (struct sockaddr *) &from, &fromlen);
-
+
if (sockctrl == INVALID_SOCKET)
{
// The accept() call can return this error when a signal is catched
@@ -558,7 +558,7 @@ static void main_passive(void *ptr)
#endif
continue;
- // Don't check for errors here, since the error can be due to the fact that the thread
+ // Don't check for errors here, since the error can be due to the fact that the thread
// has been killed
sock_geterror("accept(): ", errbuf, PCAP_ERRBUF_SIZE);
SOCK_ASSERT(errbuf, 1);
@@ -592,7 +592,7 @@ static void main_passive(void *ptr)
/* GV we need this to create the thread as detached. */
/* GV otherwise, the thread handle is not destroyed */
- pthread_attr_init(&detachedAttribute);
+ pthread_attr_init(&detachedAttribute);
pthread_attr_setdetachstate(&detachedAttribute, PTHREAD_CREATE_DETACHED);
pthread_error = pthread_create(&threadId, &detachedAttribute, (void *) &daemon_serviceloop, (void *) pars);
if (pthread_error != 0)
@@ -660,13 +660,13 @@ static void main_active(void *ptr)
// Prepare to open a new server socket
memset(&hints, 0, sizeof(struct addrinfo));
- // WARNING Currently it supports only ONE socket family among IPv4 and IPv6
+ // WARNING Currently it supports only ONE socket family among IPv4 and IPv6
hints.ai_family = AF_INET; // PF_UNSPEC to have both IPv4 and IPv6 server
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = activepars->ai_family;
snprintf(errbuf, PCAP_ERRBUF_SIZE, "Connecting to host %s, port %s, using protocol %s",
- activepars->address, activepars->port, (hints.ai_family == AF_INET) ? "IPv4":
+ activepars->address, activepars->port, (hints.ai_family == AF_INET) ? "IPv4":
(hints.ai_family == AF_INET6) ? "IPv6" : "Unspecified");
SOCK_ASSERT(errbuf, 1);
@@ -689,7 +689,7 @@ static void main_active(void *ptr)
SOCK_ASSERT(errbuf, 1);
snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error connecting to host %s, port %s, using protocol %s",
- activepars->address, activepars->port, (hints.ai_family == AF_INET) ? "IPv4":
+ activepars->address, activepars->port, (hints.ai_family == AF_INET) ? "IPv4":
(hints.ai_family == AF_INET6) ? "IPv6" : "Unspecified");
SOCK_ASSERT(errbuf, 1);