/***** **** *** ** *  *   *    *     *       *     *   *  * ** *** **** *****\

    logresolve 2.0 - http://www.net/~tomr/progs/logresolve/

    lr-ip.h - IP number utilities 2.0i2

    Tom Rathborne - tomr@uunet.ca - http://www.net/~tomr/

\***** **** *** ** *  *   *    *     *       *     *   *  * ** *** **** *****/

#ifndef LR_IP_H
#define LR_IP_H

#include "logresolve.h"
#include "lr-nsrec.h"

/* 
 * ip_cmp - compares two IP numbers and returns TRUE if they're the same
 *          (maybe it should return FALSE if they're the same like strcmp...)
 */

int ip_cmp(unsigned char ipnum1[4], unsigned char ipnum2[4]);

/* 
 * ip_cpy - copies second IP to first.
 */

void ip_cpy(unsigned char ipnum1[4], unsigned char ipnum2[4]);

/* 
 * ip_build - makes an IP number char array from 4 integers
 */

void ip_build(unsigned char ipnum[4],
	      unsigned int a, unsigned int b, unsigned int c, unsigned int d);

/* 
 * ip_str - converts an IP number char array to a string
 */

char *ip_str(char *string, unsigned char ipnum[4]);

/* 
 * str_ip - converts a string to an IP number char array
 */

int str_ip(char *string, unsigned char ipnum[4]);

/* 
 * ip_lookup - looks up hostname associated with IP number, returns new record
 */

struct nsrec *ip_lookup(unsigned char ipnum[4]);

/* 
 * ip_relookup - looks up an IP number, alters old record
 */

struct nsrec *ip_relookup(struct nsrec *record);

/* 
 * ip_hash - hashes an IP number to an integer
 */

int ip_hash(unsigned char ipnum[4], int size);

#endif

/*** end of lr-ip.h ***/
