]>
Commit | Line | Data |
---|---|---|
fe089c0d AA |
1 | /* |
2 | * Copyright (c) 2015 Nicira, Inc. | |
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 | #ifndef SYSLOG_PROVIDER_H | |
18 | #define SYSLOG_PROVIDER_H 1 | |
19 | ||
20 | ||
21 | /* Open vSwitch interface to syslog daemon's interface. | |
22 | * | |
23 | * 'syslogger' is the base class that provides abstraction. */ | |
24 | struct syslogger { | |
25 | const struct syslog_class *class; /* Virtual functions for concrete | |
26 | * syslogger implementations. */ | |
27 | const char *prefix; /* Prefix that is enforced by concrete | |
28 | * syslogger implementation. Used | |
29 | * in vlog/list-pattern function. */ | |
30 | }; | |
31 | ||
32 | /* Each concrete syslogger implementation must define it's own table with | |
33 | * following functions. These functions must never call any other VLOG_ | |
34 | * function to prevent deadlocks. */ | |
35 | struct syslog_class { | |
36 | /* openlog() function should be called before syslog() function. It | |
37 | * should initialize all system resources needed to perform logging. */ | |
38 | void (*openlog)(struct syslogger *this, int facility); | |
39 | ||
40 | /* syslog() function sends message 'msg' to syslog daemon. */ | |
41 | void (*syslog)(struct syslogger *this, int pri, const char *msg); | |
42 | }; | |
43 | ||
44 | static inline const char * | |
45 | syslog_get_prefix(struct syslogger *this) | |
46 | { | |
47 | return this->prefix; | |
48 | } | |
49 | ||
50 | #endif /* syslog-provider.h */ |