Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
eswifi_socket_offload.c File Reference
#include "eswifi_log.h"
#include <zephyr.h>
#include <kernel.h>
#include <device.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <net/socket_offload.h>
#include <net/tls_credentials.h>
#include "sockets_internal.h"
#include "eswifi.h"
#include <net/net_pkt.h>

Macros

#define SD_TO_OBJ(sd)   ((void *)(sd + 1))
 
#define OBJ_TO_SD(obj)   (((int)obj) - 1)
 
#define ESWIFI_INIT_CONTEXT   INT_TO_POINTER(0x50CE)
 

Functions

 LOG_MODULE_DECLARE (wifi_eswifi)
 
static int eswifi_socket_connect (void *obj, const struct sockaddr *addr, socklen_t addrlen)
 
static int eswifi_socket_accept (void *obj, struct sockaddr *addr, socklen_t *addrlen)
 
static int map_credentials (int sd, const void *optval, socklen_t optlen)
 
static int eswifi_socket_setsockopt (void *obj, int level, int optname, const void *optval, socklen_t optlen)
 
static ssize_t eswifi_socket_send (void *obj, const void *buf, size_t len, int flags)
 
static ssize_t eswifi_socket_sendto (void *obj, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
 
static ssize_t eswifi_socket_recv (void *obj, void *buf, size_t max_len, int flags)
 
static ssize_t eswifi_socket_recvfrom (void *obj, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
 
static int eswifi_socket_close (void *obj)
 
static int eswifi_socket_open (int family, int type, int proto)
 
static int eswifi_socket_poll (struct zsock_pollfd *fds, int nfds, int msecs)
 
static int eswifi_socket_bind (void *obj, const struct sockaddr *addr, socklen_t addrlen)
 
static bool eswifi_socket_is_supported (int family, int type, int proto)
 
static int eswifi_socket_create (int family, int type, int proto)
 
static int eswifi_socket_ioctl (void *obj, unsigned int request, va_list args)
 
static ssize_t eswifi_socket_read (void *obj, void *buffer, size_t count)
 
static ssize_t eswifi_socket_write (void *obj, const void *buffer, size_t count)
 
static int eswifi_off_getaddrinfo (const char *node, const char *service, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res)
 
static void eswifi_off_freeaddrinfo (struct zsock_addrinfo *res)
 
int eswifi_socket_offload_init (struct eswifi_dev *leswifi)
 

Variables

static struct eswifi_deveswifi
 
static const struct socket_op_vtable eswifi_socket_fd_op_vtable
 
const struct socket_dns_offload eswifi_dns_ops
 

Macro Definition Documentation

◆ ESWIFI_INIT_CONTEXT

#define ESWIFI_INIT_CONTEXT   INT_TO_POINTER(0x50CE)

◆ OBJ_TO_SD

#define OBJ_TO_SD (   obj)    (((int)obj) - 1)

◆ SD_TO_OBJ

#define SD_TO_OBJ (   sd)    ((void *)(sd + 1))

Function Documentation

◆ eswifi_off_freeaddrinfo()

static void eswifi_off_freeaddrinfo ( struct zsock_addrinfo res)
static

◆ eswifi_off_getaddrinfo()

static int eswifi_off_getaddrinfo ( const char *  node,
const char *  service,
const struct zsock_addrinfo hints,
struct zsock_addrinfo **  res 
)
static

◆ eswifi_socket_accept()

static int eswifi_socket_accept ( void obj,
struct sockaddr addr,
socklen_t addrlen 
)
static

◆ eswifi_socket_bind()

static int eswifi_socket_bind ( void obj,
const struct sockaddr addr,
socklen_t  addrlen 
)
static

◆ eswifi_socket_close()

static int eswifi_socket_close ( void obj)
static

◆ eswifi_socket_connect()

static int eswifi_socket_connect ( void obj,
const struct sockaddr addr,
socklen_t  addrlen 
)
static

◆ eswifi_socket_create()

static int eswifi_socket_create ( int  family,
int  type,
int  proto 
)
static

◆ eswifi_socket_ioctl()

static int eswifi_socket_ioctl ( void obj,
unsigned int  request,
va_list  args 
)
static

◆ eswifi_socket_is_supported()

static bool eswifi_socket_is_supported ( int  family,
int  type,
int  proto 
)
static

◆ eswifi_socket_offload_init()

int eswifi_socket_offload_init ( struct eswifi_dev leswifi)

◆ eswifi_socket_open()

static int eswifi_socket_open ( int  family,
int  type,
int  proto 
)
static

◆ eswifi_socket_poll()

static int eswifi_socket_poll ( struct zsock_pollfd fds,
int  nfds,
int  msecs 
)
static

◆ eswifi_socket_read()

static ssize_t eswifi_socket_read ( void obj,
void buffer,
size_t  count 
)
static

◆ eswifi_socket_recv()

static ssize_t eswifi_socket_recv ( void obj,
void buf,
size_t  max_len,
int  flags 
)
static

◆ eswifi_socket_recvfrom()

static ssize_t eswifi_socket_recvfrom ( void obj,
void buf,
size_t  len,
int  flags,
struct sockaddr from,
socklen_t fromlen 
)
static

◆ eswifi_socket_send()

static ssize_t eswifi_socket_send ( void obj,
const void buf,
size_t  len,
int  flags 
)
static

◆ eswifi_socket_sendto()

static ssize_t eswifi_socket_sendto ( void obj,
const void buf,
size_t  len,
int  flags,
const struct sockaddr to,
socklen_t  tolen 
)
static

◆ eswifi_socket_setsockopt()

static int eswifi_socket_setsockopt ( void obj,
int  level,
int  optname,
const void optval,
socklen_t  optlen 
)
static

◆ eswifi_socket_write()

static ssize_t eswifi_socket_write ( void obj,
const void buffer,
size_t  count 
)
static

◆ LOG_MODULE_DECLARE()

LOG_MODULE_DECLARE ( wifi_eswifi  )

◆ map_credentials()

static int map_credentials ( int  sd,
const void optval,
socklen_t  optlen 
)
static

Variable Documentation

◆ eswifi

struct eswifi_dev* eswifi
static

◆ eswifi_dns_ops

const struct socket_dns_offload eswifi_dns_ops
Initial value:
= {
.getaddrinfo = eswifi_off_getaddrinfo,
.freeaddrinfo = eswifi_off_freeaddrinfo,
}
static int eswifi_off_getaddrinfo(const char *node, const char *service, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res)
Definition: eswifi_socket_offload.c:578
static void eswifi_off_freeaddrinfo(struct zsock_addrinfo *res)
Definition: eswifi_socket_offload.c:656

◆ eswifi_socket_fd_op_vtable

static const struct socket_op_vtable eswifi_socket_fd_op_vtable
static
Initial value:
= {
.fd_vtable = {
},
.setsockopt = eswifi_socket_setsockopt,
}
static int eswifi_socket_bind(void *obj, const struct sockaddr *addr, socklen_t addrlen)
Definition: eswifi_socket_offload.c:473
static int eswifi_socket_setsockopt(void *obj, int level, int optname, const void *optval, socklen_t optlen)
Definition: eswifi_socket_offload.c:212
static ssize_t eswifi_socket_recvfrom(void *obj, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
Definition: eswifi_socket_offload.c:345
static int eswifi_socket_ioctl(void *obj, unsigned int request, va_list args)
Definition: eswifi_socket_offload.c:520
static ssize_t eswifi_socket_sendto(void *obj, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
Definition: eswifi_socket_offload.c:280
static ssize_t eswifi_socket_read(void *obj, void *buffer, size_t count)
Definition: eswifi_socket_offload.c:547
static int eswifi_socket_connect(void *obj, const struct sockaddr *addr, socklen_t addrlen)
Definition: eswifi_socket_offload.c:57
static int eswifi_socket_close(void *obj)
Definition: eswifi_socket_offload.c:357
static ssize_t eswifi_socket_write(void *obj, const void *buffer, size_t count)
Definition: eswifi_socket_offload.c:552
static int eswifi_socket_accept(void *obj, struct sockaddr *addr, socklen_t *addrlen)
Definition: eswifi_socket_offload.c:117