4aaddea71cff0df7ea5a631a3415e7e43c87fd17
[citadel.git] / webcit / paramhandling.h
1 /*
2  * Copyright (c) 1996-2013 by the citadel.org team
3  *
4  * This program is open source software.  You can redistribute it and/or
5  * modify it under the terms of the GNU General Public License, version 3.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 /* URL / Mime Post parsing -> paramhandling.c */
14 void upload_handler(char *name, char *filename, char *partnum, char *disp,
15                     void *content, char *cbtype, char *cbcharset,
16                     size_t length, char *encoding, char *cbid, void *userdata);
17
18 void ParseURLParams(StrBuf *url);
19
20
21 /* These may return NULL if not foud */
22 #define sbstr(a) SBstr(a, sizeof(a) - 1)
23 const StrBuf *SBSTR(const char *key);
24 const StrBuf *SBstr(const char *key, size_t keylen);
25
26 #define xbstr(a, b) (char*) XBstr(a, sizeof(a) - 1, b)
27 const char *XBstr(const char *key, size_t keylen, size_t *len);
28 const char *XBSTR(const char *key, size_t *len);
29
30 #define lbstr(a) LBstr(a, sizeof(a) - 1)
31 long LBstr(const char *key, size_t keylen);
32 long LBSTR(const char *key);
33
34 #define ibstr(a) IBstr(a, sizeof(a) - 1)
35 #define ibcstr(a) IBstr(a.Key, a.len)
36 int IBstr(const char *key, size_t keylen);
37 int IBSTR(const char *key);
38
39 #define havebstr(a) HaveBstr(a, sizeof(a) - 1)
40 int HaveBstr(const char *key, size_t keylen);
41 int HAVEBSTR(const char *key);
42
43 #define yesbstr(a) YesBstr(a, sizeof(a) - 1)
44 int YesBstr(const char *key, size_t keylen);
45 int YESBSTR(const char *key);
46
47 /* TODO: get rid of the non-const-typecast */
48 #define bstr(a) (char*) Bstr(a, sizeof(a) - 1)
49 const char *BSTR(const char *key);
50 const char *Bstr(const char *key, size_t keylen);
51 /* if you want to ease some parts by just parametring yourself... */
52 #define putbstr(a, b) PutBstr(a, sizeof(a) - 1, b)
53 void PutBstr(const char *key, long keylen, StrBuf *Value);
54
55 #define putlbstr(a, b) PutlBstr(a, sizeof(a) - 1, b)
56 void PutlBstr(const char *key, long keylen, long Value);
57