lunch-poll-legacy

Lunch Poll Legacy -- poll colleagues where to have lunch
Log | Files | Refs | README | LICENSE

http.h (704B)


      1 /**
      2  * Lunch Poll Legacy
      3  * Copyright 2024, 2025 Matthias Balk
      4  */
      5 
      6 #ifndef __HTTP_H__
      7 #define __HTTP_H__
      8 
      9 #define LEN(a)          (sizeof(a) / sizeof(a)[0])
     10 #define header_end()    (puts("\r"))
     11 
     12 #define MAX_PARAMS_COUNT 128
     13 #define MAX_POST_SIZE 4096
     14 
     15 typedef struct {
     16   unsigned int code;
     17   const char *name;
     18 } StatusCode;
     19 
     20 typedef struct {
     21   const char *path;
     22   const char *method;
     23   void (*func)(void);
     24 } Route;
     25 
     26 void header_status(int code);
     27 void header(const char *key, const char *value);
     28 void err_exit(const char *msg);
     29 void urldecode(const char *src, char *dst /*, size_t dst_size TODO*/);
     30 void split_and_decode_form_params(char* x_www_form_urlencoded, char** params);
     31 
     32 #endif  /* __HTTP_H__ */