Statistics
| Branch: | Revision:

iof-bird / bird-2.0.1 / test / bt-utils.h @ 6b3f1a54

History | View | Annotate | Download (1.19 KB)

1
/*
2
 *        BIRD Test -- Utils for testing parsing configuration file
3
 *
4
 *        (c) 2015 CZ.NIC z.s.p.o.
5
 *
6
 *        Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8

    
9
#ifndef _BIRDTEST_UTILS_H_
10
#define _BIRDTEST_UTILS_H_
11

    
12
#include "sysdep/config.h"
13

    
14
#define PRIip4 "%d.%d.%d.%d"
15
#define ARGip4(x) (_I(x) >> 24) & 0xff, (_I(x) >> 16) & 0xff, (_I(x) >> 8) & 0xff, _I(x) & 0xff
16

    
17
#define PRIip6 "%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X"
18
#define ARGip6_HIGH(x,i) (((x).addr[(i)] >> 16) & 0xffff)
19
#define ARGip6_LOW(x,i)  ((x).addr[(i)] & 0xffff)
20
#define ARGip6_BOTH(x,i) ARGip6_HIGH(x,i), ARGip6_LOW(x,i)
21
#define ARGip6(x) ARGip6_BOTH((x), 0), ARGip6_BOTH((x), 1), ARGip6_BOTH((x), 2), ARGip6_BOTH((x), 3)
22

    
23
#define BT_CONFIG_PARSE_ROUTER_ID        "router id 1.1.1.1; \n"
24
#define BT_CONFIG_PARSE_STATIC_PROTO        "protocol static { ipv4; } \n"
25
#define BT_CONFIG_SIMPLE                BT_CONFIG_PARSE_ROUTER_ID BT_CONFIG_PARSE_STATIC_PROTO
26

    
27
uint bt_naive_pow(uint base, uint power);
28
void bt_bytes_to_hex(char *buf, const byte *in_data, size_t size);
29

    
30
void bt_bird_init(void);
31
void bt_bird_cleanup(void);
32
struct config *bt_config_parse(const char *cfg);
33
struct config *bt_config_file_parse(const char *filepath);
34

    
35
#endif /* _BIRDTEST_UTILS_H_ */