maph 1.0.0 High-Performance Memory-Mapped Key-Value Database with O(1) Lookups

Loading...
Searching...
No Matches
Functions
context.c File Reference
`#include "libusockets.h"`
`#include "internal/internal.h"`
`#include <stdlib.h>`
`#include <string.h>`
Include dependency graph for context.c:

Go to the source code of this file.

## Functions
int | default_is_low_prio_handler (struct us_socket_t *s)
unsigned short | us_socket_context_timestamp (int ssl, struct us_socket_context_t *context)
void | us_listen_socket_close (int ssl, struct us_listen_socket_t *ls)
void | us_socket_context_close (int ssl, struct us_socket_context_t *context)
void | us_internal_socket_context_unlink_listen_socket (struct us_socket_context_t *context, struct us_listen_socket_t *ls)
void | us_internal_socket_context_unlink_socket (struct us_socket_context_t *context, struct us_socket_t *s)
void | us_internal_socket_context_link_listen_socket (struct us_socket_context_t *context, struct us_listen_socket_t *ls)
void | us_internal_socket_context_link_socket (struct us_socket_context_t *context, struct us_socket_t *s)
struct us_loop_t * | us_socket_context_loop (int ssl, struct us_socket_context_t *context)
void * | us_socket_context_find_server_name_userdata (int ssl, struct us_socket_context_t *context, const char *hostname_pattern)
void * | us_socket_server_name_userdata (int ssl, struct us_socket_t *s)
void | us_socket_context_add_server_name (int ssl, struct us_socket_context_t *context, const char *hostname_pattern, struct us_socket_context_options_t options, void *user)
void | us_socket_context_remove_server_name (int ssl, struct us_socket_context_t *context, const char *hostname_pattern)
void | us_socket_context_on_server_name (int ssl, struct us_socket_context_t *context, void(*cb)(struct us_socket_context_t *, const char *hostname))
void * | us_socket_context_get_native_handle (int ssl, struct us_socket_context_t *context)
struct us_socket_context_t * | us_create_socket_context (int ssl, struct us_loop_t *loop, int context_ext_size, struct us_socket_context_options_t options)
void | us_socket_context_free (int ssl, struct us_socket_context_t *context)
struct us_listen_socket_t * | us_socket_context_listen (int ssl, struct us_socket_context_t *context, const char *host, int port, int options, int socket_ext_size)
struct us_listen_socket_t * | us_socket_context_listen_unix (int ssl, struct us_socket_context_t *context, const char *path, int options, int socket_ext_size)
struct us_socket_t * | us_socket_context_connect (int ssl, struct us_socket_context_t *context, const char *host, int port, const char *source_host, int options, int socket_ext_size)
struct us_socket_t * | us_socket_context_connect_unix (int ssl, struct us_socket_context_t *context, const char *server_path, int options, int socket_ext_size)
struct us_socket_context_t * | us_create_child_socket_context (int ssl, struct us_socket_context_t *context, int context_ext_size)
struct us_socket_t * | us_socket_context_adopt_socket (int ssl, struct us_socket_context_t *context, struct us_socket_t *s, int ext_size)
void | us_socket_context_on_open (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_open)(struct us_socket_t *s, int is_client, char *ip, int ip_length))
void | us_socket_context_on_close (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_close)(struct us_socket_t *s, int code, void *reason))
void | us_socket_context_on_data (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_data)(struct us_socket_t *s, char *data, int length))
void | us_socket_context_on_writable (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_writable)(struct us_socket_t *s))
void | us_socket_context_on_long_timeout (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_long_timeout)(struct us_socket_t *))
void | us_socket_context_on_timeout (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_timeout)(struct us_socket_t *))
void | us_socket_context_on_end (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_end)(struct us_socket_t *))
void | us_socket_context_on_connect_error (int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_connect_error)(struct us_socket_t *s, int code))
void * | us_socket_context_ext (int ssl, struct us_socket_context_t *context)

## Function Documentation

## ◆ default_is_low_prio_handler()

int default_is_low_prio_handler | ( | struct us_socket_t * | s | ) |

Definition at line 23 of file context.c.

Referenced by us_create_socket_context().

Here is the caller graph for this function:

## ◆ us_create_child_socket_context()

struct us_socket_context_t * us_create_child_socket_context | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | int | context_ext_size
| ) |  |

