5 * Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
8 * Redistribution and use in source and binary forms, with or
9 * without modification, are permitted provided that the following
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
18 * * Neither the name of olsrd, olsr.org nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 *POSSIBILITY OF SUCH DAMAGE.
38 * Dynamic linked library example for UniK OLSRd
41 #ifndef _OLSRD_PLUGIN_TEST
42 #define _OLSRD_PLUGIN_TEST
44 #include "olsrd_plugin.h"
46 #define KEYFILE "/root/.olsr/olsrd_secure_key"
49 #define ONE_CHECKSUM 1
51 /* Algorithm definitions */
52 #define SHA1_INCLUDING_KEY 1
54 #define MAXMESSAGESIZE 512
56 #define SIGNATURE_SIZE 20
63 /* Seconds of slack allowed */
69 union olsr_ip_addr addr;
70 /* Timestamp difference */
74 struct timeval valtime; /* Validity time */
75 struct timeval conftime; /* Reconfiguration time */
80 /* Seconds to cache a valid timestamp entry */
81 #define TIMESTAMP_HOLD_TIME 30
82 /* Seconds to cache a not verified timestamp entry */
83 #define EXCHANGE_HOLD_TIME 5
85 struct stamp timestamps[HASHSIZE];
87 char checksum_cache[512 + KEYLENGTH];
90 struct interface *olsr_in_if;
92 /* Timeout function to register with the sceduler */
97 /* Event function to register with the sceduler */
102 send_challenge(union olsr_ip_addr *);
105 ifchange(struct interface *, int);
108 send_cres(union olsr_ip_addr *, union olsr_ip_addr *, olsr_u32_t, struct stamp *);
111 send_rres(union olsr_ip_addr *, union olsr_ip_addr *, olsr_u32_t);
114 parse_challenge(char *);
123 check_auth(char *, int *);
129 ipc_send(char *, int);
132 add_signature(char *, int*);
135 validate_packet(char *, int*);
141 timeout_timestamps();
144 check_timestamp(union olsr_ip_addr *, time_t);
147 lookup_timestamp_entry(union olsr_ip_addr *);
150 read_key_from_file(char *);