nfs-ganesha 1.4
Defines | Functions | Variables

rpc_tools.c File Reference

Some tools very usefull in the nfs protocol implementation. More...

#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/file.h>
#include <pwd.h>
#include <grp.h>
#include "rpcal.h"
#include "LRU_List.h"
#include "HashData.h"
#include "HashTable.h"
#include "log.h"
#include "nfs_core.h"
#include "nfs23.h"
#include "nfs4.h"
#include "fsal.h"
#include "nfs_tools.h"
#include "nfs_exports.h"
#include "nfs_file_handle.h"
#include "nfs_dupreq.h"

Go to the source code of this file.

Defines

#define SIZE_AI_ADDR   sizeof(struct sockaddr_in)

Functions

const char * str_sock_type (int st)
const char * str_ip_proto (int p)
const char * str_af (int af)
const char * xprt_type_to_str (xprt_type_t type)
int copy_xprt_addr (sockaddr_t *addr, SVCXPRT *xprt)
unsigned long hash_sockaddr (sockaddr_t *addr, ignore_port_t ignore_port)
int sprint_sockaddr (sockaddr_t *addr, char *buf, int len)
int sprint_sockip (sockaddr_t *addr, char *buf, int len)
int cmp_sockaddr (sockaddr_t *addr_1, sockaddr_t *addr_2, ignore_port_t ignore_port)
in_addr_t get_in_addr (sockaddr_t *addr)
int get_port (sockaddr_t *addr)
void socket_setoptions (int socketFd)
int ipstring_to_sockaddr (const char *str, sockaddr_t *addr)
CLIENT * Clnt_create (char *host, unsigned long prog, unsigned long vers, char *proto)
void Clnt_destroy (CLIENT *clnt)
void InitRPC (int num_sock)

Variables

pthread_mutex_t clnt_create_mutex = PTHREAD_MUTEX_INITIALIZER

Detailed Description

Some tools very usefull in the nfs protocol implementation.

Author:
Author:
ffilz
Date:
Date:
2006/01/20 07:39:22
Version:
Revision:
1.14

rpc_tools.c : Some tools very usefull in the nfs protocol implementation

Definition in file rpc_tools.c.


Define Documentation

#define SIZE_AI_ADDR   sizeof(struct sockaddr_in)

Definition at line 401 of file rpc_tools.c.


Function Documentation

CLIENT* Clnt_create ( char *  host,
unsigned long  prog,
unsigned long  vers,
char *  proto 
)

Definition at line 459 of file rpc_tools.c.

void Clnt_destroy ( CLIENT *  clnt)

Definition at line 476 of file rpc_tools.c.

int cmp_sockaddr ( sockaddr_t addr_1,
sockaddr_t addr_2,
ignore_port_t  ignore_port 
)

cmp_sockaddr: compare 2 sockaddrs, including ports

Parameters:
addr_1[IN] first address
addr_2[IN] second address
ignore_port[IN] 1 if you want to ignore port comparison, 0 if you need port comparisons
Returns:
1 if addresses match, 0 if they don't

Definition at line 305 of file rpc_tools.c.

int copy_xprt_addr ( sockaddr_t addr,
SVCXPRT *  xprt 
)

copy_xprt_addr: copies and transport address into an address field.

copies and transport address into an address field.

Parameters:
addr[OUT] address field to fill in.
xprt[IN] transport to get address from.
Returns:
1 if ok, 0 if failure.

Definition at line 137 of file rpc_tools.c.

in_addr_t get_in_addr ( sockaddr_t addr)

Definition at line 349 of file rpc_tools.c.

int get_port ( sockaddr_t addr)

Definition at line 361 of file rpc_tools.c.

unsigned long hash_sockaddr ( sockaddr_t addr,
ignore_port_t  ignore_port 
)

hash_sockaddr: create a hash value based on the sockaddr_t structure

This creates a native pointer size (unsigned long int) hash value from the sockaddr_t structure. It supports both IPv4 and IPv6, other types can be added in time.

Parameters:
addr[IN] sockaddr_t address to hash
xprt[IN] transport to get address from.
Returns:
hash value

Definition at line 170 of file rpc_tools.c.

void InitRPC ( int  num_sock)

Definition at line 483 of file rpc_tools.c.

int ipstring_to_sockaddr ( const char *  str,
sockaddr_t addr 
)

Definition at line 404 of file rpc_tools.c.

void socket_setoptions ( int  socketFd)

Definition at line 378 of file rpc_tools.c.

int sprint_sockaddr ( sockaddr_t addr,
char *  buf,
int  len 
)

Definition at line 218 of file rpc_tools.c.

int sprint_sockip ( sockaddr_t addr,
char *  buf,
int  len 
)

Definition at line 262 of file rpc_tools.c.

const char* str_af ( int  af)

Definition at line 99 of file rpc_tools.c.

const char* str_ip_proto ( int  p)

Definition at line 86 of file rpc_tools.c.

const char* str_sock_type ( int  st)

Definition at line 73 of file rpc_tools.c.

const char* xprt_type_to_str ( xprt_type_t  type)

Definition at line 111 of file rpc_tools.c.


Variable Documentation

pthread_mutex_t clnt_create_mutex = PTHREAD_MUTEX_INITIALIZER

Definition at line 457 of file rpc_tools.c.