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

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

Go to the source code of this file.

## Functions
int | us_socket_local_port (int ssl, struct us_socket_t *s)
void | us_socket_shutdown_read (int ssl, struct us_socket_t *s)
void | us_socket_remote_address (int ssl, struct us_socket_t *s, char *buf, int *length)
struct us_socket_context_t * | us_socket_context (int ssl, struct us_socket_t *s)
void | us_socket_timeout (int ssl, struct us_socket_t *s, unsigned int seconds)
void | us_socket_long_timeout (int ssl, struct us_socket_t *s, unsigned int minutes)
void | us_socket_flush (int ssl, struct us_socket_t *s)
int | us_socket_is_closed (int ssl, struct us_socket_t *s)
int | us_socket_is_established (int ssl, struct us_socket_t *s)
struct us_socket_t * | us_socket_close_connecting (int ssl, struct us_socket_t *s)
struct us_socket_t * | us_socket_close (int ssl, struct us_socket_t *s, int code, void *reason)
void * | us_socket_get_native_handle (int ssl, struct us_socket_t *s)
int | us_socket_write (int ssl, struct us_socket_t *s, const char *data, int length, int msg_more)
void * | us_socket_ext (int ssl, struct us_socket_t *s)
int | us_socket_is_shut_down (int ssl, struct us_socket_t *s)
void | us_socket_shutdown (int ssl, struct us_socket_t *s)

## Function Documentation

## ◆ us_socket_close()

struct us_socket_t * us_socket_close | ( | int | ssl,
|  | struct us_socket_t * | s,
|  | int | code,
|  | void * | reason
| ) |  |

Definition at line 105 of file socket.c.

References bsd_close_socket(), us_socket_t::context, us_loop_t::data, 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::prev, us_internal_socket_context_unlink_socket(), us_poll_fd(), us_poll_stop(), and us_socket_is_closed().

Referenced by on_echo_socket_end(), on_echo_socket_timeout(), on_http_socket_end(), on_http_socket_timeout(), us_internal_dispatch_ready_poll(), and us_socket_context_close().

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

## ◆ us_socket_close_connecting()

struct us_socket_t * us_socket_close_connecting | ( | int | ssl,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 86 of file socket.c.

References bsd_close_socket(), us_socket_t::context, us_internal_socket_context_unlink_socket(), us_poll_fd(), us_poll_stop(), and us_socket_is_closed().

Referenced by us_internal_dispatch_ready_poll().

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

## ◆ us_socket_context()

struct us_socket_context_t * us_socket_context | ( | int | ssl,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 50 of file socket.c.

References us_socket_t::context.

Referenced by on_http_socket_data(), on_http_socket_writable(), us_internal_dispatch_ready_poll(), and us_internal_handle_low_priority_sockets().

Here is the caller graph for this function:

## ◆ us_socket_ext()

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

Definition at line 167 of file socket.c.

References us_internal_ssl_socket_ext().

Referenced by on_echo_socket_close(), on_echo_socket_data(), on_echo_socket_open(), on_echo_socket_writable(), on_http_socket_data(), on_http_socket_open(), and on_http_socket_writable().

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

## ◆ us_socket_flush()

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

Definition at line 70 of file socket.c.

References bsd_socket_flush(), us_poll_fd(), and us_socket_is_shut_down().

Here is the call graph for this function:

## ◆ us_socket_get_native_handle()

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

Definition at line 137 of file socket.c.

References us_internal_ssl_socket_get_native_handle(), and us_poll_fd().

Here is the call graph for this function:

## ◆ us_socket_is_closed()

int us_socket_is_closed | ( | int | ssl,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 76 of file socket.c.

References us_socket_t::context, and us_socket_t::prev.

Referenced by us_internal_dispatch_ready_poll(), us_listen_socket_close(), us_socket_close(), us_socket_close_connecting(), us_socket_context_adopt_socket(), us_socket_shutdown(), and us_socket_write().

Here is the caller graph for this function:

## ◆ us_socket_is_established()

int us_socket_is_established | ( | int | ssl,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 80 of file socket.c.

References POLL_TYPE_SEMI_SOCKET, and us_internal_poll_type().

Here is the call graph for this function:

## ◆ us_socket_is_shut_down()

int us_socket_is_shut_down | ( | int | ssl,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 177 of file socket.c.

References us_socket_t::p, POLL_TYPE_SOCKET_SHUT_DOWN, us_internal_poll_type(), and us_internal_ssl_socket_is_shut_down().

Referenced by us_internal_dispatch_ready_poll(), us_socket_flush(), us_socket_shutdown(), and us_socket_write().

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

## ◆ us_socket_local_port()

int us_socket_local_port | ( | int | ssl,
|  | struct us_socket_t * | s
| ) |  |

Definition at line 26 of file socket.c.

References bsd_addr_get_port(), bsd_local_addr(), us_socket_t::p, and us_poll_fd().

Here is the call graph for this function:

## ◆ us_socket_long_timeout()

void us_socket_long_timeout | ( | int | ssl,
|  | struct us_socket_t * | s,
|  | unsigned int | minutes
| ) |  |

Definition at line 62 of file socket.c.

References us_socket_t::context, us_socket_t::long_timeout, and us_socket_context_t::long_timestamp.

## ◆ us_socket_remote_address()

void us_socket_remote_address | ( | int | ssl,
|  | struct us_socket_t * | s,
|  | char * | buf,
|  | int * | length
| ) |  |

Definition at line 40 of file socket.c.

References bsd_addr_get_ip(), bsd_addr_get_ip_length(), bsd_remote_addr(), us_socket_t::p, and us_poll_fd().

Here is the call graph for this function:

## ◆ us_socket_shutdown()

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

Definition at line 187 of file socket.c.

References bsd_shutdown_socket(), us_socket_t::context, LIBUS_SOCKET_READABLE, us_socket_context_t::loop, us_socket_t::p, POLL_TYPE_SOCKET_SHUT_DOWN, us_internal_poll_set_type(), us_internal_ssl_socket_shutdown(), us_poll_change(), us_poll_events(), us_poll_fd(), us_socket_is_closed(), and us_socket_is_shut_down().

Referenced by on_echo_socket_end(), and on_http_socket_end().

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

## ◆ us_socket_shutdown_read()

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

Definition at line 35 of file socket.c.

References bsd_shutdown_socket_read(), and us_poll_fd().

Here is the call graph for this function:

## ◆ us_socket_timeout()

void us_socket_timeout | ( | int | ssl,
|  | struct us_socket_t * | s,
|  | unsigned int | seconds
| ) |  |

Definition at line 54 of file socket.c.

References us_socket_t::context, us_socket_t::timeout, and us_socket_context_t::timestamp.

Referenced by on_echo_socket_data(), on_echo_socket_open(), on_echo_socket_writable(), on_http_socket_data(), on_http_socket_open(), and us_internal_dispatch_ready_poll().

Here is the caller graph for this function:

## ◆ us_socket_write()

int us_socket_write | ( | int | ssl,
|  | struct us_socket_t * | s,
|  | const char * | data,
|  | int | length,
|  | int | msg_more
| ) |  |

Definition at line 147 of file socket.c.

References bsd_send(), us_socket_t::context, us_loop_t::data, us_internal_loop_data_t::last_write_failed, LIBUS_SOCKET_READABLE, LIBUS_SOCKET_WRITABLE, us_socket_context_t::loop, us_socket_t::p, us_internal_ssl_socket_write(), us_poll_change(), us_poll_fd(), us_socket_is_closed(), and us_socket_is_shut_down().

Referenced by on_echo_socket_data(), on_echo_socket_writable(), 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: