syslog-ng source
bookmark.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2014 Balabit
3  * Copyright (c) 2014 Laszlo Budai
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 
25 #ifndef BOOKMARK_H_INCLUDED
26 #define BOOKMARK_H_INCLUDED
27 
28 #include "syslog-ng.h"
29 #include "persist-state.h"
30 
31 #define MAX_BOOKMARK_DATA_LENGTH (128)
32 
33 typedef struct _BookmarkContainer
34 {
35  /* Bookmark structure should be aligned (ie. HPUX-11v2 ia64) */
36  gint64 other_state[MAX_BOOKMARK_DATA_LENGTH / sizeof(gint64)];
38 
39 struct _Bookmark
40 {
41  PersistState *persist_state;
42  void (*save)(Bookmark *self);
43  void (*destroy)(Bookmark *self);
45 };
46 
47 static inline void
48 bookmark_save(Bookmark *self)
49 {
50  if (self->save)
51  {
52  self->save(self);
53  }
54 }
55 
56 static inline void
57 bookmark_destroy(Bookmark *self)
58 {
59  if (self->destroy)
60  {
61  self->destroy(self);
62  }
63 }
64 
65 #endif
#define MAX_BOOKMARK_DATA_LENGTH
Definition: bookmark.h:31
#define self
Definition: rcptid.c:38
Definition: bookmark.h:34
Definition: bookmark.h:40
void(* destroy)(Bookmark *self)
Definition: bookmark.h:43
void(* save)(Bookmark *self)
Definition: bookmark.h:42
BookmarkContainer container
Definition: bookmark.h:44
PersistState * persist_state
Definition: bookmark.h:41