mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
add netif, dhcp, netbios, mDSN names
This commit is contained in:
parent
255332ad03
commit
30329bd439
18 changed files with 2352 additions and 2319 deletions
|
|
@ -36,7 +36,7 @@
|
|||
#include "rtl8195a/rtl_common.h"
|
||||
#include "rtl8195a.h"
|
||||
|
||||
#include "lwip/opt.h"
|
||||
//#include "lwip/opt.h"
|
||||
#include "netbios/netbios.h"
|
||||
|
||||
#if LWIP_UDP /* don't build if not configured for use in lwipopts.h */
|
||||
|
|
@ -52,9 +52,9 @@
|
|||
#define NETBIOS_CODE_ATTR
|
||||
#define NETBIOS_DATA_ATTR
|
||||
|
||||
//extern struct netif xnetif[NET_IF_NUM];
|
||||
extern struct netif xnetif[NET_IF_NUM];
|
||||
|
||||
#define NBS_DEF_NAME "rtl871x"
|
||||
#define NBS_DEF_NAME DEF_HOSTNAME
|
||||
|
||||
/** This is an example implementation of a NetBIOS name server.
|
||||
* It responds to name queries for a configurable name.
|
||||
|
|
@ -163,6 +163,10 @@ PACK_STRUCT_END
|
|||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
//#define toupper(CH) \
|
||||
// (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
|
||||
|
||||
|
||||
/** NetBIOS decoding name */
|
||||
static int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
|
||||
{
|
||||
|
|
@ -346,41 +350,30 @@ bool NETBIOS_CODE_ATTR netbios_off(void) {
|
|||
|
||||
void NETBIOS_CODE_ATTR netbios_init(void) {
|
||||
struct udp_pcb *pcb;
|
||||
char buf[] = "a"NBS_DEF_NAME;
|
||||
#if NET_IF_NUM > 0
|
||||
if (netbios_name[0][0] == 0) {
|
||||
buf[0] = 'a'; // SoftAP
|
||||
netbios_set_name(0, buf);
|
||||
}
|
||||
#endif
|
||||
#if NET_IF_NUM > 1
|
||||
if (netbios_name[1][0] == 0) {
|
||||
buf[0] = 's'; // Station
|
||||
netbios_set_name(1, buf);
|
||||
}
|
||||
#endif
|
||||
#if NET_IF_NUM > 2
|
||||
if (netbios_name[2][0] == 0) {
|
||||
buf[0] = 'e'; // Ethernet
|
||||
netbios_set_name(2, buf);
|
||||
}
|
||||
#endif
|
||||
#if NET_IF_NUM > 3
|
||||
#error "NBNS: Add NETBIOS Name!"
|
||||
#endif
|
||||
char buf[NETBIOS_NAME_LEN];
|
||||
if (netbios_pcb() != NULL)
|
||||
return;
|
||||
|
||||
#if DEBUGSOO > 1
|
||||
#if NET_IF_NUM > 2
|
||||
// os_printf("NetBIOS init, name AP: '%s', ST: '%s', Eth: '%s'\n", netbios_name[0], netbios_name[1], netbios_name[2]);
|
||||
os_printf("NetBIOS init, interface 0: '%s', 1: '%s', 2: '%s'\n", netbios_name[0], netbios_name[1], netbios_name[2]);
|
||||
#elif NET_IF_NUM > 1
|
||||
// os_printf("NetBIOS init, name AP: '%s', ST: '%s'\n", netbios_name[0], netbios_name[1]);
|
||||
os_printf("NetBIOS init, interface 0: '%s', 1: '%s'\n", netbios_name[0], netbios_name[1]);
|
||||
#else
|
||||
os_printf("NetBIOS init\n");
|
||||
for(int i = 0; i < NET_IF_NUM; i++) {
|
||||
if (netbios_name[i][0] == 0) {
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
if(xnetif[i].hostname != 0) {
|
||||
netbios_set_name(i, xnetif[i].hostname);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sprintf(buf, NBS_DEF_NAME "%d", i);
|
||||
netbios_set_name(i, buf);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#if DEBUGSOO > 1
|
||||
os_printf("NetBIOS init, interface ");
|
||||
for(int i = 0; i < NET_IF_NUM; i++) {
|
||||
os_printf("%d: '%s' ", i, netbios_name[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
pcb = udp_new();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __NETBIOS_H__
|
||||
#define __NETBIOS_H__
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
/** default port number for "NetBIOS Name service */
|
||||
#define NETBIOS_PORT 137
|
||||
|
||||
|
|
@ -15,7 +17,9 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
//#if LWIP_NETIF_HOSTNAME
|
||||
extern char netbios_name[NET_IF_NUM][NETBIOS_NAME_LEN + 1]; // default netifs/interfacenum: 0 - SoftAP, 1 - Station, 2 - Ethernet
|
||||
//#endif
|
||||
|
||||
// struct udp_pcb * netbios_pcb(void);
|
||||
void netbios_init(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue