Elliptics version update: 2.19.2.7
[elliptics.git] / example / common.h
blob2fa4a2791871188a2666dbaa2d02ebae84486531
1 /*
2 * 2008+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
3 * All rights reserved.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
16 #ifndef __COMMON_H
17 #define __COMMON_H
19 #include <sys/mman.h>
21 #include "elliptics/packet.h"
22 #include "elliptics/interface.h"
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 int dnet_parse_addr(char *addr, struct dnet_config *cfg);
30 int dnet_parse_numeric_id(char *value, unsigned char *id);
32 void dnet_common_log(void *priv, int level, const char *msg);
33 void dnet_syslog(void *priv, int level, const char *msg);
35 int dnet_common_add_remote_addr(struct dnet_node *n, struct dnet_config *main_cfg, char *orig_addr);
37 struct dnet_node *dnet_parse_config(char *file, int mon);
38 int dnet_parse_groups(char *value, int **groups);
40 enum dnet_common_embed_types {
41 DNET_FCGI_EMBED_DATA = 1,
42 DNET_FCGI_EMBED_TIMESTAMP,
45 struct dnet_common_embed {
46 uint64_t size;
47 uint32_t type;
48 uint32_t flags;
49 uint8_t data[0];
52 static inline void dnet_common_convert_embedded(struct dnet_common_embed *e)
54 e->size = dnet_bswap64(e->size);
55 e->type = dnet_bswap32(e->type);
56 e->flags = dnet_bswap32(e->flags);
59 int dnet_common_prepend_data(struct timespec *ts, uint64_t size, void *buf, int *bufsize);
61 int dnet_background(void);
63 int dnet_map_history(struct dnet_node *n, char *file, struct dnet_history_map *map);
64 void dnet_unmap_history(struct dnet_node *n, struct dnet_history_map *map);
66 struct dnet_meta * dnet_meta_search_cust(struct dnet_meta_container *mc, uint32_t type);
68 #ifdef __cplusplus
70 #endif
72 #endif /* __COMMON_H */