Definition at line 368 of file context.c.

References us_socket_context_t::loop, us_create_socket_context(), and us_internal_create_child_ssl_socket_context().

Here is the call graph for this function:

## ◆ us_create_socket_context()

struct us_socket_context_t * us_create_socket_context | ( | int | ssl,
|  | struct us_loop_t * | loop,
|  | int | context_ext_size,
|  | struct us_socket_context_options_t | options
| ) |  |

Definition at line 202 of file context.c.

References default_is_low_prio_handler(), us_socket_context_t::global_tick, us_socket_context_t::head_listen_sockets, us_socket_context_t::head_sockets, us_socket_context_t::is_low_prio, us_socket_context_t::iterator, us_socket_context_t::long_timestamp, us_socket_context_t::loop, us_socket_context_t::next, us_socket_context_t::timestamp, us_internal_create_ssl_socket_context(), and us_internal_loop_link().

Referenced by main(), and us_create_child_socket_context().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_internal_socket_context_link_listen_socket()

void us_internal_socket_context_link_listen_socket | ( | struct us_socket_context_t * | context,
|  | struct us_listen_socket_t * | ls
| ) |  |

Definition at line 110 of file context.c.

References us_socket_t::context, us_socket_context_t::head_listen_sockets, us_socket_t::next, us_socket_t::prev, and us_listen_socket_t::s.

Referenced by us_socket_context_listen(), and us_socket_context_listen_unix().

Here is the caller graph for this function:

## ◆ us_internal_socket_context_link_socket()

void us_internal_socket_context_link_socket | ( | struct us_socket_context_t * | context,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 121 of file context.c.

References us_socket_t::context, us_socket_context_t::head_sockets, us_socket_t::next, and us_socket_t::prev.

Referenced by us_internal_dispatch_ready_poll(), us_internal_handle_low_priority_sockets(), us_socket_context_adopt_socket(), us_socket_context_connect(), and us_socket_context_connect_unix().

Here is the caller graph for this function:

## ◆ us_internal_socket_context_unlink_listen_socket()

void us_internal_socket_context_unlink_listen_socket | ( | struct us_socket_context_t * | context,
|  | struct us_listen_socket_t * | ls
| ) |  |

Definition at line 69 of file context.c.

References us_socket_t::context, us_socket_context_t::head_listen_sockets, us_socket_context_t::iterator, us_socket_t::next, us_socket_t::prev, and us_listen_socket_t::s.

Referenced by us_listen_socket_close().

Here is the caller graph for this function:

## ◆ us_internal_socket_context_unlink_socket()

void us_internal_socket_context_unlink_socket | ( | struct us_socket_context_t * | context,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 89 of file context.c.

References us_socket_context_t::head_sockets, us_socket_context_t::iterator, us_socket_t::next, us_socket_t::prev, and us_listen_socket_t::s.

Referenced by us_internal_dispatch_ready_poll(), us_socket_close(), us_socket_close_connecting(), and us_socket_context_adopt_socket().

Here is the caller graph for this function:

## ◆ us_listen_socket_close()

void us_listen_socket_close | ( | int | ssl,
|  | struct us_listen_socket_t * | ls
| ) |  |

Definition at line 33 of file context.c.

References bsd_close_socket(), us_internal_loop_data_t::closed_head, us_socket_t::context, us_loop_t::data, us_socket_context_t::loop, us_socket_t::next, us_socket_t::prev, us_listen_socket_t::s, us_internal_socket_context_unlink_listen_socket(), us_poll_fd(), us_poll_stop(), and us_socket_is_closed().

Referenced by us_socket_context_close().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_add_server_name()

void us_socket_context_add_server_name | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | const char * | hostname_pattern,
|  | struct us_socket_context_options_t | options,
|  | void * | user
| ) |  |

Definition at line 158 of file context.c.

References us_internal_ssl_socket_context_add_server_name().

Here is the call graph for this function:

## ◆ us_socket_context_adopt_socket()

struct us_socket_t * us_socket_context_adopt_socket | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t * | s,
|  | int | ext_size
| ) |  |

Definition at line 381 of file context.c.

