-
Notifications
You must be signed in to change notification settings - Fork 13.3k
/
Copy pathESP8266NetBIOS.h
44 lines (36 loc) · 1.02 KB
/
ESP8266NetBIOS.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
#ifndef __ESPNBNS_h__
#define __ESPNBNS_h__
extern "C" {
#include <lwip/ip_addr.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;
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, const ip_addr_t *addr, uint16_t port);
static void _s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port);
public:
ESP8266NetBIOS();
~ESP8266NetBIOS();
bool begin(const char *name);
void end();
};
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_NETBIOS)
extern ESP8266NetBIOS NBNS;
#endif
#endif