Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tcphandler.h File Reference


Detailed Description

The tcphandler will attempt to connect() to a specified ip:port. This is useful to poll servers to see if they are up (e.g., see smb/telnet server is accepting connections). Using the triptime: option events with the round trip time will be generated.

This is an extremely simple handler but works with any TCP service. It is preferable to use handlers designed to understand the service protocol can determine if the service listening on the port is actually functioning (see httphandler, ftphandler, imaphandler, etc.)

See /etc/services for the well known ports for common services. Some examples include:

Wire keywords (standard handler keywords documented in Wire )

Example:

// monitor smb services set noconnect create event { name: "noconnect" priority: 1 }

create handler tcp { hostname: domaincontroller.mydomain.com port: 139 noconnect: $noconnect timeout: 5 cycletime: 60 }

Events generated:
Event NameTypeDescription
connect AW_EVENT_TYPE_STRING Was able to connect, send string of "ip:port"
noconnect AW_EVENT_TYPE_STRING Was NOT able to connect, send string of "ip:port"
triptime AW_EVENT_TYPE_INT32 Estimated round trip time in usec

#include "sysnet.h"
#include "monitor.h"
#include "wire.h"

Go to the source code of this file.

Data Structures

struct  aw_tcphandler_events_t
 Events generated. More...

struct  aw_tcphandler_state_t
 State of handler during probing. More...

struct  aw_tcphandler_t
 Handler object. More...


Enumerations

enum  aw_tcphandler_state_cd_t { AW_TCPHANDLER_IDLE, AW_TCPHANDLER_WAIT_CONNECT, AW_TCPHANDLER_DONE_CONNECT }
 The state codes for each state on handler. More...


Functions

aw_tcphandler_t * aw_create_tcphandler (const aw_tcphandler_events_t *events, const byte_t *hostname, u_int32_t port, aw_timestamp_t timeout, int32_t(*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index), int32_t(*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index), const aw_alarm_sched_t *sched, aw_logger_t *logger)
 Create a tcp handler.

void aw_free_tcphandler (aw_tcphandler_t *p)
 Free handler and all associated resources.

aw_handler_t * aw_wire_tcphandler (aw_wire_mkhandler_args_t *args)
 Create a tcp handler using "wire". See header doc for keyword documentation.


Enumeration Type Documentation

enum aw_tcphandler_state_cd_t
 

The state codes for each state on handler.

Enumeration values:
AW_TCPHANDLER_IDLE 
AW_TCPHANDLER_WAIT_CONNECT 
AW_TCPHANDLER_DONE_CONNECT 


Function Documentation

aw_tcphandler_t* aw_create_tcphandler (  const aw_tcphandler_events_t *  events,
const byte_t *  hostname,
u_int32_t  port,
aw_timestamp_t  timeout,
int32_t(*  regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
int32_t(*  regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
const aw_alarm_sched_t *  sched,
aw_logger_t *  logger
) 
 

Create a tcp handler.

aw_create_tcphandler

Parameters:
events Events to generate
hostname Hostname or dotted IP string
port Port
timeout Max time to run
regevent Function pointer for event registration
regmaskevent Function pointer for event mask registration
sched Run schedule
logger Logger object
Returns:
Handler object

void aw_free_tcphandler (  aw_tcphandler_t *  p  ) 
 

Free handler and all associated resources.

aw_free_tcphandler

Parameters:
p The handler

aw_handler_t* aw_wire_tcphandler (  aw_wire_mkhandler_args_t *  args  ) 
 

Create a tcp handler using "wire". See header doc for keyword documentation.

aw_wire_tcphandler

Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)