libpcap  1.10.1
About: libpcap is a packet filter library used by tools like tcpdump.
  Fossies Dox: libpcap-1.10.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rpcap-protocol.h File Reference
#include "sockutils.h"
#include "sslutils.h"
Include dependency graph for rpcap-protocol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rpcap_header
 
struct  rpcap_authreply
 
struct  rpcap_findalldevs_if
 
struct  rpcap_sockaddr
 
struct  rpcap_sockaddr_in
 
struct  rpcap_sockaddr_in6
 
struct  rpcap_findalldevs_ifaddr
 
struct  rpcap_openreply
 
struct  rpcap_startcapreq
 
struct  rpcap_startcapreply
 
struct  rpcap_pkthdr
 
struct  rpcap_filter
 
struct  rpcap_filterbpf_insn
 
struct  rpcap_auth
 
struct  rpcap_stats
 
struct  rpcap_sampling
 

Macros

#define RPCAP_DEFAULT_NETPORT   "2002" /* Default port on which the RPCAP daemon is waiting for connections. */
 
#define RPCAP_DEFAULT_NETPORT_ACTIVE   "2003"
 
#define RPCAP_DEFAULT_NETADDR   "" /* Default network address on which the RPCAP daemon binds to. */
 
#define RPCAP_MIN_VERSION   0
 
#define RPCAP_MAX_VERSION   0
 
#define RPCAP_VERSION_IS_SUPPORTED(v)    ((v) <= RPCAP_MAX_VERSION)
 
#define RPCAP_HOSTLIST_SEP   " ,;\n\r"
 
#define RPCAP_AF_INET   2 /* Value on all OSes */
 
#define RPCAP_AF_INET6   23 /* Value on Windows */
 
#define RPCAP_MSG_IS_REPLY   0x080 /* Flag indicating a reply */
 
#define RPCAP_MSG_ERROR   0x01 /* Message that keeps an error notification */
 
#define RPCAP_MSG_FINDALLIF_REQ   0x02 /* Request to list all the remote interfaces */
 
#define RPCAP_MSG_OPEN_REQ   0x03 /* Request to open a remote device */
 
#define RPCAP_MSG_STARTCAP_REQ   0x04 /* Request to start a capture on a remote device */
 
#define RPCAP_MSG_UPDATEFILTER_REQ   0x05 /* Send a compiled filter into the remote device */
 
#define RPCAP_MSG_CLOSE   0x06 /* Close the connection with the remote peer */
 
#define RPCAP_MSG_PACKET   0x07 /* This is a 'data' message, which carries a network packet */
 
#define RPCAP_MSG_AUTH_REQ   0x08 /* Message that keeps the authentication parameters */
 
#define RPCAP_MSG_STATS_REQ   0x09 /* It requires to have network statistics */
 
#define RPCAP_MSG_ENDCAP_REQ   0x0A /* Stops the current capture, keeping the device open */
 
#define RPCAP_MSG_SETSAMPLING_REQ   0x0B /* Set sampling parameters */
 
#define RPCAP_MSG_FINDALLIF_REPLY   (RPCAP_MSG_FINDALLIF_REQ | RPCAP_MSG_IS_REPLY) /* Keeps the list of all the remote interfaces */
 
#define RPCAP_MSG_OPEN_REPLY   (RPCAP_MSG_OPEN_REQ | RPCAP_MSG_IS_REPLY) /* The remote device has been opened correctly */
 
#define RPCAP_MSG_STARTCAP_REPLY   (RPCAP_MSG_STARTCAP_REQ | RPCAP_MSG_IS_REPLY) /* The capture is starting correctly */
 
#define RPCAP_MSG_UPDATEFILTER_REPLY   (RPCAP_MSG_UPDATEFILTER_REQ | RPCAP_MSG_IS_REPLY) /* The filter has been applied correctly on the remote device */
 
#define RPCAP_MSG_AUTH_REPLY   (RPCAP_MSG_AUTH_REQ | RPCAP_MSG_IS_REPLY) /* Sends a message that says 'ok, authorization successful' */
 
#define RPCAP_MSG_STATS_REPLY   (RPCAP_MSG_STATS_REQ | RPCAP_MSG_IS_REPLY) /* Message that keeps the network statistics */
 
#define RPCAP_MSG_ENDCAP_REPLY   (RPCAP_MSG_ENDCAP_REQ | RPCAP_MSG_IS_REPLY) /* Confirms that the capture stopped successfully */
 
