Asterisk - The Open Source Telephony Project GIT-master-f36a736
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 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 41 of file strcompat.c.

Function Documentation

◆ htonll()

uint64_t htonll ( uint64_t  host64)

Definition at line 390 of file strcompat.c.

391{
392#if BYTE_ORDER == BIG_ENDIAN
393 return host64;
394#elif BYTE_ORDER == LITTLE_ENDIAN
395 union {
396 unsigned char c[8];
397 uint64_t u;
398 } number;
399 number.u = host64;
400 return
401 (((uint64_t) number.c[0]) << 56) |
402 (((uint64_t) number.c[1]) << 48) |
403 (((uint64_t) number.c[2]) << 40) |
404 (((uint64_t) number.c[3]) << 32) |
405 (((uint64_t) number.c[4]) << 24) |
406 (((uint64_t) number.c[5]) << 16) |
407 (((uint64_t) number.c[6]) << 8) |
408 (((uint64_t) number.c[7]) << 0);
409#else
410 #error "Unknown byte order"
411#endif
412}
Number structure.
Definition: app_followme.c:154
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 364 of file strcompat.c.

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

References c.

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