New directive default-client-charset which serves as charset
[yazproxy-moved-to-github.git] / include / yazproxy / module.h
1 /* $Id: module.h,v 1.6 2005-06-25 15:58:33 adam Exp $
2    Copyright (c) 1998-2005, Index Data.
3
4 This file is part of the yaz-proxy.
5
6 YAZ proxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 YAZ proxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with YAZ proxy; see the file LICENSE.  If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20  */
21
22 #ifndef YAZ_PROXY_MODULE_H
23 #define YAZ_PROXY_MODULE_H_INCLUDED
24
25 struct Yaz_ProxyModule_entry {
26     int int_version;
27     char *module_name;
28     char *module_description;
29     void *fl;
30 };
31
32 #define  YAZPROXY_RET_NOT_ME 0 /* Did not catch it. pass to other handler */
33 #define  YAZPROXY_RET_OK     1 /* OK, grabbed */
34 #define  YAZPROXY_RET_PERM   2 /* Permissiong denied, reject etc. */
35
36 struct Yaz_ProxyModule_int0 {
37     void *(*init)(void);   // Init handler - returns module-specific handle
38
39     void (*destroy)(       // Destroy handler
40         void *handle       // module-specific handle as returned by init
41         );
42     
43     int (*authenticate)(   // Authenticate handler. Returns YAZPROXY_RET_..
44         void *handle,      // module-specific handle as returned by init 
45         const char *name,  // target name (or NULL if default target)
46         void *element_ptr, // xmlnodePtr thing to XML config this
47         const char *user,  // User ID (or NULL if no suppliied User ID)
48         const char *group, // Group ID (or NULL if no supplied Group ID)
49         const char *pw,    // Password (or NULL if no supplied password)
50         const char *peer_IP// IP address of client
51     );
52 };
53
54 class Yaz_ProxyModule;
55
56 class Yaz_ProxyModules {
57     friend class Proxy_Msg;
58  public:
59     Yaz_ProxyModules();
60     ~Yaz_ProxyModules();
61     int authenticate(const char *module_name,
62                      const char *target_name, void *element_ptr,
63                      const char *user,
64                      const char *group,
65                      const char *password,
66                      const char *peer_IP);
67     int add_module(const char *fname);
68     void unload_modules();
69  private:
70     Yaz_ProxyModule *m_list;
71     int m_no_open;
72 };
73
74 #endif
75 /*
76  * Local variables:
77  * c-basic-offset: 4
78  * indent-tabs-mode: nil
79  * End:
80  * vim: shiftwidth=4 tabstop=8 expandtab
81  */
82