class Poco::Net::ICMPSocketImpl

Overview

This class implements an ICMP socket. Moreā€¦

#include <ICMPSocketImpl.h>

class ICMPSocketImpl: public Poco::Net::RawSocketImpl
{
public:
    // construction

    ICMPSocketImpl(
        IPAddress::Family family,
        int dataSize,
        int ttl,
        int timeout
        );

    // methods

    virtual
    int
    sendTo(
        const void*,
        int,
        const SocketAddress& address,
        int flags = 0
        );

    virtual
    int
    receiveFrom(
        void*,
        int,
        SocketAddress& address,
        int flags = 0
        );

    int
    dataSize() const;

    int
    ttl() const;

    int
    timeout() const;
};

Inherited Members

public:
    // enums

    enum SelectMode;

    // methods

    void
    duplicate() const;

    void
    release() const;

    int
    referenceCount() const;

    virtual
    SocketImpl*
    acceptConnection(SocketAddress& clientAddr);

    virtual
    void
    connect(const SocketAddress& address);

    virtual
    void
    connect(
        const SocketAddress& address,
        const Poco::Timespan& timeout
        );

    virtual
    void
    connectNB(const SocketAddress& address);

    virtual
    void
    bind(
        const SocketAddress& address,
        bool reuseAddress = false
        );

    virtual
    void
    bind6(
        const SocketAddress& address,
        bool reuseAddress = false,
        bool ipV6Only = false
        );

    virtual
    void
    listen(int backlog = 64);

    virtual
    void
    close();

    virtual
    void
    shutdownReceive();

    virtual
    void
    shutdownSend();

    virtual
    void
    shutdown();

    virtual
    int
    sendBytes(
        const void* buffer,
        int length,
        int flags = 0
        );

    virtual
    int
    receiveBytes(
        void* buffer,
        int length,
        int flags = 0
        );

    virtual
    int
    sendTo(
        const void* buffer,
        int length,
        const SocketAddress& address,
        int flags = 0
        );

    virtual
    int
    receiveFrom(
        void* buffer,
        int length,
        SocketAddress& address,
        int flags = 0
        );

    virtual
    void
    sendUrgent(unsigned char data);

    virtual
    int
    available();

    virtual
    bool
    poll(
        const Poco::Timespan& timeout,
        int mode
        );

    virtual
    void
    setSendBufferSize(int size);

    virtual
    int
    getSendBufferSize();

    virtual
    void
    setReceiveBufferSize(int size);

    virtual
    int
    getReceiveBufferSize();

    virtual
    void
    setSendTimeout(const Poco::Timespan& timeout);

    virtual
    Poco::Timespan
    getSendTimeout();

    virtual
    void
    setReceiveTimeout(const Poco::Timespan& timeout);

    virtual
    Poco::Timespan
    getReceiveTimeout();

    virtual
    SocketAddress
    address();

    virtual
    SocketAddress
    peerAddress();

    void
    setOption(
        int level,
        int option,
        int value
        );

    void
    setOption(
        int level,
        int option,
        unsigned value
        );

    void
    setOption(
        int level,
        int option,
        unsigned char value
        );

    void
    setOption(
        int level,
        int option,
        const Poco::Timespan& value
        );

    void
    setOption(
        int level,
        int option,
        const IPAddress& value
        );

    virtual
    void
    setRawOption(
        int level,
        int option,
        const void* value,
        poco_socklen_t length
        );

    void
    getOption(
        int level,
        int option,
        int& value
        );

    void
    getOption(
        int level,
        int option,
        unsigned& value
        );

    void
    getOption(
        int level,
        int option,
        unsigned char& value
        );

    void
    getOption(
        int level,
        int option,
        Poco::Timespan& value
        );

    void
    getOption(
        int level,
        int option,
        IPAddress& value
        );

    virtual
    void
    getRawOption(
        int level,
        int option,
        void* value,
        poco_socklen_t& length
        );

    void
    setLinger(
        bool on,
        int seconds
        );

    void
    getLinger(
        bool& on,
        int& seconds
        );

    void
    setNoDelay(bool flag);

    bool
    getNoDelay();

    void
    setKeepAlive(bool flag);

    bool
    getKeepAlive();

    void
    setReuseAddress(bool flag);

    bool
    getReuseAddress();

    void
    setReusePort(bool flag);

    bool
    getReusePort();

    void
    setOOBInline(bool flag);

    bool
    getOOBInline();

    void
    setBroadcast(bool flag);

    bool
    getBroadcast();

    virtual
    void
    setBlocking(bool flag);

    virtual
    bool
    getBlocking() const;

    virtual
    bool
    secure() const;

    int
    socketError();

    poco_socket_t
    sockfd() const;

    void
    ioctl(
        poco_ioctl_request_t request,
        int& arg
        );

    void
    ioctl(
        poco_ioctl_request_t request,
        void* arg
        );

    bool
    initialized() const;

protected:
    // methods

    virtual
    void
    init(int af);

    void
    initSocket(
        int af,
        int type,
        int proto = 0
        );

    void
    reset(poco_socket_t fd = POCO_INVALID_SOCKET);

    static
    int
    lastError();

    static
    void
    error();

    static
    void
    error(const std::string& arg);

    static
    void
    error(int code);

    static
    void
    error(
        int code,
        const std::string& arg
        );

    virtual
    void
    init(int af);

    void
    init2(
        int af,
        int proto
        );

Detailed Documentation

This class implements an ICMP socket.

Construction

ICMPSocketImpl(
    IPAddress::Family family,
    int dataSize,
    int ttl,
    int timeout
    )

Creates an unconnected ICMP socket.

The socket will be created for the given address family.

Methods

virtual
int
sendTo(
    const void*,
    int,
    const SocketAddress& address,
    int flags = 0
    )

Sends an ICMP request through the socket to the given address.

Returns the number of bytes sent.

virtual
int
receiveFrom(
    void*,
    int,
    SocketAddress& address,
    int flags = 0
    )

Receives data from the socket.

Stores the address of the sender in address.

Returns the time elapsed since the originating request was sent.

int
dataSize() const

Returns the data size in bytes.

int
ttl() const

Returns the Time-To-Live value.

int
timeout() const

Returns the socket timeout value.