#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/select.h>
Go to the source code of this file.
Classes | |
struct | iobuf |
struct | ns_connection |
struct | ns_mgr |
struct | ns_str |
union | socket_address |
Defines | |
#define | __cdecl |
#define | __STDC_FORMAT_MACROS |
#define | __STDC_LIMIT_MACROS |
#define | _CRT_SECURE_NO_WARNINGS |
#define | _FILE_OFFSET_BITS 64 |
#define | _INTEGRAL_MAX_BITS 64 |
#define | _LARGEFILE_SOURCE |
#define | _MBCS |
#define | _XOPEN_SOURCE 600 |
#define | ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) |
#define | closesocket(x) close(x) |
#define | DBG(x) |
#define | INVALID_SOCKET (-1) |
#define | NS_ACCEPT 1 |
#define | NS_CLOSE 5 |
#define | NS_CONNECT 2 |
#define | NS_POLL 0 |
#define | NS_RECV 3 |
#define | NS_SEND 4 |
#define | NS_SKELETON_VERSION "2.1.0" |
#define | NSF_BUFFER_BUT_DONT_SEND (1 << 1) |
#define | NSF_CLOSE_IMMEDIATELY (1 << 4) |
#define | NSF_CONNECTING (1 << 3) |
#define | NSF_FINISHED_SENDING_DATA (1 << 0) |
#define | NSF_LISTENING (1 << 7) |
#define | NSF_SSL_HANDSHAKE_DONE (1 << 2) |
#define | NSF_UDP (1 << 8) |
#define | NSF_USER_1 (1 << 20) |
#define | NSF_USER_2 (1 << 21) |
#define | NSF_USER_3 (1 << 22) |
#define | NSF_USER_4 (1 << 23) |
#define | NSF_USER_5 (1 << 24) |
#define | NSF_USER_6 (1 << 25) |
#define | NSF_WANT_READ (1 << 5) |
#define | NSF_WANT_WRITE (1 << 6) |
#define | to64(x) strtoll(x, NULL, 10) |
Typedefs | |
typedef void(* | ns_callback_t )(struct ns_connection *, int event_num, void *evp) |
typedef struct stat | ns_stat_t |
typedef int | sock_t |
typedef void * | SSL |
typedef void * | SSL_CTX |
Functions | |
size_t | iobuf_append (struct iobuf *, const void *data, size_t data_size) |
void | iobuf_free (struct iobuf *) |
void | iobuf_init (struct iobuf *, size_t initial_size) |
void | iobuf_remove (struct iobuf *, size_t data_size) |
void | iobuf_resize (struct iobuf *, size_t new_size) |
struct ns_connection * | ns_add_sock (struct ns_mgr *, sock_t, ns_callback_t, void *) |
int | ns_avprintf (char **buf, size_t size, const char *fmt, va_list ap) |
struct ns_connection * | ns_bind (struct ns_mgr *, const char *, ns_callback_t, void *) |
void | ns_broadcast (struct ns_mgr *, ns_callback_t, void *, size_t) |
struct ns_connection * | ns_connect (struct ns_mgr *, const char *, ns_callback_t, void *) |
int | ns_hexdump (const void *buf, int len, char *dst, int dst_len) |
void | ns_mgr_free (struct ns_mgr *) |
void | ns_mgr_init (struct ns_mgr *, void *user_data) |
time_t | ns_mgr_poll (struct ns_mgr *, int milli) |
struct ns_connection * | ns_next (struct ns_mgr *, struct ns_connection *) |
int | ns_printf (struct ns_connection *, const char *fmt,...) |
int | ns_resolve (const char *domain_name, char *ip_addr_buf, size_t buf_len) |
int | ns_send (struct ns_connection *, const void *buf, int len) |
void | ns_set_close_on_exec (sock_t) |
void | ns_sock_to_str (sock_t sock, char *buf, size_t len, int flags) |
int | ns_socketpair (sock_t[2]) |
int | ns_socketpair2 (sock_t[2], int sock_type) |
void * | ns_start_thread (void *(*f)(void *), void *p) |
int | ns_vprintf (struct ns_connection *, const char *fmt, va_list ap) |
#define __cdecl |
Definition at line 104 of file net_skeleton.h.
#define __STDC_FORMAT_MACROS |
Definition at line 31 of file net_skeleton.h.
#define __STDC_LIMIT_MACROS |
Definition at line 32 of file net_skeleton.h.
#define _CRT_SECURE_NO_WARNINGS |
Definition at line 28 of file net_skeleton.h.
#define _FILE_OFFSET_BITS 64 |
Definition at line 36 of file net_skeleton.h.
#define _INTEGRAL_MAX_BITS 64 |
Definition at line 27 of file net_skeleton.h.
#define _LARGEFILE_SOURCE |
Definition at line 34 of file net_skeleton.h.
#define _MBCS |
Definition at line 26 of file net_skeleton.h.
#define _XOPEN_SOURCE 600 |
Definition at line 30 of file net_skeleton.h.
#define ARRAY_SIZE | ( | array | ) | (sizeof(array) / sizeof(array[0])) |
Definition at line 119 of file net_skeleton.h.
#define closesocket | ( | x | ) | close(x) |
Definition at line 103 of file net_skeleton.h.
Definition at line 115 of file net_skeleton.h.
#define INVALID_SOCKET (-1) |
Definition at line 105 of file net_skeleton.h.
#define NS_ACCEPT 1 |
Definition at line 172 of file net_skeleton.h.
#define NS_CLOSE 5 |
Definition at line 176 of file net_skeleton.h.
#define NS_CONNECT 2 |
Definition at line 173 of file net_skeleton.h.
#define NS_POLL 0 |
Definition at line 171 of file net_skeleton.h.
#define NS_RECV 3 |
Definition at line 174 of file net_skeleton.h.
#define NS_SEND 4 |
Definition at line 175 of file net_skeleton.h.
#define NS_SKELETON_VERSION "2.1.0" |
Definition at line 22 of file net_skeleton.h.
#define NSF_BUFFER_BUT_DONT_SEND (1 << 1) |
Definition at line 205 of file net_skeleton.h.
#define NSF_CLOSE_IMMEDIATELY (1 << 4) |
Definition at line 208 of file net_skeleton.h.
#define NSF_CONNECTING (1 << 3) |
Definition at line 207 of file net_skeleton.h.
#define NSF_FINISHED_SENDING_DATA (1 << 0) |
Definition at line 204 of file net_skeleton.h.
#define NSF_LISTENING (1 << 7) |
Definition at line 211 of file net_skeleton.h.
#define NSF_SSL_HANDSHAKE_DONE (1 << 2) |
Definition at line 206 of file net_skeleton.h.
#define NSF_UDP (1 << 8) |
Definition at line 212 of file net_skeleton.h.
#define NSF_USER_1 (1 << 20) |
Definition at line 214 of file net_skeleton.h.
#define NSF_USER_2 (1 << 21) |
Definition at line 215 of file net_skeleton.h.
#define NSF_USER_3 (1 << 22) |
Definition at line 216 of file net_skeleton.h.
#define NSF_USER_4 (1 << 23) |
Definition at line 217 of file net_skeleton.h.
#define NSF_USER_5 (1 << 24) |
Definition at line 218 of file net_skeleton.h.
#define NSF_USER_6 (1 << 25) |
Definition at line 219 of file net_skeleton.h.
#define NSF_WANT_READ (1 << 5) |
Definition at line 209 of file net_skeleton.h.
#define NSF_WANT_WRITE (1 << 6) |
Definition at line 210 of file net_skeleton.h.
Definition at line 106 of file net_skeleton.h.
typedef void(* ns_callback_t)(struct ns_connection *, int event_num, void *evp) |
Definition at line 168 of file net_skeleton.h.
Definition at line 108 of file net_skeleton.h.
typedef int sock_t |
Definition at line 107 of file net_skeleton.h.
typedef void* SSL |
Definition at line 128 of file net_skeleton.h.
typedef void* SSL_CTX |
Definition at line 129 of file net_skeleton.h.
size_t iobuf_append | ( | struct iobuf * | io, |
const void * | data, | ||
size_t | data_size | ||
) |
Definition at line 365 of file mongoose.c.
void iobuf_free | ( | struct iobuf * | iobuf | ) |
Definition at line 358 of file mongoose.c.
void iobuf_init | ( | struct iobuf * | iobuf, |
size_t | initial_size | ||
) |
Definition at line 352 of file mongoose.c.
void iobuf_remove | ( | struct iobuf * | io, |
size_t | data_size | ||
) |
Definition at line 392 of file mongoose.c.
void iobuf_resize | ( | struct iobuf * | io, |
size_t | new_size | ||
) |
Definition at line 343 of file mongoose.c.
struct ns_connection * ns_add_sock | ( | struct ns_mgr * | s, |
sock_t | sock, | ||
ns_callback_t | callback, | ||
void * | user_data | ||
) | [read] |
Definition at line 1209 of file mongoose.c.
int ns_avprintf | ( | char ** | buf, |
size_t | size, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
Definition at line 449 of file mongoose.c.
struct ns_connection * ns_bind | ( | struct ns_mgr * | srv, |
const char * | str, | ||
ns_callback_t | callback, | ||
void * | user_data | ||
) | [read] |
Definition at line 784 of file mongoose.c.
void ns_broadcast | ( | struct ns_mgr * | mgr, |
ns_callback_t | cb, | ||
void * | data, | ||
size_t | len | ||
) |
Definition at line 1231 of file mongoose.c.
struct ns_connection * ns_connect | ( | struct ns_mgr * | mgr, |
const char * | address, | ||
ns_callback_t | callback, | ||
void * | user_data | ||
) | [read] |
Definition at line 1166 of file mongoose.c.
int ns_hexdump | ( | const void * | buf, |
int | len, | ||
char * | dst, | ||
int | dst_len | ||
) |
Definition at line 895 of file mongoose.c.
void ns_mgr_free | ( | struct ns_mgr * | s | ) |
Definition at line 1267 of file mongoose.c.
void ns_mgr_init | ( | struct ns_mgr * | s, |
void * | user_data | ||
) |
Definition at line 1243 of file mongoose.c.
time_t ns_mgr_poll | ( | struct ns_mgr * | mgr, |
int | milli | ||
) |
Definition at line 1071 of file mongoose.c.
struct ns_connection * ns_next | ( | struct ns_mgr * | s, |
struct ns_connection * | conn | ||
) | [read] |
Definition at line 1227 of file mongoose.c.
int ns_printf | ( | struct ns_connection * | conn, |
const char * | fmt, | ||
... | |||
) |
Definition at line 498 of file mongoose.c.
int ns_resolve | ( | const char * | domain_name, |
char * | ip_addr_buf, | ||
size_t | buf_len | ||
) |
Definition at line 660 of file mongoose.c.
int ns_send | ( | struct ns_connection * | , |
const void * | buf, | ||
int | len | ||
) |
void ns_set_close_on_exec | ( | sock_t | sock | ) |
Definition at line 563 of file mongoose.c.
void ns_sock_to_str | ( | sock_t | sock, |
char * | buf, | ||
size_t | len, | ||
int | flags | ||
) |
Definition at line 864 of file mongoose.c.
int ns_socketpair | ( | sock_t | sp[2] | ) |
Definition at line 618 of file mongoose.c.
int ns_socketpair2 | ( | sock_t | sp[2], |
int | sock_type | ||
) |
Definition at line 582 of file mongoose.c.
void* ns_start_thread | ( | void *(*)(void *) | f, |
void * | p | ||
) |
int ns_vprintf | ( | struct ns_connection * | nc, |
const char * | fmt, | ||
va_list | ap | ||
) |
Definition at line 484 of file mongoose.c.