Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
8a65611a
Commit
8a65611a
authored
Dec 02, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using core.h and modified API
parent
6c8a0aa7
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
279 additions
and
91 deletions
+279
-91
core.c
build/src/core.c
+190
-91
core.h
build/src/core.h
+89
-0
No files found.
build/src/core.c
View file @
8a65611a
This diff is collapsed.
Click to expand it.
build/src/core.h
0 → 100644
View file @
8a65611a
// Copyright (c) 2004-2013 Sergey Lyubka <valenok@gmail.com>
// Copyright (c) 2013 Cesanta Software Limited
// All rights reserved
//
// This library is dual-licensed: you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation. For the terms of this
// license, see <http://www.gnu.org/licenses/>.
//
// You are free to use this library under the terms of the GNU General
// Public License, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// Alternatively, you can license this library under a commercial
// license, as set out in <http://cesanta.com/products.html>.
//
// NOTE: Detailed API documentation is at http://cesanta.com/docs.html
#ifndef MONGOOSE_HEADER_INCLUDED
#define MONGOOSE_HEADER_INCLUDED
#include <stdio.h> // required for FILE
#include <stddef.h> // required for size_t
#ifdef __cplusplus
extern
"C"
{
#endif // __cplusplus
// This structure contains information about HTTP request.
struct
mg_connection
{
const
char
*
request_method
;
// "GET", "POST", etc
const
char
*
uri
;
// URL-decoded URI
const
char
*
http_version
;
// E.g. "1.0", "1.1"
const
char
*
query_string
;
// URL part after '?', not including '?', or NULL
long
remote_ip
;
// Client's IP address
int
remote_port
;
// Client's port
int
is_ssl
;
// 1 if SSL-ed, 0 if not
int
num_headers
;
// Number of HTTP headers
struct
mg_header
{
const
char
*
name
;
// HTTP header name
const
char
*
value
;
// HTTP header value
}
http_headers
[
64
];
// Maximum 64 headers
void
*
server_param
;
// Parameter passed to mg_add_uri_handler()
void
*
connection_param
;
// Placeholder for connection-specific data
};
struct
mg_server
;
// Opaque structure describing server instance
typedef
int
(
*
mg_uri_handler_t
)(
struct
mg_connection
*
);
typedef
int
(
*
mg_error_handler_t
)(
struct
mg_connection
*
,
int
http_error_code
);
// Server management functions
struct
mg_server
*
mg_create_server
(
void
*
server_param
);
void
mg_destroy_server
(
struct
mg_server
**
);
const
char
*
mg_set_option
(
struct
mg_server
*
,
const
char
*
opt
,
const
char
*
val
);
void
mg_poll_server
(
struct
mg_server
*
,
int
milliseconds
);
void
mg_add_uri_handler
(
struct
mg_server
*
,
const
char
*
uri
,
mg_uri_handler_t
);
void
mg_set_error_handler
(
struct
mg_server
*
,
mg_error_handler_t
);
void
mg_set_log_handler
(
struct
mg_server
*
,
int
(
*
)(
struct
mg_connection
*
,
int
));
const
char
**
mg_get_valid_option_names
(
void
);
const
char
*
mg_get_option
(
const
struct
mg_server
*
server
,
const
char
*
name
);
// Websocket functions
void
mg_websocket_handshake
(
struct
mg_connection
*
);
int
mg_websocket_read
(
struct
mg_connection
*
,
int
*
bits
,
char
**
data
);
int
mg_websocket_write
(
struct
mg_connection
*
conn
,
int
opcode
,
const
char
*
data
,
size_t
data_len
);
// Connection management functions
int
mg_write
(
struct
mg_connection
*
,
const
void
*
buf
,
int
len
);
int
mg_printf
(
struct
mg_connection
*
,
const
char
*
fmt
,
...);
void
mg_send_file
(
struct
mg_connection
*
,
const
char
*
path
);
int
mg_read
(
struct
mg_connection
*
,
void
*
buf
,
int
len
);
const
char
*
mg_get_header
(
const
struct
mg_connection
*
,
const
char
*
name
);
int
mg_get_var
(
const
char
*
data
,
size_t
data_len
,
const
char
*
var_name
,
char
*
dst
,
size_t
dst_len
);
int
mg_get_cookie
(
const
char
*
cookie
,
const
char
*
var_name
,
char
*
buf
,
size_t
buf_len
);
const
char
*
mg_get_mime_type
(
const
char
*
file_name
);
// Utility functions
int
mg_start_thread
(
void
*
(
*
func
)(
void
*
),
void
*
param
);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // MONGOOSE_HEADER_INCLUDED
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment