1SOCKET_WRAPPER(1) SOCKET_WRAPPER(1)
2
3
4
6 socket_wrapper - A library passing all socket communications through
7 unix sockets.
8
10 LD_PRELOAD=libsocket_wrapper.so SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM
11 SOCKET_WRAPPER_DEFAULT_IFACE=10 ./myapplication
12
14 socket_wrapper aims to help client/server software development teams
15 willing to gain full functional test coverage. It makes possible to run
16 several instances of the full software stack on the same machine and
17 perform locally functional testing of complex network configurations.
18
19 · Redirects all network communication to happen over Unix sockets.
20
21 · Support for IPv4 and IPv6 socket and addressing emulation.
22
23 · Ability to capture network traffic in pcap format.
24
26 SOCKET_WRAPPER_DIR
27 The user defines a directory where to put all the unix sockets
28 using the environment variable
29 "SOCKET_WRAPPER_DIR=/path/to/socket_dir". When a server opens a
30 port or a client wants to connect, socket_wrapper will translate IP
31 addresses to a special socket_wrapper name and look for the
32 relevant Unix socket in the SOCKET_WRAPPER_DIR.
33
34 SOCKET_WRAPPER_DEFAULT_IFACE
35 Additionally, the default interface to be used by an application is
36 defined with "SOCKET_WRAPPER_DEFAULT_IFACE=<ID>" where <ID> is
37 between 2 and 254. This is analogous to use the IPv4 addresses
38 "127.0.0.<ID>" or IPv6 addresses "fd00::5357:5f<IDx>" (where <IDx>
39 is a hexadecimal presentation of <ID>). You should always set the
40 default interface. If you listen on INADDR_ANY then it will use the
41 default interface to listen on.
42
43 SOCKET_WRAPPER_PCAP_FILE
44 When debugging, it is often interesting to investigate the network
45 traffic between the client and server within your application. If
46 you define SOCKET_WRAPPER_PCAP_FILE=/path/to/file.pcap,
47 socket_wrapper will dump all your network traffic to the specified
48 file. After the test has been finished you’re able to open the file
49 for example with Wireshark.
50
51 SOCKET_WRAPPER_MTU
52 With this variable you can change the MTU size. However we do not
53 recomment to do that as the default size of 1500 byte is best for
54 formatting PCAP files.
55
56 The minimum value you can set is 512 and the maximum 32768.
57
58 SOCKET_WRAPPER_MAX_SOCKETS
59 This variable can be used to set the maximum number of sockets to
60 be used by an application.
61
62 The default value is set to 65535 and the maximum 256000.
63
64 SOCKET_WRAPPER_DEBUGLEVEL
65 If you need to see what is going on in socket_wrapper itself or try
66 to find a bug, you can enable logging support in socket_wrapper if
67 you built it with debug symbols.
68
69 · 0 = ERROR
70
71 · 1 = WARNING
72
73 · 2 = DEBUG
74
75 · 3 = TRACE
76
77 SOCKET_WRAPPER_DISABLE_DEEPBIND
78 This allows you to disable deep binding in socket_wrapper. This is
79 useful for running valgrind tools or sanitizers like (address,
80 undefined, thread).
81
83 # Open a console and create a directory for the unix sockets.
84 $ mktemp -d
85 /tmp/tmp.bQRELqDrhM
86
87 # Then start nc to listen for network traffic using the temporary directory.
88 $ LD_PRELOAD=libsocket_wrapper.so \
89 SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM \
90 SOCKET_WRAPPER_DEFAULT_IFACE=10 nc -v -l 127.0.0.10 7
91
92 # (If nc, listens on 0.0.0.0 then listener will be open on 127.0.0.10 because
93 # it is the default interface)
94
95 # Now open another console and start 'nc' as a client to connect to the server:
96 $ LD_PRELOAD=libsocket_wrapper.so \
97 SOCKET_WRAPPER_DIR=/tmp/tmp.bQRELqDrhM \
98 SOCKET_WRAPPER_DEFAULT_IFACE=100 nc -v 127.0.0.10 7
99
100 # (The client will use the address 127.0.0.100 when connecting to the server)
101 # Now you can type 'Hello!' which will be sent to the server and should appear
102 # in the console output of the server.
103
105 Samba Team
106 Author.
107
108
109
110 2018-11-28 SOCKET_WRAPPER(1)