stun/stun.patch

changeset 774
9024b850a1f9
parent 417
76ceb617f880
equal deleted inserted replaced
2:99053b44ed66 3:2faf5b9ea713
1 Index: server.cxx 1 Index: server.cxx
2 diff -Nau server.cxx.orig server.cxx
2 --- server.cxx.orig 2005-08-13 22:19:29 +0200 3 --- server.cxx.orig 2005-08-13 22:19:29 +0200
3 +++ server.cxx 2005-11-16 10:33:51 +0100 4 +++ server.cxx 2005-11-16 10:33:51 +0100
4 @@ -23,7 +23,7 @@ 5 @@ -2,6 +2,7 @@
6 #include <cstring>
7 #include <iostream>
8 #include <cstdlib>
9 +#include <cstdio>
10
11 #ifndef WIN32
12 #include <sys/time.h>
13 @@ -23,7 +24,7 @@
5 usage() 14 usage()
6 { 15 {
7 cerr << "Usage: " << endl 16 cerr << "Usage: " << endl
8 - << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-m mediaport]" << endl 17 - << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-m mediaport]" << endl
9 + << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-b] [-m mediaport] [-P pidfile]" << endl 18 + << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-b] [-m mediaport] [-P pidfile]" << endl
10 << " " << endl 19 << " " << endl
11 << " If the IP addresses of your NIC are 10.0.1.150 and 10.0.1.151, run this program with" << endl 20 << " If the IP addresses of your NIC are 10.0.1.150 and 10.0.1.151, run this program with" << endl
12 << " ./server -v -h 10.0.1.150 -a 10.0.1.151" << endl 21 << " ./server -v -h 10.0.1.150 -a 10.0.1.151" << endl
13 @@ -32,7 +32,7 @@ 22 @@ -32,7 +33,7 @@
14 << " -a sets the secondary IP" << endl 23 << " -a sets the secondary IP" << endl
15 << " -p sets the primary port and defaults to 3478" << endl 24 << " -p sets the primary port and defaults to 3478" << endl
16 << " -o sets the secondary port and defaults to 3479" << endl 25 << " -o sets the secondary port and defaults to 3479" << endl
17 - << " -b makes the program run in the backgroud" << endl 26 - << " -b makes the program run in the backgroud" << endl
18 + << " -b makes the program run in the background" << endl 27 + << " -b makes the program run in the background" << endl
19 << " -m sets up a STERN server starting at port m" << endl 28 << " -m sets up a STERN server starting at port m" << endl
20 << " -v runs in verbose mode" << endl 29 << " -v runs in verbose mode" << endl
21 // in makefile too 30 // in makefile too
22 @@ -55,6 +55,7 @@ 31 @@ -55,6 +56,7 @@
23 StunAddress4 altAddr; 32 StunAddress4 altAddr;
24 bool verbose=false; 33 bool verbose=false;
25 bool background=false; 34 bool background=false;
26 + char *myPidFile = 0; 35 + char *myPidFile = 0;
27 36
28 myAddr.addr = 0; 37 myAddr.addr = 0;
29 altAddr.addr = 0; 38 altAddr.addr = 0;
30 @@ -135,6 +136,16 @@ 39 @@ -135,6 +137,16 @@
31 } 40 }
32 myMediaPort = UInt16(strtol( argv[arg], NULL, 10)); 41 myMediaPort = UInt16(strtol( argv[arg], NULL, 10));
33 } 42 }
34 + else if ( !strcmp( argv[arg] , "-P" ) ) 43 + else if ( !strcmp( argv[arg] , "-P" ) )
35 + { 44 + {
42 + myPidFile = argv[arg]; 51 + myPidFile = argv[arg];
43 + } 52 + }
44 else 53 else
45 { 54 {
46 usage(); 55 usage();
47 @@ -213,6 +224,19 @@ 56 @@ -213,6 +225,19 @@
48 57
49 if (pid == 0) //child or not using background 58 if (pid == 0) //child or not using background
50 { 59 {
51 + /* write a daemon pidfile */ 60 + /* write a daemon pidfile */
52 + if (myPidFile) { 61 + if (myPidFile) {
63 + 72 +
64 StunServerInfo info; 73 StunServerInfo info;
65 bool ok = stunInitServer(info, myAddr, altAddr, myMediaPort, verbose); 74 bool ok = stunInitServer(info, myAddr, altAddr, myMediaPort, verbose);
66 75
67 Index: stun.cxx 76 Index: stun.cxx
68 diff -Nau stund.orig/stun.cxx stund/stun.cxx 77 diff -Nau stun.cxx.orig stun.cxx
69 --- stun.cxx.orig 2005-08-14 02:39:03.000000000 +0200 78 --- stun.cxx.orig 2005-08-14 02:39:03.000000000 +0200
70 +++ stun.cxx 2009-01-09 00:23:08.069498590 +0100 79 +++ stun.cxx 2009-01-09 00:23:08.069498590 +0100
71 @@ -16,6 +16,7 @@ 80 @@ -16,6 +16,9 @@
72 #include <string.h> 81 #include <string.h>
73 #include <sys/ioctl.h> 82 #include <sys/ioctl.h>
74 #include <sys/socket.h> 83 #include <sys/socket.h>
84 +#if defined (__SVR4) && defined (__sun)
75 +#include <sys/sockio.h> 85 +#include <sys/sockio.h>
86 +#endif
76 #include <sys/time.h> 87 #include <sys/time.h>
77 #include <sys/types.h> 88 #include <sys/types.h>
78 #include <arpa/inet.h> 89 #include <arpa/inet.h>

mercurial