File: conf.h

package info (click to toggle)
gearmand 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,876 kB
  • ctags: 1,656
  • sloc: ansic: 17,412; sh: 10,894; makefile: 76; cpp: 9
file content (103 lines) | stat: -rw-r--r-- 2,060 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* Gearman server and library
 * Copyright (C) 2009 Eric Day
 * All rights reserved.
 *
 * Use and distribution licensed under the BSD license.  See
 * the COPYING file in the parent directory for full text.
 */

/**
 * @file
 * @brief Configuration Declarations
 */

#ifndef __GEARMAN_SERVER_CONF_H__
#define __GEARMAN_SERVER_CONF_H__

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @addtogroup gearman_conf Configuration Declarations
 * @ingroup gearman_server
 * @{
 */

struct gearman_conf_option_st
{
  size_t value_count;
  gearman_conf_module_st *module;
  const char *name;
  const char *value_name;
  const char *help;
  char **value_list;
};

struct gearman_conf_st
{
  struct {
    bool allocated;
  } options;
  gearman_return_t last_return;
  int last_errno;
  size_t module_count;
  size_t option_count;
  size_t short_count;
  gearman_conf_module_st **module_list;
  gearman_conf_option_st *option_list;
  struct option *option_getopt;
  char option_short[GEARMAN_CONF_MAX_OPTION_SHORT];
  char last_error[GEARMAN_MAX_ERROR_SIZE];
};

/**
 * Initialize a gearman conf structure.
 */
GEARMAN_API
gearman_conf_st *gearman_conf_create(gearman_conf_st *conf);

/**
 * Free a gearman conf structure.
 */
GEARMAN_API
void gearman_conf_free(gearman_conf_st *conf);

/**
 * Return an return code for the last library error encountered.
 */
GEARMAN_API
gearman_return_t gearman_conf_return(gearman_conf_st *conf);

/**
 * Return an error string for last library error encountered.
 */
GEARMAN_API
const char *gearman_conf_error(gearman_conf_st *conf);

/**
 * Value of errno in the case of a GEARMAN_ERRNO return value.
 */
GEARMAN_API
int gearman_conf_errno(gearman_conf_st *conf);

/**
 * Parse command line arguments.
 */
GEARMAN_API
gearman_return_t gearman_conf_parse_args(gearman_conf_st *conf, int argc,
                                         char *argv[]);

/**
 * Print usage information to stdout.
 */
GEARMAN_API
void gearman_conf_usage(gearman_conf_st *conf);

/** @} */

#ifdef __cplusplus
}
#endif

#endif /* __GEARMAN_SERVER_CONF_H__ */