| 1 |
. |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#include "common/attributes.h" |
| 8 |
#include <librist/udpsocket.h> |
| 9 |
|
| 10 |
#define RIST_IPH_GET_VER(v) (((v) >> 4) & 0x0F) |
| 11 |
|
| 12 |
#define RIST_OOB_API_IP_PROTOCOL 252 |
| 13 |
#define RIST_OOB_API_IP_IDENT_AUTH 54321 |
| 14 |
#define RIST_OOB_ERROR_INVALID_LENGTH -1 |
| 15 |
#define RIST_OOB_ERROR_INVALID_PROTO -2 |
| 16 |
#define RIST_OOB_ERROR_INVALID_IDENT -3 |
| 17 |
|
| 18 |
|
| 19 |
RIST_PACKED_STRUCT(ipheader, { |
| 20 |
unsigned char iph_verlen; |
| 21 |
unsigned char iph_tos; |
| 22 |
unsigned short int iph_len; |
| 23 |
unsigned short int iph_ident; |
| 24 |
unsigned short int iph_flags; |
| 25 |
unsigned char iph_ttl; |
| 26 |
unsigned char iph_protocol; |
| 27 |
unsigned short int iph_chksum; |
| 28 |
unsigned int iph_sourceip; |
| 29 |
unsigned int iph_destip; |
| 30 |
}) |
| 31 |
|
| 32 |
|
| 33 |
RIST_PACKED_STRUCT(udpheader, { |
| 34 |
unsigned short int udph_srcport; |
| 35 |
unsigned short int udph_destport; |
| 36 |
unsigned short int udph_len; |
| 37 |
unsigned short int udph_chksum; |
| 38 |
}) |
| 39 |
|
| 40 |
void populate_ipv4_rist_header(unsigned short int address_family, unsigned char *recv_buf, ssize_t recv_bufsize, struct sockaddr * addr, socklen_t addrlen); |
| 41 |
int oob_build_api_payload(uint16_t *buffer, char *sourceip, char *destip, char *message, int message_len); |
| 42 |
char *oob_process_api_message(int buffer_len, char *buffer, int *message_len); |