nfs-ganesha 1.4
Functions | Variables

nfs_ip_name.c File Reference

The management of the IP/name cache. More...

#include "HashData.h"
#include "HashTable.h"
#include "log.h"
#include "nfs_core.h"
#include "nfs_exports.h"
#include "config_parsing.h"
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

Go to the source code of this file.

Functions

uint32_t ip_name_value_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
uint64_t ip_name_rbt_hash_func (hash_parameter_t *p_hparam, hash_buffer_t *buffclef)
int compare_ip_name (hash_buffer_t *buff1, hash_buffer_t *buff2)
int display_ip_name_key (hash_buffer_t *pbuff, char *str)
int display_ip_name_val (hash_buffer_t *pbuff, char *str)
int nfs_ip_name_add (sockaddr_t *ipaddr, char *hostname)
int nfs_ip_name_get (sockaddr_t *ipaddr, char *hostname)
int nfs_ip_name_remove (sockaddr_t *ipaddr)
int nfs_Init_ip_name (nfs_ip_name_parameter_t param)
int nfs_ip_name_populate (char *path)
void nfs_ip_name_get_stats (hash_stat_t *phstat)

Variables

hash_table_tht_ip_name
unsigned int expiration_time

Detailed Description

The management of the IP/name cache.

Author:
Author:
leibovic
Date:
Date:
2006/01/20 07:39:23
Version:
Revision:
1.6

nfs_ip_name.c : The management of the IP/name cache.

Definition in file nfs_ip_name.c.


Function Documentation

int compare_ip_name ( hash_buffer_t buff1,
hash_buffer_t buff2 
)

compare_ip_name: compares the ip address stored in the key buffers.

compare the ip address stored in the key buffers. This function is to be used as 'compare_key' field in the hashtable storing the nfs duplicated requests.

Parameters:
buff1[IN] first key
buff2[IN] second key
Returns:
0 if keys are identifical, 1 if they are different.

Definition at line 115 of file nfs_ip_name.c.

int display_ip_name_key ( hash_buffer_t pbuff,
char *  str 
)

display_ip_name_key: displays the ip_name stored in the buffer.

displays the ip_name key stored in the buffer. This function is to be used as 'key_to_str' field.

Parameters:
buff1[IN] buffer to display
buff2[OUT] output string
Returns:
number of character written.

Definition at line 132 of file nfs_ip_name.c.

int display_ip_name_val ( hash_buffer_t pbuff,
char *  str 
)

display_ip_name_vale: displays the ip_name stored in the buffer.

displays the ip_name value stored in the buffer. This function is to be used as 'val_to_str' field.

Parameters:
buff1[IN] buffer to display
buff2[OUT] output string
Returns:
number of character written.

Definition at line 152 of file nfs_ip_name.c.

uint64_t ip_name_rbt_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

ip_name_rbt_hash_func: computes the rbt value for the entry in IP/name cache.

Computes the rbt value for the entry in IP/name cache. This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[in]pointer to the hash key buffer
Returns:
the computed rbt value.
See also:
HashTable_Init

Definition at line 96 of file nfs_ip_name.c.

uint32_t ip_name_value_hash_func ( hash_parameter_t p_hparam,
hash_buffer_t buffclef 
)

ip_name_rbt_hash_func: computes the hash value for the entry in IP/name cache.

Computes the hash value for the entry in IP/name cache. This function is called internal in the HasTable_* function

Parameters:
hparam[IN] hash table parameter.
buffcleff[in]pointer to the hash key buffer
Returns:
the computed hash value.
See also:
HashTable_Init

Definition at line 75 of file nfs_ip_name.c.

int nfs_Init_ip_name ( nfs_ip_name_parameter_t  param)

nfs_Init_ip_name: Init the hashtable for IP/name cache.

Perform all the required initialization for hashtable IP/name cache

Parameters:
param[IN] parameter used to init the ip name cache
Returns:
0 if successful, -1 otherwise

Definition at line 348 of file nfs_ip_name.c.

int nfs_ip_name_add ( sockaddr_t ipaddr,
char *  hostname 
)

nfs_ip_name_add: adds an entry in the duplicate requests cache.

Adds an entry in the duplicate requests cache.

Parameters:
ipaddr[IN] the ipaddr to be used as key
hostname[IN] the hostname added (found by using gethostbyaddr)
Returns:
IP_NAME_SUCCESS if successfull
.
IP_NAME_INSERT_MALLOC_ERROR if an error occured during the insertion process
IP_NAME_NETDB_ERROR if an error occured during the netdb query (via gethostbyaddr).

Definition at line 174 of file nfs_ip_name.c.

int nfs_ip_name_get ( sockaddr_t ipaddr,
char *  hostname 
)

nfs_ip_name_get: Tries to get an entry for ip_name cache.

Tries to get an entry for ip_name cache.

Parameters:
ipaddr[IN] the ip address requested
hostname[OUT] the hostname
Returns:
the result previously set if *pstatus == IP_NAME_SUCCESS

Definition at line 265 of file nfs_ip_name.c.

void nfs_ip_name_get_stats ( hash_stat_t phstat)

nfs_ip_name_get_stats: gets the hash table statistics for the IP_NAME Table.

Gets the hash table statistics for the IP_NAME Table.

Parameters:
phstat[OUT] pointer to the resulting stats.
Returns:
nothing (void function)
See also:
HashTable_GetStats

Definition at line 476 of file nfs_ip_name.c.

int nfs_ip_name_populate ( char *  path)

Definition at line 362 of file nfs_ip_name.c.

int nfs_ip_name_remove ( sockaddr_t ipaddr)

nfs_ip_name_remove: Tries to remove an entry for ip_name cache

Tries to remove an entry for ip_name cache.

Parameters:
ipaddr[IN] the ip address to be uncached.
Returns:
the result previously set if *pstatus == IP_NAME_SUCCESS

Definition at line 307 of file nfs_ip_name.c.


Variable Documentation

unsigned int expiration_time

Definition at line 58 of file nfs_ip_name.c.

Definition at line 57 of file nfs_ip_name.c.