stun/stun.patch

Fri, 13 Apr 2012 17:49:04 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 13 Apr 2012 17:49:04 +0200
changeset 417
76ceb617f880
parent 53
11a94c8e617e
child 418
680c3f7768b0
permissions
-rw-r--r--

Update to latest (although not new) upstream vendor version.

michael@52 1 Index: server.cxx
michael@52 2 --- server.cxx.orig 2005-08-13 22:19:29 +0200
michael@52 3 +++ server.cxx 2005-11-16 10:33:51 +0100
michael@52 4 @@ -23,7 +23,7 @@
michael@52 5 usage()
michael@52 6 {
michael@52 7 cerr << "Usage: " << endl
michael@52 8 - << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-m mediaport]" << endl
michael@52 9 + << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-b] [-m mediaport] [-P pidfile]" << endl
michael@52 10 << " " << endl
michael@52 11 << " If the IP addresses of your NIC are 10.0.1.150 and 10.0.1.151, run this program with" << endl
michael@52 12 << " ./server -v -h 10.0.1.150 -a 10.0.1.151" << endl
michael@52 13 @@ -32,7 +32,7 @@
michael@52 14 << " -a sets the secondary IP" << endl
michael@52 15 << " -p sets the primary port and defaults to 3478" << endl
michael@52 16 << " -o sets the secondary port and defaults to 3479" << endl
michael@52 17 - << " -b makes the program run in the backgroud" << endl
michael@52 18 + << " -b makes the program run in the background" << endl
michael@52 19 << " -m sets up a STERN server starting at port m" << endl
michael@52 20 << " -v runs in verbose mode" << endl
michael@52 21 // in makefile too
michael@52 22 @@ -55,6 +55,7 @@
michael@52 23 StunAddress4 altAddr;
michael@52 24 bool verbose=false;
michael@52 25 bool background=false;
michael@52 26 + char *myPidFile = 0;
michael@52 27
michael@52 28 myAddr.addr = 0;
michael@52 29 altAddr.addr = 0;
michael@52 30 @@ -135,6 +136,16 @@
michael@52 31 }
michael@52 32 myMediaPort = UInt16(strtol( argv[arg], NULL, 10));
michael@52 33 }
michael@52 34 + else if ( !strcmp( argv[arg] , "-P" ) )
michael@52 35 + {
michael@52 36 + arg++;
michael@52 37 + if ( argc <= arg )
michael@52 38 + {
michael@52 39 + usage();
michael@52 40 + exit(-1);
michael@52 41 + }
michael@52 42 + myPidFile = argv[arg];
michael@52 43 + }
michael@52 44 else
michael@52 45 {
michael@52 46 usage();
michael@52 47 @@ -213,6 +224,19 @@
michael@52 48
michael@52 49 if (pid == 0) //child or not using background
michael@52 50 {
michael@52 51 + /* write a daemon pidfile */
michael@52 52 + if (myPidFile) {
michael@52 53 + pid_t pid;
michael@52 54 + FILE *fp;
michael@52 55 + pid = getpid();
michael@52 56 + if ((fp = fopen(myPidFile, "w")) == NULL) {
michael@52 57 + fprintf(stderr, "stund: Can't write pidfile '%s'", myPidFile);
michael@52 58 + exit(1);
michael@52 59 + }
michael@52 60 + fprintf(fp, "%ld\n", (long)pid);
michael@52 61 + fclose(fp);
michael@52 62 + }
michael@52 63 +
michael@52 64 StunServerInfo info;
michael@52 65 bool ok = stunInitServer(info, myAddr, altAddr, myMediaPort, verbose);
michael@52 66
michael@53 67 Index: stun.cxx
michael@53 68 diff -Nau stund.orig/stun.cxx stund/stun.cxx
michael@53 69 --- stun.cxx.orig 2005-08-14 02:39:03.000000000 +0200
michael@53 70 +++ stun.cxx 2009-01-09 00:23:08.069498590 +0100
michael@53 71 @@ -16,6 +16,7 @@
michael@53 72 #include <string.h>
michael@53 73 #include <sys/ioctl.h>
michael@53 74 #include <sys/socket.h>
michael@53 75 +#include <sys/sockio.h>
michael@53 76 #include <sys/time.h>
michael@53 77 #include <sys/types.h>
michael@53 78 #include <arpa/inet.h>

mercurial