mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-01 13:10:43 +00:00
Change driver API: up(ifp) -> poll(ifp, 1second)
Add misc extras required by Wi-Fi drivers (in progress)
This commit is contained in:
1 parent
8906b1ac0f
commit
065027843e
30 files changed
+359
-248
No files matched your search
@@ -79,8 +79,8 @@ static size_t pcap_tx(const void *buf, size_t len, struct mg_tcpip_if *ifp) {
|
||||
return res == PCAP_ERROR ? 0 : len;
|
||||
}
|
||||
|
||||
static bool pcap_up(struct mg_tcpip_if *ifp) {
|
||||
return ifp->driver_data ? true : false;
|
||||
static bool pcap_poll(struct mg_tcpip_if *ifp, bool s1) {
|
||||
return s1 && ifp->driver_data ? true : false;
|
||||
}
|
||||
|
||||
static size_t pcap_rx(void *buf, size_t len, struct mg_tcpip_if *ifp) {
|
||||
@@ -272,7 +272,7 @@ int main(int argc, char *argv[]) {
|
||||
mg_mgr_init(&mgr); // Initialise event manager
|
||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
||||
|
||||
struct mg_tcpip_driver driver = {.tx = pcap_tx, .up = pcap_up, .rx = pcap_rx};
|
||||
struct mg_tcpip_driver driver = {.tx = pcap_tx, .poll = pcap_poll, .rx = pcap_rx};
|
||||
struct mg_tcpip_if mif = {.driver = &driver,
|
||||
.driver_data = ph,
|
||||
.enable_mac_check = true,
|
||||
|
||||
@@ -31,8 +31,8 @@ static size_t tap_tx(const void *buf, size_t len, struct mg_tcpip_if *ifp) {
|
||||
return (size_t) res;
|
||||
}
|
||||
|
||||
static bool tap_up(struct mg_tcpip_if *ifp) {
|
||||
return ifp->driver_data ? true : false;
|
||||
static bool tap_poll(struct mg_tcpip_if *ifp, bool s1) {
|
||||
return s1 && ifp->driver_data ? true : false;
|
||||
}
|
||||
|
||||
static size_t tap_rx(void *buf, size_t len, struct mg_tcpip_if *ifp) {
|
||||
@@ -109,7 +109,7 @@ int main(int argc, char *argv[]) {
|
||||
struct mg_mgr mgr; // Event manager
|
||||
mg_mgr_init(&mgr); // Initialise event manager
|
||||
|
||||
struct mg_tcpip_driver driver = {.tx = tap_tx, .up = tap_up, .rx = tap_rx};
|
||||
struct mg_tcpip_driver driver = {.tx = tap_tx, .poll = tap_poll, .rx = tap_rx};
|
||||
struct mg_tcpip_if mif = {.driver = &driver,
|
||||
.driver_data = &fd,
|
||||
.enable_req_dns = true,
|
||||
|
||||
Reference in new issue
Block a user