fileserver.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 chrysn
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
78 #ifndef NET_NANOCOAP_FILESERVER_H
79 #define NET_NANOCOAP_FILESERVER_H
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 #include "net/nanocoap.h"
86 
91 #define COAPFILESERVER_DIR_DELETE_ETAG (0x6ce88b56u)
92 
98 typedef enum {
106 
110 typedef struct {
111  const char *path;
112  void *user_ctx;
114 
124 
137 
152 ssize_t nanocoap_fileserver_handler(coap_pkt_t *pdu, uint8_t *buf, size_t len,
153  coap_request_ctx_t *ctx);
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif /* NET_NANOCOAP_FILESERVER_H */
160 
void(* nanocoap_fileserver_event_handler_t)(nanocoap_fileserver_event_t event, nanocoap_fileserver_event_ctx_t *ctx)
GCoAP fileserver event callback type.
Definition: fileserver.h:122
ssize_t nanocoap_fileserver_handler(coap_pkt_t *pdu, uint8_t *buf, size_t len, coap_request_ctx_t *ctx)
File server handler.
void nanocoap_fileserver_set_event_cb(nanocoap_fileserver_event_handler_t cb, void *arg)
Register a consumer for GCoAP fileserver events Requires the nanocoap_fileserver_callback module.
nanocoap_fileserver_event_t
GCoAP fileserver event types.
Definition: fileserver.h:98
@ NANOCOAP_FILESERVER_GET_FILE_START
file download started
Definition: fileserver.h:99
@ NANOCOAP_FILESERVER_PUT_FILE_END
file upload finished
Definition: fileserver.h:102
@ NANOCOAP_FILESERVER_DELETE_FILE
file deletion requested (called before file is deleted)
Definition: fileserver.h:103
@ NANOCOAP_FILESERVER_GET_FILE_END
file download finished
Definition: fileserver.h:100
@ NANOCOAP_FILESERVER_PUT_FILE_START
file upload started
Definition: fileserver.h:101
nanocoap API
CoAP resource request handler context.
Definition: nanocoap.h:328
CoAP PDU parsing context structure.
Definition: nanocoap.h:222
event structure
Definition: event.h:148
GCoAP fileserver event context.
Definition: fileserver.h:110
const char * path
VFS path of the affected file
Definition: fileserver.h:111
void * user_ctx
Optional user supplied context.
Definition: fileserver.h:112