1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/mtransport/third_party/nrappkit/upstream.diff Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,391 @@ 1.4 +diff --git a/media/mtransport/third_party/nrappkit/src/event/async_wait.h b/media/mtransport/third_party/nrappkit/src/event/async_wait.h 1.5 +--- a/media/mtransport/third_party/nrappkit/src/event/async_wait.h 1.6 ++++ b/media/mtransport/third_party/nrappkit/src/event/async_wait.h 1.7 +@@ -38,21 +38,21 @@ 1.8 + 1.9 + 1.10 + #ifndef _async_wait_h 1.11 + #define _async_wait_h 1.12 + 1.13 + #ifdef HAVE_SYS_TIME_H 1.14 + #include <sys/time.h> 1.15 + #endif 1.16 + #include <csi_platform.h> 1.17 + 1.18 +-typedef void (*NR_async_cb)(int resource,int how,void *arg); 1.19 ++typedef void (*NR_async_cb)(NR_SOCKET resource,int how,void *arg); 1.20 + 1.21 + #define NR_ASYNC_WAIT_READ 0 1.22 + #define NR_ASYNC_WAIT_WRITE 1 1.23 + 1.24 + 1.25 + int NR_async_wait_init(void); 1.26 + int NR_async_wait(NR_SOCKET sock, int how, NR_async_cb cb,void *cb_arg, 1.27 + char *function,int line); 1.28 + int NR_async_cancel(NR_SOCKET sock,int how); 1.29 + int NR_async_schedule(NR_async_cb cb,void *arg,char *function,int line); 1.30 +diff --git a/media/mtransport/third_party/nrappkit/src/log/r_log.c b/media/mtransport/third_party/nrappkit/src/log/r_log.c 1.31 +--- a/media/mtransport/third_party/nrappkit/src/log/r_log.c 1.32 ++++ b/media/mtransport/third_party/nrappkit/src/log/r_log.c 1.33 +@@ -33,28 +33,41 @@ 1.34 + POSSIBILITY OF SUCH DAMAGE. 1.35 + 1.36 + 1.37 + ekr@rtfm.com Mon Dec 3 15:24:38 2001 1.38 + */ 1.39 + 1.40 + 1.41 + static char *RCSSTRING __UNUSED__ ="$Id: r_log.c,v 1.10 2008/11/25 22:25:18 adamcain Exp $"; 1.42 + 1.43 + 1.44 ++#ifdef LINUX 1.45 ++#define _BSD_SOURCE 1.46 ++#endif 1.47 ++ 1.48 + #include "r_log.h" 1.49 + #include "hex.h" 1.50 ++ 1.51 + #include <string.h> 1.52 ++#include <errno.h> 1.53 ++#ifndef _MSC_VER 1.54 ++#include <strings.h> 1.55 ++#include <syslog.h> 1.56 ++#endif 1.57 + #include <registry.h> 1.58 + #include <time.h> 1.59 ++ 1.60 ++ 1.61 + #include "nr_common.h" 1.62 + #include "nr_reg_keys.h" 1.63 + 1.64 ++ 1.65 + #define LOGGING_DEFAULT_LEVEL 5 1.66 + 1.67 + int NR_LOG_LOGGING = 0; 1.68 + 1.69 + static char *log_level_strings[]={ 1.70 + "EMERG", 1.71 + "ALERT", 1.72 + "CRIT", 1.73 + "ERR", 1.74 + "WARNING", 1.75 +diff --git a/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h b/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h 1.76 +--- a/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h 1.77 ++++ b/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h 1.78 +@@ -37,17 +37,21 @@ 1.79 + */ 1.80 + 1.81 + 1.82 + #ifndef _platform_h 1.83 + #define _platform_h 1.84 + 1.85 + #include <unistd.h> 1.86 + 1.87 + #define STDIO_BYTES_BUFFERED(fp) (fp->_r) 1.88 + 1.89 ++#ifdef NR_SOCKET_IS_VOID_PTR 1.90 ++typedef void* NR_SOCKET; 1.91 ++#else 1.92 + typedef int NR_SOCKET; 1.93 + #define NR_SOCKET_READ(sock,buf,count) read((sock),(buf),(count)) 1.94 + #define NR_SOCKET_WRITE(sock,buf,count) write((sock),(buf),(count)) 1.95 + #define NR_SOCKET_CLOSE(sock) close(sock) 1.96 ++#endif 1.97 + 1.98 + #endif 1.99 + 1.100 +diff --git a/media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h b/media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h 1.101 +--- a/media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h 1.102 ++++ b/media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h 1.103 +@@ -35,17 +35,21 @@ 1.104 + 1.105 + ekr@rtfm.com Mon Dec 13 17:26:51 2004 1.106 + */ 1.107 + 1.108 + 1.109 + #ifndef _platform_h 1.110 + #define _platform_h 1.111 + 1.112 + #include <linux_funcs.h> 1.113 + 1.114 ++#ifdef NR_SOCKET_IS_VOID_PTR 1.115 ++typedef void* NR_SOCKET; 1.116 ++#else 1.117 + typedef int NR_SOCKET; 1.118 + #define NR_SOCKET_READ(sock,buf,count) read((sock),(buf),(count)) 1.119 + #define NR_SOCKET_WRITE(sock,buf,count) write((sock),(buf),(count)) 1.120 + #define NR_SOCKET_CLOSE(sock) close(sock) 1.121 ++#endif 1.122 + 1.123 + #endif 1.124 + 1.125 +diff --git a/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h b/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h 1.126 +--- a/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h 1.127 ++++ b/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h 1.128 +@@ -44,45 +44,51 @@ 1.129 + #define _WIN32_WINNT 0x0400 // This prevents weird "'TryEnterCriticalSection': identifier not found" 1.130 + // compiler errors when poco/win32_mutex.h is included 1.131 + #endif 1.132 + 1.133 + #define UINT8 UBLAH_IGNORE_ME_PLEASE 1.134 + #define INT8 BLAH_IGNORE_ME_PLEASE 1.135 + #include <winsock2.h> 1.136 + #undef UINT8 1.137 + #undef INT8 1.138 + #include <r_types.h> 1.139 ++#include <errno.h> 1.140 + 1.141 + #define strcasecmp _stricmp 1.142 + #define strncasecmp _strnicmp 1.143 +-#define snprintf _snprintf 1.144 + 1.145 + #define strcasestr stristr 1.146 + 1.147 + /* Hack version of strlcpy (in util/util.c) */ 1.148 + size_t strlcat(char *dst, const char *src, size_t siz); 1.149 + 1.150 + /* Hack version of getopt() (in util/getopt.c) */ 1.151 + int getopt(int argc, char *argv[], char *opstring); 1.152 + extern char *optarg; 1.153 + extern int optind; 1.154 + extern int opterr; 1.155 + 1.156 + /* Hack version of gettimeofday() (in util/util.c) */ 1.157 + int gettimeofday(struct timeval *tv, void *tz); 1.158 + 1.159 ++#ifdef NR_SOCKET_IS_VOID_PTR 1.160 ++typedef void* NR_SOCKET; 1.161 ++#else 1.162 + typedef SOCKET NR_SOCKET; 1.163 + #define NR_SOCKET_READ(sock,buf,count) recv((sock),(buf),(count),0) 1.164 + #define NR_SOCKET_WRITE(sock,buf,count) send((sock),(buf),(count),0) 1.165 + #define NR_SOCKET_CLOSE(sock) closesocket(sock) 1.166 ++#endif 1.167 + 1.168 ++#ifndef EHOSTUNREACH 1.169 + #define EHOSTUNREACH WSAEHOSTUNREACH 1.170 ++#endif 1.171 + 1.172 + #define LOG_EMERG 0 1.173 + #define LOG_ALERT 1 1.174 + #define LOG_CRIT 2 1.175 + #define LOG_ERR 3 1.176 + #define LOG_WARNING 4 1.177 + #define LOG_NOTICE 5 1.178 + #define LOG_INFO 6 1.179 + #define LOG_DEBUG 7 1.180 + 1.181 +diff --git a/media/mtransport/third_party/nrappkit/src/registry/registry.c b/media/mtransport/third_party/nrappkit/src/registry/registry.c 1.182 +--- a/media/mtransport/third_party/nrappkit/src/registry/registry.c 1.183 ++++ b/media/mtransport/third_party/nrappkit/src/registry/registry.c 1.184 +@@ -37,21 +37,22 @@ 1.185 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.186 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.187 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1.188 + * POSSIBILITY OF SUCH DAMAGE. 1.189 + * 1.190 + * 1.191 + */ 1.192 + 1.193 + #include <assert.h> 1.194 + #include <string.h> 1.195 +-#ifndef WIN32 1.196 ++#ifndef _MSC_VER 1.197 ++#include <strings.h> 1.198 + #include <sys/param.h> 1.199 + #include <netinet/in.h> 1.200 + #endif 1.201 + #ifdef OPENSSL 1.202 + #include <openssl/ssl.h> 1.203 + #endif 1.204 + #include <ctype.h> 1.205 + #include "registry.h" 1.206 + #include "registry_int.h" 1.207 + #include "registry_vtbl.h" 1.208 +diff --git a/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c b/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c 1.209 +--- a/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c 1.210 ++++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c 1.211 +@@ -58,20 +58,21 @@ 1.212 + * the crc computation is finished. The crc should be complemented 1.213 + * before transmission. 1.214 + * The variable corresponding to the macro argument "crc" should 1.215 + * be an unsigned long and should be preset to all ones for Ethernet 1.216 + * use. An error-free packet will leave 0xDEBB20E3 in the crc. 1.217 + * Spencer Garrett <srg@quick.com> 1.218 + */ 1.219 + 1.220 + 1.221 + #include <sys/types.h> 1.222 ++#include <r_types.h> 1.223 + 1.224 + static char *RCSSTRING __UNUSED__ ="$Id: r_crc32.c,v 1.4 2008/11/26 03:22:02 adamcain Exp $"; 1.225 + 1.226 + #ifdef WIN32 1.227 + #define u_int32_t UINT4 1.228 + #endif 1.229 + 1.230 + #define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff]) 1.231 + 1.232 + /* generated using the AUTODIN II polynomial 1.233 +diff --git a/media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h b/media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h 1.234 +--- a/media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h 1.235 ++++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h 1.236 +@@ -118,20 +118,20 @@ 1.237 + #ifndef MIN 1.238 + #define MIN(a,b) ((a)>(b))?(b):(a) 1.239 + #endif 1.240 + 1.241 + #ifndef MAX 1.242 + #define MAX(a,b) ((b)>(a))?(b):(a) 1.243 + #endif 1.244 + 1.245 + #ifdef DEBUG 1.246 + #define DBG(a) debug a 1.247 +-int debug(int class,char *format,...); 1.248 ++int debug(int cls, char *format,...); 1.249 + #else 1.250 + #define DBG(a) 1.251 + #endif 1.252 + 1.253 + #define UNIMPLEMENTED do { fprintf(stderr,"%s:%d Function %s unimplemented\n",__FILE__,__LINE__,__FUNCTION__); abort(); } while(0) 1.254 + 1.255 + #include "r_memory.h" 1.256 + 1.257 + #endif 1.258 +diff --git a/media/mtransport/third_party/nrappkit/src/util/libekr/r_time.h b/media/mtransport/third_party/nrappkit/src/util/libekr/r_time.h 1.259 +--- a/media/mtransport/third_party/nrappkit/src/util/libekr/r_time.h 1.260 ++++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_time.h 1.261 +@@ -77,35 +77,25 @@ 1.262 + $Id: r_time.h,v 1.4 2007/06/26 22:37:57 adamcain Exp $ 1.263 + 1.264 + 1.265 + ekr@rtfm.com Thu Mar 4 08:45:41 1999 1.266 + */ 1.267 + 1.268 + 1.269 + #ifndef _r_time_h 1.270 + #define _r_time_h 1.271 + 1.272 ++#include <csi_platform.h> 1.273 + 1.274 +-#ifdef WIN32 1.275 +-# include <time.h> 1.276 +-#else 1.277 +-/* Cribbed from the autoconf doc */ 1.278 +-# if TIME_WITH_SYS_TIME 1.279 +-# include <sys/time.h> 1.280 +-# include <time.h> 1.281 +-# else 1.282 +-# if HAVE_SYS_TIME_H 1.283 +-# include <sys/time.h> 1.284 +-# else 1.285 +-# include <time.h> 1.286 +-# endif 1.287 +-# endif 1.288 ++#ifndef WIN32 1.289 ++#include <sys/time.h> 1.290 ++#include <time.h> 1.291 + #endif 1.292 + 1.293 + int r_timeval_diff(struct timeval *t1,struct timeval *t0, struct timeval *diff); 1.294 + int r_timeval_add(struct timeval *t1,struct timeval *t2, struct timeval *sum); 1.295 + int r_timeval_cmp(struct timeval *t1,struct timeval *t2); 1.296 + 1.297 + UINT8 r_timeval2int(struct timeval *tv); 1.298 + int r_int2timeval(UINT8 t,struct timeval *tv); 1.299 + UINT8 r_gettimeint(void); 1.300 + 1.301 +diff --git a/media/mtransport/third_party/nrappkit/src/util/util.c b/media/mtransport/third_party/nrappkit/src/util/util.c 1.302 +--- a/media/mtransport/third_party/nrappkit/src/util/util.c 1.303 ++++ b/media/mtransport/third_party/nrappkit/src/util/util.c 1.304 +@@ -292,20 +292,22 @@ int nr_sha1_file(char *filename,UCHAR *o 1.305 + 1.306 + return(_status); 1.307 + } 1.308 + 1.309 + #endif 1.310 + 1.311 + #ifdef WIN32 1.312 + // TODO 1.313 + #else 1.314 + 1.315 ++#if 0 1.316 ++ 1.317 + #include <fts.h> 1.318 + 1.319 + int nr_rm_tree(char *path) 1.320 + { 1.321 + FTS *fts=0; 1.322 + FTSENT *p; 1.323 + int failed=0; 1.324 + int _status; 1.325 + char *argv[2]; 1.326 + 1.327 +@@ -337,20 +339,21 @@ int nr_rm_tree(char *path) 1.328 + } 1.329 + 1.330 + if(failed) 1.331 + ABORT(R_FAILED); 1.332 + 1.333 + _status=0; 1.334 + abort: 1.335 + if(fts) fts_close(fts); 1.336 + return(_status); 1.337 + } 1.338 ++#endif 1.339 + 1.340 + int nr_write_pid_file(char *pid_filename) 1.341 + { 1.342 + FILE *fp; 1.343 + int _status; 1.344 + 1.345 + if(!pid_filename) 1.346 + ABORT(R_BAD_ARGS); 1.347 + 1.348 + unlink(pid_filename); 1.349 +@@ -739,12 +742,24 @@ int gettimeofday(struct timeval *tv, voi 1.350 + * since the Epoch */ 1.351 + SystemTimeToFileTime(&st, &ft); 1.352 + u.HighPart = ft.dwHighDateTime; 1.353 + u.LowPart = ft.dwLowDateTime; 1.354 + 1.355 + tv->tv_sec = (long) (u.QuadPart / 10000000L); 1.356 + tv->tv_usec = (long) (st.wMilliseconds * 1000);; 1.357 + 1.358 + return 0; 1.359 + } 1.360 ++ 1.361 ++int snprintf(char *buffer, size_t n, const char *format, ...) 1.362 ++{ 1.363 ++ va_list argp; 1.364 ++ int ret; 1.365 ++ va_start(argp, format); 1.366 ++ ret = _vscprintf(format, argp); 1.367 ++ vsnprintf_s(buffer, n, _TRUNCATE, format, argp); 1.368 ++ va_end(argp); 1.369 ++ return ret; 1.370 ++} 1.371 ++ 1.372 + #endif 1.373 + 1.374 +diff --git a/media/mtransport/third_party/nrappkit/src/util/util.h b/media/mtransport/third_party/nrappkit/src/util/util.h 1.375 +--- a/media/mtransport/third_party/nrappkit/src/util/util.h 1.376 ++++ b/media/mtransport/third_party/nrappkit/src/util/util.h 1.377 +@@ -57,12 +57,17 @@ int nr_drop_privileges(char *username); 1.378 + int nr_hex_ascii_dump(Data *data); 1.379 + int nr_fwrite_all(FILE *fp,UCHAR *buf,int len); 1.380 + int nr_sha1_file(char *filename,UCHAR *out); 1.381 + int nr_bin2hex(UCHAR *in,int len,UCHAR *out); 1.382 + int nr_rm_tree(char *path); 1.383 + int nr_write_pid_file(char *pid_filename); 1.384 + 1.385 + int nr_reg_uint4_fetch_and_check(NR_registry key, UINT4 min, UINT4 max, int log_fac, int die, UINT4 *val); 1.386 + int nr_reg_uint8_fetch_and_check(NR_registry key, UINT8 min, UINT8 max, int log_fac, int die, UINT8 *val); 1.387 + 1.388 ++#ifdef WIN32 1.389 ++int snprintf(char *buffer, size_t n, const char *format, ...); 1.390 ++const char *inet_ntop(int af, const void *src, char *dst, size_t size); 1.391 + #endif 1.392 + 1.393 ++#endif 1.394 ++