mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Implement Async NBNS (NetBIOS) name resolution for Windows (#2275)
* Implement Async NBNS (NetBIOS) Name resolution for windows Source: http://www.xpablo.cz/?p=751#more-751
This commit is contained in:
38
libraries/ESP8266NetBIOS/ESP8266NetBIOS.h
Executable file
38
libraries/ESP8266NetBIOS/ESP8266NetBIOS.h
Executable file
@ -0,0 +1,38 @@
|
||||
//
|
||||
#ifndef __ESPNBNS_h__
|
||||
#define __ESPNBNS_h__
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
|
||||
#define NBNS_PORT 137
|
||||
/**
|
||||
* @def NBNS_MAX_HOSTNAME_LEN
|
||||
* @brief maximalni delka NBNS jmena zarizeni
|
||||
* @remarks
|
||||
* Jmeno zarizeni musi byt uvedeno VELKYMI pismenami a nesmi obsahovat mezery (whitespaces).
|
||||
*/
|
||||
#define NBNS_MAX_HOSTNAME_LEN 16
|
||||
|
||||
struct udp_pcb;
|
||||
struct pbuf;
|
||||
struct ip_addr;
|
||||
|
||||
class ESP8266NetBIOS
|
||||
{
|
||||
protected:
|
||||
udp_pcb* _pcb;
|
||||
char _name[NBNS_MAX_HOSTNAME_LEN + 1];
|
||||
void _getnbname(char *nbname, char *name, uint8_t maxlen);
|
||||
void _makenbname(char *name, char *nbname, uint8_t outlen);
|
||||
void _recv(udp_pcb *upcb, pbuf *pb, struct ip_addr *addr, uint16_t port);
|
||||
static void _s_recv(void *arg, udp_pcb *upcb, pbuf *p, struct ip_addr *addr, uint16_t port);
|
||||
public:
|
||||
ESP8266NetBIOS();
|
||||
~ESP8266NetBIOS();
|
||||
bool begin(const char *name);
|
||||
void end();
|
||||
};
|
||||
|
||||
extern ESP8266NetBIOS NBNS;
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user