static inline const char *conn_get_xprt_name(const struct connection *conn)
{
- static char ptr[19]; /* 0x... */
- extern struct xprt_ops raw_sock; // should theorically not be exported
- extern struct xprt_ops ssl_sock; // should theorically not be exported
-
if (!conn_xprt_ready(conn))
return "NONE";
-
- if (conn->xprt == &raw_sock)
- return "RAW";
-
-#ifdef USE_OPENSSL
- if (conn->xprt == &ssl_sock)
- return "SSL";
-#endif
- snprintf(ptr, sizeof(ptr), "%p", conn->xprt);
- return ptr;
+ return conn->xprt->name;
}
static inline const char *conn_get_data_name(const struct connection *conn)
{
- static char ptr[19]; /* 0x... */
- extern struct data_cb sess_conn_cb; // should theorically not be exported
- extern struct data_cb si_conn_cb; // should theorically not be exported
- extern struct data_cb check_conn_cb; // should theorically not be exported
-
if (!conn->data)
return "NONE";
-
- if (conn->data == &sess_conn_cb)
- return "SESS";
-
- if (conn->data == &si_conn_cb)
- return "STRM";
-
- if (conn->data == &check_conn_cb)
- return "CHCK";
-
- snprintf(ptr, sizeof(ptr), "%p", conn->data);
- return ptr;
+ return conn->data->name;
}
void (*shutw)(struct connection *, int); /* shutw function */
void (*close)(struct connection *); /* close the transport layer */
int (*init)(struct connection *conn); /* initialize the transport layer */
+ char name[8]; /* transport layer name, zero-terminated */
};
/* data_cb describes the data layer's recv and send callbacks which are called
void (*send)(struct connection *conn); /* data-layer send callback */
int (*wake)(struct connection *conn); /* data-layer callback to report activity */
int (*init)(struct connection *conn); /* data-layer initialization */
+ char name[8]; /* data layer name, zero-terminated */
};
struct my_tcphdr {
.send = NULL,
.wake = conn_update_session,
.init = conn_complete_session,
+ .name = "SESS",
};
/* Create a a new session and assign it to frontend <fe>, listener <li>,
.recv = si_conn_recv_cb,
.send = si_conn_send_cb,
.wake = si_conn_wake_cb,
+ .name = "STRM",
};
struct data_cb si_idle_conn_cb = {
.recv = si_idle_conn_null_cb,
.send = si_idle_conn_null_cb,
.wake = si_idle_conn_wake_cb,
+ .name = "IDLE",
};
/*