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
|
/*
* This file defines the lua interface into
* FRRouting.
*
* Copyright (C) 2016 Cumulus Networks, Inc.
* Donald Sharp
*
* This file is part of FreeRangeRouting (FRR).
*
* FRR 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, or (at your option) any later version.
*
* FRR 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 FRR; see the file COPYING. If not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LUA_H__
#define __LUA_H__
#if defined(HAVE_LUA)
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* These functions are helper functions that
* try to glom some of the lua_XXX functionality
* into what we actually need, instead of having
* to make multiple calls to set up what
* we want
*/
enum lua_rm_status {
/*
* Script function run failure. This will translate into a
* deny
*/
LUA_RM_FAILURE = 0,
/*
* No Match was found for the route map function
*/
LUA_RM_NOMATCH,
/*
* Match was found but no changes were made to the
* incoming data.
*/
LUA_RM_MATCH,
/*
* Match was found and data was modified, so
* figure out what changed
*/
LUA_RM_MATCH_AND_CHANGE,
};
/*
* Open up the lua.scr file and parse
* initial global values, if any.
*/
lua_State *lua_initialize(const char *file);
void lua_setup_prefix_table(lua_State *L, const struct prefix *prefix);
enum lua_rm_status lua_run_rm_rule(lua_State *L, const char *rule);
/*
* Get particular string/integer information
* from a table. It is *assumed* that
* the table has already been selected
*/
const char *get_string(lua_State *L, const char *key);
int get_integer(lua_State *L, const char *key);
#ifdef __cplusplus
}
#endif
#endif
#endif
|