Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
a3040f1b
Commit
a3040f1b
authored
Aug 05, 2003
by
Per Cederqvist
Browse files
(isc_dns_resolve_cb): New function.
(isc_resolve_remote): New function. (isc_gethostname): Removed.
parent
4c86dfce
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libraries/libisc-new/src/isc_socket.c
View file @
a3040f1b
...
...
@@ -61,6 +61,7 @@
#include "isc.h"
#include "intern.h"
#include "isc_addr.h"
#include "unused.h"
...
...
@@ -186,23 +187,17 @@ char *isc_getipnum(union isc_address *ia, char *buf, int len)
}
char
*
isc_gethostname
(
union
isc_address
*
ia
,
char
*
buf
,
int
len
)
void
*
isc_dns_resolve_cb
(
oop_source
*
UNUSED
(
src
),
struct
timeval
UNUSED
(
tv
),
void
*
user
)
{
st
atic
char
hostname
[
256
]
;
st
ruct
isc_scb_internal
*
session
=
user
;
struct
hostent
*
hp
;
if
(
ia
==
NULL
)
{
return
NULL
;
}
isc_resolve_done_cb
*
cb
;
union
isc_address
*
ia
=
session
->
pub
.
raddr
;
if
(
!
buf
)
{
buf
=
hostname
;
len
=
sizeof
(
hostname
)
-
1
;
}
hp
=
CHOOSE_IP4OR6
(
ia
->
saddr
,
gethostbyaddr
((
char
*
)
&
ia
->
saddr
.
sa_in
.
sin_addr
,
sizeof
(
ia
->
saddr
.
sa_in
.
sin_addr
),
...
...
@@ -211,13 +206,31 @@ char *isc_gethostname(union isc_address *ia, char *buf, int len)
sizeof
(
ia
->
saddr
.
sa_in6
.
sin6_addr
),
ia
->
saddr
.
sa
.
sa_family
));
if
(
!
hp
)
return
NULL
;
strncpy
(
buf
,
hp
->
h_name
,
len
);
buf
[
len
]
=
'\0'
;
return
buf
;
cb
=
session
->
resolve_callback
;
session
->
resolve_callback
=
NULL
;
if
(
hp
)
{
s_crea_str
(
&
session
->
pub
.
remote
,
hp
->
h_name
);
return
cb
(
&
session
->
pub
,
isc_resolve_ok
,
0
);
}
else
{
s_crea_str
(
&
session
->
pub
.
remote
,
isc_getipnum
(
ia
,
NULL
,
0
));
return
cb
(
&
session
->
pub
,
isc_resolve_h_errno
,
h_errno
);
}
}
void
isc_resolve_remote
(
struct
isc_scb
*
scb
,
isc_resolve_done_cb
*
callback
)
{
struct
isc_scb_internal
*
session
=
(
struct
isc_scb_internal
*
)
scb
;
oop_source
*
source
=
session
->
pub
.
master
->
event_source
;
session
->
resolve_callback
=
callback
;
source
->
on_time
(
source
,
OOP_TIME_NOW
,
isc_dns_resolve_cb
,
session
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment