-
Notifications
You must be signed in to change notification settings - Fork 564
/
dr_cb.h
71 lines (62 loc) · 2.04 KB
/
dr_cb.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
65
66
67
68
69
70
71
/**
*
* drouting module callbacks header
*
* Copyright (C) 2014-2020 OpenSIPS Foundation
*
* This file is part of opensips, a free SIP server.
*
* opensips 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
*
* opensips 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _DR_CB_H_
#define _DR_CB_H_
/* callback types used on top of DRouting */
enum drcb_types {
DRCB_REG_CREATE_PARTS_LIST /* create a partitions list */,
/* params: */
DRCB_REG_INIT_RULE,
DRCB_REG_GW,
DRCB_REG_CR,
DRCB_REG_ADD_RULE,
DRCB_REG_MARK_AS_RULE_LIST,
DRCB_REG_FREE_LIST,
DRCB_ACC_CALL,
DRCB_SORT_DST,
DRCB_MAX /*keep this at the end*/
};
#include "prefix_tree.h"
#include "dr_cb_sorting.h"
#define POINTER_CLOSED_MARKER ((void *)(-1))
/* callback function prototype */
typedef void (*dr_cb) (void *param);
/* function to free callback param */
typedef void (*dr_param_free_cb) (void *param);
/* register callback function protoype */
typedef int (*register_drcb_f)(enum drcb_types, dr_cb f, void *param,
dr_param_free_cb ff);
typedef int (*register_drcb_to_array_f)(enum drcb_types, dr_cb f,
void *param, dr_param_free_cb ff);
struct dr_callback {
dr_cb callback;
void *param;
dr_param_free_cb callback_param_free;
struct dr_callback *next;
};
/* TODO: should i have a different structure for sort_callbacks */
int register_dr_cb(enum drcb_types type, dr_cb f, void *param,
dr_param_free_cb ff);
int run_dr_cbs(enum drcb_types type, void *param);
void destroy_dr_cbs(void);
#endif