Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
network_byte_order.h
Go to the documentation of this file.
1// Copyright 2026 The Symbian SDK Authors.
2// Licensed under the Apache License, Version 2.0.
3// nghttp2 needs byte order conversions, not a POSIX socket implementation.
4#ifndef SYMBIAN_WEBSOCKET_NETWORK_BYTE_ORDER_H_
5#define SYMBIAN_WEBSOCKET_NETWORK_BYTE_ORDER_H_
6#ifdef __SYMBIAN32__
7#include <e32def.h>
8#include <sys/types.h>
9#endif
10#include <stdint.h>
11#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
12#define htonl(value) __builtin_bswap32((uint32_t)(value))
13#define htons(value) __builtin_bswap16((uint16_t)(value))
14#else
15#define htonl(value) ((uint32_t)(value))
16#define htons(value) ((uint16_t)(value))
17#endif
18#define ntohl(value) htonl(value)
19#define ntohs(value) htons(value)
20#endif