Paul Jakma | 5734509 | 2011-12-25 17:52:09 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is free software: you may copy, redistribute and/or modify it |
| 3 | * under the terms of the GNU General Public License as published by the |
| 4 | * Free Software Foundation, either version 2 of the License, or (at your |
| 5 | * option) any later version. |
| 6 | * |
| 7 | * This file is distributed in the hope that it will be useful, but |
| 8 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 10 | * General Public License for more details. |
| 11 | * |
| 12 | * You should have received a copy of the GNU General Public License |
| 13 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 14 | * |
| 15 | * This file incorporates work covered by the following copyright and |
| 16 | * permission notice: |
| 17 | * |
| 18 | Copyright (c) 2007, 2008 by Juliusz Chroboczek |
| 19 | |
| 20 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 21 | of this software and associated documentation files (the "Software"), to deal |
| 22 | in the Software without restriction, including without limitation the rights |
| 23 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 24 | copies of the Software, and to permit persons to whom the Software is |
| 25 | furnished to do so, subject to the following conditions: |
| 26 | |
| 27 | The above copyright notice and this permission notice shall be included in |
| 28 | all copies or substantial portions of the Software. |
| 29 | |
| 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 36 | THE SOFTWARE. |
| 37 | */ |
| 38 | |
| 39 | #ifndef BABEL_MESSAGE_H |
| 40 | #define BABEL_MESSAGE_H |
| 41 | |
| 42 | #include "babel_interface.h" |
| 43 | |
| 44 | #define MAX_BUFFERED_UPDATES 200 |
| 45 | |
| 46 | #define BUCKET_TOKENS_MAX 200 |
| 47 | #define BUCKET_TOKENS_PER_SEC 40 |
| 48 | |
| 49 | #define MESSAGE_PAD1 0 |
| 50 | #define MESSAGE_PADN 1 |
| 51 | #define MESSAGE_ACK_REQ 2 |
| 52 | #define MESSAGE_ACK 3 |
| 53 | #define MESSAGE_HELLO 4 |
| 54 | #define MESSAGE_IHU 5 |
| 55 | #define MESSAGE_ROUTER_ID 6 |
| 56 | #define MESSAGE_NH 7 |
| 57 | #define MESSAGE_UPDATE 8 |
| 58 | #define MESSAGE_REQUEST 9 |
| 59 | #define MESSAGE_MH_REQUEST 10 |
| 60 | |
| 61 | |
| 62 | extern unsigned short myseqno; |
| 63 | extern struct timeval seqno_time; |
| 64 | |
Paul Jakma | 5734509 | 2011-12-25 17:52:09 +0100 | [diff] [blame] | 65 | extern int broadcast_ihu; |
| 66 | extern int split_horizon; |
| 67 | |
| 68 | extern unsigned char packet_header[4]; |
| 69 | |
| 70 | extern struct neighbour *unicast_neighbour; |
| 71 | extern struct timeval unicast_flush_timeout; |
| 72 | |
| 73 | void parse_packet(const unsigned char *from, struct interface *ifp, |
| 74 | const unsigned char *packet, int packetlen); |
| 75 | void flushbuf(struct interface *ifp); |
| 76 | void flushupdates(struct interface *ifp); |
| 77 | void send_ack(struct neighbour *neigh, unsigned short nonce, |
| 78 | unsigned short interval); |
| 79 | void send_hello_noupdate(struct interface *ifp, unsigned interval); |
| 80 | void send_hello(struct interface *ifp); |
| 81 | void flush_unicast(int dofree); |
| 82 | void send_update(struct interface *ifp, int urgent, |
| 83 | const unsigned char *prefix, unsigned char plen); |
| 84 | void send_update_resend(struct interface *ifp, |
| 85 | const unsigned char *prefix, unsigned char plen); |
| 86 | void send_wildcard_retraction(struct interface *ifp); |
| 87 | void update_myseqno(void); |
| 88 | void send_self_update(struct interface *ifp); |
| 89 | void send_ihu(struct neighbour *neigh, struct interface *ifp); |
| 90 | void send_marginal_ihu(struct interface *ifp); |
| 91 | void send_request(struct interface *ifp, |
| 92 | const unsigned char *prefix, unsigned char plen); |
| 93 | void send_unicast_request(struct neighbour *neigh, |
| 94 | const unsigned char *prefix, unsigned char plen); |
| 95 | void send_multihop_request(struct interface *ifp, |
| 96 | const unsigned char *prefix, unsigned char plen, |
| 97 | unsigned short seqno, const unsigned char *id, |
| 98 | unsigned short hop_count); |
| 99 | void |
| 100 | send_unicast_multihop_request(struct neighbour *neigh, |
| 101 | const unsigned char *prefix, unsigned char plen, |
| 102 | unsigned short seqno, const unsigned char *id, |
| 103 | unsigned short hop_count); |
| 104 | void send_request_resend(struct neighbour *neigh, |
| 105 | const unsigned char *prefix, unsigned char plen, |
| 106 | unsigned short seqno, unsigned char *id); |
| 107 | void handle_request(struct neighbour *neigh, const unsigned char *prefix, |
| 108 | unsigned char plen, unsigned char hop_count, |
| 109 | unsigned short seqno, const unsigned char *id); |
| 110 | |
| 111 | #endif |