Bump year
[yaz-moved-to-github.git] / include / yaz / zgdu.h
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: zgdu.h,v 1.4 2005-01-15 19:47:10 adam Exp $
6  */
7
8 /**
9  * \file zgdu.h
10  * \brief Header for the Z_GDU (HTTP or Z39.50 package)
11  */
12
13 #ifndef Z_GDU_H
14 #define Z_GDU_H
15
16 #include <yaz/z-core.h>
17
18 YAZ_BEGIN_CDECL
19
20 typedef struct Z_HTTP_Header Z_HTTP_Header;
21
22 struct Z_HTTP_Header {
23     char *name;
24     char *value;
25     Z_HTTP_Header *next;
26 };
27
28 typedef struct {
29     char *method;
30     char *version;
31     char *path;
32     Z_HTTP_Header *headers;
33     char *content_buf;
34     int content_len;
35 } Z_HTTP_Request;
36
37 typedef struct {
38     int code;
39     char *version;
40     Z_HTTP_Header *headers;
41     char *content_buf;
42     int content_len;
43 } Z_HTTP_Response;
44
45 #define Z_GDU_Z3950         1
46 #define Z_GDU_HTTP_Request  2
47 #define Z_GDU_HTTP_Response 3
48 typedef struct {
49     int which;
50     union {
51         Z_APDU *z3950;
52         Z_HTTP_Request *HTTP_Request;
53         Z_HTTP_Response *HTTP_Response;
54     } u;
55 } Z_GDU ;
56 YAZ_EXPORT int z_GDU (ODR o, Z_GDU **p, int opt, const char *name);
57 YAZ_EXPORT void z_HTTP_header_add(ODR o, Z_HTTP_Header **hp, const char *n,
58                                   const char *v);
59 YAZ_EXPORT const char *z_HTTP_header_lookup(Z_HTTP_Header *hp, const char *n);
60
61 YAZ_EXPORT const char *z_HTTP_errmsg(int code);
62
63 YAZ_EXPORT Z_GDU *z_get_HTTP_Response(ODR o, int code);
64 YAZ_EXPORT Z_GDU *z_get_HTTP_Request(ODR o);
65
66 YAZ_END_CDECL
67
68 #endif