/* RIPng nexthop support
 * Copyright (C) 6WIND Vincent Jardin <vincent.jardin@6wind.com>
 *
 * This file is part of GNU Zebra.
 *
 * GNU Zebra is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * GNU Zebra is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Zebra; see the file COPYING.  If not, write to the Free
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.  
 */

#ifndef _ZEBRA_RIPNG_RIPNG_NEXTHOP_H
#define _ZEBRA_RIPNG_RIPNG_NEXTHOP_H

#include <zebra.h>
#include "linklist.h"
#include "ripngd/ripng_route.h"
#include "ripngd/ripngd.h"

struct list * ripng_rte_new(void);
void ripng_rte_free(struct list *ripng_rte_list);
void ripng_rte_add(struct list *ripng_rte_list, struct prefix_ipv6 *p,
                   struct ripng_info *rinfo, struct ripng_aggregate *aggregate);
void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp,
                    struct sockaddr_in6 *to);

/***
 * 1 if A > B
 * 0 if A = B
 * -1 if A < B
 **/
static inline int
addr6_cmp(struct in6_addr *A, struct in6_addr *B) {

#ifndef s6_addr32
#define s6_addr32 __u6_addr.__u6_addr32
#endif /*s6_addr32*/

#define a(i) A->s6_addr32[i]
#define b(i) B->s6_addr32[i]

  if (a(3) > b(3))
    return 1;
  else if ((a(3) == b(3)) && (a(2) > b(2)))
    return 1;
  else if ((a(3) == b(3)) && (a(2) == b(2)) && (a(1) > b(1)))
    return 1;
  else if ((a(3) == b(3)) && (a(2) == b(2)) && (a(1) == b(1)) && (a(0) > b(0)))
    return 1;

  if ((a(3) == b(3)) && (a(2) == b(2)) && (a(1) == b(1)) && (a(0) == b(0)))
    return 0;

  return -1;
}

#endif /* _ZEBRA_RIPNG_RIPNG_NEXTHOP_H */