#define RPCAP_MSG_SETSAMPLING_REPLY   (RPCAP_MSG_SETSAMPLING_REQ | RPCAP_MSG_IS_REPLY) /* Confirms that the capture stopped successfully */
 
#define RPCAP_STARTCAPREQ_FLAG_PROMISC   0x00000001 /* Enables promiscuous mode (default: disabled) */
 
#define RPCAP_STARTCAPREQ_FLAG_DGRAM   0x00000002 /* Use a datagram (i.e. UDP) connection for the data stream (default: use TCP)*/
 
#define RPCAP_STARTCAPREQ_FLAG_SERVEROPEN   0x00000004 /* The server has to open the data connection toward the client */
 
#define RPCAP_STARTCAPREQ_FLAG_INBOUND   0x00000008 /* Capture only inbound packets (take care: the flag has no effect with promiscuous enabled) */
 
#define RPCAP_STARTCAPREQ_FLAG_OUTBOUND   0x00000010 /* Capture only outbound packets (take care: the flag has no effect with promiscuous enabled) */
 
#define RPCAP_UPDATEFILTER_BPF   1 /* This code tells us that the filter is encoded with the BPF/NPF syntax */
 
#define PCAP_ERR_NETW   1 /* Network error */
 
#define PCAP_ERR_INITTIMEOUT   2 /* The RPCAP initial timeout has expired */
 
#define PCAP_ERR_AUTH   3 /* Generic authentication error */
 
#define PCAP_ERR_FINDALLIF   4 /* Generic findalldevs error */
 
#define PCAP_ERR_NOREMOTEIF   5 /* The findalldevs was ok, but the remote end had no interfaces to list */
 
#define PCAP_ERR_OPEN   6 /* Generic pcap_open error */
 
#define PCAP_ERR_UPDATEFILTER   7 /* Generic updatefilter error */
 
#define PCAP_ERR_GETSTATS   8 /* Generic pcap_stats error */
 
#define PCAP_ERR_READEX   9 /* Generic pcap_next_ex error */
 
#define PCAP_ERR_HOSTNOAUTH   10 /* The host is not authorized to connect to this server */
 
#define PCAP_ERR_REMOTEACCEPT   11 /* Generic pcap_remoteaccept error */
 
#define PCAP_ERR_STARTCAPTURE   12 /* Generic pcap_startcapture error */
 
#define PCAP_ERR_ENDCAPTURE   13 /* Generic pcap_endcapture error */
 
#define PCAP_ERR_RUNTIMETIMEOUT   14 /* The RPCAP run-time timeout has expired */
 
#define PCAP_ERR_SETSAMPLING   15 /* Error during the settings of sampling parameters */
 
#define PCAP_ERR_WRONGMSG   16 /* The other end endpoint sent a message which has not been recognized */
 
#define PCAP_ERR_WRONGVER   17 /* The other end endpoint has a version number that is not compatible with our */
 
#define PCAP_ERR_AUTH_FAILED   18 /* The user couldn't be authenticated */
 
#define PCAP_ERR_TLS_REQUIRED   19 /* The server requires TLS to connect */
 
#define PCAP_ERR_AUTH_TYPE_NOTSUP   20 /* The authentication type isn't supported */
 
#define RPCAP_NETBUF_SIZE   64000
 

Typedefs

typedef unsigned char uint8
 
typedef unsigned short uint16
 
typedef unsigned int uint32
 
typedef int int32
 

Functions

void rpcap_createhdr (struct rpcap_header *header, uint8 ver, uint8 type, uint16 value, uint32 length)
 
const char * rpcap_msg_type_string (uint8 type)
 
int rpcap_senderror (int sock, void const *ssl, uint8 ver, uint16 errcode, const char *error, char *errbuf)
 

Macro Definition Documentation

◆ PCAP_ERR_AUTH

#define PCAP_ERR_AUTH   3 /* Generic authentication error */

Definition at line 390 of file rpcap-protocol.h.

◆ PCAP_ERR_AUTH_FAILED

#define PCAP_ERR_AUTH_FAILED   18 /* The user couldn't be authenticated */

Definition at line 405 of file rpcap-protocol.h.

◆ PCAP_ERR_AUTH_TYPE_NOTSUP

#define PCAP_ERR_AUTH_TYPE_NOTSUP   20 /* The authentication type isn't supported */

Definition at line 407 of file rpcap-protocol.h.

◆ PCAP_ERR_ENDCAPTURE

