AdsLib
Loading...
Searching...
No Matches
Public Member Functions | List of all members
AmsRouter Struct Reference

#include <AmsRouter.h>

Inheritance diagram for AmsRouter:
Router

Public Member Functions

 AmsRouter (AmsNetId netId=AmsNetId {})
 
uint16_t OpenPort ()
 
long ClosePort (uint16_t port)
 
long GetLocalAddress (uint16_t port, AmsAddr *pAddr)
 
void SetLocalAddress (AmsNetId netId)
 
long GetTimeout (uint16_t port, uint32_t &timeout)
 
long SetTimeout (uint16_t port, uint32_t timeout)
 
long AddNotification (AmsRequest &request, uint32_t *pNotification, std::shared_ptr< Notification > notify)
 
long DelNotification (uint16_t port, const AmsAddr *pAddr, uint32_t hNotification)
 
long AddRoute (AmsNetId ams, const IpV4 &ip)
 
long AddRoute (AmsNetId ams, const std::string &host)
 
void DelRoute (const AmsNetId &ams)
 
AmsConnectionGetConnection (const AmsNetId &pAddr)
 
long AdsRequest (AmsRequest &request)
 
virtual long GetLocalAddress (uint16_t port, AmsAddr *pAddr)=0
 

Additional Inherited Members

- Static Public Attributes inherited from Router
static const size_t NUM_PORTS_MAX = 128
 
static const uint16_t PORT_BASE = 30000
 

Detailed Description

Copyright (c) 2015 - 2022 Beckhoff Automation GmbH & Co. KG

Constructor & Destructor Documentation

◆ AmsRouter()

AmsRouter::AmsRouter ( AmsNetId  netId = AmsNetId {})

Copyright (c) 2015 - 2022 Beckhoff Automation GmbH & Co. KG

Member Function Documentation

◆ AddRoute() [1/2]

long AmsRouter::AddRoute ( AmsNetId  ams,
const IpV4 ip 
)

We keep this madness only for backwards compatibility, to give downstream projects time to migrate to the much saner interface.

◆ AddRoute() [2/2]

long AmsRouter::AddRoute ( AmsNetId  ams,
const std::string &  host 
)

DNS lookups are pretty time consuming, we shouldn't do them with a looked mutex! So instead we do the lookup first and use the results, later.

There is already a route for this AmsNetId, but with a different IP. The old route has to be deleted, first!

in case no local AmsNetId was set previously, we derive one

◆ GetLocalAddress()

long AmsRouter::GetLocalAddress ( uint16_t  port,
AmsAddr pAddr 
)
virtual

Implements Router.


The documentation for this struct was generated from the following files: