Statistics
| Branch: | Revision:

iof-bird-daemon / sysdep / unix / sync-rt.c @ 10d807d0

History | View | Annotate | Download (1.36 KB)

1
/*
2
 *        BIRD -- Unix Routing Table Scanning and Syncing
3
 *
4
 *        (c) 1998--1999 Martin Mares <mj@ucw.cz>
5
 *
6
 *        Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8

    
9
#include <string.h>
10
#include <sys/socket.h>
11
#include <netinet/in.h>
12
#include <sys/ioctl.h>
13
#include <errno.h>
14

    
15
#define LOCAL_DEBUG
16

    
17
#include "nest/bird.h"
18
#include "nest/iface.h"
19
#include "nest/route.h"
20
#include "nest/protocol.h"
21
#include "lib/timer.h"
22

    
23
#include "unix.h"
24
#include "krt.h"
25

    
26
struct proto_config *cf_krt;
27

    
28
static int
29
krt_start(struct proto *p)
30
{
31
  struct krt_proto *k = (struct krt_proto *) p;
32

    
33
  krt_scan_start(k);
34
  krt_set_start(k);
35
  krt_if_start(k);
36
  return PS_UP;
37
}
38

    
39
int
40
krt_shutdown(struct proto *p)
41
{
42
  struct krt_proto *k = (struct krt_proto *) p;
43

    
44
  krt_scan_shutdown(k);
45
  krt_if_shutdown(k);
46
  return PS_DOWN;
47
}
48

    
49
static void
50
krt_preconfig(struct protocol *x, struct config *c)
51
{
52
  struct krt_config *z = proto_config_new(&proto_unix_kernel, sizeof(struct krt_config));
53

    
54
  cf_krt = &z->c;
55
  z->c.preference = DEF_PREF_UKR;
56
  krt_scan_preconfig(z);
57
  krt_set_preconfig(z);
58
  krt_if_preconfig(z);
59
}
60

    
61
static struct proto *
62
krt_init(struct proto_config *c)
63
{
64
  struct krt_proto *p = proto_new(c, sizeof(struct krt_proto));
65

    
66
  return &p->p;
67
}
68

    
69
struct protocol proto_unix_kernel = {
70
  name:                "Kernel",
71
  preconfig:        krt_preconfig,
72
  init:                krt_init,
73
  start:        krt_start,
74
  shutdown:        krt_shutdown,
75
};