mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-22 11:36:21 +00:00
Implementing MG interfaces
PUBLISHED_FROM=46496c2d5340a0bbe4fe1c6c9ff187bc65d2d35f
This commit is contained in:
1 parent
8bf3bd48a6
commit
fffb54e2c6
8 files changed
+646
-235
No files matched your search
@@ -15,6 +15,7 @@ items:
|
||||
- { name: mg_enable_multithreading.md }
|
||||
- { name: mg_mgr_free.md }
|
||||
- { name: mg_mgr_init.md }
|
||||
- { name: mg_mgr_init_opt.md }
|
||||
- { name: mg_mgr_poll.md }
|
||||
- { name: mg_next.md }
|
||||
- { name: mg_printf.md }
|
||||
@@ -31,6 +32,7 @@ items:
|
||||
- { name: struct_mg_connect_opts.md }
|
||||
- { name: struct_mg_connection.md }
|
||||
- { name: struct_mg_mgr.md }
|
||||
- { name: struct_mg_mgr_init_opts.md }
|
||||
- { name: struct_mg_multithreading_opts.md }
|
||||
---
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ title: "mg_event_handler_t"
|
||||
decl_name: "mg_event_handler_t"
|
||||
symbol_kind: "typedef"
|
||||
signature: |
|
||||
typedef void (*mg_event_handler_t)(struct mg_connection *nc, int ev, void *ev_data);
|
||||
typedef void (*mg_event_handler_t)(struct mg_connection *nc, int ev,
|
||||
void *ev_data);
|
||||
---
|
||||
|
||||
Callback function (event handler) prototype. Must be defined by the user.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: "mg_mgr_init_opt()"
|
||||
decl_name: "mg_mgr_init_opt"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
void mg_mgr_init_opt(struct mg_mgr *mgr, void *user_data,
|
||||
struct mg_mgr_init_opts opts);
|
||||
---
|
||||
|
||||
Like `mg_mgr_init` but with more options.
|
||||
|
||||
Notably, this allows you to create a manger and choose
|
||||
dynamically which networking interface implementation to use.
|
||||
|
||||
@@ -42,6 +42,7 @@ signature: |
|
||||
} priv_1; /* Used by mg_enable_multithreading() */
|
||||
void *priv_2; /* Used by mg_enable_multithreading() */
|
||||
void *mgr_data; /* Implementation-specific event manager's data. */
|
||||
struct mg_iface *iface;
|
||||
unsigned long flags;
|
||||
/* Flags set by Mongoose */
|
||||
#define MG_F_LISTENING (1 << 0) /* This connection is listening */
|
||||
|
||||
@@ -12,7 +12,8 @@ signature: |
|
||||
sock_t ctl[2]; /* Socketpair for mg_broadcast() */
|
||||
#endif
|
||||
void *user_data; /* User data */
|
||||
void *mgr_data; /* Implementation-specific event manager's data. */
|
||||
int num_ifaces;
|
||||
struct mg_iface **ifaces; /* network interfaces */
|
||||
#if MG_ENABLE_JAVASCRIPT
|
||||
struct v7 *v7;
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "struct mg_mgr_init_opts"
|
||||
decl_name: "struct mg_mgr_init_opts"
|
||||
symbol_kind: "struct"
|
||||
signature: |
|
||||
struct mg_mgr_init_opts {
|
||||
struct mg_iface_vtable *main_iface;
|
||||
int num_ifaces;
|
||||
struct mg_iface_vtable **ifaces;
|
||||
};
|
||||
---
|
||||
|
||||
Optional parameters to `mg_mgr_init_opt()`.
|
||||
|
||||
If `main_iface` is not NULL, it will be used as the main interface in the
|
||||
default interface set. The pointer will be free'd by `mg_mgr_free`.
|
||||
Otherwise, the main interface will be autodetected based on the current
|
||||
platform.
|
||||
|
||||
If `num_ifaces` is 0 and `ifaces` is NULL, the default interface set will be
|
||||
used.
|
||||
This is an advanced option, as it requires you to construct a full interface
|
||||
set, including special networking interfaces required by some optional
|
||||
features such as TCP tunneling. Memory backing `ifaces` and each of the
|
||||
`num_ifaces` pointers it contains will be reclaimed by `mg_mgr_free`.
|
||||
|
||||
Reference in new issue
Block a user