References us_socket_t::context, us_loop_t::data, us_socket_t::long_timeout, us_socket_context_t::loop, us_internal_loop_data_t::low_prio_head, us_socket_t::low_prio_state, us_socket_t::next, us_socket_t::p, us_socket_t::prev, us_socket_t::timeout, us_internal_socket_context_link_socket(), us_internal_socket_context_unlink_socket(), us_internal_ssl_socket_context_adopt_socket(), us_poll_resize(), and us_socket_is_closed().

Here is the call graph for this function:

## ◆ us_socket_context_close()

void us_socket_context_close | ( | int | ssl,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 51 of file context.c.

References us_socket_t::context, us_socket_context_t::head_listen_sockets, us_socket_context_t::head_sockets, us_socket_t::next, us_listen_socket_t::s, us_listen_socket_close(), and us_socket_close().

Here is the call graph for this function:

## ◆ us_socket_context_connect()

struct us_socket_t * us_socket_context_connect | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | const char * | host,
|  | int | port,
|  | const char * | source_host,
|  | int | options,
|  | int | socket_ext_size
| ) |  |

Definition at line 310 of file context.c.

References bsd_create_connect_socket(), us_socket_t::context, LIBUS_SOCKET_DESCRIPTOR, LIBUS_SOCKET_ERROR, LIBUS_SOCKET_WRITABLE, us_socket_t::long_timeout, us_socket_context_t::loop, us_socket_t::low_prio_state, us_socket_t::p, POLL_TYPE_SEMI_SOCKET, us_socket_t::timeout, us_create_poll(), us_internal_socket_context_link_socket(), us_internal_ssl_socket_context_connect(), us_poll_init(), and us_poll_start().

Here is the call graph for this function:

## ◆ us_socket_context_connect_unix()

struct us_socket_t * us_socket_context_connect_unix | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | const char * | server_path,
|  | int | options,
|  | int | socket_ext_size
| ) |  |

Definition at line 339 of file context.c.

References bsd_create_connect_socket_unix(), us_socket_t::context, LIBUS_SOCKET_DESCRIPTOR, LIBUS_SOCKET_ERROR, LIBUS_SOCKET_WRITABLE, us_socket_t::long_timeout, us_socket_context_t::loop, us_socket_t::low_prio_state, us_socket_t::p, POLL_TYPE_SEMI_SOCKET, us_socket_t::timeout, us_create_poll(), us_internal_socket_context_link_socket(), us_internal_ssl_socket_context_connect_unix(), us_poll_init(), and us_poll_start().

Here is the call graph for this function:

## ◆ us_socket_context_ext()

void * us_socket_context_ext | ( | int | ssl,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 503 of file context.c.

References us_socket_t::context, and us_internal_ssl_socket_context_ext().

Referenced by main(), on_http_socket_data(), and on_http_socket_writable().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_find_server_name_userdata()

void * us_socket_context_find_server_name_userdata | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | const char * | hostname_pattern
| ) |  |

Definition at line 138 of file context.c.

References us_internal_ssl_socket_context_find_server_name_userdata().

Here is the call graph for this function:

## ◆ us_socket_context_free()

void us_socket_context_free | ( | int | ssl,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 232 of file context.c.

References us_socket_context_t::loop, us_internal_loop_unlink(), and us_internal_ssl_socket_context_free().

Here is the call graph for this function:

## ◆ us_socket_context_get_native_handle()

void * us_socket_context_get_native_handle | ( | int | ssl,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 190 of file context.c.

References us_internal_ssl_socket_context_get_native_handle().

Here is the call graph for this function:

## ◆ us_socket_context_listen()

struct us_listen_socket_t * us_socket_context_listen | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | const char * | host,
|  | int | port,
|  | int | options,
|  | int | socket_ext_size
| ) |  |

Definition at line 248 of file context.c.

References bsd_create_listen_socket(), us_socket_t::context, LIBUS_SOCKET_DESCRIPTOR, LIBUS_SOCKET_ERROR, LIBUS_SOCKET_READABLE, us_socket_t::long_timeout, us_socket_context_t::loop, us_socket_t::low_prio_state, us_socket_t::next, POLL_TYPE_SEMI_SOCKET, us_listen_socket_t::s, us_listen_socket_t::socket_ext_size, us_socket_t::timeout, us_create_poll(), us_internal_socket_context_link_listen_socket(), us_internal_ssl_socket_context_listen(), us_poll_init(), and us_poll_start().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_listen_unix()

struct us_listen_socket_t * us_socket_context_listen_unix | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | const char * | path,
|  | int | options,
|  | int | socket_ext_size
| ) |  |

