Asterisk - The Open Source Telephony Project GIT-master-80b953f
Loading...
Searching...
No Matches
Macros | Functions
strcompat.c File Reference

Compatibility functions for strsep and strtoq missing on Solaris. More...

#include "asterisk.h"
#include <ctype.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <fcntl.h>
#include "asterisk/utils.h"
#include "asterisk/poll-compat.h"
Include dependency graph for strcompat.c:

Go to the source code of this file.

Macros

#define ASTMM_LIBC   ASTMM_IGNORE
 
#define POLL_SIZE   1024
 

Functions

uint64_t htonll (uint64_t host64)
 
uint64_t ntohll (uint64_t net64)
 

Detailed Description

Compatibility functions for strsep and strtoq missing on Solaris.

.. and lots of other functions too.

Definition in file strcompat.c.

Macro Definition Documentation

◆ ASTMM_LIBC

#define ASTMM_LIBC   ASTMM_IGNORE

Definition at line 28 of file strcompat.c.

◆ POLL_SIZE

#define POLL_SIZE   1024

Definition at line 42 of file strcompat.c.

Function Documentation

◆ htonll()

uint64_t htonll ( uint64_t  host64)

Definition at line 391 of file strcompat.c.

392{
393#if BYTE_ORDER == BIG_ENDIAN
394 return host64;
395#elif BYTE_ORDER == LITTLE_ENDIAN
396 union {
397 unsigned char c[8];
398 uint64_t u;
399 } number;
400 number.u = host64;
401 return
402 (((uint64_t) number.c[0]) << 56) |
403 (((uint64_t) number.c[1]) << 48) |
404 (((uint64_t) number.c[2]) << 40) |
405 (((uint64_t) number.c[3]) << 32) |
406 (((uint64_t) number.c[4]) << 24) |
407 (((uint64_t) number.c[5]) << 16) |
408 (((uint64_t) number.c[6]) << 8) |
409 (((uint64_t) number.c[7]) << 0);
410#else
411 #error "Unknown byte order"
412#endif
413}
Number structure.
static struct test_val c

References c.

Referenced by ast_websocket_write(), and iax_ie_append_versioned_uint64().

◆ ntohll()

uint64_t ntohll ( uint64_t  net64)

Definition at line 365 of file strcompat.c.

366{
367#if BYTE_ORDER == BIG_ENDIAN
368 return net64;
369#elif BYTE_ORDER == LITTLE_ENDIAN
370 union {
371 unsigned char c[8];
372 uint64_t u;
373 } number;
374 number.u = net64;
375 return
376 (((uint64_t) number.c[0]) << 56) |
377 (((uint64_t) number.c[1]) << 48) |
378 (((uint64_t) number.c[2]) << 40) |
379 (((uint64_t) number.c[3]) << 32) |
380 (((uint64_t) number.c[4]) << 24) |
381 (((uint64_t) number.c[5]) << 16) |
382 (((uint64_t) number.c[6]) << 8) |
383 (((uint64_t) number.c[7]) << 0);
384#else
385 #error "Unknown byte order"
386#endif
387}

References c.

Referenced by ast_websocket_read(), dump_versioned_codec(), and iax_parse_ies().