OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 * This file defines _PR_MapOptionName(). The purpose of putting | 7 * This file defines _PR_MapOptionName(). The purpose of putting |
8 * _PR_MapOptionName() in a separate file is to work around a Winsock | 8 * _PR_MapOptionName() in a separate file is to work around a Winsock |
9 * header file problem on Windows NT. | 9 * header file problem on Windows NT. |
10 * | 10 * |
(...skipping 15 matching lines...) Expand all Loading... |
26 #ifndef IP_TTL | 26 #ifndef IP_TTL |
27 #define IP_TTL 7 | 27 #define IP_TTL 7 |
28 #endif | 28 #endif |
29 #ifndef IP_TOS | 29 #ifndef IP_TOS |
30 #define IP_TOS 8 | 30 #define IP_TOS 8 |
31 #endif | 31 #endif |
32 #endif | 32 #endif |
33 | 33 |
34 #include "primpl.h" | 34 #include "primpl.h" |
35 | 35 |
36 #if defined(NEXTSTEP) | |
37 /* NEXTSTEP is special: this must come before netinet/tcp.h. */ | |
38 #include <netinet/in_systm.h> /* n_short, n_long, n_time */ | |
39 #endif | |
40 | |
41 #ifdef HAVE_NETINET_TCP_H | 36 #ifdef HAVE_NETINET_TCP_H |
42 #include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */ | 37 #include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */ |
43 #endif | 38 #endif |
44 | 39 |
45 #ifndef _PR_PTHREADS | 40 #ifndef _PR_PTHREADS |
46 | 41 |
47 PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat
a *data) | 42 PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat
a *data) |
48 { | 43 { |
49 PRStatus rv; | 44 PRStatus rv; |
50 PRInt32 length; | 45 PRInt32 length; |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 * Sanity check. SO_LINGER and TCP_NODELAY should be available | 347 * Sanity check. SO_LINGER and TCP_NODELAY should be available |
353 * on all platforms. Just to make sure we have included the | 348 * on all platforms. Just to make sure we have included the |
354 * appropriate header files. Then any undefined socket options | 349 * appropriate header files. Then any undefined socket options |
355 * are really missing. | 350 * are really missing. |
356 */ | 351 */ |
357 | 352 |
358 #if !defined(SO_LINGER) | 353 #if !defined(SO_LINGER) |
359 #error "SO_LINGER is not defined" | 354 #error "SO_LINGER is not defined" |
360 #endif | 355 #endif |
361 | 356 |
362 /* | |
363 * Some platforms, such as NCR 2.03, don't have TCP_NODELAY defined | |
364 * in <netinet/tcp.h> | |
365 */ | |
366 #if !defined(NCR) | |
367 #if !defined(TCP_NODELAY) | 357 #if !defined(TCP_NODELAY) |
368 #error "TCP_NODELAY is not defined" | 358 #error "TCP_NODELAY is not defined" |
369 #endif | 359 #endif |
370 #endif | |
371 | 360 |
372 /* | 361 /* |
373 * Make sure the value of _PR_NO_SUCH_SOCKOPT is not | 362 * Make sure the value of _PR_NO_SUCH_SOCKOPT is not |
374 * a valid socket option. | 363 * a valid socket option. |
375 */ | 364 */ |
376 #define _PR_NO_SUCH_SOCKOPT -1 | 365 #define _PR_NO_SUCH_SOCKOPT -1 |
377 | 366 |
378 #ifndef SO_KEEPALIVE | 367 #ifndef SO_KEEPALIVE |
379 #define SO_KEEPALIVE _PR_NO_SUCH_SOCKOPT | 368 #define SO_KEEPALIVE _PR_NO_SUCH_SOCKOPT |
380 #endif | 369 #endif |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 443 |
455 if (socketOptions[optname] == _PR_NO_SUCH_SOCKOPT) | 444 if (socketOptions[optname] == _PR_NO_SUCH_SOCKOPT) |
456 { | 445 { |
457 PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0); | 446 PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0); |
458 return PR_FAILURE; | 447 return PR_FAILURE; |
459 } | 448 } |
460 *name = socketOptions[optname]; | 449 *name = socketOptions[optname]; |
461 *level = socketLevels[optname]; | 450 *level = socketLevels[optname]; |
462 return PR_SUCCESS; | 451 return PR_SUCCESS; |
463 } /* _PR_MapOptionName */ | 452 } /* _PR_MapOptionName */ |
OLD | NEW |