![]() |
libwebsockets
Lightweight C library for HTML5 websockets
|
Functions | |
LWS_VISIBLE LWS_EXTERN const char *LWS_WARN_UNUSED_RESULT | lws_canonical_hostname (struct lws_context *context) |
LWS_VISIBLE LWS_EXTERN void | lws_get_peer_addresses (struct lws *wsi, lws_sockfd_type fd, char *name, int name_len, char *rip, int rip_len) |
LWS_VISIBLE LWS_EXTERN const char * | lws_get_peer_simple (struct lws *wsi, char *name, int namelen) |
LWS_VISIBLE LWS_EXTERN int | lws_interface_to_sa (int ipv6, const char *ifname, struct sockaddr_in *addr, size_t addrlen) |
These wrap miscellaneous useful network-related functions
LWS_VISIBLE LWS_EXTERN const char* LWS_WARN_UNUSED_RESULT lws_canonical_hostname | ( | struct lws_context * | context | ) |
#include <lib/libwebsockets.h>
lws_canonical_hostname() - returns this host's hostname
This is typically used by client code to fill in the host parameter when making a client connection. You can only call it after the context has been created.
context | Websocket context |
LWS_VISIBLE LWS_EXTERN void lws_get_peer_addresses | ( | struct lws * | wsi, |
lws_sockfd_type | fd, | ||
char * | name, | ||
int | name_len, | ||
char * | rip, | ||
int | rip_len | ||
) |
#include <lib/libwebsockets.h>
lws_get_peer_addresses() - Get client address information
wsi | Local struct lws associated with |
fd | Connection socket descriptor |
name | Buffer to take client address name |
name_len | Length of client address name buffer |
rip | Buffer to take client address IP dotted quad |
rip_len | Length of client address IP buffer This function fills in name and rip with the name and IP of the client connected with socket descriptor fd. Names may be truncated if there is not enough room. If either cannot be determined, they will be returned as valid zero-length strings. |
LWS_VISIBLE LWS_EXTERN const char* lws_get_peer_simple | ( | struct lws * | wsi, |
char * | name, | ||
int | namelen | ||
) |
#include <lib/libwebsockets.h>
lws_get_peer_simple() - Get client address information without RDNS
wsi | Local struct lws associated with |
name | Buffer to take client address name |
namelen | Length of client address name buffer |
This provides a 123.123.123.123 type IP address in name from the peer that has connected to wsi
LWS_VISIBLE LWS_EXTERN int lws_interface_to_sa | ( | int | ipv6, |
const char * | ifname, | ||
struct sockaddr_in * | addr, | ||
size_t | addrlen | ||
) |
#include <lib/libwebsockets.h>
lws_interface_to_sa() - Convert interface name or IP to sockaddr struct
ipv6 | Allow IPV6 addresses |
ifname | Interface name or IP |
addr | struct sockaddr_in * to be written |
addrlen | Length of addr |
This converts a textual network interface name to a sockaddr usable by other network functions