Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / clients / net-snk / app / netlib / ndp.h
1 /******************************************************************************
2  * Copyright (c) 2013 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12
13 #ifndef _NDP_H_
14 #define _NDP_H_
15
16 #include <netlib/ipv6.h>
17
18 #define __NDP_DEBUG__
19
20 #ifdef __NDP_DEBUG__
21 #define NDP_DEBUG_PRINT(format, ...) do { printf(format, ## __VA_ARGS__); } while (0)
22 #else
23 #define NDP_DEBUG_PRINT(format, ...)
24 #endif
25
26 #define ND_OPTION_SOURCE_LL_ADDR  1
27 #define ND_OPTION_TARGET_LL_ADDR  2
28 #define ND_OPTION_PREFIX_INFO     3
29 #define ND_OPTION_REDIRECT_HDR    4
30 #define ND_OPTION_MTU             5
31
32 /* Default Router List */
33 struct router {
34         uint8_t  mac[6];
35         ip6_addr_t ip;
36         uint32_t lifetime;
37         uint32_t reachable_time;
38         uint32_t retrans_timer;
39         struct router *next;
40 };
41
42 /* Neighbor cache */
43 struct neighbor {
44         uint8_t mac[6];
45         ip6_addr_t ip;
46         uint8_t is_router;
47         uint8_t status;
48         uint8_t times_asked;
49         /* ... */
50         struct neighbor *next;
51         uint8_t eth_frame[1500]; //FIXME
52         uint32_t eth_len;
53
54 #define NB_INCOMPLETE 1
55 #define NB_REACHABLE  2
56 #define NB_STALE      3
57 #define NB_DELAY      4
58 #define NB_PROBE      5
59 };
60
61 /******************** FUNCTIONS *********************************************/
62 int8_t neighbor_add (struct neighbor *);
63 void * neighbor_create (uint8_t *packet, struct packeth *headers);
64 struct neighbor * find_neighbor (ip6_addr_t *);
65
66 int8_t router_add(struct router*);
67 void * router_create(uint8_t *mac, ip6_addr_t *ip);
68 struct router * find_router(ip6_addr_t *);
69
70 #endif //_NDP_H_