mikroSDK Reference Manual
llmnr_common.h
Go to the documentation of this file.
1
31#ifndef _LLMNR_COMMON_H
32#define _LLMNR_COMMON_H
33
34//Dependencies
35#include "core/net.h"
36#include "dns/dns_common.h"
37
38//Maximum size of LLMNR messages
39#ifndef LLMNR_MESSAGE_MAX_SIZE
40 #define LLMNR_MESSAGE_MAX_SIZE 512
41#elif (LLMNR_MESSAGE_MAX_SIZE < 1)
42 #error LLMNR_MESSAGE_MAX_SIZE parameter is not valid
43#endif
44
45//Default resource record TTL (cache lifetime)
46#ifndef LLMNR_DEFAULT_RESOURCE_RECORD_TTL
47 #define LLMNR_DEFAULT_RESOURCE_RECORD_TTL 30
48#elif (LLMNR_DEFAULT_RESOURCE_RECORD_TTL < 1)
49 #error LLMNR_DEFAULT_RESOURCE_RECORD_TTL parameter is not valid
50#endif
51
52//LLMNR port number
53#define LLMNR_PORT 5355
54//Default IP TTL value for LLMNR queries
55#define LLMNR_DEFAULT_QUERY_IP_TTL 1
56//Default IP TTL value for LLMNR responses
57#define LLMNR_DEFAULT_RESPONSE_IP_TTL 255
58
59//LLMNR IPv4 multicast group
60#define LLMNR_IPV4_MULTICAST_ADDR IPV4_ADDR(224, 0, 0, 252)
61
62//C++ guard
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67
68//CodeWarrior or Win32 compiler?
69#if defined(__CWCC__) || defined(_WIN32)
70 #pragma pack(push, 1)
71#endif
72
73
79{
80 uint16_t id; //0-1
81#if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
82 uint8_t qr : 1; //2
83 uint8_t opcode : 4;
84 uint8_t c : 1;
85 uint8_t tc : 1;
86 uint8_t t : 1;
87 uint8_t z : 4; //3
88 uint8_t rcode : 4;
89#else
90 uint8_t t : 1; //2
91 uint8_t tc : 1;
92 uint8_t c : 1;
93 uint8_t opcode : 4;
94 uint8_t qr : 1;
95 uint8_t rcode : 4; //3
96 uint8_t z : 4;
97#endif
98 uint16_t qdcount; //4-5
99 uint16_t ancount; //6-7
100 uint16_t nscount; //8-9
101 uint16_t arcount; //10-11
102 uint8_t questions[]; //12
103} LlmnrHeader;
104
105
106//CodeWarrior or Win32 compiler?
107#if defined(__CWCC__) || defined(_WIN32)
108 #pragma pack(pop)
109#endif
110
111//LLMNR IPv6 multicast group
112extern const Ipv6Addr LLMNR_IPV6_MULTICAST_ADDR;
113
114//C++ guard
115#ifdef __cplusplus
116}
117#endif
118
119#endif
Common DNS routines.
typedef __packed_struct
LLMNR message header.
Definition llmnr_common.h:79
TCP/IP stack core.