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 
9 #pragma once
10 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 #include "net/nanocoap.h"
85 
90 #define COAPFILESERVER_DIR_DELETE_ETAG (0x6ce88b56u)
91 
97 typedef enum {
105 
109 typedef struct {
110  const char *path;
111  void *user_ctx;
113 
123 
136 
151 ssize_t nanocoap_fileserver_handler(coap_pkt_t *pdu, uint8_t *buf, size_t len,
152  coap_request_ctx_t *ctx);
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
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:121
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:97
@ NANOCOAP_FILESERVER_GET_FILE_START
file download started
Definition: fileserver.h:98
@ NANOCOAP_FILESERVER_PUT_FILE_END
file upload finished
Definition: fileserver.h:101
@ NANOCOAP_FILESERVER_DELETE_FILE
file deletion requested (called before file is deleted)
Definition: fileserver.h:102
@ NANOCOAP_FILESERVER_GET_FILE_END
file download finished
Definition: fileserver.h:99
@ NANOCOAP_FILESERVER_PUT_FILE_START
file upload started
Definition: fileserver.h:100
nanocoap API
CoAP resource request handler context.
Definition: nanocoap.h:327
CoAP PDU parsing context structure.
Definition: nanocoap.h:221
event structure
Definition: event.h:145
GCoAP fileserver event context.
Definition: fileserver.h:109
const char * path
VFS path of the affected file
Definition: fileserver.h:110
void * user_ctx
Optional user supplied context.
Definition: fileserver.h:111