X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=common%2Fapp.h;h=04d8fa5fbe064099218c4342c7c460d160baab30;hb=HEAD;hp=d1df68869703df88c63599fd9a18d4d094e86620;hpb=54789cc8538714fc3622646721f6f2ecceae94ac;p=blerg.git diff --git a/common/app.h b/common/app.h index d1df688..04d8fa5 100644 --- a/common/app.h +++ b/common/app.h @@ -4,30 +4,38 @@ #ifndef _APP_H #define _APP_H -#include #include "database.h" +#include "config.h" +#include "auth.h" #define REALM "Blerg" #define CONTENT_401 "401 Unauthorized

401 Unauthorized

DENIED" +#define CONTENT_403 "403 Forbidden

403 Forbidden

Go away." #define CONTENT_404 "404 Not Found

404 Not Found

I couldn't find that." #define CONTENT_405 "405 Method Not Allowed

405 Method Not Allowed

I'm sorry, Dave. I'm afraid I can't do that." #define JSON_SUCCESS "{\"status\": \"success\"}" #define JSON_FAILURE "{\"status\": \"failure\"}" -#define URL_INFO_AUTHOR 0x1 +#define URL_INFO_NAME 0x1 #define URL_INFO_RECORD 0x2 #define URL_INFO_RECORD_TO 0x4 #define DERP "DERP DERP DERP" struct url_info { unsigned int contents; - char author[33]; + char name[MAX_TAG_LENGTH + 1]; uint64_t record; uint64_t record_to; }; +struct auth_cookie { + char name[MAX_TAG_LENGTH + 1]; + char token[TOKEN_SIZE * 2 + 1]; +}; + int parse_url_info(const char *url, struct url_info *info); +int parse_auth_cookie(const char *str, struct auth_cookie *cookie); uint64_t *make_sequential_list(uint64_t from, uint64_t to); #endif /* _APP_H */