libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws_plat_file_ops Struct Reference

#include <lws-vfs.h>

Collaboration diagram for lws_plat_file_ops:

Data Fields

lws_fop_fd_t(* LWS_FOP_OPEN )(const struct lws_plat_file_ops *fops_own, const struct lws_plat_file_ops *fops, const char *filename, const char *vpath, lws_fop_flags_t *flags)
int(* LWS_FOP_CLOSE )(lws_fop_fd_t *fop_fd)
lws_fileofs_t(* LWS_FOP_SEEK_CUR )(lws_fop_fd_t fop_fd, lws_fileofs_t offset_from_cur_pos)
int(* LWS_FOP_READ )(lws_fop_fd_t fop_fd, lws_filepos_t *amount, uint8_t *buf, lws_filepos_t len)
int(* LWS_FOP_WRITE )(lws_fop_fd_t fop_fd, lws_filepos_t *amount, uint8_t *buf, lws_filepos_t len)
struct lws_fops_index fi [3]
const struct lws_plat_file_ops * next
struct lws_context * cx

Detailed Description

Definition at line 95 of file lws-vfs.h.

Field Documentation

◆ LWS_FOP_OPEN

lws_fop_fd_t(* lws_plat_file_ops::LWS_FOP_OPEN) (const struct lws_plat_file_ops *fops_own, const struct lws_plat_file_ops *fops, const char *filename, const char *vpath, lws_fop_flags_t *flags)

Open file (always binary access if plat supports it) fops_own is the fops this was called through. fops is the base fops the open can use to find files to process as present as its own, like the zip fops does.

vpath may be NULL, or if the fops understands it, the point at which the filename's virtual part starts. *flags & LWS_FOP_FLAGS_MASK should be set to O_RDONLY or O_RDWR. If the file may be gzip-compressed, LWS_FOP_FLAG_COMPR_ACCEPTABLE_GZIP is set. If it actually is gzip-compressed, then the open handler should OR LWS_FOP_FLAG_COMPR_IS_GZIP on to *flags before returning.

Definition at line 96 of file lws-vfs.h.

◆ LWS_FOP_CLOSE

int(* lws_plat_file_ops::LWS_FOP_CLOSE) (lws_fop_fd_t *fop_fd)

close file AND set the pointer to NULL

Definition at line 113 of file lws-vfs.h.

◆ LWS_FOP_SEEK_CUR

lws_fileofs_t(* lws_plat_file_ops::LWS_FOP_SEEK_CUR) (lws_fop_fd_t fop_fd, lws_fileofs_t offset_from_cur_pos)

seek from current position

Definition at line 115 of file lws-vfs.h.

◆ LWS_FOP_READ

int(* lws_plat_file_ops::LWS_FOP_READ) (lws_fop_fd_t fop_fd, lws_filepos_t *amount, uint8_t *buf, lws_filepos_t len)

Read from file. Returns 0 on success with *amount set to the bytes actually read (0 only at end of file), or < 0 on failure with *amount set to 0. Callers treat 0 with *amount == 0 as EOF, so an implementation must never report a failure as a 0-byte success. *amount must never exceed len: callers use it directly as the count of valid bytes in buf and will read past the buffer if it does.

Definition at line 118 of file lws-vfs.h.

◆ LWS_FOP_WRITE

int(* lws_plat_file_ops::LWS_FOP_WRITE) (lws_fop_fd_t fop_fd, lws_filepos_t *amount, uint8_t *buf, lws_filepos_t len)

Write to file, on exit *amount is set to amount actually written. *amount must never exceed len.

Definition at line 126 of file lws-vfs.h.

◆ fi

struct lws_fops_index lws_plat_file_ops::fi[3]

vfs path signatures implying use of this fops

Definition at line 131 of file lws-vfs.h.

◆ next

const struct lws_plat_file_ops* lws_plat_file_ops::next

NULL or next fops in list... eg copy static fops def to heap and modify copy at runtime

Definition at line 134 of file lws-vfs.h.

◆ cx

struct lws_context* lws_plat_file_ops::cx

the lws_context... eg copy static fops def to heap and modify copy at runtime

Definition at line 138 of file lws-vfs.h.


The documentation for this struct was generated from the following file: