Initial checkin of proxy 2 code
[yazproxy-moved-to-github.git] / src / p2_backend_dummy.cpp
1
2 #include <yaz/log.h>
3 #include "p2_backend.h"
4
5 class P2_BackendSetDummy : public IP2_BackendSet {
6 public:
7     P2_BackendSetDummy();
8     ~P2_BackendSetDummy();
9     int get(int start, int number);
10 };
11
12 class P2_BackendDummy : public IP2_Backend {
13 public:
14     P2_BackendDummy(const char *address);
15     ~P2_BackendDummy();
16     int search(yazpp_1::Yaz_Z_Query *q, IP2_BackendSet **rset, int *hits);
17 };
18
19 P2_BackendDummy::P2_BackendDummy(const char *address)
20 {
21     yaz_log(YLOG_LOG, "P2_backendDummy %p create", this);
22 }
23
24 P2_BackendDummy::~P2_BackendDummy()
25 {
26     yaz_log(YLOG_LOG, "P2_backendDummy %p destroy", this);
27 }
28
29 int P2_BackendDummy::search(yazpp_1::Yaz_Z_Query *q, IP2_BackendSet **rset,
30                             int *hits)
31 {
32     yaz_log(YLOG_LOG, "P2_backendDummy %p search", this);
33
34     P2_BackendSetDummy *s = new P2_BackendSetDummy();
35
36     *rset = s;
37     *hits = 42;
38     return 0;
39 }
40
41 int P2_BackendSetDummy::get(int start, int number)
42 {
43     yaz_log(YLOG_LOG, "P2_backendSetDummy %p get", this);
44     return 0;
45 }
46
47 P2_BackendSetDummy::P2_BackendSetDummy()
48 {
49     yaz_log(YLOG_LOG, "P2_backendSetDummy %p create", this);
50
51 }
52
53 P2_BackendSetDummy::~P2_BackendSetDummy()
54 {
55     yaz_log(YLOG_LOG, "P2_backendSetDummy %p destroy", this);
56 }
57
58 static IP2_Backend *dummy_create(const char *address)
59 {
60     return new P2_BackendDummy(address);
61 }
62
63 P2_ModuleInterface0 int0 = {
64     dummy_create
65 };
66
67 P2_ModuleEntry p2_module_entry = {
68     0,
69     "dummy",
70     "Dummy Backend",
71     (void *) &int0
72 };
73
74 P2_ModuleEntry *p2_backend_dummy = &p2_module_entry;