Revision ae80a2de

View differences:

client/commands.c
38 38
void
39 39
cmd_build_tree(void)
40 40
{
41
  unsigned int i;
41
  uint i;
42 42

  
43 43
  cmd_root.plastson = &cmd_root.son;
44 44

  
conf/conf.h
100 100

  
101 101
/* Lexer */
102 102

  
103
extern int (*cf_read_hook)(byte *buf, unsigned int max, int fd);
103
extern int (*cf_read_hook)(byte *buf, uint max, int fd);
104 104

  
105 105
struct symbol {
106 106
  struct symbol *next;
lib/bitops.c
17 17
 * representation consists of @n ones followed by zeroes.
18 18
 */
19 19
u32
20
u32_mkmask(unsigned n)
20
u32_mkmask(uint n)
21 21
{
22 22
  return n ? ~((1 << (32 - n)) - 1) : 0;
23 23
}
lib/bitops.h
18 18
 *	u32_masklen	Inverse operation to u32_mkmask, -1 if not a bitmask.
19 19
 */
20 20

  
21
u32 u32_mkmask(unsigned n);
21
u32 u32_mkmask(uint n);
22 22
int u32_masklen(u32 x);
23 23

  
24 24
u32 u32_log2(u32 v);
lib/checksum.c
28 28
}
29 29

  
30 30
static u16
31
ipsum_calc_block(u32 *buf, unsigned len, u16 isum)
31
ipsum_calc_block(u32 *buf, uint len, u16 isum)
32 32
{
33 33
  /*
34 34
   *  A few simple facts about the IP checksum (see RFC 1071 for detailed
......
57 57
}
58 58

  
59 59
static u16
60
ipsum_calc(void *frag, unsigned len, va_list args)
60
ipsum_calc(void *frag, uint len, va_list args)
61 61
{
62 62
  u16 sum = 0;
63 63

  
......
67 67
      frag = va_arg(args, void *);
68 68
      if (!frag)
69 69
	break;
70
      len = va_arg(args, unsigned);
70
      len = va_arg(args, uint);
71 71
    }
72 72
  return sum;
73 73
}
......
87 87
 * Result: 1 if the checksum is correct, 0 else.
88 88
 */
89 89
int
90
ipsum_verify(void *frag, unsigned len, ...)
90
ipsum_verify(void *frag, uint len, ...)
91 91
{
92 92
  va_list args;
93 93
  u16 sum;
......
110 110
 * up checksum calculation as much as possible.
111 111
 */
112 112
u16
113
ipsum_calculate(void *frag, unsigned len, ...)
113
ipsum_calculate(void *frag, uint len, ...)
114 114
{
115 115
  va_list args;
116 116
  u16 sum;
lib/checksum.h
14 14
 *	fragments finished by NULL pointer.
15 15
 */
16 16

  
17
int ipsum_verify(void *frag, unsigned len, ...);
18
u16 ipsum_calculate(void *frag, unsigned len, ...);
17
int ipsum_verify(void *frag, uint len, ...);
18
u16 ipsum_calculate(void *frag, uint len, ...);
19 19

  
20 20
#endif
lib/ip.h
471 471
#define ipa_in_net(x,n,p) (ipa_zero(ipa_and(ipa_xor((n),(x)),ipa_mkmask(p))))
472 472
#define net_in_net(n1,l1,n2,l2) (((l1) >= (l2)) && (ipa_zero(ipa_and(ipa_xor((n1),(n2)),ipa_mkmask(l2)))))
473 473

  
474
char *ip_scope_text(unsigned);
474
char *ip_scope_text(uint);
475 475

  
476 476
struct prefix {
477 477
  ip_addr addr;
478
  unsigned int len;
478
  uint len;
479 479
};
480 480

  
481 481

  
lib/mempool.c
27 27

  
28 28
struct lp_chunk {
29 29
  struct lp_chunk *next;
30
  unsigned int size;
30
  uint size;
31 31
  uintptr_t data_align[0];
32 32
  byte data[0];
33 33
};
......
37 37
  byte *ptr, *end;
38 38
  struct lp_chunk *first, *current, **plast;	/* Normal (reusable) chunks */
39 39
  struct lp_chunk *first_large;			/* Large chunks */
40
  unsigned chunk_size, threshold, total, total_large;
40
  uint chunk_size, threshold, total, total_large;
41 41
};
42 42

  
43 43
static void lp_free(resource *);
......
64 64
 * @blk.
65 65
 */
66 66
linpool
67
*lp_new(pool *p, unsigned blk)
67
*lp_new(pool *p, uint blk)
68 68
{
69 69
  linpool *m = ralloc(p, &lp_class);
70 70
  m->plast = &m->first;
......
88 88
 * size chunk, an "overflow" chunk is created for it instead.
89 89
 */
90 90
void *
91
lp_alloc(linpool *m, unsigned size)
91
lp_alloc(linpool *m, uint size)
92 92
{
93 93
  byte *a = (byte *) BIRD_ALIGN((unsigned long) m->ptr, CPU_STRUCT_ALIGN);
94 94
  byte *e = a + size;
......
146 146
 * how to allocate strings without any space overhead.
147 147
 */
148 148
void *
149
lp_allocu(linpool *m, unsigned size)
149
lp_allocu(linpool *m, uint size)
150 150
{
151 151
  byte *a = m->ptr;
152 152
  byte *e = a + size;
......
168 168
 * clears the allocated memory block.
169 169
 */
170 170
void *
171
lp_allocz(linpool *m, unsigned size)
171
lp_allocz(linpool *m, uint size)
172 172
{
173 173
  void *z = lp_alloc(m, size);
174 174

  
lib/printf.c
355 355
		} else if (flags & SIGN)
356 356
			num = va_arg(args, int);
357 357
		else
358
			num = va_arg(args, unsigned int);
358
			num = va_arg(args, uint);
359 359
		str = number(str, num, base, field_width, precision, flags, size);
360 360
		if (!str)
361 361
			return -1;
lib/slab.c
51 51

  
52 52
struct slab {
53 53
  resource r;
54
  unsigned size;
54
  uint size;
55 55
  list objs;
56 56
};
57 57

  
......
71 71
};
72 72

  
73 73
slab *
74
sl_new(pool *p, unsigned size)
74
sl_new(pool *p, uint size)
75 75
{
76 76
  slab *s = ralloc(p, &sl_class);
77 77
  s->size = size;
......
144 144

  
145 145
struct slab {
146 146
  resource r;
147
  unsigned obj_size, head_size, objs_per_slab, num_empty_heads, data_size;
147
  uint obj_size, head_size, objs_per_slab, num_empty_heads, data_size;
148 148
  list empty_heads, partial_heads, full_heads;
149 149
};
150 150

  
......
185 185
 * objects of size @size can be allocated.
186 186
 */
187 187
slab *
188
sl_new(pool *p, unsigned size)
188
sl_new(pool *p, uint size)
189 189
{
190 190
  slab *s = ralloc(p, &sl_class);
191
  unsigned int align = sizeof(struct sl_alignment);
191
  uint align = sizeof(struct sl_alignment);
192 192
  if (align < sizeof(int))
193 193
    align = sizeof(int);
194 194
  s->data_size = size;
......
214 214
  struct sl_head *h = xmalloc(SLAB_SIZE);
215 215
  struct sl_obj *o = (struct sl_obj *)((byte *)h+s->head_size);
216 216
  struct sl_obj *no;
217
  unsigned int n = s->objs_per_slab;
217
  uint n = s->objs_per_slab;
218 218

  
219 219
  h->first_free = o;
220 220
  h->num_full = 0;
lib/socket.h
20 20
  int type;				/* Socket type */
21 21
  void *data;				/* User data */
22 22
  ip_addr saddr, daddr;			/* IPA_NONE = unspecified */
23
  unsigned sport, dport;		/* 0 = unspecified (for IP: protocol type) */
23
  uint sport, dport;			/* 0 = unspecified (for IP: protocol type) */
24 24
  int tos;				/* TOS / traffic class, -1 = default */
25 25
  int priority;				/* Local socket priority, -1 = default */
26 26
  int ttl;				/* Time To Live, -1 = default */
......
28 28
  struct iface *iface;			/* Interface; specify this for broad/multicast sockets */
29 29

  
30 30
  byte *rbuf, *rpos;			/* NULL=allocate automatically */
31
  unsigned rbsize;
31
  uint rbsize;
32 32
  int (*rx_hook)(struct birdsock *, int size); /* NULL=receiving turned off, returns 1 to clear rx buffer */
33 33

  
34 34
  byte *tbuf, *tpos;			/* NULL=allocate automatically */
35 35
  byte *ttx;				/* Internal */
36
  unsigned tbsize;
36
  uint tbsize;
37 37
  void (*tx_hook)(struct birdsock *);
38 38

  
39 39
  void (*err_hook)(struct birdsock *, int); /* errno or zero if EOF */
40 40

  
41 41
  /* Information about received datagrams (UDP, RAW), valid in rx_hook */
42 42
  ip_addr faddr, laddr;			/* src (From) and dst (Local) address of the datagram */
43
  unsigned fport;			/* src port of the datagram */
44
  unsigned lifindex;			/* local interface that received the datagram */
43
  uint fport;				/* src port of the datagram */
44
  uint lifindex;			/* local interface that received the datagram */
45 45
  /* laddr and lifindex are valid only if SKF_LADDR_RX flag is set to request it */
46 46

  
47 47
  int af;				/* Address family (AF_INET, AF_INET6 or 0 for non-IP) of fd */
......
59 59

  
60 60
int sk_open(sock *);			/* Open socket */
61 61
int sk_rx_ready(sock *s);
62
int sk_send(sock *, unsigned len);	/* Send data, <0=err, >0=ok, 0=sleep */
63
int sk_send_to(sock *, unsigned len, ip_addr to, unsigned port); /* sk_send to given destination */
62
int sk_send(sock *, uint len);		/* Send data, <0=err, >0=ok, 0=sleep */
63
int sk_send_to(sock *, uint len, ip_addr to, uint port); /* sk_send to given destination */
64 64
void sk_reallocate(sock *);		/* Free and allocate tbuf & rbuf */
65 65
void sk_set_rbsize(sock *s, uint val);	/* Resize RX buffer */
66 66
void sk_set_tbsize(sock *s, uint val);	/* Resize TX buffer, keeping content */
lib/xmalloc.c
24 24
 * Wherever possible, please use the memory resources instead.
25 25
 */
26 26
void *
27
xmalloc(unsigned size)
27
xmalloc(uint size)
28 28
{
29 29
  void *p = malloc(size);
30 30
  if (p)
......
44 44
 * Wherever possible, please use the memory resources instead.
45 45
 */
46 46
void *
47
xrealloc(void *ptr, unsigned size)
47
xrealloc(void *ptr, uint size)
48 48
{
49 49
  void *p = realloc(ptr, size);
50 50
  if (p)
misc/ips.c
23 23
 *	= ((1-1/k)^k)^a which we can approximate by e^-a.
24 24
 */
25 25

  
26
unsigned int hf(unsigned int n)
26
uint hf(uint n)
27 27
{
28 28
#if 0
29 29
	n = (n ^ (n >> 16)) & 0xffff;
......
58 58

  
59 59
	while (max--)
60 60
	  {
61
	    unsigned int i, e;
61
	    uint i, e;
62 62
	    if (scanf("%x/%d", &i, &e) != 2)
63 63
	      if (feof(stdin))
64 64
		break;
nest/a-path.c
124 124
}
125 125

  
126 126
void
127
as_path_format(struct adata *path, byte *buf, unsigned int size)
127
as_path_format(struct adata *path, byte *buf, uint size)
128 128
{
129 129
  byte *p = path->data;
130 130
  byte *e = p + path->length;
nest/a-set.c
32 32
 * the buffer to indicate truncation.
33 33
 */
34 34
int
35
int_set_format(struct adata *set, int way, int from, byte *buf, unsigned int size)
35
int_set_format(struct adata *set, int way, int from, byte *buf, uint size)
36 36
{
37 37
  u32 *z = (u32 *) set->data;
38 38
  byte *end = buf + size - 24;
......
113 113
}
114 114

  
115 115
int
116
ec_set_format(struct adata *set, int from, byte *buf, unsigned int size)
116
ec_set_format(struct adata *set, int from, byte *buf, uint size)
117 117
{
118 118
  u32 *z = int_set_get_data(set);
119 119
  byte *end = buf + size - 24;
nest/attrs.h
30 30
struct adata *as_path_prepend(struct linpool *pool, struct adata *olda, u32 as);
31 31
int as_path_convert_to_old(struct adata *path, byte *dst, int *new_used);
32 32
int as_path_convert_to_new(struct adata *path, byte *dst, int req_as);
33
void as_path_format(struct adata *path, byte *buf, unsigned int size);
33
void as_path_format(struct adata *path, byte *buf, uint size);
34 34
int as_path_getlen(struct adata *path);
35 35
int as_path_getlen_int(struct adata *path, int bs);
36 36
int as_path_get_first(struct adata *path, u32 *orig_as);
......
95 95
static inline u64 ec_generic(u64 key, u64 val)
96 96
{ return (key << 32) | val; }
97 97

  
98
int int_set_format(struct adata *set, int way, int from, byte *buf, unsigned int size);
98
int int_set_format(struct adata *set, int way, int from, byte *buf, uint size);
99 99
int ec_format(byte *buf, u64 ec);
100
int ec_set_format(struct adata *set, int from, byte *buf, unsigned int size);
100
int ec_set_format(struct adata *set, int from, byte *buf, uint size);
101 101
int int_set_contains(struct adata *list, u32 val);
102 102
int ec_set_contains(struct adata *list, u64 val);
103 103
struct adata *int_set_add(struct linpool *pool, struct adata *list, u32 val);
nest/cli.c
163 163
cli_copy_message(cli *c)
164 164
{
165 165
  byte *p, *q;
166
  unsigned int cnt = 2;
166
  uint cnt = 2;
167 167

  
168 168
  if (c->ring_overflow)
169 169
    {
......
230 230

  
231 231

  
232 232
static byte *cli_rh_pos;
233
static unsigned int cli_rh_len;
233
static uint cli_rh_len;
234 234
static int cli_rh_trick_flag;
235 235
struct cli *this_cli;
236 236

  
237 237
static int
238
cli_cmd_read_hook(byte *buf, unsigned int max, UNUSED int fd)
238
cli_cmd_read_hook(byte *buf, uint max, UNUSED int fd)
239 239
{
240 240
  if (!cli_rh_trick_flag)
241 241
    {
......
330 330
static int cli_log_inited;
331 331

  
332 332
void
333
cli_set_log_echo(cli *c, unsigned int mask, unsigned int size)
333
cli_set_log_echo(cli *c, uint mask, uint size)
334 334
{
335 335
  if (c->ring_buf)
336 336
    {
......
351 351
}
352 352

  
353 353
void
354
cli_echo(unsigned int class, byte *msg)
354
cli_echo(uint class, byte *msg)
355 355
{
356 356
  unsigned len, free, i, l;
357 357
  cli *c;
nest/cli.h
40 40
  struct linpool *parser_pool;		/* Pool used during parsing */
41 41
  byte *ring_buf;			/* Ring buffer for asynchronous messages */
42 42
  byte *ring_end, *ring_read, *ring_write;	/* Pointers to the ring buffer */
43
  unsigned int ring_overflow;		/* Counter of ring overflows */
44
  unsigned int log_mask;		/* Mask of allowed message levels */
45
  unsigned int log_threshold;		/* When free < log_threshold, store only important messages */
46
  unsigned int async_msg_size;		/* Total size of async messages queued in tx_buf */
43
  uint ring_overflow;			/* Counter of ring overflows */
44
  uint log_mask;			/* Mask of allowed message levels */
45
  uint log_threshold;			/* When free < log_threshold, store only important messages */
46
  uint async_msg_size;			/* Total size of async messages queued in tx_buf */
47 47
} cli;
48 48

  
49 49
extern pool *cli_pool;
......
55 55

  
56 56
void cli_printf(cli *, int, char *, ...);
57 57
#define cli_msg(x...) cli_printf(this_cli, x)
58
void cli_set_log_echo(cli *, unsigned int mask, unsigned int size);
58
void cli_set_log_echo(cli *, uint mask, uint size);
59 59

  
60 60
/* Functions provided to sysdep layer */
61 61

  
......
64 64
void cli_free(cli *);
65 65
void cli_kick(cli *);
66 66
void cli_written(cli *);
67
void cli_echo(unsigned int class, byte *msg);
67
void cli_echo(uint class, byte *msg);
68 68

  
69 69
static inline int cli_access_restricted(void)
70 70
{
nest/neighbor.c
49 49
static slab *neigh_slab;
50 50
static list sticky_neigh_list, neigh_hash_table[NEIGH_HASH_SIZE];
51 51

  
52
static inline unsigned int
52
static inline uint
53 53
neigh_hash(struct proto *p, ip_addr *a)
54 54
{
55 55
  return (p->hash_key ^ ipa_hash(*a)) & (NEIGH_HASH_SIZE-1);
......
126 126
{
127 127
  neighbor *n;
128 128
  int class, scope = -1;
129
  unsigned int h = neigh_hash(p, a);
129
  uint h = neigh_hash(p, a);
130 130
  struct iface *i;
131 131
  struct ifa *addr;
132 132

  
nest/proto.c
1488 1488
}
1489 1489

  
1490 1490
void
1491
proto_cmd_show(struct proto *p, unsigned int verbose, int cnt)
1491
proto_cmd_show(struct proto *p, uint verbose, int cnt)
1492 1492
{
1493 1493
  byte buf[256], tbuf[TM_DATETIME_BUFFER_SIZE];
1494 1494

  
......
1524 1524
}
1525 1525

  
1526 1526
void
1527
proto_cmd_disable(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
1527
proto_cmd_disable(struct proto *p, uint arg UNUSED, int cnt UNUSED)
1528 1528
{
1529 1529
  if (p->disabled)
1530 1530
    {
......
1540 1540
}
1541 1541

  
1542 1542
void
1543
proto_cmd_enable(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
1543
proto_cmd_enable(struct proto *p, uint arg UNUSED, int cnt UNUSED)
1544 1544
{
1545 1545
  if (!p->disabled)
1546 1546
    {
......
1555 1555
}
1556 1556

  
1557 1557
void
1558
proto_cmd_restart(struct proto *p, unsigned int arg UNUSED, int cnt UNUSED)
1558
proto_cmd_restart(struct proto *p, uint arg UNUSED, int cnt UNUSED)
1559 1559
{
1560 1560
  if (p->disabled)
1561 1561
    {
......
1573 1573
}
1574 1574

  
1575 1575
void
1576
proto_cmd_reload(struct proto *p, unsigned int dir, int cnt UNUSED)
1576
proto_cmd_reload(struct proto *p, uint dir, int cnt UNUSED)
1577 1577
{
1578 1578
  if (p->disabled)
1579 1579
    {
......
1615 1615
}
1616 1616

  
1617 1617
void
1618
proto_cmd_debug(struct proto *p, unsigned int mask, int cnt UNUSED)
1618
proto_cmd_debug(struct proto *p, uint mask, int cnt UNUSED)
1619 1619
{
1620 1620
  p->debug = mask;
1621 1621
}
1622 1622

  
1623 1623
void
1624
proto_cmd_mrtdump(struct proto *p, unsigned int mask, int cnt UNUSED)
1624
proto_cmd_mrtdump(struct proto *p, uint mask, int cnt UNUSED)
1625 1625
{
1626 1626
  p->mrtdump = mask;
1627 1627
}
1628 1628

  
1629 1629
static void
1630
proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, unsigned int, int), unsigned int arg)
1630
proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, uint, int), uint arg)
1631 1631
{
1632 1632
  if (s->class != SYM_PROTO)
1633 1633
    {
......
1640 1640
}
1641 1641

  
1642 1642
static void
1643
proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, unsigned int, int), unsigned int arg)
1643
proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, uint, int), uint arg)
1644 1644
{
1645 1645
  int cnt = 0;
1646 1646

  
......
1660 1660
}
1661 1661

  
1662 1662
void
1663
proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, unsigned int, int),
1664
		int restricted, unsigned int arg)
1663
proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uint, int),
1664
		int restricted, uint arg)
1665 1665
{
1666 1666
  if (restricted && cli_access_restricted())
1667 1667
    return;
nest/protocol.h
261 261
void proto_show_limit(struct proto_limit *l, const char *dsc);
262 262
void proto_show_basic_info(struct proto *p);
263 263

  
264
void proto_cmd_show(struct proto *, unsigned int, int);
265
void proto_cmd_disable(struct proto *, unsigned int, int);
266
void proto_cmd_enable(struct proto *, unsigned int, int);
267
void proto_cmd_restart(struct proto *, unsigned int, int);
268
void proto_cmd_reload(struct proto *, unsigned int, int);
269
void proto_cmd_debug(struct proto *, unsigned int, int);
270
void proto_cmd_mrtdump(struct proto *, unsigned int, int);
271

  
272
void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, unsigned int, int), int restricted, unsigned int arg);
264
void proto_cmd_show(struct proto *, uint, int);
265
void proto_cmd_disable(struct proto *, uint, int);
266
void proto_cmd_enable(struct proto *, uint, int);
267
void proto_cmd_restart(struct proto *, uint, int);
268
void proto_cmd_reload(struct proto *, uint, int);
269
void proto_cmd_debug(struct proto *, uint, int);
270
void proto_cmd_mrtdump(struct proto *, uint, int);
271

  
272
void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uint, int), int restricted, uint arg);
273 273
struct proto *proto_get_named(struct symbol *, struct protocol *);
274 274

  
275 275
#define CMD_RELOAD	0
nest/route.h
47 47
  byte efef;				/* 0xff to distinguish between iterator and node */
48 48
  byte pad[3];
49 49
  struct fib_node *node;		/* Or NULL if freshly merged */
50
  unsigned int hash;
50
  uint hash;
51 51
};
52 52

  
53 53
typedef void (*fib_init_func)(struct fib_node *);
......
56 56
  pool *fib_pool;			/* Pool holding all our data */
57 57
  slab *fib_slab;			/* Slab holding all fib nodes */
58 58
  struct fib_node **hash_table;		/* Node hash table */
59
  unsigned int hash_size;		/* Number of hash table entries (a power of two) */
60
  unsigned int hash_order;		/* Binary logarithm of hash_size */
61
  unsigned int hash_shift;		/* 16 - hash_log */
62
  unsigned int entries;			/* Number of entries */
63
  unsigned int entries_min, entries_max;/* Entry count limits (else start rehashing) */
59
  uint hash_size;			/* Number of hash table entries (a power of two) */
60
  uint hash_order;			/* Binary logarithm of hash_size */
61
  uint hash_shift;			/* 16 - hash_log */
62
  uint entries;				/* Number of entries */
63
  uint entries_min, entries_max;	/* Entry count limits (else start rehashing) */
64 64
  fib_init_func init;			/* Constructor */
65 65
};
66 66

  
......
78 78

  
79 79
#define FIB_WALK(fib, z) do {					\
80 80
	struct fib_node *z, **ff = (fib)->hash_table;		\
81
	unsigned int count = (fib)->hash_size;			\
81
	uint count = (fib)->hash_size;				\
82 82
	while (count--)						\
83 83
	  for(z = *ff++; z; z=z->next)
84 84

  
......
88 88

  
89 89
#define FIB_ITERATE_START(fib, it, z) do {			\
90 90
	struct fib_node *z = fit_get(fib, it);			\
91
	unsigned int count = (fib)->hash_size;			\
92
	unsigned int hpos = (it)->hash;				\
91
	uint count = (fib)->hash_size;				\
92
	uint hpos = (it)->hash;					\
93 93
	for(;;) {						\
94 94
	  if (!z)						\
95 95
            {							\
......
435 435
#define EAF_TEMP 0x80			/* A temporary attribute (the one stored in the tmp attr list) */
436 436

  
437 437
struct adata {
438
  unsigned int length;			/* Length of data */
438
  uint length;				/* Length of data */
439 439
  byte data[0];
440 440
};
441 441

  
......
475 475
unsigned ea_scan(ea_list *);		/* How many bytes do we need for merged ea_list */
476 476
void ea_merge(ea_list *from, ea_list *to); /* Merge sub-lists to allocated buffer */
477 477
int ea_same(ea_list *x, ea_list *y);	/* Test whether two ea_lists are identical */
478
unsigned int ea_hash(ea_list *e);	/* Calculate 16-bit hash value */
478
uint ea_hash(ea_list *e);	/* Calculate 16-bit hash value */
479 479
ea_list *ea_append(ea_list *to, ea_list *what);
480 480
void ea_format_bitfield(struct eattr *a, byte *buf, int bufsize, const char **names, int min, int max);
481 481

  
nest/rt-attr.c
98 98
  HASH_INIT(src_hash, rta_pool, RSH_INIT_ORDER);
99 99
}
100 100

  
101
static inline int u32_cto(unsigned int x) { return ffs(~x) - 1; }
101
static inline int u32_cto(uint x) { return ffs(~x) - 1; }
102 102

  
103 103
static inline u32
104 104
rte_src_alloc_id(void)
......
195 195
 *	Multipath Next Hop
196 196
 */
197 197

  
198
static inline unsigned int
198
static inline uint
199 199
mpnh_hash(struct mpnh *x)
200 200
{
201
  unsigned int h = 0;
201
  uint h = 0;
202 202
  for (; x; x = x->next)
203 203
    h ^= ipa_hash(x->gw);
204 204

  
......
666 666
}
667 667

  
668 668
static inline void
669
opaque_format(struct adata *ad, byte *buf, unsigned int size)
669
opaque_format(struct adata *ad, byte *buf, uint size)
670 670
{
671 671
  byte *bound = buf + size - 10;
672 672
  int i;
......
838 838
 * ea_hash() takes an extended attribute list and calculated a hopefully
839 839
 * uniformly distributed hash value from its contents.
840 840
 */
841
inline unsigned int
841
inline uint
842 842
ea_hash(ea_list *e)
843 843
{
844 844
  u32 h = 0;
......
900 900
 *	rta's
901 901
 */
902 902

  
903
static unsigned int rta_cache_count;
904
static unsigned int rta_cache_size = 32;
905
static unsigned int rta_cache_limit;
906
static unsigned int rta_cache_mask;
903
static uint rta_cache_count;
904
static uint rta_cache_size = 32;
905
static uint rta_cache_limit;
906
static uint rta_cache_mask;
907 907
static rta **rta_hash_table;
908 908

  
909 909
static void
......
917 917
  rta_cache_mask = rta_cache_size - 1;
918 918
}
919 919

  
920
static inline unsigned int
920
static inline uint
921 921
rta_hash(rta *a)
922 922
{
923 923
  return (((uint) (uintptr_t) a->src) ^ ipa_hash(a->gw) ^
......
957 957
static inline void
958 958
rta_insert(rta *r)
959 959
{
960
  unsigned int h = r->hash_key & rta_cache_mask;
960
  uint h = r->hash_key & rta_cache_mask;
961 961
  r->next = rta_hash_table[h];
962 962
  if (r->next)
963 963
    r->next->pprev = &r->next;
......
968 968
static void
969 969
rta_rehash(void)
970 970
{
971
  unsigned int ohs = rta_cache_size;
972
  unsigned int h;
971
  uint ohs = rta_cache_size;
972
  uint h;
973 973
  rta *r, *n;
974 974
  rta **oht = rta_hash_table;
975 975

  
......
1002 1002
rta_lookup(rta *o)
1003 1003
{
1004 1004
  rta *r;
1005
  unsigned int h;
1005
  uint h;
1006 1006

  
1007 1007
  ASSERT(!(o->aflags & RTAF_CACHED));
1008 1008
  if (o->eattrs)
......
1093 1093
rta_dump_all(void)
1094 1094
{
1095 1095
  rta *a;
1096
  unsigned int h;
1096
  uint h;
1097 1097

  
1098 1098
  debug("Route attribute cache (%d entries, rehash at %d):\n", rta_cache_count, rta_cache_limit);
1099 1099
  for(h=0; h<rta_cache_size; h++)
nest/rt-fib.c
206 206
void *
207 207
fib_get(struct fib *f, ip_addr *a, int len)
208 208
{
209
  unsigned int h = ipa_hash(*a);
209
  uint h = ipa_hash(*a);
210 210
  struct fib_node **ee = f->hash_table + (h >> f->hash_shift);
211 211
  struct fib_node *g, *e = *ee;
212 212
  u32 uid = h << 16;
......
321 321
fib_delete(struct fib *f, void *E)
322 322
{
323 323
  struct fib_node *e = E;
324
  unsigned int h = fib_hash(f, &e->prefix);
324
  uint h = fib_hash(f, &e->prefix);
325 325
  struct fib_node **ee = f->hash_table + h;
326 326
  struct fib_iterator *it;
327 327

  
......
442 442
void
443 443
fib_check(struct fib *f)
444 444
{
445
  unsigned int i, ec, lo, nulls;
445
  uint i, ec, lo, nulls;
446 446

  
447 447
  ec = 0;
448 448
  for(i=0; i<f->hash_size; i++)
......
452 452
      for(n=f->hash_table[i]; n; n=n->next)
453 453
	{
454 454
	  struct fib_iterator *j, *j0;
455
	  unsigned int h0 = ipa_hash(n->prefix);
455
	  uint h0 = ipa_hash(n->prefix);
456 456
	  if (h0 < lo)
457 457
	    bug("fib_check: discord in hash chains");
458 458
	  lo = h0;
......
489 489

  
490 490
void dump(char *m)
491 491
{
492
  unsigned int i;
492
  uint i;
493 493

  
494 494
  debug("%s ... order=%d, size=%d, entries=%d\n", m, f.hash_order, f.hash_size, f.hash_size);
495 495
  for(i=0; i<f.hash_size; i++)
nest/rt-table.c
182 182
}
183 183

  
184 184
static inline void
185
rte_trace_in(unsigned int flag, struct proto *p, rte *e, char *msg)
185
rte_trace_in(uint flag, struct proto *p, rte *e, char *msg)
186 186
{
187 187
  if (p->debug & flag)
188 188
    rte_trace(p, e, '>', msg);
189 189
}
190 190

  
191 191
static inline void
192
rte_trace_out(unsigned int flag, struct proto *p, rte *e, char *msg)
192
rte_trace_out(uint flag, struct proto *p, rte *e, char *msg)
193 193
{
194 194
  if (p->debug & flag)
195 195
    rte_trace(p, e, '<', msg);
......
1880 1880
static inline void
1881 1881
hc_insert(struct hostcache *hc, struct hostentry *he)
1882 1882
{
1883
  unsigned int k = he->hash_key >> hc->hash_shift;
1883
  uint k = he->hash_key >> hc->hash_shift;
1884 1884
  he->next = hc->hash_table[k];
1885 1885
  hc->hash_table[k] = he;
1886 1886
}
......
1889 1889
hc_remove(struct hostcache *hc, struct hostentry *he)
1890 1890
{
1891 1891
  struct hostentry **hep;
1892
  unsigned int k = he->hash_key >> hc->hash_shift;
1892
  uint k = he->hash_key >> hc->hash_shift;
1893 1893

  
1894 1894
  for (hep = &hc->hash_table[k]; *hep != he; hep = &(*hep)->next);
1895 1895
  *hep = he->next;
......
2154 2154
  if (!tab->hostcache)
2155 2155
    rt_init_hostcache(tab);
2156 2156

  
2157
  unsigned int k = hc_hash(a, dep);
2157
  uint k = hc_hash(a, dep);
2158 2158
  struct hostcache *hc = tab->hostcache;
2159 2159
  for (he = hc->hash_table[k >> hc->hash_shift]; he != NULL; he = he->next)
2160 2160
    if (ipa_equal(he->addr, a) && (he->tab == dep))
proto/bgp/attrs.c
114 114

  
115 115
/* Validates path attribute, removes AS_CONFED_* segments, and also returns path length */
116 116
static int
117
validate_path(struct bgp_proto *p, int as_path, int bs, byte *idata, unsigned int *ilength)
117
validate_path(struct bgp_proto *p, int as_path, int bs, byte *idata, uint *ilength)
118 118
{
119 119
  int res = 0;
120 120
  u8 *a, *dst;
......
381 381
}
382 382

  
383 383
static int
384
bgp_encode_attr_hdr(byte *dst, unsigned int flags, unsigned code, int len)
384
bgp_encode_attr_hdr(byte *dst, uint flags, unsigned code, int len)
385 385
{
386 386
  int wlen;
387 387

  
......
473 473
 *
474 474
 * Result: Length of the attribute block generated or -1 if not enough space.
475 475
 */
476
unsigned int
476
uint
477 477
bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains)
478 478
{
479
  unsigned int i, code, type, flags;
479
  uint i, code, type, flags;
480 480
  byte *start = w;
481 481
  int len, rv;
482 482

  
......
1593 1593
 * by a &rta.
1594 1594
 */
1595 1595
struct rta *
1596
bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct linpool *pool, int mandatory)
1596
bgp_decode_attrs(struct bgp_conn *conn, byte *attr, uint len, struct linpool *pool, int mandatory)
1597 1597
{
1598 1598
  struct bgp_proto *bgp = conn->bgp;
1599 1599
  rta *a = lp_alloc(pool, sizeof(struct rta));
1600
  unsigned int flags, code, l, i, type;
1600
  uint flags, code, l, i, type;
1601 1601
  int errcode;
1602 1602
  byte *z, *attr_start;
1603 1603
  byte seen[256/8];
......
1791 1791
int
1792 1792
bgp_get_attr(eattr *a, byte *buf, int buflen)
1793 1793
{
1794
  unsigned int i = EA_ID(a->id);
1794
  uint i = EA_ID(a->id);
1795 1795
  struct attr_desc *d;
1796 1796
  int len;
1797 1797

  
proto/bgp/bgp.h
90 90
struct bgp_conn {
91 91
  struct bgp_proto *bgp;
92 92
  struct birdsock *sk;
93
  unsigned int state;			/* State of connection state machine */
93
  uint state;				/* State of connection state machine */
94 94
  struct timer *connect_retry_timer;
95 95
  struct timer *hold_timer;
96 96
  struct timer *keepalive_timer;
......
142 142
  struct timer *startup_timer;		/* Timer used to delay protocol startup due to previous errors (startup_delay) */
143 143
  struct timer *gr_timer;		/* Timer waiting for reestablishment after graceful restart */
144 144
  struct bgp_bucket **bucket_hash;	/* Hash table of attribute buckets */
145
  unsigned int hash_size, hash_count, hash_limit;
145
  uint hash_size, hash_count, hash_limit;
146 146
  HASH(struct bgp_prefix) prefix_hash;	/* Prefixes to be sent */
147 147
  slab *prefix_slab;			/* Slab holding prefix nodes */
148 148
  list bucket_queue;			/* Queue of buckets to send */
......
235 235

  
236 236
void bgp_attach_attr(struct ea_list **to, struct linpool *pool, unsigned attr, uintptr_t val);
237 237
byte *bgp_attach_attr_wa(struct ea_list **to, struct linpool *pool, unsigned attr, unsigned len);
238
struct rta *bgp_decode_attrs(struct bgp_conn *conn, byte *a, unsigned int len, struct linpool *pool, int mandatory);
238
struct rta *bgp_decode_attrs(struct bgp_conn *conn, byte *a, uint len, struct linpool *pool, int mandatory);
239 239
int bgp_get_attr(struct eattr *e, byte *buf, int buflen);
240 240
int bgp_rte_better(struct rte *, struct rte *);
241 241
int bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best);
......
245 245
void bgp_free_bucket(struct bgp_proto *p, struct bgp_bucket *buck);
246 246
void bgp_init_prefix_table(struct bgp_proto *p, u32 order);
247 247
void bgp_free_prefix(struct bgp_proto *p, struct bgp_prefix *bp);
248
unsigned int bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains);
248
uint bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains);
249 249
void bgp_get_route_info(struct rte *, byte *buf, struct ea_list *attrs);
250 250

  
251 251
inline static void bgp_attach_attr_ip(struct ea_list **to, struct linpool *pool, unsigned attr, ip_addr a)
proto/bgp/packets.c
289 289
    }
290 290
}
291 291

  
292
static unsigned int
293
bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, unsigned int remains)
292
static uint
293
bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, uint remains)
294 294
{
295 295
  byte *start = w;
296 296
  ip_addr a;
......
648 648

  
649 649

  
650 650
static void
651
bgp_create_header(byte *buf, unsigned int len, unsigned int type)
651
bgp_create_header(byte *buf, uint len, uint type)
652 652
{
653 653
  memset(buf, 0xff, 16);		/* Marker */
654 654
  put_u16(buf+16, len);
......
669 669
bgp_fire_tx(struct bgp_conn *conn)
670 670
{
671 671
  struct bgp_proto *p = conn->bgp;
672
  unsigned int s = conn->packets_to_send;
672
  uint s = conn->packets_to_send;
673 673
  sock *sk = conn->sk;
674 674
  byte *buf, *pkt, *end;
675 675
  int type;
sysdep/bsd/krt-sock.c
181 181
#define GETADDR(p, F) \
182 182
  bzero(p, sizeof(*p));\
183 183
  if ((addrs & (F)) && ((struct sockaddr *)body)->sa_len) {\
184
    unsigned int l = ROUNDUP(((struct sockaddr *)body)->sa_len);\
184
    uint l = ROUNDUP(((struct sockaddr *)body)->sa_len);\
185 185
    memcpy(p, body, (l > sizeof(*p) ? sizeof(*p) : l));\
186 186
    body += l;}
187 187

  
......
537 537
  struct if_msghdr *ifm = (struct if_msghdr *)&msg->rtm;
538 538
  void *body = (void *)(ifm + 1);
539 539
  struct sockaddr_dl *dl = NULL;
540
  unsigned int i;
540
  uint i;
541 541
  struct iface *iface = NULL, f = {};
542 542
  int fl = ifm->ifm_flags;
543 543
  int nlen = 0;
sysdep/linux/netlink.c
50 50
  u32 seq;
51 51
  byte *rx_buffer;			/* Receive buffer */
52 52
  struct nlmsghdr *last_hdr;		/* Recently received packet */
53
  unsigned int last_size;
53
  uint last_size;
54 54
};
55 55

  
56 56
#define NL_RX_SIZE 8192
......
443 443
  struct iface *ifi;
444 444
  char *name;
445 445
  u32 mtu;
446
  unsigned int fl;
446
  uint fl;
447 447

  
448 448
  if (!(i = nl_checkin(h, sizeof(*i))) || !nl_parse_attrs(IFLA_RTA(i), a, sizeof(a)))
449 449
    return;
......
1088 1088
  struct msghdr m = { (struct sockaddr *) &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
1089 1089
  struct nlmsghdr *h;
1090 1090
  int x;
1091
  unsigned int len;
1091
  uint len;
1092 1092

  
1093 1093
  x = recvmsg(sk->fd, &m, 0);
1094 1094
  if (x < 0)
sysdep/unix/main.c
155 155
static char *config_name = PATH_CONFIG_FILE;
156 156

  
157 157
static int
158
cf_read(byte *dest, unsigned int len, int fd)
158
cf_read(byte *dest, uint len, int fd)
159 159
{
160 160
  int l = read(fd, dest, len);
161 161
  if (l < 0)
sysdep/unix/unix.h
119 119

  
120 120
struct log_config {
121 121
  node n;
122
  unsigned int mask;			/* Classes to log */
122
  uint mask;				/* Classes to log */
123 123
  void *fh;				/* FILE to log to, NULL=syslog */
124 124
  int terminal_flag;
125 125
};

Also available in: Unified diff