mDNS
Embed:
(wiki syntax)
Show/hide line numbers
mDNSResponder.h
00001 /* 00002 Made by JB RYU, KOR - 2015 00003 00004 class mDNSResponder 00005 */ 00006 00007 #ifndef MDNS_RESPONDER_H 00008 #define MDNS_RESPONDER_H 00009 00010 #include "lwip/opt.h" 00011 #include "mbed.h" 00012 #include "EthernetInterface.h" 00013 #include "dns-sd.h" 00014 00015 #if LWIP_DNS 00016 00017 #include "mbed.h" 00018 #include "mem.h" 00019 #include "memp.h" 00020 #include "dns.h" 00021 00022 #define MDNS_PORT (5353) 00023 #define MCAST "224.0.0.251" 00024 00025 class mDNSResponder 00026 { 00027 public: 00028 mDNSResponder(EthernetInterface); 00029 virtual ~mDNSResponder(); 00030 void close(); 00031 void announce(const char* ip); 00032 void MDNS_process(); 00033 00034 private: 00035 void IPstringToByte(char* IPstr); 00036 char* skip_name(char* query); 00037 void query_domain(void); 00038 void register_service(char* number); 00039 char* decode_name(char* query, char* packet); 00040 void send_dns_ans(struct dns_hdr* hdr); 00041 00042 /*static objs */ 00043 static MY_SD_DOMAINS SD_domains; 00044 static struct dns_hdr SD_res_hdr; 00045 00046 static char query_buf[1500]; 00047 static QR_MAP g_queries; 00048 00049 char* IP_str; 00050 uint8_t IP_byte[4]; 00051 00052 UDPSocket mdns_sock; 00053 SocketAddress rcv_endpt; //initial value := ip addr any 00054 SocketAddress send_endpt; 00055 }; 00056 00057 #endif 00058 00059 #ifndef htons 00060 #define htons( x ) ( (( x << 8 ) & 0xFF00) | (( x >> 8 ) & 0x00FF) ) 00061 #define ntohs( x ) (htons(x)) 00062 #endif 00063 00064 #ifndef htonl 00065 #define htonl( x ) ( (( x << 24 ) & 0xff000000) \ 00066 | (( x << 8 ) & 0x00ff0000) \ 00067 | (( x >> 8 ) & 0x0000ff00) \ 00068 | (( x >> 24 ) & 0x000000ff) ) 00069 #define ntohl( x ) (htonl(x)) 00070 #endif 00071 00072 #endif
Generated on Sat Jul 23 2022 00:40:12 by 1.7.2