2 * Copyright (c) 2005, Bruno Randolf <bruno.randolf@4g-systems.biz>
3 * Copyright (c) 2004, Andreas Tønnesen(andreto-at-olsr.org)
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 * * Neither the name of the UniK olsr daemon nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
32 /* $Id: nameservice.h,v 1.7 2005/03/17 21:41:30 br1 Exp $ */
35 * Dynamic linked library for UniK OLSRd
38 #ifndef _NAMESERVICE_PLUGIN
39 #define _NAMESERVICE_PLUGIN
41 #include "olsrd_plugin.h"
42 #include "nameservice_msg.h"
44 #define PLUGIN_NAME "OLSRD nameservice plugin"
45 #define PLUGIN_VERSION "0.2"
46 #define PLUGIN_AUTHOR "Bruno Randolf"
49 #define MESSAGE_TYPE 130
50 #define PARSER_TYPE MESSAGE_TYPE
51 #define EMISSION_INTERVAL 120 /* two minutes */
52 #define NAME_VALID_TIME 3600 /* one hour */
54 #define NAME_PROTOCOL_VERSION 1
58 #define MAX_SUFFIX 255
63 union olsr_ip_addr ip;
67 struct name_entry *next; /* linked list */
73 union olsr_ip_addr originator; /* IP address of the node this entry describes */
74 struct timeval timer; /* Validity time */
75 struct name_entry *names; /* list of names this originator declares */
76 struct db_entry *next; /* linked list */
80 /* Timeout function to register with the sceduler */
84 /* Parser function to register with the sceduler */
86 olsr_parser(union olsr_message *, struct interface *, union olsr_ip_addr *);
88 /* Event function to register with the sceduler */
93 encap_namemsg(struct namemsg *);
96 decap_namemsg(struct namemsg *, int, struct name_entry**);
99 update_name_entry(union olsr_ip_addr *, struct namemsg *, int, double);
102 write_hosts_file(void);
105 write_resolv_file(void);
108 register_olsr_param(char *key, char *value);
111 free_name_entry_list(struct name_entry **list);
114 allowed_ip(union olsr_ip_addr *addr);
117 name_constructor(void);