ForwardingHandler Class

[C++]

class ForwardingHandler : public HandlerBase (.. public RefCountable, public NoCopy)
{
public:
  bool Success() const;
  unsigned int GetListPort() const;
  ForwardingErr GetError() const;

protected:
  virtual void OnStart();
  virtual void OnDone();
  virtual void OnSuccess(unsigned int listPort);
  virtual void OnError(ForwardingErr const& error);
}

[C#]

public class ForwardingHandler : IDisposable, HandlerBase (.. WaitImpl)
{
  public bool Success { get; }
  public uint GetListPort();
  public ForwardingErr GetError();
  
  public event StartEventHandler OnStart;
  public event DoneEventHandler OnDone;
  public event ForwardingSuccessEventHandler OnSuccess;
  public event ForwardingErrorEventHandler OnError;
  
  public override sealed bool IsDisposed { get; }
  public override sealed void Dispose();
}

Members

General

  • Success: Request completed successfully?
  • GetListPort: Returns the listening port. This value is meaningful only with [Client]AddForwarding, when the forwarding has successfully been added, and the initiating forwarding rule had listening port set to 0 (use any port).
  • GetError: Returns a ForwardingErr.

Overrides and Events

  • OnStart: The first override/event being invoked for a request. *
  • OnDone: The last override/event being invoked for a request. *
  • OnSuccess: Invoked when the request was successful.
    Parameters:
    • listPort: See GetListPort().
  • OnError: Invoked for a failed request.
    Parameters:
    • error: See GetError().

[.NET] Disposing

  • IsDisposed: Is the object disposed?
  • Dispose: Release all resources used by the object.

Remarks

ForwardingHandler is a base class which must be derived to use. Either derive and implement your own OnDone() method, or use pre-made derived classes ForwardingEvent or ForwardingMsg (for Win32 graphical applications). If you use ForwardingEvent, call WaitDone() or wait for GetDoneEvent() before checking the result.

This handler is used with the [Client]AddForwarding, [Client]CancelForwarding, and [Client]InviteForwardings requests.

* [C++] Always call the base class implementation from your override.