mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
apply the modified style
This commit is contained in:
@@ -37,15 +37,13 @@
|
||||
* changed in the future.
|
||||
*/
|
||||
|
||||
static void
|
||||
dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg);
|
||||
static void dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region,
|
||||
void *arg);
|
||||
|
||||
static void
|
||||
resume_processing(void *arg);
|
||||
static void resume_processing(void *arg);
|
||||
|
||||
static inline size_t
|
||||
dnslen(unsigned char *base)
|
||||
{
|
||||
dnslen(unsigned char *base) {
|
||||
return ((base[0] << 8) + (base[1]));
|
||||
}
|
||||
|
||||
@@ -60,8 +58,7 @@ dnslen(unsigned char *base)
|
||||
*/
|
||||
#define NM_BIG_BUF (65535 + 2) * 2
|
||||
static inline void
|
||||
alloc_dnsbuf(isc_nmsocket_t *sock, size_t len)
|
||||
{
|
||||
alloc_dnsbuf(isc_nmsocket_t *sock, size_t len) {
|
||||
REQUIRE(len <= NM_BIG_BUF);
|
||||
|
||||
if (sock->buf == NULL) {
|
||||
@@ -78,8 +75,7 @@ alloc_dnsbuf(isc_nmsocket_t *sock, size_t len)
|
||||
}
|
||||
|
||||
static void
|
||||
timer_close_cb(uv_handle_t *handle)
|
||||
{
|
||||
timer_close_cb(uv_handle_t *handle) {
|
||||
isc_nmsocket_t *sock = (isc_nmsocket_t *)uv_handle_get_data(handle);
|
||||
INSIST(VALID_NMSOCK(sock));
|
||||
atomic_store(&sock->closed, true);
|
||||
@@ -87,8 +83,7 @@ timer_close_cb(uv_handle_t *handle)
|
||||
}
|
||||
|
||||
static void
|
||||
dnstcp_readtimeout(uv_timer_t *timer)
|
||||
{
|
||||
dnstcp_readtimeout(uv_timer_t *timer) {
|
||||
isc_nmsocket_t *sock =
|
||||
(isc_nmsocket_t *)uv_handle_get_data((uv_handle_t *)timer);
|
||||
|
||||
@@ -103,8 +98,7 @@ dnstcp_readtimeout(uv_timer_t *timer)
|
||||
* Accept callback for TCP-DNS connection.
|
||||
*/
|
||||
static void
|
||||
dnslisten_acceptcb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg)
|
||||
{
|
||||
dnslisten_acceptcb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) {
|
||||
isc_nmsocket_t *dnslistensock = (isc_nmsocket_t *)cbarg;
|
||||
isc_nmsocket_t *dnssock = NULL;
|
||||
|
||||
@@ -154,8 +148,7 @@ dnslisten_acceptcb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg)
|
||||
* The caller will need to unreference the handle.
|
||||
*/
|
||||
static isc_result_t
|
||||
processbuffer(isc_nmsocket_t *dnssock, isc_nmhandle_t **handlep)
|
||||
{
|
||||
processbuffer(isc_nmsocket_t *dnssock, isc_nmhandle_t **handlep) {
|
||||
size_t len;
|
||||
|
||||
REQUIRE(VALID_NMSOCK(dnssock));
|
||||
@@ -175,8 +168,8 @@ processbuffer(isc_nmsocket_t *dnssock, isc_nmhandle_t **handlep)
|
||||
*/
|
||||
len = dnslen(dnssock->buf);
|
||||
if (len <= dnssock->buf_len - 2) {
|
||||
isc_nmhandle_t *dnshandle =
|
||||
isc__nmhandle_get(dnssock, NULL, NULL);
|
||||
isc_nmhandle_t *dnshandle = isc__nmhandle_get(dnssock, NULL,
|
||||
NULL);
|
||||
isc_nmsocket_t *listener = dnssock->listener;
|
||||
|
||||
if (listener != NULL && listener->rcb.recv != NULL) {
|
||||
@@ -206,12 +199,11 @@ processbuffer(isc_nmsocket_t *dnssock, isc_nmhandle_t **handlep)
|
||||
* a complete DNS packet and, if so - call the callback
|
||||
*/
|
||||
static void
|
||||
dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg)
|
||||
{
|
||||
dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg) {
|
||||
isc_nmsocket_t *dnssock = (isc_nmsocket_t *)arg;
|
||||
unsigned char * base = NULL;
|
||||
bool done = false;
|
||||
size_t len;
|
||||
unsigned char *base = NULL;
|
||||
bool done = false;
|
||||
size_t len;
|
||||
|
||||
REQUIRE(VALID_NMSOCK(dnssock));
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
@@ -237,7 +229,7 @@ dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg)
|
||||
: dnssock->mgr->idle);
|
||||
|
||||
do {
|
||||
isc_result_t result;
|
||||
isc_result_t result;
|
||||
isc_nmhandle_t *dnshandle = NULL;
|
||||
|
||||
result = processbuffer(dnssock, &dnshandle);
|
||||
@@ -290,11 +282,10 @@ isc_result_t
|
||||
isc_nm_listentcpdns(isc_nm_t *mgr, isc_nmiface_t *iface, isc_nm_recv_cb_t cb,
|
||||
void *cbarg, isc_nm_cb_t accept_cb, void *accept_cbarg,
|
||||
size_t extrahandlesize, int backlog, isc_quota_t *quota,
|
||||
isc_nmsocket_t **sockp)
|
||||
{
|
||||
isc_nmsocket_t **sockp) {
|
||||
/* A 'wrapper' socket object with outer set to true TCP socket */
|
||||
isc_nmsocket_t *dnslistensock =
|
||||
isc_mem_get(mgr->mctx, sizeof(*dnslistensock));
|
||||
isc_nmsocket_t *dnslistensock = isc_mem_get(mgr->mctx,
|
||||
sizeof(*dnslistensock));
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
@@ -322,8 +313,7 @@ isc_nm_listentcpdns(isc_nm_t *mgr, isc_nmiface_t *iface, isc_nm_recv_cb_t cb,
|
||||
}
|
||||
|
||||
void
|
||||
isc_nm_tcpdns_stoplistening(isc_nmsocket_t *sock)
|
||||
{
|
||||
isc_nm_tcpdns_stoplistening(isc_nmsocket_t *sock) {
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
REQUIRE(sock->type == isc_nm_tcpdnslistener);
|
||||
|
||||
@@ -339,8 +329,7 @@ isc_nm_tcpdns_stoplistening(isc_nmsocket_t *sock)
|
||||
}
|
||||
|
||||
void
|
||||
isc_nm_tcpdns_sequential(isc_nmhandle_t *handle)
|
||||
{
|
||||
isc_nm_tcpdns_sequential(isc_nmhandle_t *handle) {
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
|
||||
if (handle->sock->type != isc_nm_tcpdnssocket ||
|
||||
@@ -361,8 +350,7 @@ isc_nm_tcpdns_sequential(isc_nmhandle_t *handle)
|
||||
}
|
||||
|
||||
void
|
||||
isc_nm_tcpdns_keepalive(isc_nmhandle_t *handle)
|
||||
{
|
||||
isc_nm_tcpdns_keepalive(isc_nmhandle_t *handle) {
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
|
||||
if (handle->sock->type != isc_nm_tcpdnssocket ||
|
||||
@@ -375,19 +363,18 @@ isc_nm_tcpdns_keepalive(isc_nmhandle_t *handle)
|
||||
}
|
||||
|
||||
typedef struct tcpsend {
|
||||
isc_mem_t * mctx;
|
||||
isc_mem_t *mctx;
|
||||
isc_nmhandle_t *handle;
|
||||
isc_region_t region;
|
||||
isc_region_t region;
|
||||
isc_nmhandle_t *orighandle;
|
||||
isc_nm_cb_t cb;
|
||||
void * cbarg;
|
||||
isc_nm_cb_t cb;
|
||||
void *cbarg;
|
||||
} tcpsend_t;
|
||||
|
||||
static void
|
||||
resume_processing(void *arg)
|
||||
{
|
||||
resume_processing(void *arg) {
|
||||
isc_nmsocket_t *sock = (isc_nmsocket_t *)arg;
|
||||
isc_result_t result;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
REQUIRE(sock->tid == isc_nm_tid());
|
||||
@@ -448,8 +435,7 @@ resume_processing(void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
tcpdnssend_cb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg)
|
||||
{
|
||||
tcpdnssend_cb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg) {
|
||||
tcpsend_t *ts = (tcpsend_t *)cbarg;
|
||||
|
||||
UNUSED(handle);
|
||||
@@ -466,8 +452,7 @@ tcpdnssend_cb(isc_nmhandle_t *handle, isc_result_t result, void *cbarg)
|
||||
*/
|
||||
isc_result_t
|
||||
isc__nm_tcpdns_send(isc_nmhandle_t *handle, isc_region_t *region,
|
||||
isc_nm_cb_t cb, void *cbarg)
|
||||
{
|
||||
isc_nm_cb_t cb, void *cbarg) {
|
||||
tcpsend_t *t = NULL;
|
||||
|
||||
REQUIRE(VALID_NMHANDLE(handle));
|
||||
@@ -504,8 +489,7 @@ isc__nm_tcpdns_send(isc_nmhandle_t *handle, isc_region_t *region,
|
||||
}
|
||||
|
||||
static void
|
||||
tcpdns_close_direct(isc_nmsocket_t *sock)
|
||||
{
|
||||
tcpdns_close_direct(isc_nmsocket_t *sock) {
|
||||
REQUIRE(sock->tid == isc_nm_tid());
|
||||
if (sock->outer != NULL) {
|
||||
sock->outer->rcb.recv = NULL;
|
||||
@@ -523,8 +507,7 @@ tcpdns_close_direct(isc_nmsocket_t *sock)
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_tcpdns_close(isc_nmsocket_t *sock)
|
||||
{
|
||||
isc__nm_tcpdns_close(isc_nmsocket_t *sock) {
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
REQUIRE(sock->type == isc_nm_tcpdnssocket);
|
||||
|
||||
@@ -541,8 +524,7 @@ isc__nm_tcpdns_close(isc_nmsocket_t *sock)
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_async_tcpdnsclose(isc__networker_t *worker, isc__netievent_t *ev0)
|
||||
{
|
||||
isc__nm_async_tcpdnsclose(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
isc__netievent_tcpdnsclose_t *ievent =
|
||||
(isc__netievent_tcpdnsclose_t *)ev0;
|
||||
|
||||
|
Reference in New Issue
Block a user