mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-05 21:18:32 +08:00
Fixed C++ builds.
This commit is contained in:
parent
2afd529107
commit
aeab3ef7ac
@ -7007,7 +7007,7 @@ static size_t tx_tcp(struct mip_if *ifp, uint32_t dst_ip, uint8_t flags,
|
||||
struct ip *ip = tx_ip(ifp, 6, ifp->ip, dst_ip, sizeof(struct tcp) + len);
|
||||
struct tcp *tcp = (struct tcp *) (ip + 1);
|
||||
memset(tcp, 0, sizeof(*tcp));
|
||||
memmove(tcp + 1, buf, len);
|
||||
if (buf != NULL && len) memmove(tcp + 1, buf, len);
|
||||
tcp->sport = sport;
|
||||
tcp->dport = dport;
|
||||
tcp->seq = seq;
|
||||
@ -7374,6 +7374,11 @@ void mip_init(struct mg_mgr *mgr, struct mip_if *ifp) {
|
||||
}
|
||||
}
|
||||
|
||||
void mip_free(struct mip_if * ifp) {
|
||||
free((char *)ifp->rx.ptr);
|
||||
free((char *)ifp->tx.ptr);
|
||||
}
|
||||
|
||||
int mg_mkpipe(struct mg_mgr *m, mg_event_handler_t fn, void *d, bool udp) {
|
||||
(void) m, (void) fn, (void) d, (void) udp;
|
||||
MG_ERROR(("Not implemented"));
|
||||
|
@ -122,7 +122,12 @@ static void f_http_fetch_query(struct mg_connection *c, int ev, void *ev_data, v
|
||||
|
||||
// Fetch utility returns message from fetch(..., URL, POST)
|
||||
char *fetch(struct mg_mgr *mgr, const char *url, const char *fn_data) {
|
||||
struct Post_reply post_reply = {.post=(char*)fn_data, .http_response=0, .http_responses_received=0};
|
||||
struct Post_reply post_reply;
|
||||
{
|
||||
post_reply.post=(char*)fn_data;
|
||||
post_reply.http_response=0;
|
||||
post_reply.http_responses_received=0;
|
||||
}
|
||||
struct mg_connection *conn;
|
||||
conn = mg_http_connect(mgr, url, f_http_fetch_query, &post_reply);
|
||||
ASSERT(conn != NULL); // Assertion on initialisation
|
||||
@ -135,7 +140,7 @@ char *fetch(struct mg_mgr *mgr, const char *url, const char *fn_data) {
|
||||
if (!post_reply.http_responses_received)
|
||||
return 0;
|
||||
else
|
||||
return post_reply.http_response;
|
||||
return (char*)post_reply.http_response;
|
||||
}
|
||||
|
||||
// Returns server's HTTP response code
|
||||
@ -174,8 +179,18 @@ static void test_http_fetch(void) {
|
||||
mg_mgr_init(&mgr); // Initialise event manager
|
||||
|
||||
// MIP driver
|
||||
struct mip_driver driver = {.tx = tap_tx, .up = tap_up, .rx = tap_rx};
|
||||
struct mip_if mif = {.use_dhcp = true, .driver = &driver, .driver_data = &fd};
|
||||
struct mip_driver driver;
|
||||
{
|
||||
driver.tx = tap_tx;
|
||||
driver.up = tap_up;
|
||||
driver.rx = tap_rx;
|
||||
}
|
||||
struct mip_if mif;
|
||||
{
|
||||
mif.use_dhcp = true;
|
||||
mif.driver = &driver;
|
||||
mif.driver_data = &fd;
|
||||
}
|
||||
sscanf(mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &mif.mac[0], &mif.mac[1], &mif.mac[2],
|
||||
&mif.mac[3], &mif.mac[4], &mif.mac[5]);
|
||||
|
||||
@ -197,7 +212,7 @@ static void test_http_fetch(void) {
|
||||
|
||||
// Simple HTTP fetch
|
||||
{
|
||||
char* http_feedback = "";
|
||||
char* http_feedback = (char*)"";
|
||||
const bool ipv6 = 0;
|
||||
if (ipv6) {
|
||||
http_feedback = fetch (&mgr, "ipv6.google.com",\
|
||||
|
Loading…
Reference in New Issue
Block a user