![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
#include "nilorea/n_str.h"#include "nilorea/n_log.h"#include "nilorea/n_network.h"#include "nilorea/n_common.h"#include <getopt.h>#include <string.h>#include <pthread.h>#include <unistd.h>
Include dependency graph for ex_network_mock.c:Go to the source code of this file.
Macros | |
| #define | MOCK_PORT 19090 |
| mock server port | |
Functions | |
| int | main (int argc, char *argv[]) |
| static void | on_request (N_HTTP_REQUEST *req, N_HTTP_RESPONSE *resp, void *user_data) |
| Request handler: returns JSON for GET /api/test, 404 otherwise. | |
| static void * | server_thread (void *arg) |
| Thread function that runs the server accept loop. | |
Variables | |
| static N_MOCK_SERVER * | g_server = NULL |
| global server pointer for thread | |
| #define MOCK_PORT 19090 |
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 78 of file ex_network_mock.c.
References g_server, getoptret, LOG_DEBUG, LOG_ERR, LOG_INFO, log_level, LOG_NOTICE, MOCK_PORT, n_mock_server_free(), n_mock_server_start(), n_mock_server_stop(), on_request(), port_str, server_thread(), and set_log_level().
Here is the call graph for this function:
|
static |
Request handler: returns JSON for GET /api/test, 404 otherwise.
| req | parsed HTTP request |
| resp | response to fill |
| user_data | unused |
Definition at line 49 of file ex_network_mock.c.
References N_HTTP_RESPONSE::body, char_to_nstr(), N_HTTP_RESPONSE::content_type, LOG_INFO, N_HTTP_REQUEST::method, n_log, N_HTTP_REQUEST::path, and N_HTTP_RESPONSE::status_code.
Referenced by main(), and n_mock_server_start().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Thread function that runs the server accept loop.
| arg | unused |
Definition at line 72 of file ex_network_mock.c.
References g_server, and n_mock_server_run().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
global server pointer for thread
Definition at line 41 of file ex_network_mock.c.
Referenced by main(), and server_thread().