|
version 1.28.4.1, 2025/11/17 19:53:08
|
version 1.32.4.2, 2026/07/29 01:09:33
|
|
Line 12 terms:
|
Line 12 terms:
|
| All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
| Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| |
|
| Copyright 2004 - 2025 | Copyright 2004 - 2026 |
| by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
| |
|
| Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
|
Line 56 SUCH DAMAGE.
|
Line 56 SUCH DAMAGE.
|
| #include <sys/param.h> |
#include <sys/param.h> |
| #include <sys/socket.h> |
#include <sys/socket.h> |
| #include <sys/un.h> |
#include <sys/un.h> |
| |
#ifndef __cplusplus |
| |
#include <stdatomic.h> |
| |
#else |
| |
#include <atomic> |
| |
#define _Atomic(X) std::atomic<X> |
| |
#endif |
| #ifndef __linux__ |
#ifndef __linux__ |
| #include <sys/limits.h> |
#include <sys/limits.h> |
| #include <sys/endian.h> |
#include <sys/endian.h> |
|
Line 165 SUCH DAMAGE.
|
Line 171 SUCH DAMAGE.
|
| #define powerof2(x) ((((x) - 1) & (x)) == 0) |
#define powerof2(x) ((((x) - 1) & (x)) == 0) |
| #endif |
#endif |
| |
|
| |
/* timespec helpers */ |
| |
/* Operations on timevals. */ |
| |
#ifndef timerclear |
| |
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) |
| |
#endif |
| |
|
| |
#ifndef timerisset |
| |
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) |
| |
#endif |
| |
|
| |
#ifndef timercmp |
| |
#define timercmp(tvp, uvp, cmp) \ |
| |
(((tvp)->tv_sec == (uvp)->tv_sec) ? \ |
| |
((tvp)->tv_usec cmp (uvp)->tv_usec) : \ |
| |
((tvp)->tv_sec cmp (uvp)->tv_sec)) |
| |
#endif |
| |
|
| |
#ifndef timeradd |
| |
#define timeradd(tvp, uvp, vvp) \ |
| |
do { \ |
| |
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ |
| |
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ |
| |
if ((vvp)->tv_usec >= 1000000) { \ |
| |
(vvp)->tv_sec++; \ |
| |
(vvp)->tv_usec -= 1000000; \ |
| |
} \ |
| |
} while (0) |
| |
#endif |
| |
|
| |
#ifndef timersub |
| |
#define timersub(tvp, uvp, vvp) \ |
| |
do { \ |
| |
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ |
| |
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ |
| |
if ((vvp)->tv_usec < 0) { \ |
| |
(vvp)->tv_sec--; \ |
| |
(vvp)->tv_usec += 1000000; \ |
| |
} \ |
| |
} while (0) |
| |
#endif |
| |
|
| |
/* Operations on timespecs. */ |
| |
#ifndef timespecclear |
| |
#define timespecclear(tsp) ((tsp)->tv_sec = (tsp)->tv_nsec = 0) |
| |
#endif |
| |
|
| |
#ifndef timespecisset |
| |
#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec) |
| |
#endif |
| |
|
| |
#ifndef timespeccmp |
| |
#define timespeccmp(tsp, usp, cmp) \ |
| |
(((tsp)->tv_sec == (usp)->tv_sec) ? \ |
| |
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ |
| |
((tsp)->tv_sec cmp (usp)->tv_sec)) |
| |
#endif |
| |
|
| |
#ifndef timespecadd |
| |
#define timespecadd(tsp, usp, vsp) \ |
| |
do { \ |
| |
(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \ |
| |
(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \ |
| |
if ((vsp)->tv_nsec >= 1000000000L) { \ |
| |
(vsp)->tv_sec++; \ |
| |
(vsp)->tv_nsec -= 1000000000L; \ |
| |
} \ |
| |
} while (0) |
| |
#endif |
| |
|
| |
#ifndef timespecsub |
| |
#define timespecsub(tsp, usp, vsp) \ |
| |
do { \ |
| |
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ |
| |
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ |
| |
if ((vsp)->tv_nsec < 0) { \ |
| |
(vsp)->tv_sec--; \ |
| |
(vsp)->tv_nsec += 1000000000L; \ |
| |
} \ |
| |
} while (0) |
| |
#endif |
| |
|
| /* Macros for min/max. */ |
/* Macros for min/max. */ |
| #ifndef MIN |
#ifndef MIN |
| #define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
|
Line 298 extern int elwix_Debug;
|
Line 385 extern int elwix_Debug;
|
| #define ELWIX_DEBUG_LOCK 0x20 |
#define ELWIX_DEBUG_LOCK 0x20 |
| #define ELWIX_DEBUG_SYS 0x40 |
#define ELWIX_DEBUG_SYS 0x40 |
| #define ELWIX_DEBUG_NET 0x80 |
#define ELWIX_DEBUG_NET 0x80 |
| |
#define ELWIX_DEBUG_1 0x100 |
| |
#define ELWIX_DEBUG_2 0x200 |
| |
#define ELWIX_DEBUG_3 0x400 |
| |
#define ELWIX_DEBUG_4 0x800 |
| #define ELWIX_DEBUG_ANY 0xFFFFFFFF |
#define ELWIX_DEBUG_ANY 0xFFFFFFFF |
| |
|
| #define EDBG(x) (elwix_Debug & (x)) |
#define EDBG(x) (elwix_Debug & (x)) |