#define PCAP_ERR_ENDCAPTURE   13 /* Generic pcap_endcapture error */

Definition at line 400 of file rpcap-protocol.h.

◆ PCAP_ERR_FINDALLIF

#define PCAP_ERR_FINDALLIF   4 /* Generic findalldevs error */

Definition at line 391 of file rpcap-protocol.h.

◆ PCAP_ERR_GETSTATS

#define PCAP_ERR_GETSTATS   8 /* Generic pcap_stats error */

Definition at line 395 of file rpcap-protocol.h.

◆ PCAP_ERR_HOSTNOAUTH

#define PCAP_ERR_HOSTNOAUTH   10 /* The host is not authorized to connect to this server */

Definition at line 397 of file rpcap-protocol.h.

◆ PCAP_ERR_INITTIMEOUT

#define PCAP_ERR_INITTIMEOUT   2 /* The RPCAP initial timeout has expired */

Definition at line 389 of file rpcap-protocol.h.

◆ PCAP_ERR_NETW

#define PCAP_ERR_NETW   1 /* Network error */

Definition at line 388 of file rpcap-protocol.h.

◆ PCAP_ERR_NOREMOTEIF

#define PCAP_ERR_NOREMOTEIF   5 /* The findalldevs was ok, but the remote end had no interfaces to list */

Definition at line 392 of file rpcap-protocol.h.

◆ PCAP_ERR_OPEN

#define PCAP_ERR_OPEN   6 /* Generic pcap_open error */

Definition at line 393 of file rpcap-protocol.h.

◆ PCAP_ERR_READEX

#define PCAP_ERR_READEX   9 /* Generic pcap_next_ex error */

Definition at line 396 of file rpcap-protocol.h.

◆ PCAP_ERR_REMOTEACCEPT

#define PCAP_ERR_REMOTEACCEPT   11 /* Generic pcap_remoteaccept error */

Definition at line 398 of file rpcap-protocol.h.

◆ PCAP_ERR_RUNTIMETIMEOUT

#define PCAP_ERR_RUNTIMETIMEOUT   14 /* The RPCAP run-time timeout has expired */

Definition at line 401 of file rpcap-protocol.h.

◆ PCAP_ERR_SETSAMPLING

#define PCAP_ERR_SETSAMPLING   15 /* Error during the settings of sampling parameters */

Definition at line 402 of file rpcap-protocol.h.

◆ PCAP_ERR_STARTCAPTURE

#define PCAP_ERR_STARTCAPTURE   12 /* Generic pcap_startcapture error */

Definition at line 399 of file rpcap-protocol.h.

◆ PCAP_ERR_TLS_REQUIRED

#define PCAP_ERR_TLS_REQUIRED   19 /* The server requires TLS to connect */

Definition at line 406 of file rpcap-protocol.h.

◆ PCAP_ERR_UPDATEFILTER

#define PCAP_ERR_UPDATEFILTER   7 /* Generic updatefilter error */

Definition at line 394 of file rpcap-protocol.h.

◆ PCAP_ERR_WRONGMSG

#define PCAP_ERR_WRONGMSG   16 /* The other end endpoint sent a message which has not been recognized */

Definition at line 403 of file rpcap-protocol.h.

◆ PCAP_ERR_WRONGVER

#define PCAP_ERR_WRONGVER   17 /* The other end endpoint has a version number that is not compatible with our */

Definition at line 404 of file rpcap-protocol.h.

◆ RPCAP_AF_INET

#define RPCAP_AF_INET   2 /* Value on all OSes */

Definition at line 223 of file rpcap-protocol.h.

◆ RPCAP_AF_INET6

#define RPCAP_AF_INET6   23 /* Value on Windows */

Definition at line 235 of file rpcap-protocol.h.

◆ RPCAP_DEFAULT_NETADDR

#define RPCAP_DEFAULT_NETADDR   "" /* Default network address on which the RPCAP daemon binds to. */

Definition at line 40 of file rpcap-protocol.h.

◆ RPCAP_DEFAULT_NETPORT

#define RPCAP_DEFAULT_NETPORT   "2002" /* Default port on which the RPCAP daemon is waiting for connections. */

Definition at line 37 of file rpcap-protocol.h.

◆ RPCAP_DEFAULT_NETPORT_ACTIVE

#define RPCAP_DEFAULT_NETPORT_ACTIVE   "2003"

Definition at line 39 of file rpcap-protocol.h.

