Z_GDU definitions in zgdu.h. Renamed PROTO_SRW to PROTO_HTTP.
[yaz-moved-to-github.git] / include / yaz / zgdu.h
1 /*
2  * Copyright (c) 1998-2003, Index Data
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Id: zgdu.h,v 1.1 2003-02-21 12:08:58 adam Exp $
7  */
8 #ifndef Z_GDU_H
9 #define Z_GDU_H
10
11 #include <yaz/z-core.h>
12
13 typedef struct Z_HTTP_Header Z_HTTP_Header;
14
15 struct Z_HTTP_Header {
16     char *name;
17     char *value;
18     Z_HTTP_Header *next;
19 };
20
21 typedef struct {
22     char *method;
23     char *version;
24     char *path;
25     Z_HTTP_Header *headers;
26     char *content_buf;
27     int content_len;
28 } Z_HTTP_Request;
29
30 typedef struct {
31     int code;
32     char *version;
33     Z_HTTP_Header *headers;
34     char *content_buf;
35     int content_len;
36 } Z_HTTP_Response;
37
38 #define Z_GDU_Z3950         1
39 #define Z_GDU_HTTP_Request  2
40 #define Z_GDU_HTTP_Response 3
41 typedef struct {
42     int which;
43     union {
44         Z_APDU *z3950;
45         Z_HTTP_Request *HTTP_Request;
46         Z_HTTP_Response *HTTP_Response;
47     } u;
48 } Z_GDU ;
49 YAZ_EXPORT int z_GDU (ODR o, Z_GDU **p, int opt, const char *name);
50 YAZ_EXPORT void z_HTTP_header_add(ODR o, Z_HTTP_Header **hp, const char *n,
51                                   const char *v);
52 YAZ_EXPORT const char *z_HTTP_header_lookup(Z_HTTP_Header *hp, const char *n);
53
54 YAZ_EXPORT const char *z_HTTP_errmsg(int code);
55
56 YAZ_EXPORT Z_GDU *z_get_HTTP_Response(ODR o, int code);
57 YAZ_EXPORT Z_GDU *z_get_HTTP_Request(ODR o);
58
59 #endif