pcap-remote.h File Reference

#include "pcap.h"
#include "sockutils.h"

Go to the source code of this file.

Data Structures

struct  activehosts
 Keeps a list of all the opened connections in the active mode. More...
struct  rpcap_header
 Common header for all the RPCAP messages. More...
struct  rpcap_findalldevs_if
 Format of the message for the interface description (findalldevs command). More...
struct  rpcap_findalldevs_ifaddr
 Format of the message for the address listing (findalldevs command). More...
struct  rpcap_openreply
 Format of the message of the connection opening reply (open command). More...
struct  rpcap_startcapreq
 Format of the message that starts a remote capture (startcap command). More...
struct  rpcap_startcapreply
 Format of the reply message that devoted to start a remote capture (startcap reply command). More...
struct  rpcap_pkthdr
 Format of the header which encapsulates captured packets when transmitted on the network. More...
struct  rpcap_filter
 General header used for the pcap_setfilter() command; keeps just the number of BPF instructions. More...
struct  rpcap_filterbpf_insn
 Structure that keeps a single BPF instuction; it is repeated 'ninsn' times according to the 'rpcap_filterbpf' header. More...
struct  rpcap_auth
 Structure that keeps the data required for the authentication on the remote host. More...
struct  rpcap_stats
 Structure that keeps the statistics about the number of packets captured, dropped, etc. More...
struct  rpcap_sampling
 Structure that is needed to set sampling parameters. More...


#define RPCAP_DEFAULT_NETPORT   "2002"
#define RPCAP_VERSION   0
#define RPCAP_ACTIVE_WAIT   30
#define RPCAP_NETBUF_SIZE   64000
 Buffer used by socket functions to send-receive packets. In case you plan to have messages larger than this value, you have to increase it.
#define RPCAP_HOSTLIST_SEP   " ,;\n\r"
 Separators used for the host list.
#define RPCAP_MSG_ERROR   1
#define RPCAP_MSG_OPEN_REQ   3
#define RPCAP_MSG_CLOSE   6
#define RPCAP_MSG_PACKET   7
#define RPCAP_MSG_AUTH_REQ   8
#define PCAP_ERR_NETW   1
#define PCAP_ERR_AUTH   3
#define PCAP_ERR_OPEN   6
#define PCAP_ERR_READEX   9
#define PCAP_ERR_WRONGMSG   16
#define PCAP_ERR_WRONGVER   17


typedef unsigned char uint8
 Provides an 8-bits unsigned integer.
typedef unsigned short uint16
 Provides a 16-bits unsigned integer.
typedef unsigned int uint32
 Provides a 32-bits unsigned integer.
typedef int int32
 Provides a 32-bits integer.


int pcap_opensource_remote (pcap_t *p, struct pcap_rmtauth *auth)
int pcap_startcapture_remote (pcap_t *fp)
int pcap_read_nocb_remote (pcap_t *p, struct pcap_pkthdr **pkt_header, u_char **pkt_data)
int pcap_read_remote (pcap_t *p, int cnt, pcap_handler callback, u_char *user)
int pcap_updatefilter_remote (pcap_t *fp, struct bpf_program *prog)
int pcap_setfilter_remote (pcap_t *fp, struct bpf_program *prog)
int pcap_stats_remote (pcap_t *p, struct pcap_stat *ps)
int pcap_setsampling_remote (pcap_t *p)
struct pcap_statpcap_stats_ex_remote (pcap_t *p)
void pcap_cleanup_remote (pcap_t *p)
void rpcap_createhdr (struct rpcap_header *header, uint8 type, uint16 value, uint32 length)
int rpcap_deseraddr (struct sockaddr_storage *sockaddrin, struct sockaddr_storage **sockaddrout, char *errbuf)
int rpcap_checkmsg (char *errbuf, SOCKET sock, struct rpcap_header *header, uint8 first,...)
int rpcap_senderror (SOCKET sock, char *error, unsigned short errcode, char *errbuf)
int rpcap_sendauth (SOCKET sock, struct pcap_rmtauth *auth, char *errbuf)
int rpcap_remoteact_getsock (const char *host, char *errbuf)

Detailed Description

This file keeps all the new definitions and typedefs that are exported to the user and that are needed for the RPCAP protocol.

All the RPCAP functions that are allowed to return a buffer containing the error description can return max PCAP_ERRBUF_SIZE characters. However there is no guarantees that the string will be zero-terminated. Best practice is to define the errbuf variable as a char of size 'PCAP_ERRBUF_SIZE+1' and to insert manually the termination char at the end of the buffer. This will guarantee that no buffer overflows occur even if we use the printf() to show the error on the screen.
This file declares some typedefs that MUST be of a specific size. These definitions (i.e. typedefs) could need to be changed on other platforms than Intel IA32.
This file defines some structures that are used to transfer data on the network. Be careful that you compiler MUST not insert padding into these structures for better alignment. These structures have been created in order to be correctly aligned to a 32 bits boundary, but be careful in any case.

Definition in file pcap-remote.h.

Function Documentation

void pcap_cleanup_remote ( pcap_t p  ) 
int pcap_opensource_remote ( pcap_t p,
struct pcap_rmtauth auth 
int pcap_read_nocb_remote ( pcap_t p,
struct pcap_pkthdr **  pkt_header,
u_char **  pkt_data 
int pcap_read_remote ( pcap_t p,
int  cnt,
pcap_handler  callback,
u_char *  user 
int pcap_setfilter_remote ( pcap_t fp,
struct bpf_program *  prog 
int pcap_setsampling_remote ( pcap_t p  ) 
int pcap_startcapture_remote ( pcap_t fp  ) 
struct pcap_stat* pcap_stats_ex_remote ( pcap_t p  )  [read]
int pcap_stats_remote ( pcap_t p,
struct pcap_stat ps 
int pcap_updatefilter_remote ( pcap_t fp,
struct bpf_program *  prog 
int rpcap_checkmsg ( char *  errbuf,
SOCKET  sock,
struct rpcap_header header,
uint8  first,
void rpcap_createhdr ( struct rpcap_header header,
uint8  type,
uint16  value,
uint32  length 
int rpcap_deseraddr ( struct sockaddr_storage *  sockaddrin,
struct sockaddr_storage **  sockaddrout,
char *  errbuf 
int rpcap_remoteact_getsock ( const char *  host,
char *  errbuf 
int rpcap_sendauth ( SOCKET  sock,
struct pcap_rmtauth auth,
char *  errbuf 
int rpcap_senderror ( SOCKET  sock,
char *  error,
unsigned short  errcode,
char *  errbuf 

documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2009 CACE Technologies. All rights reserved.