Update Solaris packaging files.
[shibboleth/cpp-sp.git] / shar / shar-utils.h
1 /*
2  *  Copyright 2001-2005 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /*
18  * shar-utils.h -- header file for the SHAR utilities.
19  *
20  * Created by:  Derek Atkins <derek@ihtfp.com>
21  *
22  * $Id$
23  */
24
25 #ifndef SHAR_UTILS_H
26 #define SHAR_UTILS_H
27
28 #include <saml/saml.h>
29 #include <shib-target/shibrpc.h>
30 #include <shib-target/shib-target.h>
31
32 #if defined(HAVE_LOG4SHIB)
33 # include <log4shib/Category.hh>
34 namespace shibd {
35     namespace logging = log4shib;
36 };
37 #elif defined(HAVE_LOG4CPP)
38 # include <log4cpp/Category.hh>
39 namespace shibd {
40     namespace logging = log4cpp;
41 };
42 #else
43 # error "Supported logging library not available."
44 #endif
45
46 extern "C" {
47     typedef void (*dispatch_fn)(struct svc_req* rqstp, register SVCXPRT* transp);
48 }
49
50 struct ShibRPCProtocols
51 {
52     u_long prog;
53     u_long vers;
54     dispatch_fn dispatch;
55 };
56
57 class SharChild {
58 public:
59     SharChild(shibtarget::IListener::ShibSocket& s, const saml::Iterator<ShibRPCProtocols>& protos);
60     ~SharChild();
61     void run();
62
63 private:
64     bool svc_create();
65     shibtarget::IListener::ShibSocket sock;
66     std::vector<ShibRPCProtocols> v_protos;
67     shibboleth::Thread* child;
68 };
69
70 struct SHARUtils
71 {
72     static void init();
73     static void fini();
74     static void log_error();
75 };
76
77 #endif /* SHAR_UTILS_H */