update isc_sockettype_t enum names
This commit is contained in:
@@ -117,7 +117,7 @@ ns_interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
|
||||
* Open a UDP socket.
|
||||
*/
|
||||
ifp->udpsocket = NULL;
|
||||
iresult = isc_socket_create(mgr->socketmgr, isc_socket_udp,
|
||||
iresult = isc_socket_create(mgr->socketmgr, isc_sockettype_udp,
|
||||
&ifp->udpsocket);
|
||||
if (iresult != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
@@ -147,7 +147,7 @@ ns_interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
|
||||
* Open a TCP socket.
|
||||
*/
|
||||
ifp->tcpsocket = NULL;
|
||||
iresult = isc_socket_create(mgr->socketmgr, isc_socket_tcp,
|
||||
iresult = isc_socket_create(mgr->socketmgr, isc_sockettype_tcp,
|
||||
&ifp->tcpsocket);
|
||||
if (iresult != ISC_R_SUCCESS) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
|
||||
@@ -354,7 +354,7 @@ main(int argc, char *argv[])
|
||||
sockaddr.type.sin.sin_family = AF_INET;
|
||||
sockaddr.type.sin.sin_port = htons(5555);
|
||||
sockaddr.length = sizeof (struct sockaddr_in);
|
||||
RUNTIME_CHECK(isc_socket_create(socketmgr, isc_socket_udp, &s0) ==
|
||||
RUNTIME_CHECK(isc_socket_create(socketmgr, isc_sockettype_udp, &s0) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_socket_bind(s0, &sockaddr) == ISC_R_SUCCESS);
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ main(int argc, char *argv[])
|
||||
sockaddr.type.sin.sin_family = AF_INET;
|
||||
sockaddr.type.sin.sin_port = htons(5544);
|
||||
sockaddr.length = sizeof (struct sockaddr_in);
|
||||
RUNTIME_CHECK(isc_socket_create(socketmgr, isc_socket_tcp, &so1) ==
|
||||
RUNTIME_CHECK(isc_socket_create(socketmgr, isc_sockettype_tcp, &so1) ==
|
||||
ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_socket_bind(so1, &sockaddr) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_socket_listen(so1, 0) == ISC_R_SUCCESS);
|
||||
@@ -345,7 +345,7 @@ main(int argc, char *argv[])
|
||||
sockaddr.type.sin.sin_family = AF_INET;
|
||||
sockaddr.type.sin.sin_addr.s_addr = inet_addr("204.152.186.34");
|
||||
sockaddr.length = sizeof (struct sockaddr_in);
|
||||
RUNTIME_CHECK(isc_socket_create(socketmgr, isc_socket_tcp,
|
||||
RUNTIME_CHECK(isc_socket_create(socketmgr, isc_sockettype_tcp,
|
||||
&so2) == ISC_R_SUCCESS);
|
||||
RUNTIME_CHECK(isc_socket_connect(so2, &sockaddr, t2,
|
||||
my_connect, "so2") == ISC_R_SUCCESS);
|
||||
|
||||
@@ -307,10 +307,10 @@ free_buffer(dns_dispatch_t *disp, void *buf, unsigned int len)
|
||||
socktype = isc_socket_gettype(disp->socket);
|
||||
|
||||
switch (socktype) {
|
||||
case isc_socket_tcp:
|
||||
case isc_sockettype_tcp:
|
||||
isc_mem_put(disp->mctx, buf, len);
|
||||
break;
|
||||
case isc_socket_udp:
|
||||
case isc_sockettype_udp:
|
||||
XDEBUG(("Freeing buffer %p, length %d, into %s, %d remain\n",
|
||||
buf, len,
|
||||
(len == disp->buffersize ? "mempool" : "mctx"),
|
||||
@@ -752,7 +752,7 @@ startrecv(dns_dispatch_t *disp)
|
||||
/*
|
||||
* UDP reads are always maximal.
|
||||
*/
|
||||
case isc_socket_udp:
|
||||
case isc_sockettype_udp:
|
||||
region.length = disp->buffersize;
|
||||
region.base = allocate_buffer(disp, disp->buffersize);
|
||||
if (region.base == NULL)
|
||||
@@ -769,7 +769,7 @@ startrecv(dns_dispatch_t *disp)
|
||||
disp->recvs++;
|
||||
break;
|
||||
|
||||
case isc_socket_tcp:
|
||||
case isc_sockettype_tcp:
|
||||
XDEBUG(("Starting tcp receive\n"));
|
||||
res = dns_tcpmsg_readmessage(&disp->tcpmsg,
|
||||
disp->task, tcp_recv,
|
||||
@@ -811,7 +811,8 @@ dns_dispatch_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
|
||||
REQUIRE(dispp != NULL && *dispp == NULL);
|
||||
|
||||
socktype = isc_socket_gettype(sock);
|
||||
REQUIRE(socktype == isc_socket_udp || socktype == isc_socket_tcp);
|
||||
REQUIRE(socktype == isc_sockettype_udp ||
|
||||
socktype == isc_sockettype_tcp);
|
||||
|
||||
res = DNS_R_SUCCESS;
|
||||
|
||||
@@ -826,7 +827,7 @@ dns_dispatch_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
|
||||
disp->maxbuffers = maxbuffers;
|
||||
disp->refcount = 1;
|
||||
disp->recvs = 0;
|
||||
if (socktype == isc_socket_udp) {
|
||||
if (socktype == isc_sockettype_udp) {
|
||||
disp->recvs_wanted = 4; /* XXXMLG config option */
|
||||
} else {
|
||||
disp->recvs_wanted = 1;
|
||||
|
||||
@@ -483,10 +483,10 @@ isc_socket_create(isc_socketmgr_t *manager, isc_sockettype_t type,
|
||||
return (ret);
|
||||
|
||||
switch (type) {
|
||||
case isc_socket_udp:
|
||||
case isc_sockettype_udp:
|
||||
sock->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
break;
|
||||
case isc_socket_tcp:
|
||||
case isc_sockettype_tcp:
|
||||
sock->fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
break;
|
||||
}
|
||||
@@ -973,7 +973,7 @@ internal_recv(isc_task_t *task, isc_event_t *ev)
|
||||
* we can.
|
||||
*/
|
||||
read_count = dev->region.length - dev->n;
|
||||
if (sock->type == isc_socket_udp) {
|
||||
if (sock->type == isc_sockettype_udp) {
|
||||
addrlen = sizeof dev->address.type;
|
||||
cc = recvfrom(sock->fd,
|
||||
ISC_SOCKDATA_CAST(dev->region.base
|
||||
@@ -1001,7 +1001,7 @@ internal_recv(isc_task_t *task, isc_event_t *ev)
|
||||
#define SOFT_OR_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
if (sock->connected) { \
|
||||
if (sock->type == isc_socket_tcp) \
|
||||
if (sock->type == isc_sockettype_tcp) \
|
||||
sock->recv_result = _isc; \
|
||||
send_recvdone_event(sock, &iev->task, &iev, \
|
||||
&dev, _isc); \
|
||||
@@ -1041,7 +1041,7 @@ internal_recv(isc_task_t *task, isc_event_t *ev)
|
||||
* result code. This will set the EOF flag in markers as
|
||||
* well, but that's really ok.
|
||||
*/
|
||||
if ((sock->type == isc_socket_tcp) && (cc == 0)) {
|
||||
if ((sock->type == isc_sockettype_tcp) && (cc == 0)) {
|
||||
do {
|
||||
send_recvdone_event(sock, &iev->task,
|
||||
&iev, &dev,
|
||||
@@ -1162,7 +1162,7 @@ internal_send(isc_task_t *task, isc_event_t *ev)
|
||||
* we can.
|
||||
*/
|
||||
write_count = dev->region.length - dev->n;
|
||||
if (sock->type == isc_socket_udp)
|
||||
if (sock->type == isc_sockettype_udp)
|
||||
cc = sendto(sock->fd,
|
||||
ISC_SOCKDATA_CAST(dev->region.base
|
||||
+ dev->n),
|
||||
@@ -1185,7 +1185,7 @@ internal_send(isc_task_t *task, isc_event_t *ev)
|
||||
#define SOFT_OR_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
if (sock->connected) { \
|
||||
if (sock->type == isc_socket_tcp) \
|
||||
if (sock->type == isc_sockettype_tcp) \
|
||||
sock->send_result = _isc; \
|
||||
send_senddone_event(sock, &iev->task, &iev, \
|
||||
&dev, _isc); \
|
||||
@@ -1702,7 +1702,7 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
/*
|
||||
* UDP sockets are always partial read
|
||||
*/
|
||||
if (sock->type == isc_socket_udp)
|
||||
if (sock->type == isc_sockettype_udp)
|
||||
partial = ISC_TRUE;
|
||||
|
||||
dev->region = *region;
|
||||
@@ -1714,7 +1714,7 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
* If the read queue is empty, try to do the I/O right now.
|
||||
*/
|
||||
if (EMPTY(sock->recv_list)) {
|
||||
if (sock->type == isc_socket_udp) {
|
||||
if (sock->type == isc_sockettype_udp) {
|
||||
ISC_SOCKADDR_LEN_T addrlen;
|
||||
|
||||
addrlen = (ISC_SOCKADDR_LEN_T)
|
||||
@@ -1744,7 +1744,7 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
#define SOFT_OR_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
if (sock->connected) { \
|
||||
if (sock->type == isc_socket_tcp) \
|
||||
if (sock->type == isc_sockettype_tcp) \
|
||||
sock->recv_result = _isc; \
|
||||
send_recvdone_event(sock, &task, NULL, &dev, _isc); \
|
||||
} \
|
||||
@@ -1780,7 +1780,7 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region,
|
||||
* UDP, zero length reads are perfectly valid, although
|
||||
* strange.
|
||||
*/
|
||||
if ((sock->type == isc_socket_tcp) && (cc == 0)) {
|
||||
if ((sock->type == isc_sockettype_tcp) && (cc == 0)) {
|
||||
sock->recv_result = ISC_R_EOF;
|
||||
send_recvdone_event(sock, &task, NULL,
|
||||
&dev, ISC_R_EOF);
|
||||
@@ -1901,24 +1901,24 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
/*
|
||||
* If the write queue is empty, try to do the I/O right now.
|
||||
*/
|
||||
if (sock->type == isc_socket_udp) {
|
||||
if (sock->type == isc_sockettype_udp) {
|
||||
if (address != NULL)
|
||||
dev->address = *address;
|
||||
else
|
||||
dev->address = sock->address;
|
||||
} else if (sock->type == isc_socket_tcp) {
|
||||
} else if (sock->type == isc_sockettype_tcp) {
|
||||
INSIST(address == NULL);
|
||||
dev->address = sock->address;
|
||||
}
|
||||
|
||||
if (EMPTY(sock->send_list)) {
|
||||
if (sock->type == isc_socket_udp)
|
||||
if (sock->type == isc_sockettype_udp)
|
||||
cc = sendto(sock->fd,
|
||||
ISC_SOCKDATA_CAST(dev->region.base),
|
||||
dev->region.length, 0,
|
||||
&dev->address.type.sa,
|
||||
(int)dev->address.length);
|
||||
else if (sock->type == isc_socket_tcp)
|
||||
else if (sock->type == isc_sockettype_tcp)
|
||||
cc = send(sock->fd,
|
||||
ISC_SOCKDATA_CAST(dev->region.base),
|
||||
dev->region.length, 0);
|
||||
@@ -1937,7 +1937,7 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
|
||||
#define SOFT_OR_HARD(_system, _isc) \
|
||||
if (errno == _system) { \
|
||||
if (sock->connected) { \
|
||||
if (sock->type == isc_socket_tcp) \
|
||||
if (sock->type == isc_sockettype_tcp) \
|
||||
sock->send_result = _isc; \
|
||||
send_senddone_event(sock, &task, NULL, &dev, _isc); \
|
||||
} \
|
||||
@@ -2086,7 +2086,7 @@ isc_socket_listen(isc_socket_t *sock, unsigned int backlog)
|
||||
LOCK(&sock->lock);
|
||||
|
||||
REQUIRE(!sock->listener);
|
||||
REQUIRE(sock->type == isc_socket_tcp);
|
||||
REQUIRE(sock->type == isc_sockettype_tcp);
|
||||
|
||||
if (backlog == 0)
|
||||
backlog = SOMAXCONN;
|
||||
|
||||
Reference in New Issue
Block a user