◆ RPCAP_HOSTLIST_SEP

#define RPCAP_HOSTLIST_SEP   " ,;\n\r"

Definition at line 106 of file rpcap-protocol.h.

◆ RPCAP_MAX_VERSION

#define RPCAP_MAX_VERSION   0

Definition at line 82 of file rpcap-protocol.h.

◆ RPCAP_MIN_VERSION

#define RPCAP_MIN_VERSION   0

Definition at line 81 of file rpcap-protocol.h.

◆ RPCAP_MSG_AUTH_REPLY

#define RPCAP_MSG_AUTH_REPLY   (RPCAP_MSG_AUTH_REQ | RPCAP_MSG_IS_REPLY) /* Sends a message that says 'ok, authorization successful' */

Definition at line 369 of file rpcap-protocol.h.

◆ RPCAP_MSG_AUTH_REQ

#define RPCAP_MSG_AUTH_REQ   0x08 /* Message that keeps the authentication parameters */

Definition at line 360 of file rpcap-protocol.h.

◆ RPCAP_MSG_CLOSE

#define RPCAP_MSG_CLOSE   0x06 /* Close the connection with the remote peer */

Definition at line 358 of file rpcap-protocol.h.

◆ RPCAP_MSG_ENDCAP_REPLY

#define RPCAP_MSG_ENDCAP_REPLY   (RPCAP_MSG_ENDCAP_REQ | RPCAP_MSG_IS_REPLY) /* Confirms that the capture stopped successfully */

Definition at line 371 of file rpcap-protocol.h.

◆ RPCAP_MSG_ENDCAP_REQ

#define RPCAP_MSG_ENDCAP_REQ   0x0A /* Stops the current capture, keeping the device open */

Definition at line 362 of file rpcap-protocol.h.

◆ RPCAP_MSG_ERROR

#define RPCAP_MSG_ERROR   0x01 /* Message that keeps an error notification */

Definition at line 353 of file rpcap-protocol.h.

◆ RPCAP_MSG_FINDALLIF_REPLY

#define RPCAP_MSG_FINDALLIF_REPLY   (RPCAP_MSG_FINDALLIF_REQ | RPCAP_MSG_IS_REPLY) /* Keeps the list of all the remote interfaces */

Definition at line 365 of file rpcap-protocol.h.

◆ RPCAP_MSG_FINDALLIF_REQ

#define RPCAP_MSG_FINDALLIF_REQ   0x02 /* Request to list all the remote interfaces */

Definition at line 354 of file rpcap-protocol.h.

◆ RPCAP_MSG_IS_REPLY

#define RPCAP_MSG_IS_REPLY   0x080 /* Flag indicating a reply */

Definition at line 351 of file rpcap-protocol.h.

◆ RPCAP_MSG_OPEN_REPLY

#define RPCAP_MSG_OPEN_REPLY   (RPCAP_MSG_OPEN_REQ | RPCAP_MSG_IS_REPLY) /* The remote device has been opened correctly */

Definition at line 366 of file rpcap-protocol.h.

◆ RPCAP_MSG_OPEN_REQ

#define RPCAP_MSG_OPEN_REQ   0x03 /* Request to open a remote device */

Definition at line 355 of file rpcap-protocol.h.

◆ RPCAP_MSG_PACKET

#define RPCAP_MSG_PACKET   0x07 /* This is a 'data' message, which carries a network packet */

Definition at line 359 of file rpcap-protocol.h.

◆ RPCAP_MSG_SETSAMPLING_REPLY

#define RPCAP_MSG_SETSAMPLING_REPLY   (RPCAP_MSG_SETSAMPLING_REQ | RPCAP_MSG_IS_REPLY) /* Confirms that the capture stopped successfully */

Definition at line 372 of file rpcap-protocol.h.

◆ RPCAP_MSG_SETSAMPLING_REQ

#define RPCAP_MSG_SETSAMPLING_REQ   0x0B /* Set sampling parameters */

Definition at line 363 of file rpcap-protocol.h.

◆ RPCAP_MSG_STARTCAP_REPLY

#define RPCAP_MSG_STARTCAP_REPLY   (RPCAP_MSG_STARTCAP_REQ | RPCAP_MSG_IS_REPLY) /* The capture is starting correctly */

Definition at line 367 of file rpcap-protocol.h.

◆ RPCAP_MSG_STARTCAP_REQ

#define RPCAP_MSG_STARTCAP_REQ   0x04 /* Request to start a capture on a remote device */

