[RFC 4/6] net: protocols -- Move protocol function declarations to protocols.h

Cyrill Gorcunov <[email protected]>
Newsgroups org.kernel.vger.trinity
Message-ID <[email protected]>
This allows to isolate functions and include the header only where needed.

Signed-off-by: Cyrill Gorcunov <[email protected]>
---
 include/net.h       | 2 --
 include/protocols.h | 7 +++++++
 net/protocols.c     | 1 +
 sockets.c           | 1 +
 trinity.c           | 1 +
 5 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 include/protocols.h

diff --git a/include/net.h b/include/net.h
index 4e43546..ae99c61 100644
--- a/include/net.h
+++ b/include/net.h
@@ -9,8 +9,6 @@ void generate_sockaddr(unsigned long *addr, unsigned long *addrlen, int pf);
 
 /* protocol decoding */
 extern unsigned int specific_proto;
-const char * get_proto_name(unsigned int proto);
-void find_specific_proto(const char *protoarg);
 
 
 /* glibc headers might be older than the kernel, so chances are we know
diff --git a/include/protocols.h b/include/protocols.h
new file mode 100644
index 0000000..e423a3a
--- /dev/null
+++ b/include/protocols.h
@@ -0,0 +1,7 @@
+#ifndef _PROTOCOLS_H
+#define _PROTOCOLS_H 1
+
+extern const char * get_proto_name(unsigned int proto);
+extern void find_specific_proto(const char *protoarg);
+
+#endif /* _PROTOCOLS_H */
diff --git a/net/protocols.c b/net/protocols.c
index 4331351..c279476 100644
--- a/net/protocols.c
+++ b/net/protocols.c
@@ -5,6 +5,7 @@
 
 #include "trinity.h"
 #include "constants.h"
+#include "protocols.h"
 #include "net.h"
 #include "log.h"
 
diff --git a/sockets.c b/sockets.c
index 590c814..fba3aa9 100644
--- a/sockets.c
+++ b/sockets.c
@@ -15,6 +15,7 @@
 #include "log.h"
 #include "params.h"	// victim_path, verbose, do_specific_proto
 #include "random.h"
+#include "protocols.h"
 
 unsigned int nr_sockets = 0;
 
diff --git a/trinity.c b/trinity.c
index 941c98b..d5b6041 100644
--- a/trinity.c
+++ b/trinity.c
@@ -32,6 +32,7 @@
 #include "syscall.h"
 #include "tables.h"
 #include "ioctls.h"
+#include "protocols.h"
 #include "config.h"	// for VERSION
 
 char *progname = NULL;
-- 
1.8.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.