forked from iqiyi/dpvs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdpip.h
64 lines (57 loc) · 1.74 KB
/
dpip.h
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
/*
* DPVS is a software load balancer (Virtual Server) based on DPDK.
*
* Copyright (C) 2017 iQIYI (www.iqiyi.com).
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __DPIP_H__
#define __DPIP_H__
#include "list.h"
#include "utils.h"
#define DPIP_NAME "dpip"
#define DPIP_VERSION "v1.0.0"
typedef enum dpip_cmd_e {
DPIP_CMD_ADD,
DPIP_CMD_DEL,
DPIP_CMD_SET,
DPIP_CMD_SHOW,
DPIP_CMD_FLUSH,
DPIP_CMD_HELP,
} dpip_cmd_t;
struct dpip_conf {
int af;
int verbose;
int stats;
bool color;
char *obj;
dpip_cmd_t cmd;
int argc;
char **argv;
};
struct dpip_obj {
struct list_head list;
char *name;
void *param;
void (*help)(void);
/* XXX: for back compatible we reserve @conf, may remove in the future.
* since we have @parse() to handle @conf. */
int (*do_cmd)(struct dpip_obj *obj, dpip_cmd_t cmd,
struct dpip_conf *conf);
/* the parser can be used to parse @conf into @param */
int (*parse)(struct dpip_obj *obj, struct dpip_conf *conf);
int (*check)(const struct dpip_obj *obj, dpip_cmd_t cmd);
};
void dpip_register_obj(struct dpip_obj *obj);
void dpip_unregister_obj(struct dpip_obj *obj);
#endif