olsrd.h
Go to the documentation of this file.
1 /* vim: set ts=2 expandtab: */
2 /**
3  * @file olsrd.h
4  * @brief OLSRd configuration and process management
5  *
6  * @author Josh King (jheretic), jking@chambana.net
7  *
8  * @internal
9  * Created 03/07/2013
10  * Revision $Id: doxygen.commotion.templates,v 0.1 2013/01/01 09:00:00 jheretic Exp $
11  * Compiler gcc/g++
12  * Company The Open Technology Institute
13  * Copyright Copyright (c) 2013, Josh King
14  *
15  * This file is part of Commotion, Copyright (c) 2013, Josh King
16  *
17  * Commotion is free software: you can redistribute it and/or modify
18  * it under the terms of the GNU Affero General Public License as
19  * published by the Free Software Foundation, either version 3 of the
20  * License, or (at your option) any later version.
21  *
22  * Commotion is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU Affero General Public License for more details.
26  *
27  * You should have received a copy of the GNU Affero General Public License
28  * along with Commotion. If not, see <http://www.gnu.org/licenses/>.
29  *
30  * =====================================================================================
31  */
32 
33 #include <stdlib.h>
34 #include "process.h"
35 #include "util.h"
36 #include "obj.h"
37 
38 #define OLSR_HNA4 (1 << 0)
39 #define OLSR_HNA6 (1 << 1)
40 #define OLSR_IFACE_MESH (1 << 0)
41 #define OLSR_IFACE_ETHER (1 << 1)
42 
43 /**
44  * @struct co_olsrd_process_t
45  * @brief contains the OLSRd process protocol
46  */
47 typedef struct {
48  co_process_t proto;
50 
51 /**
52  * @struct co_olsrd_conf_item_t
53  * @brief contains the key and value for configuring OLSRd for Commotion
54  */
55 typedef struct {
56  char *key;
57  char *value;
59 
60 /**
61  * @struct co_olsrd_conf_plugin_t
62  * @brief contains the number of configuration items for OLSRd
63  */
64 typedef struct {
65  char *name;
66  co_olsrd_conf_item_t **attr;
67  int num_attr;
69 
70 /**
71  * @struct co_olsrd_conf_iface_t
72  * @brief contains interace configuration settings for OLSR, including interface name, mode and IPv4 broadcast message
73  */
74 typedef struct {
75  char *ifname;
76  int mode;
77  char *Ipv4Broadcast;
79 
80 /**
81  * @struct co_olsrd_conf_hna_t
82  * @brief contains host network address settings, including family, address and netmask
83  */
84 typedef struct {
85  int family;
86  char *address;
87  char *netmask;
89 
90 /**
91  * @brief adds an interface to OLSRd
92  * @param name name of the interface to be added
93  * @param mode network mode for interface
94  * @param Ipv4Broadcast IPv4 broadcast address (node address, using netmask as last octet)
95  */
96 int co_olsrd_add_iface(const char* name, int mode, const char *Ipv4Broadcast);
97 
98 /**
99  * @brief removes an interface from OLSRd
100  * @param name name of the interface to be removed
101  * @param mode network mode for interface
102  * @param Ipv4Broadcast IPv4 broadcast address (node address, using netmask as last octet)
103  */
104 int co_olsrd_remove_iface(char* name, int mode, char *Ipv4Broadcast);
105 
106 /**
107  * @brief adds a host network address to OLSRd
108  * @param family the address family
109  * @param address the network address for the interface
110  * @param netmask the netmask for the interface
111  */
112 int co_olsrd_add_hna(const int family, const char *address, const char *netmask);
113 
114 /**
115  * @brief remves a host network address from OLSRd
116  * @param family the address family
117  * @param address the network address for the interface
118  * @param netmask the netmask for the interface
119  */
120 int co_olsrd_remove_hna(int family, char *address, char *netmask);
121 
122 /**
123  * @brief prints OLSR configuration info from file (currently unimplemented)
124  * @param filename the configuration file
125  */
126 int co_olsrd_print_conf(const char *filename);
127 
128 /**
129  * @brief initiates the OLSR daemon when a new process gets created (currently unimplemented)
130  * @param self process to be called
131  */
132 int co_olsrd_init(co_obj_t *self);
Commotion object model.
int co_olsrd_print_conf(const char *filename)
prints OLSR configuration info from file (currently unimplemented)
Definition: olsrd.c:93
int co_olsrd_init(co_obj_t *self)
initiates the OLSR daemon when a new process gets created (currently unimplemented) ...
Definition: olsrd.c:248
contains host network address settings, including family, address and netmask
Definition: olsrd.h:84
int co_olsrd_add_hna(const int family, const char *address, const char *netmask)
adds a host network address to OLSRd
Definition: olsrd.c:198
contains the key and value for configuring OLSRd for Commotion
Definition: olsrd.h:55
contains the OLSRd process protocol
Definition: olsrd.h:47
Definition: obj.h:131
Definition: process.h:58
int co_olsrd_remove_hna(int family, char *address, char *netmask)
remves a host network address from OLSRd
Definition: olsrd.c:214
utility functions for the Commotion daemon
a simple object-oriented process manager object model inspired by Zed Shaw
contains interace configuration settings for OLSR, including interface name, mode and IPv4 broadcast ...
Definition: olsrd.h:74
co_obj_t * name
Definition: cmd.h:60
int co_olsrd_remove_iface(char *name, int mode, char *Ipv4Broadcast)
removes an interface from OLSRd
Definition: olsrd.c:165
int co_olsrd_add_iface(const char *name, int mode, const char *Ipv4Broadcast)
adds an interface to OLSRd
Definition: olsrd.c:149
contains the number of configuration items for OLSRd
Definition: olsrd.h:64