Unit AHicmp

Classes

TICMP - @/// TICMP=class(TComponent)
TPing - @\\\*) (*@/// TPing=class(TICMP)
TTraceRoute - @\\\0000001C01*) (*@/// TTraceRoute=class(TICMP)

Functions

ICMP_checksum - drop an IP group membership } (* IP_DEFAULT_MULTICAST_TTL = 1; { normally limit m'casts to 1 hop } *) (* IP_DEFAULT_MULTICAST_LOOP = 1; { normally hear sends if a member } *) (* IP_MAX_MEMBERSHIPS = 20; { per socket; must fit in one mbuf } *) (*@\\\0000000301

@/// function ICMP_checksum(var buf; length:integer):word;
Register - my magic message number

@\\\0000000301*) (*@/// procedure Register;

Types

p_icmp_echo_reply
p_ip_options
TPingEvent
TRouteEvent
t_icmp_call
t_icmp_echo_reply
t_icmp_echo_request
t_icmp_reply
t_ip_header
t_ip_options

Constants

ICMP_ECHO
ICMP_ECHOREPLY
ICMP_IREQ
ICMP_IREQREPLY
ICMP_MASKREPLY
ICMP_MASKREQ
ICMP_PARAMPROB
ICMP_REDIRECT
ICMP_REDIRECT_HOST
ICMP_REDIRECT_NET
ICMP_REDIRECT_TOSHOST
ICMP_REDIRECT_TOSNET
ICMP_SOURCEQUENCH
ICMP_TIMXCEED
ICMP_TIMXCEED_INTRANS
ICMP_TIMXCEED_REASS
ICMP_TSTAMP
ICMP_TSTAMPREPLY
ICMP_UNREACH
ICMP_UNREACH_HOST
ICMP_UNREACH_NEEDFRAG
ICMP_UNREACH_NET
ICMP_UNREACH_PORT
ICMP_UNREACH_PROTOCOL
ICMP_UNREACH_SRCFAIL
ip_addr_deleted
IP_ADD_MEMBERSHIP
ip_bad_destination
ip_bad_options
ip_bad_req
ip_bad_route
ip_buf_too_small
ip_dest_host_unreachable
ip_dest_net_unreachable
ip_dest_port_unreachable
ip_dest_prot_unreachable
IP_DROP_MEMBERSHIP
ip_general_failure
ip_hw_error
ip_mtu_change
IP_MULTICAST_IF
IP_MULTICAST_LOOP
IP_MULTICAST_TTL
ip_no_resources
ip_option_too_big
ip_packet_too_big
ip_param_problem
ip_pending
ip_req_timed_out
ip_sepc_mtu_change
ip_source_quench
ip_status_base
ip_success
IP_TTL
ip_ttl_expired_reassem
ip_ttl_expired_transmit
ip_unload
max_ip_status
uwm_socketevent

Variables

ICMPCloseHandle
ICMPCreateFile
ICMPSendEcho
icmp_state


Functions


function ICMP_checksum(var buf; length:integer):word;

drop an IP group membership } (* IP_DEFAULT_MULTICAST_TTL = 1; { normally limit m'casts to 1 hop } *) (* IP_DEFAULT_MULTICAST_LOOP = 1; { normally hear sends if a member } *) (* IP_MAX_MEMBERSHIPS = 20; { per socket; must fit in one mbuf } *) (*@\\\0000000301

@/// function ICMP_checksum(var buf; length:integer):word;


procedure Register;

my magic message number

@\\\0000000301*) (*@/// procedure Register;


Types


p_icmp_echo_reply=^t_icmp_echo_reply
@\\\0000000201*) (*@/// t_icmp_echo_reply=packed record
p_ip_options=^t_ip_options
@/// t_ip_options=packed record
TPingEvent = procedure (sender:TObject; status: integer; ip:longint; roundtime:longint) of object

TRouteEvent = procedure (sender:TObject; hop: byte; ip:longint; roundtime:longint) of object

t_icmp_call=(  icmp_dll,         (* only ICMP.DLL calls *)
                 icmp_winsock_ttl, (* Winsock including setting TTL *)
                 icmp_winsock_dll, (* Winsock, but ICMP.DLL for TTL *)
                 icmp_winsock,     (* Winsock, but no TTL *)
                 no_icmp           (* no at all *)
               );
@\\\0000000701
t_icmp_echo_reply = record
address : u_long;
status : u_long;
rttime : u_long;
datasize : word;
reserved : word;
data : pointer;
ip_options : t_ip_options;
end;

t_icmp_echo_request = record
icmp_type : byte;
icmp_code : byte;
icmp_cksum : word;
icmp_id : word;
icmp_seq : word;
end;
@\\\*) (*@/// t_icmp_echo_request=packed record
t_icmp_reply = record
icmp_type : byte;
icmp_code : byte;
icmp_cksum : word;
icmp_unused : longint;
icmp_ip : t_ip_header;
icmp_dgram : array[0..63] of byte;
end;
@\\\000000050A*) (*@/// t_icmp_reply=packed record
t_ip_header = record
ip_hl_v : byte;
ip_tos : byte;
ip_len : word;
ip_id : word;
ip_off : word;
ip_ttl : byte;
ip_p : byte;
ip_sum : word;
ip_src : longint;
ip_dst : longint;
end;
@/// t_ip_header=packed record
t_ip_options = record
Ttl : byte;
Tos : byte;
flags : byte;
optionssize : byte;
optionsdata : pointer;
end;

Constants

ICMP_ECHO = 8

for tos and host

ICMP_ECHOREPLY = 0

@/// ICMP types

ICMP_IREQ = 15

timestamp reply

ICMP_IREQREPLY = 16

information request

ICMP_MASKREPLY = 18

address mask request

ICMP_MASKREQ = 17

information reply

ICMP_PARAMPROB = 12

ttl==0 in reass

ICMP_REDIRECT = 5

packet lost, slow down

ICMP_REDIRECT_HOST = 1

for network

ICMP_REDIRECT_NET = 0

shorter route, codes:

ICMP_REDIRECT_TOSHOST = 3

for tos and net

ICMP_REDIRECT_TOSNET = 2

for host

ICMP_SOURCEQUENCH = 4

src route failed

ICMP_TIMXCEED = 11

echo service

ICMP_TIMXCEED_INTRANS = 0

time exceeded, code:

ICMP_TIMXCEED_REASS = 1

ttl==0 in transit

ICMP_TSTAMP = 13

ip header bad

ICMP_TSTAMPREPLY = 14

timestamp request

ICMP_UNREACH = 3

echo reply

ICMP_UNREACH_HOST = 1

bad net

ICMP_UNREACH_NEEDFRAG = 4

bad port

ICMP_UNREACH_NET = 0

dest unreachable, codes:

ICMP_UNREACH_PORT = 3

bad protocol

ICMP_UNREACH_PROTOCOL = 2

bad host

ICMP_UNREACH_SRCFAIL = 5

IP_DF caused drop

ip_addr_deleted = ip_status_base + 19

IP_ADD_MEMBERSHIP = 12

set/get IP multicast loopback

ip_bad_destination = ip_status_base + 18

ip_bad_options = ip_status_base + 7

ip_bad_req = ip_status_base + 11

ip_bad_route = ip_status_base + 12

ip_buf_too_small = ip_status_base + 1

ip_dest_host_unreachable = ip_status_base + 3

ip_dest_net_unreachable = ip_status_base + 2

ip_dest_port_unreachable = ip_status_base + 5

ip_dest_prot_unreachable = ip_status_base + 4

IP_DROP_MEMBERSHIP = 13

add an IP group membership

ip_general_failure = ip_status_base + 50

ip_hw_error = ip_status_base + 8

ip_mtu_change = ip_status_base + 21

IP_MULTICAST_IF = 9

Time to live of IP packet

IP_MULTICAST_LOOP = 11

set/get IP multicast timetolive

IP_MULTICAST_TTL = 10

set/get IP multicast interface

ip_no_resources = ip_status_base + 6

ip_option_too_big = ip_status_base + 17

ip_packet_too_big = ip_status_base + 9

ip_param_problem = ip_status_base + 15

ip_pending = ip_status_base +255

ip_req_timed_out = ip_status_base + 10

ip_sepc_mtu_change = ip_status_base + 20

ip_source_quench = ip_status_base + 16

ip_status_base = 11000

@/// ip status values

ip_success = 0

IP_TTL = 4

address mask reply *) (*@\\\*) (*@/// Options for use with [gs]etsockopt at the IP level. (corrected from winsock) *) (* IP_OPTIONS = 1;

ip_ttl_expired_reassem = ip_status_base + 14

ip_ttl_expired_transmit = ip_status_base + 13

ip_unload = ip_status_base + 22

max_ip_status = ip_general_failure

uwm_socketevent = wm_user+$102

@\\\

Variables

ICMPCloseHandle : function(ICMPHandle:THandle):Boolean

ICMPCreateFile : function:THandle

@\\\

ICMPSendEcho : function(ICMPHandle: THandle; (* handle returned from ICMPCreateFile *) DestAddress:longint; (* destination IP address (network order) *) Requestdata:pointer; (* pointer to buffer to send *) requestsize:word; (* length of data in buffer *) RequestOptns: p_ip_options; ReplyBuffer:pointer; (* see note *) Replysize:dword; (* length of reply, minimum 1 reply *) Timeout: DWord (* time in milliseconds to wait for reply *) ):dword

icmp_state : t_icmp_call

no at all