paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 1999 Yasuhiro Ohara |
| 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the |
| 18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | * Boston, MA 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef OSPF6_PREFIX_H |
| 23 | #define OSPF6_PREFIX_H |
| 24 | |
| 25 | #include "linklist.h" |
| 26 | |
| 27 | #define OSPF6_PREFIX_OPTION_NU (1 << 0) /* No Unicast */ |
| 28 | #define OSPF6_PREFIX_OPTION_LA (1 << 1) /* Local Address */ |
| 29 | #define OSPF6_PREFIX_OPTION_MC (1 << 2) /* MultiCast */ |
| 30 | #define OSPF6_PREFIX_OPTION_P (1 << 3) /* Propagate (NSSA) */ |
| 31 | |
| 32 | struct ospf6_prefix |
| 33 | { |
| 34 | u_int8_t prefix_length; |
| 35 | u_int8_t prefix_options; |
| 36 | union { |
| 37 | u_int16_t _prefix_metric; |
| 38 | u_int16_t _prefix_referenced_lstype; |
| 39 | } u; |
| 40 | #define prefix_metric u._prefix_metric |
| 41 | #define prefix_refer_lstype u._prefix_referenced_lstype |
| 42 | /* followed by one address_prefix */ |
| 43 | }; |
| 44 | |
| 45 | /* size_t OSPF6_PREFIX_SPACE (int prefixlength); */ |
| 46 | #define OSPF6_PREFIX_SPACE(x) ((((x) + 31) / 32) * 4) |
| 47 | |
| 48 | /* size_t OSPF6_PREFIX_SIZE (struct ospf6_prefix *); */ |
| 49 | #define OSPF6_PREFIX_SIZE(x) \ |
| 50 | (OSPF6_PREFIX_SPACE ((x)->prefix_length) + sizeof (struct ospf6_prefix)) |
| 51 | |
| 52 | /* struct ospf6_prefix *OSPF6_NEXT_PREFIX (struct ospf6_prefix *); */ |
| 53 | #define OSPF6_NEXT_PREFIX(x) \ |
| 54 | ((struct ospf6_prefix *)((char *)(x) + OSPF6_PREFIX_SIZE (x))) |
| 55 | |
| 56 | |
| 57 | |
| 58 | /* Function Prototypes */ |
| 59 | struct ospf6_prefix * |
| 60 | ospf6_prefix_make (u_int8_t, u_int16_t, struct prefix_ipv6 *); |
| 61 | void ospf6_prefix_free (struct ospf6_prefix *); |
| 62 | void ospf6_prefix_in6_addr (struct ospf6_prefix *, struct in6_addr *); |
| 63 | void ospf6_prefix_copy (struct ospf6_prefix *, struct ospf6_prefix *, |
| 64 | size_t); |
| 65 | |
| 66 | void ospf6_prefix_apply_mask (struct ospf6_prefix *); |
| 67 | int ospf6_prefix_issame (struct ospf6_prefix *, struct ospf6_prefix *); |
| 68 | |
| 69 | char *ospf6_prefix_options_str (u_int8_t, char *, size_t); |
| 70 | char *ospf6_prefix_string (struct ospf6_prefix *, char *, size_t); |
| 71 | |
| 72 | struct ospf6_prefix * |
| 73 | ospf6_prefix_lookup (list l, struct ospf6_prefix *prefix); |
| 74 | void ospf6_prefix_add (list, struct ospf6_prefix *); |
| 75 | |
| 76 | struct ospf6_prefix * |
| 77 | ospf6_prefix_create (u_int8_t, u_int16_t, struct prefix_ipv6 *); |
| 78 | void ospf6_prefix_delete (struct ospf6_prefix *); |
| 79 | |
| 80 | void ospf6_prefix_init (); |
| 81 | |
| 82 | #endif /* OSPF6_PREFIX_H */ |
| 83 | |