Table of Contents

Class SnmpMessageExtension

Namespace
Lextm.SharpSnmpLib.Messaging
Assembly
SharpSnmpLib.dll

Extension methods for ISnmpMessage.

public static class SnmpMessageExtension
Inheritance
SnmpMessageExtension
Inherited Members

Properties

IsRunningOnIOS

Gets a value indicating whether it is running on iOS.

public static bool IsRunningOnIOS { get; }

Property Value

bool

true if is running on iOS; otherwise, false.

IsRunningOnMac

Gets a value indicating whether it is running on macOS.

public static bool IsRunningOnMac { get; }

Property Value

bool

true if is running on macOS; otherwise, false.

IsRunningOnWindows

Gets a value indicating whether it is running on Windows.

public static bool IsRunningOnWindows { get; }

Property Value

bool

true if is running on Windows; otherwise, false.

Methods

Community(ISnmpMessage)

Community name.

public static OctetString Community(this ISnmpMessage message)

Parameters

message ISnmpMessage

The ISnmpMessage.

Returns

OctetString

GetResponse(ISnmpMessage, int, IPEndPoint)

Sends this ISnmpMessage and handles the response from agent.

public static ISnmpMessage GetResponse(this ISnmpMessage request, int timeout, IPEndPoint receiver)

Parameters

request ISnmpMessage

The ISnmpMessage.

timeout int

The time-out value, in milliseconds. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.

receiver IPEndPoint

Port number.

Returns

ISnmpMessage

GetResponse(ISnmpMessage, int, IPEndPoint, UserRegistry)

Sends this ISnmpMessage and handles the response from agent.

public static ISnmpMessage GetResponse(this ISnmpMessage request, int timeout, IPEndPoint receiver, UserRegistry registry)

Parameters

request ISnmpMessage

The ISnmpMessage.

timeout int

The time-out value, in milliseconds. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.

receiver IPEndPoint

Port number.

registry UserRegistry

User registry.

Returns

ISnmpMessage

GetResponse(ISnmpMessage, int, IPEndPoint, UserRegistry, Socket)

Sends an ISnmpMessage and handles the response from agent.

public static ISnmpMessage GetResponse(this ISnmpMessage request, int timeout, IPEndPoint receiver, UserRegistry registry, Socket udpSocket)

Parameters

request ISnmpMessage

The ISnmpMessage.

timeout int

The time-out value, in milliseconds. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.

receiver IPEndPoint

Agent.

registry UserRegistry

The user registry.

udpSocket Socket

The UDP Socket to use to send/receive.

Returns

ISnmpMessage

GetResponse(ISnmpMessage, int, IPEndPoint, Socket)

Sends this ISnmpMessage and handles the response from agent.

public static ISnmpMessage GetResponse(this ISnmpMessage request, int timeout, IPEndPoint receiver, Socket udpSocket)

Parameters

request ISnmpMessage

The ISnmpMessage.

timeout int

The time-out value, in milliseconds. The default value is 0, which indicates an infinite time-out period. Specifying -1 also indicates an infinite time-out period.

receiver IPEndPoint

Agent.

udpSocket Socket

The UDP Socket to use to send/receive.

Returns

ISnmpMessage

GetResponseAsync(ISnmpMessage, IPEndPoint)

Sends this ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Port number.

Returns

Task<ISnmpMessage>

GetResponseAsync(ISnmpMessage, IPEndPoint, UserRegistry)

Sends this ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver, UserRegistry registry)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Port number.

registry UserRegistry

User registry.

Returns

Task<ISnmpMessage>

GetResponseAsync(ISnmpMessage, IPEndPoint, UserRegistry, Socket)

Sends an ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver, UserRegistry registry, Socket udpSocket)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Agent.

registry UserRegistry

The user registry.

udpSocket Socket

The UDP Socket to use to send/receive.

Returns

Task<ISnmpMessage>

GetResponseAsync(ISnmpMessage, IPEndPoint, UserRegistry, Socket, CancellationToken)

Sends an ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver, UserRegistry registry, Socket udpSocket, CancellationToken token)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Agent.

registry UserRegistry

The user registry.

udpSocket Socket

The UDP Socket to use to send/receive.

token CancellationToken

The cancellation token.

Returns

Task<ISnmpMessage>

GetResponseAsync(ISnmpMessage, IPEndPoint, UserRegistry, CancellationToken)

