1use libc::{c_char, c_int, c_uint, c_void, size_t};
6
7pub type PRIntn = c_int;
8pub type PRUintn = c_uint;
9pub type PRInt16 = i16;
10pub type PRUint16 = u16;
11pub type PRInt32 = i32;
12pub type PRUint32 = u32;
13pub type PRInt64 = i64;
14pub type PRUint64 = u64;
15pub type PROffset32 = PRInt32;
16pub type PROffset64 = PRInt64;
17
18pub type PRBool = PRIntn;
19pub const PR_TRUE: PRBool = 1;
20pub const PR_FALSE: PRBool = 0;
21pub type PRPackedBool = u8;
22
23pub type PRSize = size_t;
24
25#[derive(Clone, Copy, PartialEq, Eq, Debug)]
26#[repr(C)]
27pub enum PRStatus {
28    PR_FAILURE = -1,
29    PR_SUCCESS = 0,
30}
31pub use self::PRStatus::*;
32
33pub type PRErrorCode = PRInt32;
34
35pub const PR_OUT_OF_MEMORY_ERROR: PRErrorCode = -6000;
36pub const PR_BAD_DESCRIPTOR_ERROR: PRErrorCode = -5999;
37pub const PR_WOULD_BLOCK_ERROR: PRErrorCode = -5998;
38pub const PR_ACCESS_FAULT_ERROR: PRErrorCode = -5997;
39pub const PR_INVALID_METHOD_ERROR: PRErrorCode = -5996;
40pub const PR_ILLEGAL_ACCESS_ERROR: PRErrorCode = -5995;
41pub const PR_UNKNOWN_ERROR: PRErrorCode = -5994;
42pub const PR_PENDING_INTERRUPT_ERROR: PRErrorCode = -5993;
43pub const PR_NOT_IMPLEMENTED_ERROR: PRErrorCode = -5992;
44pub const PR_IO_ERROR: PRErrorCode = -5991;
45pub const PR_IO_TIMEOUT_ERROR: PRErrorCode = -5990;
46pub const PR_IO_PENDING_ERROR: PRErrorCode = -5989;
47pub const PR_DIRECTORY_OPEN_ERROR: PRErrorCode = -5988;
48pub const PR_INVALID_ARGUMENT_ERROR: PRErrorCode = -5987;
49pub const PR_ADDRESS_NOT_AVAILABLE_ERROR: PRErrorCode = -5986;
50pub const PR_ADDRESS_NOT_SUPPORTED_ERROR: PRErrorCode = -5985;
51pub const PR_IS_CONNECTED_ERROR: PRErrorCode = -5984;
52pub const PR_BAD_ADDRESS_ERROR: PRErrorCode = -5983;
53pub const PR_ADDRESS_IN_USE_ERROR: PRErrorCode = -5982;
54pub const PR_CONNECT_REFUSED_ERROR: PRErrorCode = -5981;
55pub const PR_NETWORK_UNREACHABLE_ERROR: PRErrorCode = -5980;
56pub const PR_CONNECT_TIMEOUT_ERROR: PRErrorCode = -5979;
57pub const PR_NOT_CONNECTED_ERROR: PRErrorCode = -5978;
58pub const PR_LOAD_LIBRARY_ERROR: PRErrorCode = -5977;
59pub const PR_UNLOAD_LIBRARY_ERROR: PRErrorCode = -5976;
60pub const PR_FIND_SYMBOL_ERROR: PRErrorCode = -5975;
61pub const PR_INSUFFICIENT_RESOURCES_ERROR: PRErrorCode = -5974;
62pub const PR_DIRECTORY_LOOKUP_ERROR: PRErrorCode = -5973;
63pub const PR_TPD_RANGE_ERROR: PRErrorCode = -5972;
64pub const PR_PROC_DESC_TABLE_FULL_ERROR: PRErrorCode = -5971;
65pub const PR_SYS_DESC_TABLE_FULL_ERROR: PRErrorCode = -5970;
66pub const PR_NOT_SOCKET_ERROR: PRErrorCode = -5969;
67pub const PR_NOT_TCP_SOCKET_ERROR: PRErrorCode = -5968;
68pub const PR_SOCKET_ADDRESS_IS_BOUND_ERROR: PRErrorCode = -5967;
69pub const PR_NO_ACCESS_RIGHTS_ERROR: PRErrorCode = -5966;
70pub const PR_OPERATION_NOT_SUPPORTED_ERROR: PRErrorCode = -5965;
71pub const PR_PROTOCOL_NOT_SUPPORTED_ERROR: PRErrorCode = -5964;
72pub const PR_REMOTE_FILE_ERROR: PRErrorCode = -5963;
73pub const PR_BUFFER_OVERFLOW_ERROR: PRErrorCode = -5962;
74pub const PR_CONNECT_RESET_ERROR: PRErrorCode = -5961;
75pub const PR_RANGE_ERROR: PRErrorCode = -5960;
76pub const PR_DEADLOCK_ERROR: PRErrorCode = -5959;
77pub const PR_FILE_IS_LOCKED_ERROR: PRErrorCode = -5958;
78pub const PR_FILE_TOO_BIG_ERROR: PRErrorCode = -5957;
79pub const PR_NO_DEVICE_SPACE_ERROR: PRErrorCode = -5956;
80pub const PR_PIPE_ERROR: PRErrorCode = -5955;
81pub const PR_NO_SEEK_DEVICE_ERROR: PRErrorCode = -5954;
82pub const PR_IS_DIRECTORY_ERROR: PRErrorCode = -5953;
83pub const PR_LOOP_ERROR: PRErrorCode = -5952;
84pub const PR_NAME_TOO_LONG_ERROR: PRErrorCode = -5951;
85pub const PR_FILE_NOT_FOUND_ERROR: PRErrorCode = -5950;
86pub const PR_NOT_DIRECTORY_ERROR: PRErrorCode = -5949;
87pub const PR_READ_ONLY_FILESYSTEM_ERROR: PRErrorCode = -5948;
88pub const PR_DIRECTORY_NOT_EMPTY_ERROR: PRErrorCode = -5947;
89pub const PR_FILESYSTEM_MOUNTED_ERROR: PRErrorCode = -5946;
90pub const PR_NOT_SAME_DEVICE_ERROR: PRErrorCode = -5945;
91pub const PR_DIRECTORY_CORRUPTED_ERROR: PRErrorCode = -5944;
92pub const PR_FILE_EXISTS_ERROR: PRErrorCode = -5943;
93pub const PR_MAX_DIRECTORY_ENTRIES_ERROR: PRErrorCode = -5942;
94pub const PR_INVALID_DEVICE_STATE_ERROR: PRErrorCode = -5941;
95pub const PR_DEVICE_IS_LOCKED_ERROR: PRErrorCode = -5940;
96pub const PR_NO_MORE_FILES_ERROR: PRErrorCode = -5939;
97pub const PR_END_OF_FILE_ERROR: PRErrorCode = -5938;
98pub const PR_FILE_SEEK_ERROR: PRErrorCode = -5937;
99pub const PR_FILE_IS_BUSY_ERROR: PRErrorCode = -5936;
100pub const PR_OPERATION_ABORTED_ERROR: PRErrorCode = -5935;
101pub const PR_IN_PROGRESS_ERROR: PRErrorCode = -5934;
102pub const PR_ALREADY_INITIATED_ERROR: PRErrorCode = -5933;
103pub const PR_GROUP_EMPTY_ERROR: PRErrorCode = -5932;
104pub const PR_INVALID_STATE_ERROR: PRErrorCode = -5931;
105pub const PR_NETWORK_DOWN_ERROR: PRErrorCode = -5930;
106pub const PR_SOCKET_SHUTDOWN_ERROR: PRErrorCode = -5929;
107pub const PR_CONNECT_ABORTED_ERROR: PRErrorCode = -5928;
108pub const PR_HOST_UNREACHABLE_ERROR: PRErrorCode = -5927;
109pub const PR_LIBRARY_NOT_LOADED_ERROR: PRErrorCode = -5926;
110pub const PR_CALL_ONCE_ERROR: PRErrorCode = -5925;
111pub const PR_MAX_ERROR: PRErrorCode = -5924;
112
113#[derive(Debug)]
116#[repr(C)]
117pub struct PRFileDesc {
118    pub methods: *const PRIOMethods,
119    pub secret: *mut PRFilePrivate,
120    pub lower: *mut PRFileDesc,
121    pub higher: *mut PRFileDesc,
122    pub dtor: Option<unsafe extern "C" fn(*mut PRFileDesc)>,
123    pub identity: PRDescIdentity,
124}
125
126#[repr(C)]
137pub struct PRFilePrivate(c_void);
138
139pub type PRDescIdentity = PRIntn;
140
141#[derive(Clone, Copy, Debug)]
142#[repr(C)]
143pub struct PRIOMethods {
144    pub file_type: PRDescType,
145    pub close: PRCloseFN,
146    pub read: PRReadFN,
147    pub write: PRWriteFN,
148    pub available: PRAvailableFN,
149    pub available64: PRAvailable64FN,
150    pub fsync: PRFsyncFN,
151    pub seek: PRSeekFN,
152    pub seek64: PRSeek64FN,
153    pub fileInfo: PRFileInfoFN,
154    pub fileInfo64: PRFileInfo64FN,
155    pub writev: PRWritevFN,
156    pub connect: PRConnectFN,
157    pub accept: PRAcceptFN,
158    pub bind: PRBindFN,
159    pub listen: PRListenFN,
160    pub shutdown: PRShutdownFN,
161    pub recv: PRRecvFN,
162    pub send: PRSendFN,
163    pub recvfrom: PRRecvfromFN,
164    pub sendto: PRSendtoFN,
165    pub poll: PRPollFN,
166    pub acceptread: PRAcceptreadFN,
167    pub transmitfile: PRTransmitfileFN,
168    pub getsockname: PRGetsocknameFN,
169    pub getpeername: PRGetpeernameFN,
170    pub reserved_fn_6: PRReservedFN,
171    pub reserved_fn_5: PRReservedFN,
172    pub getsocketoption: PRGetsocketoptionFN,
173    pub setsocketoption: PRSetsocketoptionFN,
174    pub sendfile: PRSendfileFN,
175    pub connectcontinue: PRConnectcontinueFN,
176    pub reserved_fn_3: PRReservedFN,
177    pub reserved_fn_2: PRReservedFN,
178    pub reserved_fn_1: PRReservedFN,
179    pub reserved_fn_0: PRReservedFN,
180}
181
182pub type PRCloseFN =
184    Option<unsafe extern "C" fn(fd: *mut PRFileDesc)
185                                -> PRStatus>;
186pub type PRReadFN =
187    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
188                                buf: *mut c_void,
189                                amount: PRInt32)
190                                -> PRInt32>;
191pub type PRWriteFN =
192    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
193                                buf: *const c_void,
194                                amount: PRInt32)
195                                -> PRInt32>;
196pub type PRAvailableFN =
197    Option<unsafe extern "C" fn(fd: *mut PRFileDesc)
198                                -> PRInt32>;
199pub type PRAvailable64FN =
200    Option<unsafe extern "C" fn(fd: *mut PRFileDesc)
201                                -> PRInt64>;
202pub type PRFsyncFN =
203    Option<unsafe extern "C" fn(fd: *mut PRFileDesc)
204                                -> PRStatus>;
205pub type PRSeekFN =
206    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
207                                offset: PROffset32,
208                                how: PRSeekWhence)
209                                -> PROffset32>;
210pub type PRSeek64FN =
211    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
212                                offset: PROffset64,
213                                how: PRSeekWhence)
214                                -> PROffset64>;
215pub type PRFileInfoFN =
216    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
217                                info: *mut PRFileInfo)
218                                -> PRStatus>;
219pub type PRFileInfo64FN =
220    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
221                                info: *mut PRFileInfo64)
222                                -> PRStatus>;
223pub type PRWritevFN =
224    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
225                                iov: *const PRIOVec,
226                                iov_size: PRInt32,
227                                timeout: PRIntervalTime)
228                                -> PRInt32>;
229pub type PRConnectFN =
230    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
231                                addr: *const PRNetAddr,
232                                timeout: PRIntervalTime)
233                                -> PRStatus>;
234pub type PRAcceptFN =
235    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
236                                addr: *mut PRNetAddr,
237                                timeout: PRIntervalTime)
238                                -> *mut PRFileDesc>;
239pub type PRBindFN =
240    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
241                                addr: *const PRNetAddr)
242                                -> PRStatus>;
243pub type PRListenFN =
244    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
245                                backlog: PRIntn)
246                                -> PRStatus>;
247pub type PRShutdownFN =
248    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
249                                how: PRIntn)
250                                -> PRStatus>;
251pub type PRRecvFN =
252    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
253                                buf: *mut c_void,
254                                amount: PRInt32,
255                                flags: PRIntn,
256                                timeout: PRIntervalTime)
257                                -> PRInt32>;
258pub type PRSendFN =
259    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
260                                buf: *const c_void,
261                                amount: PRInt32,
262                                flags: PRIntn,
263                                timeout: PRIntervalTime)
264                                -> PRInt32>;
265pub type PRRecvfromFN =
266    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
267                                buf: *mut c_void,
268                                amount: PRInt32,
269                                flags: PRIntn,
270                                addr: *mut PRNetAddr,
271                                timeout: PRIntervalTime)
272                                -> PRInt32>;
273pub type PRSendtoFN =
274    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
275                                buf: *const c_void,
276                                amount: PRInt32,
277                                flags: PRIntn,
278                                addr: *const PRNetAddr,
279                                timeout: PRIntervalTime)
280                                -> PRInt32>;
281pub type PRPollFN =
282    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
283                                in_flags: PRInt16,
284                                out_flags: *mut PRInt16)
285                                -> PRInt16>;
286pub type PRAcceptreadFN =
287    Option<unsafe extern "C" fn(sd: *mut PRFileDesc,
288                                nd: *mut *mut PRFileDesc,
289                                raddr: *mut *mut PRNetAddr,
290                                buf: *mut c_void,
291                                amount: PRInt32,
292                                t: PRIntervalTime)
293                                -> PRInt32>;
294pub type PRTransmitfileFN =
295    Option<unsafe extern "C" fn(sd: *mut PRFileDesc,
296                                fd: *mut PRFileDesc,
297                                headers: *const c_void,
298                                hlen: PRInt32,
299                                flags: PRTransmitFileFlags,
300                                t: PRIntervalTime)
301                                -> PRInt32>;
302pub type PRGetsocknameFN =
303    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
304                                addr: *mut PRNetAddr)
305                                -> PRStatus>;
306pub type PRGetpeernameFN =
307    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
308                                addr: *mut PRNetAddr)
309                                -> PRStatus>;
310pub type PRGetsocketoptionFN =
311    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
312                                data: *mut PRSocketOptionData)
313                                -> PRStatus>;
314pub type PRSetsocketoptionFN =
315    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
316                                data: *const PRSocketOptionData)
317                                -> PRStatus>;
318pub type PRSendfileFN =
319    Option<unsafe extern "C" fn(networkSocket: *mut PRFileDesc,
320                                sendData: *mut PRSendFileData,
321                                flags: PRTransmitFileFlags,
322                                timeout: PRIntervalTime)
323                                -> PRInt32>;
324pub type PRConnectcontinueFN =
325    Option<unsafe extern "C" fn(fd: *mut PRFileDesc,
326                                out_flags: PRInt16)
327                                -> PRStatus>;
328pub type PRReservedFN =
329    Option<unsafe extern "C" fn(fd: *mut PRFileDesc)
330                                -> PRIntn>;
331
332#[derive(Clone, Copy, PartialEq, Eq, Debug)]
333#[repr(C)]
334pub enum PRDescType {
335    PR_DESC_FILE = 1,
336    PR_DESC_SOCKET_TCP = 2,
337    PR_DESC_SOCKET_UDP = 3,
338    PR_DESC_LAYERED = 4,
339    PR_DESC_PIPE = 5,
340}
341pub use self::PRDescType::*;
342
343#[derive(Clone, Copy, PartialEq, Eq, Debug)]
344#[repr(C)]
345pub enum PRSeekWhence {
346    PR_SEEK_SET = 0,
347    PR_SEEK_CUR = 1,
348    PR_SEEK_END = 2,
349}
350pub use self::PRSeekWhence::*;
351
352#[derive(Debug)]
353#[repr(C)]
354pub struct PRIOVec {
355    pub iov_base: *mut c_char,
356    pub iov_len: c_int,
357}
358
359pub type PRSocketOptionData = PRSocketOptionCase<PRSocketOptionVoid>;
363pub enum PRSocketOptionVoid { }
364
365#[derive(Clone, Copy, Debug)]
368#[repr(C)]
369pub struct PRSocketOptionCase<T> {
370    padded_enum: PRSize,
373    pub value: T
374}
375impl<T> PRSocketOptionCase<T> {
376    pub fn new(which: PRSockOption, value: T) -> Self {
377        let mut padded_enum: PRSize = 0;
378        unsafe { *(&mut padded_enum as *mut PRSize as *mut PRSockOption) = which; }
380        PRSocketOptionCase {
381            padded_enum: padded_enum,
382            value: value
383        }
384    }
385    pub fn get_enum(&self) -> PRSockOption {
386        unsafe { *(&self.padded_enum as *const PRSize as *const PRSockOption) }
388    }
389    pub fn as_ptr(&self) -> *const PRSocketOptionData {
390        self as *const Self as *const PRSocketOptionData
391    }
392    pub fn as_mut_ptr(&mut self) -> *mut PRSocketOptionData {
393        self as *mut Self as *mut PRSocketOptionData
394    }
395}
396
397#[derive(Clone, Copy, PartialEq, Eq, Debug)]
398#[repr(C)]
399pub enum PRSockOption {
400    PR_SockOpt_Nonblocking = 0,      PR_SockOpt_Linger = 1,           PR_SockOpt_Reuseaddr = 2,        PR_SockOpt_Keepalive = 3,        PR_SockOpt_RecvBufferSize = 4,   PR_SockOpt_SendBufferSize = 5,   PR_SockOpt_IpTimeToLive = 6,     PR_SockOpt_IpTypeOfService = 7,  PR_SockOpt_AddMember = 8,        PR_SockOpt_DropMember = 9,       PR_SockOpt_McastInterface = 10,  PR_SockOpt_McastTimeToLive = 11, PR_SockOpt_McastLoopback = 12,   PR_SockOpt_NoDelay = 13,         PR_SockOpt_MaxSegment = 14,      PR_SockOpt_Broadcast = 15,       PR_SockOpt_Reuseport = 16,       }
418pub use self::PRSockOption::*;
419
420#[derive(Clone, Copy, Debug)]
421#[repr(C)]
422pub struct PRLinger {
423    pub polarity: PRBool,
424    pub linger: PRIntervalTime,
425}
426
427pub type PRIntervalTime = PRUint32;
428pub const PR_INTERVAL_NO_WAIT: PRIntervalTime = 0;
429pub const PR_INTERVAL_NO_TIMEOUT: PRIntervalTime = 0xffffffff;
430
431pub type PRTime = PRInt64;
432
433pub enum PRNetAddr { }
447
448#[derive(Clone, Copy, Debug)]
453#[repr(C)]
454pub struct PRNetAddrRaw {
455    pub family: PRUint16,
456    pub data: [c_char; 14], }
458
459#[derive(Clone, Copy, Debug)]
460#[repr(C)]
461pub struct PRNetAddrInet {
462    pub family: PRUint16, pub port: PRUint16, pub ip: PRUint32,
465    pub pad: [c_char; 8], }
467
468#[derive(Clone, Copy, Debug)]
469#[repr(C)]
470pub struct PRNetAddrInet6 {
471    pub family: PRUint16, pub port: PRUint16,
473    pub flowinfo: PRUint32,
474    pub ip: PRIPv6Addr,
475    pub scope_id: PRUint32,
476}
477
478#[derive(Copy)]
479#[repr(C)]
480pub struct PRNetAddrLocal {
481    pub family: PRUint16, pub path: [c_char; 104], }
484impl Clone for PRNetAddrLocal {
486    fn clone(&self) -> Self { *self }
487}
488
489#[derive(Clone, Copy, Debug)]
492#[repr(C)]
493pub struct PRIPv6Addr(pub [PRUint64; 2]);
494
495#[derive(Debug)]
496#[repr(C)]
497pub struct PRSendFileData {
498    pub fd: *mut PRFileDesc,
499    pub file_offset: PRUint32,
500    pub file_nbytes: PRSize,
501    pub header: *const c_void,
502    pub hlen: PRInt32,
503    pub trailer: *const c_void,
504    pub tlen: PRInt32,
505}
506
507#[derive(Clone, Copy, PartialEq, Eq, Debug)]
508#[repr(C)]
509pub enum PRTransmitFileFlags {
510    PR_TRANSMITFILE_KEEP_OPEN = 0,
511    PR_TRANSMITFILE_CLOSE_SOCKET = 1,
512}
513pub use self::PRTransmitFileFlags::*;
514
515#[derive(Clone, Copy, Debug)]
516#[repr(C)]
517pub struct PRFileInfo {
518    pub type_: PRFileType,
519    pub size: PROffset32,
520    pub creationTime: PRTime,
521    pub modifyTime: PRTime,
522}
523
524#[derive(Clone, Copy, Debug)]
525#[repr(C)]
526pub struct PRFileInfo64 {
527    pub type_: PRFileType,
528    pub size: PROffset64,
529    pub creationTime: PRTime,
530    pub modifyTime: PRTime,
531}
532
533#[derive(Clone, Copy, PartialEq, Eq, Debug)]
534#[repr(C)]
535pub enum PRFileType {
536    PR_FILE_FILE = 1,
537    PR_FILE_DIRECTORY = 2,
538    PR_FILE_OTHER = 3,
539}
540pub use self::PRFileType::*;
541
542
543#[derive(Clone, Copy, PartialEq, Eq, Debug)]
544#[repr(C)]
545pub enum PRThreadType {
546    PR_USER_THREAD,
547    PR_SYSTEM_THREAD
548}
549pub use self::PRThreadType::*;
550
551#[derive(Clone, Copy, PartialEq, Eq, Debug)]
552#[repr(C)]
553pub enum PRThreadPriority
554{
555    PR_PRIORITY_LOW = 0,
556    PR_PRIORITY_NORMAL = 1,
557    PR_PRIORITY_HIGH = 2,
558    PR_PRIORITY_URGENT = 3,
559}
560pub use self::PRThreadPriority::*;
561
562pub const PR_MSG_PEEK: PRIntn = 0x2;
563
564pub enum PLArenaPool { }
566
567pub type PRCList = PRCListStr;
568
569#[derive(Debug)]
570#[repr(C)]
571pub struct PRCListStr {
572    pub next: *mut PRCList,
573    pub prev: *mut PRCList,
574}
575
576pub type PRLanguageCode = PRUint32;
577pub const PR_LANGUAGE_I_DEFAULT: PRLanguageCode = 0;
578pub const PR_LANGUAGE_EN: PRLanguageCode = 1;
579
580extern "C" {
581    pub fn PR_Init(_type: PRThreadType,
583                   _priority: PRThreadPriority,
584                   _maxPTDs: PRUintn);
585
586    pub fn PR_GetError() -> PRErrorCode;
587    pub fn PR_GetOSError() -> PRInt32;
588    pub fn PR_SetError(code: PRErrorCode, orErr: PRInt32);
589    pub fn PR_ErrorToString(code: PRErrorCode, language: PRLanguageCode) -> *const c_char;
592    pub fn PR_ErrorToName(code: PRErrorCode) -> *const c_char;
593
594    pub fn PR_GetUniqueIdentity(layer_name: *const c_char) -> PRDescIdentity;
595    pub fn PR_TicksPerSecond() -> PRUint32;
596
597    pub fn PR_Close(fd: *mut PRFileDesc) -> PRStatus;
598    pub fn PR_Read(fd: *mut PRFileDesc, buf: *mut c_void, amount: PRInt32) -> PRInt32;
599    pub fn PR_Write(fd: *mut PRFileDesc, buf: *const c_void, amount: PRInt32) -> PRInt32;
600    pub fn PR_Connect(fd: *mut PRFileDesc, addr: *const PRNetAddr, timeout: PRIntervalTime)
601                      -> PRStatus;
602    pub fn PR_Recv(fd: *mut PRFileDesc, buf: *mut c_void, amount: PRInt32, flags: PRIntn,
603                   timeout: PRIntervalTime) -> PRInt32;
604    pub fn PR_Send(fd: *mut PRFileDesc, buf: *const c_void, amount: PRInt32, flags: PRIntn,
605                   timeout: PRIntervalTime) -> PRInt32;
606    pub fn PR_GetSockName(fd: *mut PRFileDesc, addr: *mut PRNetAddr) -> PRStatus;
607    pub fn PR_GetPeerName(fd: *mut PRFileDesc, addr: *mut PRNetAddr) -> PRStatus;
608    pub fn PR_GetSocketOption(fd: *mut PRFileDesc, data: *mut PRSocketOptionData) -> PRStatus;
609    pub fn PR_SetSocketOption(fd: *mut PRFileDesc, data: *const PRSocketOptionData) -> PRStatus;
610
611    pub fn PR_CreatePipe(readPipe: *mut *mut PRFileDesc, writePipe: *mut *mut PRFileDesc)
612                         -> PRStatus;
613    pub fn PR_OpenTCPSocket(af: PRIntn) -> *mut PRFileDesc;
614    pub fn PR_OpenUDPSocket(af: PRIntn) -> *mut PRFileDesc;
615}