libdsm
0.0.4-11-g223c1ba
Minimalist and read-only SMB client lib
|
Netbios name service. More...
#include <stdint.h>
Functions | |
const char * | netbios_ns_entry_name (netbios_ns_entry *entry) |
Get the name of the entry referenced by the iterator iter. More... | |
const char * | netbios_ns_entry_group (netbios_ns_entry *entry) |
Get the name of the entry referenced by the iterator iter. More... | |
uint32_t | netbios_ns_entry_ip (netbios_ns_entry *entry) |
Return the IP address of the correspondance referenced by the iterator. More... | |
char | netbios_ns_entry_type (netbios_ns_entry *entry) |
Return the type of record. More... | |
netbios_ns * | netbios_ns_new () |
Allocate and initialize the Netbios name service client object. More... | |
void | netbios_ns_destroy (netbios_ns *ns) |
Destroy the netbios name service object. More... | |
int | netbios_ns_resolve (netbios_ns *ns, const char *name, char type, uint32_t *addr) |
Resolve a Netbios name. More... | |
const char * | netbios_ns_inverse (netbios_ns *ns, uint32_t ip) |
Perform an inverse netbios lookup (get name from ip) More... | |
int | netbios_ns_discover_start (netbios_ns *ns, unsigned int broadcast_timeout, netbios_ns_discover_callbacks *callbacks) |
Perform a NETBIOS discovery in a separate thread. More... | |
int | netbios_ns_discover_stop (netbios_ns *ns) |
Stop the NETBIOS discovery. More... | |
Netbios name service.
void netbios_ns_destroy | ( | netbios_ns * | ns | ) |
Destroy the netbios name service object.
[in] | ns | A pointer on the netbios_ns to destroy and deallocate |
int netbios_ns_discover_start | ( | netbios_ns * | ns, |
unsigned int | broadcast_timeout, | ||
netbios_ns_discover_callbacks * | callbacks | ||
) |
Perform a NETBIOS discovery in a separate thread.
This functions starts a new thread that will send a message to '*' Netbios name (broadcast NB query on 255.255.255.255). It'll wait for the machine on the LAN to answer. It'll then perform a reverse lookup on all the ip he received packet from. Once a name and an ip is found, this function will notify the caller by a callback.
ns | The name service object. |
broadcast_timeout | Do a broadcast every timeout seconds |
callbacks | The callbacks previously setup by the caller |
int netbios_ns_discover_stop | ( | netbios_ns * | ns | ) |
Stop the NETBIOS discovery.
ns | The name service object. |
const char* netbios_ns_entry_group | ( | netbios_ns_entry * | entry | ) |
Get the name of the entry referenced by the iterator iter.
The pointer points to an area of memory owned by the netbios name service
uint32_t netbios_ns_entry_ip | ( | netbios_ns_entry * | entry | ) |
Return the IP address of the correspondance referenced by the iterator.
const char* netbios_ns_entry_name | ( | netbios_ns_entry * | entry | ) |
Get the name of the entry referenced by the iterator iter.
The pointer points to an area of memory owned by the netbios name service
char netbios_ns_entry_type | ( | netbios_ns_entry * | entry | ) |
Return the type of record.
const char* netbios_ns_inverse | ( | netbios_ns * | ns, |
uint32_t | ip | ||
) |
Perform an inverse netbios lookup (get name from ip)
This function does a NBSTAT and stores all the returned entry in the internal list of entries. It returns one of the name found. (Normally the <20> or <0> name)
ns | The name service object. |
ip | The ip address in network byte order. |
netbios_ns* netbios_ns_new | ( | ) |
Allocate and initialize the Netbios name service client object.
int netbios_ns_resolve | ( | netbios_ns * | ns, |
const char * | name, | ||
char | type, | ||
uint32_t * | addr | ||
) |
Resolve a Netbios name.
This function tries to resolves the given NetBIOS name with the given type on the LAN, using broadcast queries. No WINS server is called.
ns | the netbios name service object. |
name | the null-terminated ASCII netbios name to resolve. If it's longer than 15 chars, it'll be truncated. |
type | The type of the name to look for. |
[out] | addr | The IP address in network byte order of the machine if found. |