mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-15 18:09:15 +08:00
bafc30bec6
"#if FOO" still works with simple -DFOO, but gives more flexibility. Specifically, if user expressed no preference (FOO is not defined), we can apply reasonable defaults (this is the legitimate use of ifdef). In short, from now on, please use #if MG_ENABLE_FOO instead of #ifdef MG_ENABLE_FOO Since we are all used to #ifdef, this change also adds a precommit check to police this. Specifically, in *.h and *.c files that are Copyright Cesanta, "ifdef" and "if defined()" are not allowed to be used with macros that contain ENABLE or DISABLE, unless the like also contains "ifdef-ok". Hence, if you are sure you want to use ifdef, use this: #ifdef MG_ENABLE_FOO /* ifdef-ok */ PUBLISHED_FROM=9be829448f53cff575d6cae8b9945fb12531c15a
3.0 KiB
3.0 KiB
title | decl_name | symbol_kind | signature |
---|---|---|---|
struct mg_connection | struct mg_connection | struct | struct mg_connection { struct mg_connection *next, *prev; /* mg_mgr::active_connections linkage */ struct mg_connection *listener; /* Set only for accept()-ed connections */ struct mg_mgr *mgr; /* Pointer to containing manager */ sock_t sock; /* Socket to the remote peer */ int err; union socket_address sa; /* Remote peer address */ size_t recv_mbuf_limit; /* Max size of recv buffer */ struct mbuf recv_mbuf; /* Received data */ struct mbuf send_mbuf; /* Data scheduled for sending */ #if MG_ENABLE_SSL #if !defined(MG_SOCKET_SIMPLELINK) SSL *ssl; SSL_CTX *ssl_ctx; #else char *ssl_cert; char *ssl_key; char *ssl_ca_cert; char *ssl_server_name; #endif #endif time_t last_io_time; /* Timestamp of the last socket IO */ double ev_timer_time; /* Timestamp of the future MG_EV_TIMER */ mg_event_handler_t proto_handler; /* Protocol-specific event handler */ void *proto_data; /* Protocol-specific data */ void (*proto_data_destructor)(void *proto_data); mg_event_handler_t handler; /* Event handler function */ void *user_data; /* User-specific data */ union { void *v; /* * the C standard is fussy about fitting function pointers into * void pointers, since some archs might have fat pointers for functions. */ mg_event_handler_t f; } priv_1; /* Used by mg_enable_multithreading() */ void *priv_2; /* Used by mg_enable_multithreading() */ void *mgr_data; /* Implementation-specific event manager's data. */ unsigned long flags; /* Flags set by Mongoose */ #define MG_F_LISTENING (1 << 0) /* This connection is listening */ #define MG_F_UDP (1 << 1) /* This connection is UDP */ #define MG_F_RESOLVING (1 << 2) /* Waiting for async resolver */ #define MG_F_CONNECTING (1 << 3) /* connect() call in progress */ #define MG_F_SSL (1 << 4) /* SSL is enabled on the connection */ #define MG_F_SSL_HANDSHAKE_DONE (1 << 5) /* SSL hanshake has completed */ #define MG_F_WANT_READ (1 << 6) /* SSL specific */ #define MG_F_WANT_WRITE (1 << 7) /* SSL specific */ #define MG_F_IS_WEBSOCKET (1 << 8) /* Websocket specific */ /* Flags that are settable by user */ #define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */ #define MG_F_CLOSE_IMMEDIATELY (1 << 11) /* Disconnect */ #define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12) /* Websocket specific */ #define MG_F_DELETE_CHUNK (1 << 13) /* HTTP specific */ #define MG_F_ENABLE_BROADCAST (1 << 14) /* Allow broadcast address usage */ #define MG_F_USER_1 (1 << 20) /* Flags left for application */ #define MG_F_USER_2 (1 << 21) #define MG_F_USER_3 (1 << 22) #define MG_F_USER_4 (1 << 23) #define MG_F_USER_5 (1 << 24) #define MG_F_USER_6 (1 << 25) }; |
Mongoose connection.