Definition at line 279 of file context.c.

References bsd_create_listen_socket_unix(), us_socket_t::context, LIBUS_SOCKET_DESCRIPTOR, LIBUS_SOCKET_ERROR, LIBUS_SOCKET_READABLE, us_socket_t::long_timeout, us_socket_context_t::loop, us_socket_t::low_prio_state, us_socket_t::next, POLL_TYPE_SEMI_SOCKET, us_listen_socket_t::s, us_listen_socket_t::socket_ext_size, us_socket_t::timeout, us_create_poll(), us_internal_socket_context_link_listen_socket(), us_internal_ssl_socket_context_listen_unix(), us_poll_init(), and us_poll_start().

Here is the call graph for this function:

## ◆ us_socket_context_loop()

struct us_loop_t * us_socket_context_loop | ( | int | ssl,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 131 of file context.c.

References us_socket_context_t::loop.

## ◆ us_socket_context_on_close()

void us_socket_context_on_close | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *s, int code, void *reason) | on_close
| ) |  |

Definition at line 426 of file context.c.

References us_socket_t::context, us_socket_context_t::on_close, and us_internal_ssl_socket_context_on_close().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_on_connect_error()

void us_socket_context_on_connect_error | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *s, int code) | on_connect_error
| ) |  |

Definition at line 492 of file context.c.

References us_socket_t::context, us_socket_context_t::on_connect_error, and us_internal_ssl_socket_context_on_connect_error().

Here is the call graph for this function:

## ◆ us_socket_context_on_data()

void us_socket_context_on_data | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *s, char *data, int length) | on_data
| ) |  |

Definition at line 437 of file context.c.

References us_socket_t::context, us_socket_context_t::on_data, and us_internal_ssl_socket_context_on_data().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_on_end()

void us_socket_context_on_end | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *) | on_end
| ) |  |

Definition at line 481 of file context.c.

References us_socket_t::context, us_socket_context_t::on_end, and us_internal_ssl_socket_context_on_end().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_on_long_timeout()

void us_socket_context_on_long_timeout | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *) | on_long_timeout
| ) |  |

Definition at line 459 of file context.c.

References us_socket_t::context, us_socket_context_t::on_socket_long_timeout, and us_internal_ssl_socket_context_on_long_timeout().

Here is the call graph for this function:

## ◆ us_socket_context_on_open()

void us_socket_context_on_open | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *s, int is_client, char *ip, int ip_length) | on_open
| ) |  |

Definition at line 415 of file context.c.

References us_socket_t::context, us_socket_context_t::on_open, and us_internal_ssl_socket_context_on_open().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_on_server_name()

void us_socket_context_on_server_name | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | void(*)(struct us_socket_context_t *, const char *hostname) | cb
| ) |  |

Definition at line 180 of file context.c.

References us_internal_ssl_socket_context_on_server_name().

Here is the call graph for this function:

## ◆ us_socket_context_on_timeout()

void us_socket_context_on_timeout | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *) | on_timeout
| ) |  |

Definition at line 470 of file context.c.

References us_socket_t::context, us_socket_context_t::on_socket_timeout, and us_internal_ssl_socket_context_on_timeout().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_on_writable()

void us_socket_context_on_writable | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | struct us_socket_t *(*)(struct us_socket_t *s) | on_writable
| ) |  |

Definition at line 448 of file context.c.

References us_socket_t::context, us_socket_context_t::on_writable, and us_internal_ssl_socket_context_on_writable().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ us_socket_context_remove_server_name()

void us_socket_context_remove_server_name | ( | int | ssl,
|  | struct us_socket_context_t * | context,
|  | const char * | hostname_pattern
| ) |  |

Definition at line 167 of file context.c.

References us_internal_ssl_socket_context_remove_server_name().

Here is the call graph for this function:

## ◆ us_socket_context_timestamp()

unsigned short us_socket_context_timestamp | ( | int | ssl,
|  | struct us_socket_context_t * | context
| ) |  |

Definition at line 29 of file context.c.

References us_socket_context_t::timestamp.

## ◆ us_socket_server_name_userdata()

void * us_socket_server_name_userdata | ( | int | ssl,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 148 of file context.c.

References us_internal_ssl_socket_get_sni_userdata().

Here is the call graph for this function: