mirror of
https://github.com/nmap/nmap.git
synced 2025-12-20 14:39:02 +00:00
Replaced a couple macros by corresponding static inline functions.
Removed unused PROXY_CTX_NODES() macro.
This commit is contained in:
@@ -268,7 +268,7 @@ nsock_event_id nsock_connect_tcp(nsock_pool nsp, nsock_iod ms_iod, nsock_ev_hand
|
||||
if (nsi->px_ctx) {
|
||||
struct proxy_node *current;
|
||||
|
||||
current = PROXY_CTX_CURRENT(nsi->px_ctx);
|
||||
current = proxy_ctx_node_current(nsi->px_ctx);
|
||||
assert(current != NULL);
|
||||
|
||||
memcpy(&nsi->px_ctx->target_ss, saddr, sslen);
|
||||
|
||||
@@ -452,7 +452,7 @@ void nsock_proxy_ev_dispatch(nsock_pool nspool, nsock_event nsevent, void *udata
|
||||
if (nse->status != NSE_STATUS_SUCCESS)
|
||||
fatal("Error, but this is debug only!");
|
||||
|
||||
current = PROXY_CTX_CURRENT(nse->iod->px_ctx);
|
||||
current = proxy_ctx_node_current(nse->iod->px_ctx);
|
||||
assert(current);
|
||||
current->ops->handler(nspool, nsevent, udata);
|
||||
}
|
||||
|
||||
@@ -61,12 +61,6 @@
|
||||
#include <nsock.h>
|
||||
|
||||
|
||||
/* ------------------ UTIL MACROS ------------------ */
|
||||
#define PROXY_CTX_CURRENT(ctx) ((struct proxy_node *)(GH_LIST_ELEM_DATA((ctx)->px_current)))
|
||||
#define PROXY_CTX_NEXT(ctx) ((struct proxy_node *)((GH_LIST_ELEM_NEXT((ctx)->px_current)) ? GH_LIST_ELEM_DATA(GH_LIST_ELEM_NEXT((ctx)->px_current)) : NULL))
|
||||
#define PROXY_CTX_NODES(ctx) ((ctx)->px_chain->nodes)
|
||||
|
||||
|
||||
/* ------------------- CONSTANTS ------------------- */
|
||||
enum nsock_proxy_type {
|
||||
PROXY_TYPE_HTTP = 0,
|
||||
@@ -141,6 +135,22 @@ struct proxy_op {
|
||||
};
|
||||
|
||||
|
||||
/* ------------------- UTIL FUNCTIONS ------------------- */
|
||||
static inline struct proxy_node *proxy_ctx_node_current(struct proxy_chain_context *ctx) {
|
||||
return GH_LIST_ELEM_DATA(ctx->px_current);
|
||||
}
|
||||
|
||||
static inline struct proxy_node *proxy_ctx_node_next(struct proxy_chain_context *ctx) {
|
||||
gh_list_elem *next;
|
||||
|
||||
next = GH_LIST_ELEM_NEXT(ctx->px_current);
|
||||
if (next)
|
||||
return GH_LIST_ELEM_DATA(next);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------- PROTOTYPES ------------------- */
|
||||
|
||||
struct proxy_chain_context *proxy_chain_context_new(nsock_pool nspool);
|
||||
|
||||
@@ -112,15 +112,14 @@ void proxy_http_handler(nsock_pool nspool, nsock_event nsevent, void *udata) {
|
||||
struct sockaddr_storage *ss;
|
||||
size_t sslen;
|
||||
unsigned short port;
|
||||
struct proxy_node *next;
|
||||
|
||||
switch (nse->iod->px_ctx->px_state) {
|
||||
case PROXY_STATE_INITIAL:
|
||||
nse->iod->px_ctx->px_state = PROXY_STATE_HTTP_TCP_CONNECTED;
|
||||
|
||||
if (PROXY_CTX_NEXT(nse->iod->px_ctx)) {
|
||||
struct proxy_node *next;
|
||||
|
||||
next = PROXY_CTX_NEXT(nse->iod->px_ctx);
|
||||
next = proxy_ctx_node_next(nse->iod->px_ctx);
|
||||
if (next) {
|
||||
ss = &next->ss;
|
||||
sslen = next->sslen;
|
||||
port = next->port;
|
||||
|
||||
Reference in New Issue
Block a user