aboutsummaryrefslogtreecommitdiff
path: root/include/magi/cookie.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/magi/cookie.h')
-rw-r--r--include/magi/cookie.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/magi/cookie.h b/include/magi/cookie.h
new file mode 100644
index 0000000..485b6d9
--- /dev/null
+++ b/include/magi/cookie.h
@@ -0,0 +1,37 @@
+#ifndef MAGI_INCLUDED_COOKIE
+#define MAGI_INCLUDED_COOKIE
+/** @file cookie.h
+ * @brief blah...
+ *
+ * blah-blah...
+ */
+
+
+typedef struct magi_cookie {
+ /* All pointers must be valid as 'free' arguments. */
+ char *name;
+ char *data;
+ char *path; /* Without '/' at the end. */
+ char *domain; /* With dot at the begining. */
+ char *max_age; /* In seconds until discard, used only in response. */
+} magi_cookie;
+
+typedef struct magi_cookie_list {
+ struct magi_cookie_list *next; /* Must be valid as 'free' arguments. */
+ magi_cookie item;
+} magi_cookie_list;
+
+
+/* Addition of item to top of list. Null <=> error. */
+int magi_cookie_list_add(magi_cookie_list **list, magi_cookie *item);
+
+/* Data of last cookie in list: cookie.name == name, returns null if no such;
+ * Last cookie in list is first from request, and from RFC 2109 we know that
+ * first cookie is the most accurate for request's domain and path. */
+char *magi_cookie_list_get(magi_cookie_list *list, const char *name);
+
+/* Freeing and invalidation of list. */
+void magi_cookie_list_destroy(magi_cookie_list *list);
+
+
+#endif