You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ipv6-gmp.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* This file is part of Netsukuku
  2. * (c) Copyright 2004 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
  3. *
  4. * This source code is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as published
  6. * by the Free Software Foundation; either version 2 of the License,
  7. * or (at your option) any later version.
  8. *
  9. * This source code is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. * Please refer to the GNU Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Public License along with
  15. * this source code; if not, write to:
  16. * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. * --
  18. * 128bit-gmp.c: I made this to handle the HUGE ipv6 numbers
  19. */
  20. #ifndef IPV6_GMP_H
  21. #define IPV6_GMP_H
  22. #define ZERO128 {0,0,0,0}
  23. /* * * Defines used for mpz_import/export * * */
  24. /* From info gmp: "ORDER can be 1 for most significant word first or -1 for least
  25. * significant first." */
  26. #define NETWORK_ORDER 1
  27. #define HOST_ORDER -1
  28. #define NATIVE_ENDIAN 0
  29. #define HOST_ENDIAN -1
  30. #define NETWORK_ENDIAN 1
  31. int sum_int(unsigned int, unsigned int *);
  32. int sum_128(unsigned int *, unsigned int *);
  33. int sub_int(unsigned int *, unsigned int);
  34. int sub_128(unsigned int *, unsigned int *);
  35. int div_128(unsigned int *, unsigned int *);
  36. int div_int(unsigned int *, unsigned int);
  37. int div_mpz(unsigned int *, mpz_t);
  38. int htonl_128(unsigned int *, unsigned int *);
  39. int ntohl_128(unsigned int *, unsigned int *);
  40. #endif /*IPV6_GMP_H */