*/
#include "includes.h"
+#include "system/time.h"
/*
This is pretty much a complete rewrite of the earlier code. The main
#define WINS_SRV_FMT "WINS_SRV_DEAD/%s,%s" /* wins_ip,src_ip */
-static char *wins_srv_keystr(struct in_addr wins_ip, struct in_addr src_ip)
+static char *wins_srv_keystr(struct ipv4_addr wins_ip, struct ipv4_addr src_ip)
{
char *keystr;
- if (asprintf(&keystr, WINS_SRV_FMT, inet_ntoa(wins_ip),
- inet_ntoa(src_ip)) == -1) {
+ if (asprintf(&keystr, WINS_SRV_FMT, sys_inet_ntoa(wins_ip),
+ sys_inet_ntoa(src_ip)) == -1) {
DEBUG(0, ("wins_srv_is_dead: malloc error\n"));
return NULL;
}
see if an ip is on the dead list
*/
-BOOL wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip)
+BOOL wins_srv_is_dead(struct ipv4_addr wins_ip, struct ipv4_addr src_ip)
{
char *keystr = wins_srv_keystr(wins_ip, src_ip);
BOOL result;
result = gencache_get(keystr, NULL, NULL);
SAFE_FREE(keystr);
- DEBUG(4, ("wins_srv_is_dead: %s is %s\n", inet_ntoa(wins_ip),
+ DEBUG(4, ("wins_srv_is_dead: %s is %s\n", sys_inet_ntoa(wins_ip),
result ? "dead" : "alive"));
return result;
/*
mark a wins server as being alive (for the moment)
*/
-void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip)
+void wins_srv_alive(struct ipv4_addr wins_ip, struct ipv4_addr src_ip)
{
char *keystr = wins_srv_keystr(wins_ip, src_ip);
SAFE_FREE(keystr);
DEBUG(4, ("wins_srv_alive: marking wins server %s alive\n",
- inet_ntoa(wins_ip)));
+ sys_inet_ntoa(wins_ip)));
}
/*
mark a wins server as temporarily dead
*/
-void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip)
+void wins_srv_died(struct ipv4_addr wins_ip, struct ipv4_addr src_ip)
{
char *keystr;
SAFE_FREE(keystr);
DEBUG(4,("Marking wins server %s dead for %u seconds from source %s\n",
- inet_ntoa(wins_ip), DEATH_TIME, inet_ntoa(src_ip)));
+ sys_inet_ntoa(wins_ip), DEATH_TIME, sys_inet_ntoa(src_ip)));
}
/*
return the total number of wins servers, dead or not
*/
-unsigned wins_srv_count(void)
+uint_t wins_srv_count(void)
{
const char **list;
int count = 0;
attached */
struct tagged_ip {
fstring tag;
- struct in_addr ip;
+ struct ipv4_addr ip;
};
/*
char *s = strchr(str, ':');
if (!s) {
fstrcpy(ip->tag, "*");
- ip->ip = *interpret_addr2(mem_ctx, str);
+ ip->ip = interpret_addr2(str);
return;
}
- ip->ip = *interpret_addr2(mem_ctx, s+1);
+ ip->ip = interpret_addr2(s+1);
fstrcpy(ip->tag, str);
s = strchr(ip->tag, ':');
if (s) *s = 0;
return the IP of the currently active wins server for the given tag,
or the zero IP otherwise
*/
-struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip)
+struct ipv4_addr wins_srv_ip_tag(const char *tag, struct ipv4_addr src_ip)
{
const char **list;
int i;
/* if we are a wins server then we always just talk to ourselves */
if (lp_wins_support()) {
- extern struct in_addr loopback_ip;
+ extern struct ipv4_addr loopback_ip;
return loopback_ip;
}
list = lp_wins_server_list();
if (!list || !list[0]) {
- struct in_addr ip;
+ struct ipv4_addr ip;
zero_ip(&ip);
return ip;
}
}
if (!wins_srv_is_dead(t_ip.ip, src_ip)) {
char *src_name;
- src_name = talloc_strdup(mem_ctx, inet_ntoa(src_ip));
+ src_name = talloc_strdup(mem_ctx, sys_inet_ntoa(src_ip));
DEBUG(6,("Current wins server for tag '%s' with source %s is %s\n",
tag,
src_name,
- inet_ntoa(t_ip.ip)));
+ sys_inet_ntoa(t_ip.ip)));
goto exit;
}
}
return a count of the number of IPs for a particular tag, including
dead ones
*/
-unsigned wins_srv_count_tag(const char *tag)
+uint_t wins_srv_count_tag(const char *tag)
{
const char **list;
int i, count=0;