]>
git.proxmox.com Git - mirror_frr.git/blob - lib/ns.h
3 * Copyright (C) 2014 6WIND S.A.
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your
10 * option) any later version.
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "openbsd-tree.h"
30 typedef u_int32_t ns_id_t
;
32 /* the default NS ID */
34 #define NS_UNKNOWN UINT32_MAX
36 /* Default netns directory (Linux) */
37 #define NS_RUN_DIR "/var/run/netns"
42 /* Identifier, same as the vector index */
51 /* Master list of interfaces belonging to this NS */
54 /* Back Pointer to VRF */
61 RB_PROTOTYPE(ns_head
, ns
, entry
, ns_compare
)
63 extern struct ns_head ns_tree
;
69 #define NS_NEW_HOOK 0 /* a new logical-router is just created */
70 #define NS_DELETE_HOOK 1 /* a logical-router is to be deleted */
71 #define NS_ENABLE_HOOK 2 /* a logical-router is ready to use */
72 #define NS_DISABLE_HOOK 3 /* a logical-router is to be unusable */
75 * Add a specific hook ns module.
77 * @param2: the callback function
78 * - param 1: the NS ID
79 * - param 2: the address of the user data pointer (the user data
80 * can be stored in or freed from there)
82 extern void ns_add_hook(int type
, int (*)(struct ns
*));
85 * NS initializer/destructor
87 extern void ns_init_zebra(void);
88 extern void ns_terminate(void);
94 /* Create a socket serving for the given NS */
95 extern int ns_socket(int, int, int, ns_id_t
);
96 extern void ns_cmd_init(void);
97 extern int ns_handler_create(struct vty
*vty
, struct vrf
*vrf
,
98 char *pathname
, ns_id_t ns_id
);
99 extern char *ns_netns_pathname(struct vty
*vty
, const char *name
);
100 extern void *ns_info_lookup(ns_id_t ns_id
);
101 extern void ns_walk_func(int (*func
)(struct ns
*));
103 #endif /*_ZEBRA_NS_H*/