[zebra] Connected routes must always be added to main table
[jleu-quagga.git] / guile / guile-bgp.c
blobfbd01ba0e1ad1bcb40bd0b58c8cf5d886569df34
1 /* Guile bgp interface.
2 Copyright (C) 1999 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
21 #include <zebra.h>
22 #include <guile/gh.h>
24 #include "log.h"
25 #include "bgpd/bgpd.h"
27 /* static SCM scm_mark_bgp (SCM obj); */
28 static size_t scm_free_bgp (SCM vect);
29 static int scm_print_bgp (SCM vect, SCM port, scm_print_state *pstate);
30 static SCM scm_equalp_bgp (SCM a, SCM b);
32 /* Tag of scheme type of bgp. */
33 long scm_tag_bgp;
35 static scm_smobfuns bgp_funs =
37 scm_mark0, scm_free_bgp, scm_print_bgp, scm_equalp_bgp
40 static int
41 scm_print_bgp (SCM vect, SCM port, scm_print_state *pstate)
43 unsigned short num;
44 struct bgp *bgp;
46 num = 0;
47 bgp = (struct bgp *) SCM_CDR (vect);
48 num = bgp->as;
49 scm_puts ("#<bgp ", port);
50 scm_intprint (num, 10, port);
51 scm_putc ('>', port);
52 return 1;
55 static size_t
56 scm_free_bgp (SCM obj)
58 /* dummy function. */
59 return 10;
62 static SCM
63 scm_equalp_bgp (SCM a, SCM b)
66 return SCM_BOOL_F;
69 /* Make bgp instance. */
70 SCM
71 scm_router_bgp (SCM as_number)
73 SCM cell;
74 long num;
75 struct bgp *bgp;
76 struct bgp *bgp_create ();
78 SCM_ASSERT (SCM_INUMP (as_number), as_number, SCM_ARG1, "router-bgp");
80 SCM_DEFER_INTS;
82 num = gh_scm2long (as_number);
84 /* Make new bgp object. */
85 bgp = bgp_create ();
86 bgp->as = num;
88 SCM_NEWCELL (cell);
89 SCM_SETCAR (cell, scm_tag_bgp);
90 SCM_SETCDR (cell, bgp);
92 SCM_ALLOW_INTS;
94 return cell;
97 #if 0
98 SCM
99 scm_router_bgp_list ()
101 return NULL;
103 #endif
105 void
106 init_bgp ()
108 void bgp_init ();
110 bgp_init ();
112 /* Initi types. */
113 scm_tag_bgp = scm_newsmob (&bgp_funs);
115 gh_new_procedure ("router-bgp", scm_router_bgp, 1, 0, 0);
116 /* gh_new_procedure ("router-bgp-list", scm_router_bgp_list, 0, 0, 0); */