Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
8321dd21
Commit
8321dd21
authored
May 11, 2000
by
Michael Graff
Browse files
add ISC_R_NOTBOUND and ISC_R_NOTCONNECTED and return them where appropriate.
parent
dcd66bf9
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/isc/include/isc/result.h
View file @
8321dd21
...
...
@@ -42,7 +42,7 @@
#define ISC_R_EXISTS 18
#define ISC_R_NOSPACE 19
/* ran out of space */
#define ISC_R_CANCELED 20
/* AVAILABLE CODE 21
*/
#define ISC_R_NOTBOUND 21
/* socket is not bound
*/
#define ISC_R_SHUTTINGDOWN 22
/* shutting down */
#define ISC_R_NOTFOUND 23
#define ISC_R_UNEXPECTEDEND 24
/* unexpected end of input */
...
...
@@ -61,8 +61,9 @@
#define ISC_R_MASKNONCONTIG 37
#define ISC_R_FILENOTFOUND 38
#define ISC_R_FILEEXISTS 39
#define ISC_R_NOTCONNECTED 40
/* socket is not connected */
#define ISC_R_NRESULTS 4
0
/* Number of results */
#define ISC_R_NRESULTS 4
1
/* Number of results */
ISC_LANG_BEGINDECLS
...
...
lib/isc/result.c
View file @
8321dd21
...
...
@@ -57,7 +57,7 @@ static char *text[ISC_R_NRESULTS] = {
"already exists"
,
/* 18 */
"ran out of space"
,
/* 19 */
"operation canceled"
,
/* 20 */
"
<available code 21>
"
,
/* 21 */
"
socket is not bound
"
,
/* 21 */
"shutting down"
,
/* 22 */
"not found"
,
/* 23 */
"unexpected end of input"
,
/* 24 */
...
...
@@ -75,7 +75,8 @@ static char *text[ISC_R_NRESULTS] = {
"ignore"
,
/* 36 */
"address mask not contiguous"
,
/* 37 */
"file not found"
,
/* 38 */
"file already exists"
/* 39 */
"file already exists"
,
/* 39 */
"socket is not connected"
/* 40 */
};
#define ISC_RESULT_RESULTSET 2
...
...
lib/isc/unix/socket.c
View file @
8321dd21
...
...
@@ -2887,38 +2887,55 @@ internal_connect(isc_task_t *me, isc_event_t *ev)
isc_result_t
isc_socket_getpeername
(
isc_socket_t
*
sock
,
isc_sockaddr_t
*
addressp
)
{
isc_result_t
ret
;
REQUIRE
(
VALID_SOCKET
(
sock
));
REQUIRE
(
addressp
!=
NULL
);
LOCK
(
&
sock
->
lock
);
*
addressp
=
sock
->
address
;
if
(
sock
->
connected
)
{
*
addressp
=
sock
->
address
;
ret
=
ISC_R_SUCCESS
;
}
else
{
ret
=
ISC_R_NOTCONNECTED
;
}
UNLOCK
(
&
sock
->
lock
);
return
(
ISC_R_SUCCESS
);
return
(
ret
);
}
isc_result_t
isc_socket_getsockname
(
isc_socket_t
*
sock
,
isc_sockaddr_t
*
addressp
)
{
ISC_SOCKADDR_LEN_T
len
;
isc_result_t
ret
;
REQUIRE
(
VALID_SOCKET
(
sock
));
REQUIRE
(
addressp
!=
NULL
);
LOCK
(
&
sock
->
lock
);
if
(
!
sock
->
bound
)
{
ret
=
ISC_R_NOTBOUND
;
goto
out
;
}
ret
=
ISC_R_SUCCESS
;
len
=
sizeof
addressp
->
type
;
if
(
getsockname
(
sock
->
fd
,
&
addressp
->
type
.
sa
,
(
void
*
)
&
len
)
<
0
)
{
UNEXPECTED_ERROR
(
__FILE__
,
__LINE__
,
"getsockname: %s"
,
strerror
(
errno
));
UNLOCK
(
&
sock
->
lock
)
;
return
(
ISC_R_UNEXPECTED
)
;
ret
=
ISC_R_UNEXPECTED
;
goto
out
;
}
addressp
->
length
=
(
unsigned
int
)
len
;
out:
UNLOCK
(
&
sock
->
lock
);
return
(
ISC_R_SUCCESS
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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