From 3b28a7b64ac016a4be65a3eb01347b207b114ebf Mon Sep 17 00:00:00 2001 From: Nakidai Date: Sun, 29 Sep 2024 15:01:05 +0300 Subject: Add docstrings --- cptc.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'cptc.h') diff --git a/cptc.h b/cptc.h index 9b57cd0..463e2c9 100644 --- a/cptc.h +++ b/cptc.h @@ -4,17 +4,50 @@ #include +/** + * HTTP methods that CPTC supports + */ enum CPTC_Method { CPTC_GET = 'G', CPTC_HEAD = 'H', }; +/** + * Discord bot's token. CPTC_downloadAvatar requires it when requests avatar ID + * + * Library users should create it and set before calling CPTC + */ extern const char *CPTC_token; + +/** + * Contents of README file. CPTC_requestHandler responses with this when + * requesting on "/" + */ extern const char *CPTC_root; +/** + * Starts CPTC server + * @param address Adress to bind + * @param port Port to bind + */ void CPTC(const char *address, in_port_t port); + +/** + * Handles request + * Paths: + * / README + * /.* GIF that pets given UID + * @param fd Request + * @param n Any number, used for generating random files in /tmp/ + */ void CPTC_requestHandler(int fd, int n); + +/** + * Downloads given user's avatar + * @param uid UserID + * @param download_path Path where to save avatar. + */ char *CPTC_downloadAvatar(long long uid, const char *download_path); #endif /* __CPTC_H__ */ -- cgit 1.4.1