Definition at line 356 of file rpcap-protocol.h.

◆ RPCAP_MSG_STATS_REPLY

#define RPCAP_MSG_STATS_REPLY   (RPCAP_MSG_STATS_REQ | RPCAP_MSG_IS_REPLY) /* Message that keeps the network statistics */

Definition at line 370 of file rpcap-protocol.h.

◆ RPCAP_MSG_STATS_REQ

#define RPCAP_MSG_STATS_REQ   0x09 /* It requires to have network statistics */

Definition at line 361 of file rpcap-protocol.h.

◆ RPCAP_MSG_UPDATEFILTER_REPLY

#define RPCAP_MSG_UPDATEFILTER_REPLY   (RPCAP_MSG_UPDATEFILTER_REQ | RPCAP_MSG_IS_REPLY) /* The filter has been applied correctly on the remote device */

Definition at line 368 of file rpcap-protocol.h.

◆ RPCAP_MSG_UPDATEFILTER_REQ

#define RPCAP_MSG_UPDATEFILTER_REQ   0x05 /* Send a compiled filter into the remote device */

Definition at line 357 of file rpcap-protocol.h.

◆ RPCAP_NETBUF_SIZE

#define RPCAP_NETBUF_SIZE   64000

Definition at line 413 of file rpcap-protocol.h.

◆ RPCAP_STARTCAPREQ_FLAG_DGRAM

#define RPCAP_STARTCAPREQ_FLAG_DGRAM   0x00000002 /* Use a datagram (i.e. UDP) connection for the data stream (default: use TCP)*/

Definition at line 375 of file rpcap-protocol.h.

◆ RPCAP_STARTCAPREQ_FLAG_INBOUND

#define RPCAP_STARTCAPREQ_FLAG_INBOUND   0x00000008 /* Capture only inbound packets (take care: the flag has no effect with promiscuous enabled) */

Definition at line 377 of file rpcap-protocol.h.

◆ RPCAP_STARTCAPREQ_FLAG_OUTBOUND

#define RPCAP_STARTCAPREQ_FLAG_OUTBOUND   0x00000010 /* Capture only outbound packets (take care: the flag has no effect with promiscuous enabled) */

Definition at line 378 of file rpcap-protocol.h.

◆ RPCAP_STARTCAPREQ_FLAG_PROMISC

#define RPCAP_STARTCAPREQ_FLAG_PROMISC   0x00000001 /* Enables promiscuous mode (default: disabled) */

Definition at line 374 of file rpcap-protocol.h.

◆ RPCAP_STARTCAPREQ_FLAG_SERVEROPEN

#define RPCAP_STARTCAPREQ_FLAG_SERVEROPEN   0x00000004 /* The server has to open the data connection toward the client */

Definition at line 376 of file rpcap-protocol.h.

◆ RPCAP_UPDATEFILTER_BPF

#define RPCAP_UPDATEFILTER_BPF   1 /* This code tells us that the filter is encoded with the BPF/NPF syntax */

Definition at line 380 of file rpcap-protocol.h.

◆ RPCAP_VERSION_IS_SUPPORTED

#define RPCAP_VERSION_IS_SUPPORTED (   v)     ((v) <= RPCAP_MAX_VERSION)

Definition at line 91 of file rpcap-protocol.h.

Typedef Documentation

◆ int32

typedef int int32

Definition at line 138 of file rpcap-protocol.h.

◆ uint16

typedef unsigned short uint16

Definition at line 136 of file rpcap-protocol.h.

◆ uint32

typedef unsigned int uint32

Definition at line 137 of file rpcap-protocol.h.

◆ uint8

typedef unsigned char uint8
  • Protocol messages formats *

Definition at line 135 of file rpcap-protocol.h.

Function Documentation

◆ rpcap_createhdr()

void rpcap_createhdr ( struct rpcap_header header,
uint8  ver,
uint8  type,
uint16  value,
uint32  length 
)
  • Routines used by the rpcap client and rpcap daemon *

Definition at line 137 of file rpcap-protocol.c.

References rpcap_header::plen, rpcap_header::type, rpcap_header::value, and rpcap_header::ver.

Referenced by rpcap_senderror().

◆ rpcap_msg_type_string()

const char* rpcap_msg_type_string ( uint8  type)

◆ rpcap_senderror()

int rpcap_senderror ( int  sock,
void const *  ssl,
uint8  ver,
uint16  errcode,
const char *  error,
char *  errbuf 
)