ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_util_network.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | // Copyright 2017 Baidu Inc. All Rights Reserved. |
| TMBOY | 47:9e361da97763 | 2 | // Author: Su Hao (suhao@baidu.com) |
| TMBOY | 47:9e361da97763 | 3 | // |
| TMBOY | 47:9e361da97763 | 4 | // Description: Network util tools. |
| TMBOY | 47:9e361da97763 | 5 | |
| TMBOY | 47:9e361da97763 | 6 | #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_UTIL_NETWORK_H |
| TMBOY | 47:9e361da97763 | 7 | #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_UTIL_NETWORK_H |
| TMBOY | 47:9e361da97763 | 8 | |
| TMBOY | 47:9e361da97763 | 9 | #include "baidu_ca_types.h" |
| TMBOY | 47:9e361da97763 | 10 | |
| TMBOY | 47:9e361da97763 | 11 | /* |
| TMBOY | 47:9e361da97763 | 12 | * Determine whether the system byte order is little endian |
| TMBOY | 47:9e361da97763 | 13 | * |
| TMBOY | 47:9e361da97763 | 14 | * @Return bca_ut_t, if big endian return 0, else return 1. |
| TMBOY | 47:9e361da97763 | 15 | */ |
| TMBOY | 47:9e361da97763 | 16 | BCA_INT bca_u8_t bca_is_little_endian(void); |
| TMBOY | 47:9e361da97763 | 17 | |
| TMBOY | 47:9e361da97763 | 18 | /* |
| TMBOY | 47:9e361da97763 | 19 | * Convert the byte order from host to network for 16bit value |
| TMBOY | 47:9e361da97763 | 20 | * |
| TMBOY | 47:9e361da97763 | 21 | * @Param value, in, the host value |
| TMBOY | 47:9e361da97763 | 22 | * @Param bca_u16_t, the network result |
| TMBOY | 47:9e361da97763 | 23 | */ |
| TMBOY | 47:9e361da97763 | 24 | BCA_INT bca_u16_t bca_htons(bca_u16_t value); |
| TMBOY | 47:9e361da97763 | 25 | |
| TMBOY | 47:9e361da97763 | 26 | /* |
| TMBOY | 47:9e361da97763 | 27 | * Convert the byte order from host to network for 32bit value |
| TMBOY | 47:9e361da97763 | 28 | * |
| TMBOY | 47:9e361da97763 | 29 | * @Param value, in, the host value |
| TMBOY | 47:9e361da97763 | 30 | * @Param bca_u32_t, the network result |
| TMBOY | 47:9e361da97763 | 31 | */ |
| TMBOY | 47:9e361da97763 | 32 | BCA_INT bca_u32_t bca_htonl(bca_u32_t value); |
| TMBOY | 47:9e361da97763 | 33 | |
| TMBOY | 47:9e361da97763 | 34 | #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_UTIL_NETWORK_H |
