summary refs log tree commit diff
path: root/cptc.h
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2024-09-29 15:01:05 +0300
committerNakidai <nakidai@disroot.org>2024-09-29 15:01:05 +0300
commit3b28a7b64ac016a4be65a3eb01347b207b114ebf (patch)
treef1391f6312f5ea6029f3e9eb1d7c87062ca15b48 /cptc.h
parentbc3d220bdc1aaabb3c2c5249033ac3399bfc4c32 (diff)
downloadcptc-1.1.0.tar.gz
cptc-1.1.0.zip
Add docstrings v1.1.0
Diffstat (limited to 'cptc.h')
-rw-r--r--cptc.h33
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__ */