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.
33 * Dynamic linked library example for UniK OLSRd
36 #ifndef _OLSRD_PLUGIN_TEST
37 #define _OLSRD_PLUGIN_TEST
39 #include "olsrd_plugin.h"
43 #define EMISSION_INTERVAL 2.5
48 union olsr_ip_addr originator; /* IP address of the node this entry describes */
49 olsr_u8_t source_type; /* Powersource of the node */
50 olsr_u8_t percentage; /* Percentage of battery power left */
51 olsr_u16_t time_left; /* Operation time left on battery */
52 struct timeval timer; /* Validity time */
53 struct pwrentry *next; /* Next element in line */
54 struct pwrentry *prev; /* Previous elemnt in line */
58 /* The database - (using hashing) */
59 struct pwrentry list[HASHSIZE];
64 /* set buffer to size of IPv6 message */
65 static char buffer[sizeof(struct olsrmsg6)];
68 /* Timeout function to register with the sceduler */
72 /* Parser function to register with the sceduler */
74 olsr_parser(union olsr_message *, struct interface *, union olsr_ip_addr *);
76 /* Event function to register with the sceduler */
84 get_powerstatus(struct powermsg *);
87 update_power_entry(union olsr_ip_addr *, struct powermsg *, double);