fileserver.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 chrysn
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 #include "net/nanocoap.h"
82 
87 #define COAPFILESERVER_DIR_DELETE_ETAG (0x6ce88b56u)
88 
94 typedef enum {
102 
106 typedef struct {
107  const char *path;
108  void *user_ctx;
110 
120 
133 
148 ssize_t nanocoap_fileserver_handler(coap_pkt_t *pdu, uint8_t *buf, size_t len,
149  coap_request_ctx_t *ctx);
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 
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:118
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:94
@ NANOCOAP_FILESERVER_GET_FILE_START
file download started
Definition: fileserver.h:95
@ NANOCOAP_FILESERVER_PUT_FILE_END
file upload finished
Definition: fileserver.h:98
@ NANOCOAP_FILESERVER_DELETE_FILE
file deletion requested (called before file is deleted)
Definition: fileserver.h:99
@ NANOCOAP_FILESERVER_GET_FILE_END
file download finished
Definition: fileserver.h:96
@ NANOCOAP_FILESERVER_PUT_FILE_START
file upload started
Definition: fileserver.h:97
nanocoap API
CoAP resource request handler context.
Definition: nanocoap.h:324
CoAP PDU parsing context structure.
Definition: nanocoap.h:218
event structure
Definition: event.h:142
GCoAP fileserver event context.
Definition: fileserver.h:106
const char * path
VFS path of the affected file
Definition: fileserver.h:107
void * user_ctx
Optional user supplied context.
Definition: fileserver.h:108