|
1 diff --git a/media/mtransport/third_party/nrappkit/src/event/async_wait.h b/media/mtransport/third_party/nrappkit/src/event/async_wait.h |
|
2 --- a/media/mtransport/third_party/nrappkit/src/event/async_wait.h |
|
3 +++ b/media/mtransport/third_party/nrappkit/src/event/async_wait.h |
|
4 @@ -38,21 +38,21 @@ |
|
5 |
|
6 |
|
7 #ifndef _async_wait_h |
|
8 #define _async_wait_h |
|
9 |
|
10 #ifdef HAVE_SYS_TIME_H |
|
11 #include <sys/time.h> |
|
12 #endif |
|
13 #include <csi_platform.h> |
|
14 |
|
15 -typedef void (*NR_async_cb)(int resource,int how,void *arg); |
|
16 +typedef void (*NR_async_cb)(NR_SOCKET resource,int how,void *arg); |
|
17 |
|
18 #define NR_ASYNC_WAIT_READ 0 |
|
19 #define NR_ASYNC_WAIT_WRITE 1 |
|
20 |
|
21 |
|
22 int NR_async_wait_init(void); |
|
23 int NR_async_wait(NR_SOCKET sock, int how, NR_async_cb cb,void *cb_arg, |
|
24 char *function,int line); |
|
25 int NR_async_cancel(NR_SOCKET sock,int how); |
|
26 int NR_async_schedule(NR_async_cb cb,void *arg,char *function,int line); |
|
27 diff --git a/media/mtransport/third_party/nrappkit/src/log/r_log.c b/media/mtransport/third_party/nrappkit/src/log/r_log.c |
|
28 --- a/media/mtransport/third_party/nrappkit/src/log/r_log.c |
|
29 +++ b/media/mtransport/third_party/nrappkit/src/log/r_log.c |
|
30 @@ -33,28 +33,41 @@ |
|
31 POSSIBILITY OF SUCH DAMAGE. |
|
32 |
|
33 |
|
34 ekr@rtfm.com Mon Dec 3 15:24:38 2001 |
|
35 */ |
|
36 |
|
37 |
|
38 static char *RCSSTRING __UNUSED__ ="$Id: r_log.c,v 1.10 2008/11/25 22:25:18 adamcain Exp $"; |
|
39 |
|
40 |
|
41 +#ifdef LINUX |
|
42 +#define _BSD_SOURCE |
|
43 +#endif |
|
44 + |
|
45 #include "r_log.h" |
|
46 #include "hex.h" |
|
47 + |
|
48 #include <string.h> |
|
49 +#include <errno.h> |
|
50 +#ifndef _MSC_VER |
|
51 +#include <strings.h> |
|
52 +#include <syslog.h> |
|
53 +#endif |
|
54 #include <registry.h> |
|
55 #include <time.h> |
|
56 + |
|
57 + |
|
58 #include "nr_common.h" |
|
59 #include "nr_reg_keys.h" |
|
60 |
|
61 + |
|
62 #define LOGGING_DEFAULT_LEVEL 5 |
|
63 |
|
64 int NR_LOG_LOGGING = 0; |
|
65 |
|
66 static char *log_level_strings[]={ |
|
67 "EMERG", |
|
68 "ALERT", |
|
69 "CRIT", |
|
70 "ERR", |
|
71 "WARNING", |
|
72 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 |
|
73 --- a/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h |
|
74 +++ b/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h |
|
75 @@ -37,17 +37,21 @@ |
|
76 */ |
|
77 |
|
78 |
|
79 #ifndef _platform_h |
|
80 #define _platform_h |
|
81 |
|
82 #include <unistd.h> |
|
83 |
|
84 #define STDIO_BYTES_BUFFERED(fp) (fp->_r) |
|
85 |
|
86 +#ifdef NR_SOCKET_IS_VOID_PTR |
|
87 +typedef void* NR_SOCKET; |
|
88 +#else |
|
89 typedef int NR_SOCKET; |
|
90 #define NR_SOCKET_READ(sock,buf,count) read((sock),(buf),(count)) |
|
91 #define NR_SOCKET_WRITE(sock,buf,count) write((sock),(buf),(count)) |
|
92 #define NR_SOCKET_CLOSE(sock) close(sock) |
|
93 +#endif |
|
94 |
|
95 #endif |
|
96 |
|
97 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 |
|
98 --- a/media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h |
|
99 +++ b/media/mtransport/third_party/nrappkit/src/port/linux/include/csi_platform.h |
|
100 @@ -35,17 +35,21 @@ |
|
101 |
|
102 ekr@rtfm.com Mon Dec 13 17:26:51 2004 |
|
103 */ |
|
104 |
|
105 |
|
106 #ifndef _platform_h |
|
107 #define _platform_h |
|
108 |
|
109 #include <linux_funcs.h> |
|
110 |
|
111 +#ifdef NR_SOCKET_IS_VOID_PTR |
|
112 +typedef void* NR_SOCKET; |
|
113 +#else |
|
114 typedef int NR_SOCKET; |
|
115 #define NR_SOCKET_READ(sock,buf,count) read((sock),(buf),(count)) |
|
116 #define NR_SOCKET_WRITE(sock,buf,count) write((sock),(buf),(count)) |
|
117 #define NR_SOCKET_CLOSE(sock) close(sock) |
|
118 +#endif |
|
119 |
|
120 #endif |
|
121 |
|
122 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 |
|
123 --- a/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h |
|
124 +++ b/media/mtransport/third_party/nrappkit/src/port/win32/include/csi_platform.h |
|
125 @@ -44,45 +44,51 @@ |
|
126 #define _WIN32_WINNT 0x0400 // This prevents weird "'TryEnterCriticalSection': identifier not found" |
|
127 // compiler errors when poco/win32_mutex.h is included |
|
128 #endif |
|
129 |
|
130 #define UINT8 UBLAH_IGNORE_ME_PLEASE |
|
131 #define INT8 BLAH_IGNORE_ME_PLEASE |
|
132 #include <winsock2.h> |
|
133 #undef UINT8 |
|
134 #undef INT8 |
|
135 #include <r_types.h> |
|
136 +#include <errno.h> |
|
137 |
|
138 #define strcasecmp _stricmp |
|
139 #define strncasecmp _strnicmp |
|
140 -#define snprintf _snprintf |
|
141 |
|
142 #define strcasestr stristr |
|
143 |
|
144 /* Hack version of strlcpy (in util/util.c) */ |
|
145 size_t strlcat(char *dst, const char *src, size_t siz); |
|
146 |
|
147 /* Hack version of getopt() (in util/getopt.c) */ |
|
148 int getopt(int argc, char *argv[], char *opstring); |
|
149 extern char *optarg; |
|
150 extern int optind; |
|
151 extern int opterr; |
|
152 |
|
153 /* Hack version of gettimeofday() (in util/util.c) */ |
|
154 int gettimeofday(struct timeval *tv, void *tz); |
|
155 |
|
156 +#ifdef NR_SOCKET_IS_VOID_PTR |
|
157 +typedef void* NR_SOCKET; |
|
158 +#else |
|
159 typedef SOCKET NR_SOCKET; |
|
160 #define NR_SOCKET_READ(sock,buf,count) recv((sock),(buf),(count),0) |
|
161 #define NR_SOCKET_WRITE(sock,buf,count) send((sock),(buf),(count),0) |
|
162 #define NR_SOCKET_CLOSE(sock) closesocket(sock) |
|
163 +#endif |
|
164 |
|
165 +#ifndef EHOSTUNREACH |
|
166 #define EHOSTUNREACH WSAEHOSTUNREACH |
|
167 +#endif |
|
168 |
|
169 #define LOG_EMERG 0 |
|
170 #define LOG_ALERT 1 |
|
171 #define LOG_CRIT 2 |
|
172 #define LOG_ERR 3 |
|
173 #define LOG_WARNING 4 |
|
174 #define LOG_NOTICE 5 |
|
175 #define LOG_INFO 6 |
|
176 #define LOG_DEBUG 7 |
|
177 |
|
178 diff --git a/media/mtransport/third_party/nrappkit/src/registry/registry.c b/media/mtransport/third_party/nrappkit/src/registry/registry.c |
|
179 --- a/media/mtransport/third_party/nrappkit/src/registry/registry.c |
|
180 +++ b/media/mtransport/third_party/nrappkit/src/registry/registry.c |
|
181 @@ -37,21 +37,22 @@ |
|
182 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
183 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
184 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
185 * POSSIBILITY OF SUCH DAMAGE. |
|
186 * |
|
187 * |
|
188 */ |
|
189 |
|
190 #include <assert.h> |
|
191 #include <string.h> |
|
192 -#ifndef WIN32 |
|
193 +#ifndef _MSC_VER |
|
194 +#include <strings.h> |
|
195 #include <sys/param.h> |
|
196 #include <netinet/in.h> |
|
197 #endif |
|
198 #ifdef OPENSSL |
|
199 #include <openssl/ssl.h> |
|
200 #endif |
|
201 #include <ctype.h> |
|
202 #include "registry.h" |
|
203 #include "registry_int.h" |
|
204 #include "registry_vtbl.h" |
|
205 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 |
|
206 --- a/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c |
|
207 +++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_crc32.c |
|
208 @@ -58,20 +58,21 @@ |
|
209 * the crc computation is finished. The crc should be complemented |
|
210 * before transmission. |
|
211 * The variable corresponding to the macro argument "crc" should |
|
212 * be an unsigned long and should be preset to all ones for Ethernet |
|
213 * use. An error-free packet will leave 0xDEBB20E3 in the crc. |
|
214 * Spencer Garrett <srg@quick.com> |
|
215 */ |
|
216 |
|
217 |
|
218 #include <sys/types.h> |
|
219 +#include <r_types.h> |
|
220 |
|
221 static char *RCSSTRING __UNUSED__ ="$Id: r_crc32.c,v 1.4 2008/11/26 03:22:02 adamcain Exp $"; |
|
222 |
|
223 #ifdef WIN32 |
|
224 #define u_int32_t UINT4 |
|
225 #endif |
|
226 |
|
227 #define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff]) |
|
228 |
|
229 /* generated using the AUTODIN II polynomial |
|
230 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 |
|
231 --- a/media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h |
|
232 +++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_macros.h |
|
233 @@ -118,20 +118,20 @@ |
|
234 #ifndef MIN |
|
235 #define MIN(a,b) ((a)>(b))?(b):(a) |
|
236 #endif |
|
237 |
|
238 #ifndef MAX |
|
239 #define MAX(a,b) ((b)>(a))?(b):(a) |
|
240 #endif |
|
241 |
|
242 #ifdef DEBUG |
|
243 #define DBG(a) debug a |
|
244 -int debug(int class,char *format,...); |
|
245 +int debug(int cls, char *format,...); |
|
246 #else |
|
247 #define DBG(a) |
|
248 #endif |
|
249 |
|
250 #define UNIMPLEMENTED do { fprintf(stderr,"%s:%d Function %s unimplemented\n",__FILE__,__LINE__,__FUNCTION__); abort(); } while(0) |
|
251 |
|
252 #include "r_memory.h" |
|
253 |
|
254 #endif |
|
255 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 |
|
256 --- a/media/mtransport/third_party/nrappkit/src/util/libekr/r_time.h |
|
257 +++ b/media/mtransport/third_party/nrappkit/src/util/libekr/r_time.h |
|
258 @@ -77,35 +77,25 @@ |
|
259 $Id: r_time.h,v 1.4 2007/06/26 22:37:57 adamcain Exp $ |
|
260 |
|
261 |
|
262 ekr@rtfm.com Thu Mar 4 08:45:41 1999 |
|
263 */ |
|
264 |
|
265 |
|
266 #ifndef _r_time_h |
|
267 #define _r_time_h |
|
268 |
|
269 +#include <csi_platform.h> |
|
270 |
|
271 -#ifdef WIN32 |
|
272 -# include <time.h> |
|
273 -#else |
|
274 -/* Cribbed from the autoconf doc */ |
|
275 -# if TIME_WITH_SYS_TIME |
|
276 -# include <sys/time.h> |
|
277 -# include <time.h> |
|
278 -# else |
|
279 -# if HAVE_SYS_TIME_H |
|
280 -# include <sys/time.h> |
|
281 -# else |
|
282 -# include <time.h> |
|
283 -# endif |
|
284 -# endif |
|
285 +#ifndef WIN32 |
|
286 +#include <sys/time.h> |
|
287 +#include <time.h> |
|
288 #endif |
|
289 |
|
290 int r_timeval_diff(struct timeval *t1,struct timeval *t0, struct timeval *diff); |
|
291 int r_timeval_add(struct timeval *t1,struct timeval *t2, struct timeval *sum); |
|
292 int r_timeval_cmp(struct timeval *t1,struct timeval *t2); |
|
293 |
|
294 UINT8 r_timeval2int(struct timeval *tv); |
|
295 int r_int2timeval(UINT8 t,struct timeval *tv); |
|
296 UINT8 r_gettimeint(void); |
|
297 |
|
298 diff --git a/media/mtransport/third_party/nrappkit/src/util/util.c b/media/mtransport/third_party/nrappkit/src/util/util.c |
|
299 --- a/media/mtransport/third_party/nrappkit/src/util/util.c |
|
300 +++ b/media/mtransport/third_party/nrappkit/src/util/util.c |
|
301 @@ -292,20 +292,22 @@ int nr_sha1_file(char *filename,UCHAR *o |
|
302 |
|
303 return(_status); |
|
304 } |
|
305 |
|
306 #endif |
|
307 |
|
308 #ifdef WIN32 |
|
309 // TODO |
|
310 #else |
|
311 |
|
312 +#if 0 |
|
313 + |
|
314 #include <fts.h> |
|
315 |
|
316 int nr_rm_tree(char *path) |
|
317 { |
|
318 FTS *fts=0; |
|
319 FTSENT *p; |
|
320 int failed=0; |
|
321 int _status; |
|
322 char *argv[2]; |
|
323 |
|
324 @@ -337,20 +339,21 @@ int nr_rm_tree(char *path) |
|
325 } |
|
326 |
|
327 if(failed) |
|
328 ABORT(R_FAILED); |
|
329 |
|
330 _status=0; |
|
331 abort: |
|
332 if(fts) fts_close(fts); |
|
333 return(_status); |
|
334 } |
|
335 +#endif |
|
336 |
|
337 int nr_write_pid_file(char *pid_filename) |
|
338 { |
|
339 FILE *fp; |
|
340 int _status; |
|
341 |
|
342 if(!pid_filename) |
|
343 ABORT(R_BAD_ARGS); |
|
344 |
|
345 unlink(pid_filename); |
|
346 @@ -739,12 +742,24 @@ int gettimeofday(struct timeval *tv, voi |
|
347 * since the Epoch */ |
|
348 SystemTimeToFileTime(&st, &ft); |
|
349 u.HighPart = ft.dwHighDateTime; |
|
350 u.LowPart = ft.dwLowDateTime; |
|
351 |
|
352 tv->tv_sec = (long) (u.QuadPart / 10000000L); |
|
353 tv->tv_usec = (long) (st.wMilliseconds * 1000);; |
|
354 |
|
355 return 0; |
|
356 } |
|
357 + |
|
358 +int snprintf(char *buffer, size_t n, const char *format, ...) |
|
359 +{ |
|
360 + va_list argp; |
|
361 + int ret; |
|
362 + va_start(argp, format); |
|
363 + ret = _vscprintf(format, argp); |
|
364 + vsnprintf_s(buffer, n, _TRUNCATE, format, argp); |
|
365 + va_end(argp); |
|
366 + return ret; |
|
367 +} |
|
368 + |
|
369 #endif |
|
370 |
|
371 diff --git a/media/mtransport/third_party/nrappkit/src/util/util.h b/media/mtransport/third_party/nrappkit/src/util/util.h |
|
372 --- a/media/mtransport/third_party/nrappkit/src/util/util.h |
|
373 +++ b/media/mtransport/third_party/nrappkit/src/util/util.h |
|
374 @@ -57,12 +57,17 @@ int nr_drop_privileges(char *username); |
|
375 int nr_hex_ascii_dump(Data *data); |
|
376 int nr_fwrite_all(FILE *fp,UCHAR *buf,int len); |
|
377 int nr_sha1_file(char *filename,UCHAR *out); |
|
378 int nr_bin2hex(UCHAR *in,int len,UCHAR *out); |
|
379 int nr_rm_tree(char *path); |
|
380 int nr_write_pid_file(char *pid_filename); |
|
381 |
|
382 int nr_reg_uint4_fetch_and_check(NR_registry key, UINT4 min, UINT4 max, int log_fac, int die, UINT4 *val); |
|
383 int nr_reg_uint8_fetch_and_check(NR_registry key, UINT8 min, UINT8 max, int log_fac, int die, UINT8 *val); |
|
384 |
|
385 +#ifdef WIN32 |
|
386 +int snprintf(char *buffer, size_t n, const char *format, ...); |
|
387 +const char *inet_ntop(int af, const void *src, char *dst, size_t size); |
|
388 #endif |
|
389 |
|
390 +#endif |
|
391 + |