diff options
| author | Nakidai <nakidai@disroot.org> | 2024-09-29 15:01:05 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2024-09-29 15:01:05 +0300 |
| commit | 3b28a7b64ac016a4be65a3eb01347b207b114ebf (patch) | |
| tree | f1391f6312f5ea6029f3e9eb1d7c87062ca15b48 /cptc.h | |
| parent | bc3d220bdc1aaabb3c2c5249033ac3399bfc4c32 (diff) | |
| download | cptc-e9eedc8c99a52a4796789f7c2a5414cc1f8f920d.tar.gz cptc-e9eedc8c99a52a4796789f7c2a5414cc1f8f920d.zip | |
Add docstrings v1.1.0
Diffstat (limited to 'cptc.h')
| -rw-r--r-- | cptc.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cptc.h b/cptc.h index 9b57cd0..463e2c9 100644 --- a/cptc.h +++ b/cptc.h @@ -4,17 +4,50 @@ #include <netinet/in.h> +/** + * 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 + * /<UID>.* 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__ */ |