Sends this ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver, UserRegistry registry, CancellationToken token)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Port number.

registry UserRegistry

User registry.

token CancellationToken

The cancellation token.

Returns

Task<ISnmpMessage>

GetResponseAsync(ISnmpMessage, IPEndPoint, Socket)

Sends this ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver, Socket udpSocket)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Agent.

udpSocket Socket

The UDP Socket to use to send/receive.

Returns

Task<ISnmpMessage>

GetResponseAsync(ISnmpMessage, IPEndPoint, Socket, CancellationToken)

Sends this ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver, Socket udpSocket, CancellationToken token)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Agent.

udpSocket Socket

The UDP Socket to use to send/receive.

token CancellationToken

The cancellation token.

Returns

Task<ISnmpMessage>

GetResponseAsync(ISnmpMessage, IPEndPoint, CancellationToken)

Sends this ISnmpMessage and handles the response from agent.

public static Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage request, IPEndPoint receiver, CancellationToken token)

Parameters

request ISnmpMessage

The ISnmpMessage.

receiver IPEndPoint

Port number.

token CancellationToken

The cancellation token.

Returns

Task<ISnmpMessage>

IsRunningOnMono()

Tests if running on Mono.

public static bool IsRunningOnMono()

Returns

bool

MessageId(ISnmpMessage)

Gets the message ID.

public static int MessageId(this ISnmpMessage message)

Parameters

message ISnmpMessage

The ISnmpMessage.

Returns

int

The message ID.

Remarks

For v3, message ID is different from request ID. For v1 and v2c, they are the same.

Pdu(ISnmpMessage)

PDU.

public static ISnmpPdu Pdu(this ISnmpMessage message)

Parameters

message ISnmpMessage

The ISnmpMessage.

Returns

ISnmpPdu

RequestId(ISnmpMessage)

Request ID.

public static int RequestId(this ISnmpMessage message)

Parameters

message ISnmpMessage

The ISnmpMessage.

Returns

int

Send(ISnmpMessage, EndPoint)

Sends an ISnmpMessage.

public static void Send(this ISnmpMessage message, EndPoint manager)

Parameters

message ISnmpMessage

The ISnmpMessage.

manager EndPoint

Manager

Send(ISnmpMessage, EndPoint, Socket)

Sends an ISnmpMessage.

public static void Send(this ISnmpMessage message, EndPoint manager, Socket socket)

Parameters

message ISnmpMessage

The ISnmpMessage.

manager EndPoint

Manager

socket Socket

The socket.

SendAsync(ISnmpMessage, EndPoint)

Sends an ISnmpMessage.

public static Task SendAsync(this ISnmpMessage message, EndPoint manager)

Parameters

message ISnmpMessage

The ISnmpMessage.

manager EndPoint

Manager

Returns

Task

SendAsync(ISnmpMessage, EndPoint, Socket)

Sends an ISnmpMessage.

public static Task SendAsync(this ISnmpMessage message, EndPoint manager, Socket socket)

Parameters

message ISnmpMessage

The ISnmpMessage.

manager EndPoint

Manager

socket Socket

The socket.

Returns

Task

SendAsync(ISnmpMessage, EndPoint, Socket, CancellationToken)

Sends an ISnmpMessage.

public static Task SendAsync(this ISnmpMessage message, EndPoint manager, Socket socket, CancellationToken token)

Parameters

message ISnmpMessage

The ISnmpMessage.

manager EndPoint

Manager

socket Socket

The socket.

token CancellationToken

The cancellation token.

Returns

Task

SendAsync(ISnmpMessage, EndPoint, CancellationToken)

Sends an ISnmpMessage.

public static Task SendAsync(this ISnmpMessage message, EndPoint manager, CancellationToken token)

Parameters

message ISnmpMessage

The ISnmpMessage.

manager EndPoint

Manager

token CancellationToken

The cancellation token.

Returns

Task

TypeCode(ISnmpMessage)

Gets the SnmpType.

public static SnmpType TypeCode(this ISnmpMessage message)

Parameters

message ISnmpMessage

The ISnmpMessage.

Returns

SnmpType

Variables(ISnmpMessage)

Variables.

public static IList<Variable> Variables(this ISnmpMessage message)

Parameters

message ISnmpMessage

The ISnmpMessage.

Returns

IList<Variable>