OpenCPN Partial API docs
Loading...
Searching...
No Matches
MdnsCache Class Reference

Singleton cache for hosts looked up using mdns. More...

#include <mdns_cache.h>

Classes

struct  Entry
 

Public Member Functions

MdnsCacheoperator= (MdnsCache &)=delete
 
 MdnsCache (const MdnsCache &)=delete
 
void Validate ()
 Check that all entries are accessible, remove stale ones.
 
bool Add (const Entry &entry)
 Add new entry to the cache.
 
bool Add (const std::string &service, const std::string &host, const std::string &_ip, const std::string &_port)
 Add new entry to the cache.
 
bool Add (const std::string &_ip, const std::string &_port)
 Add a manual entry where only IP and port is known.
 
const std::vector< Entry > & GetCache () const
 Return read-only cached entries reference.
 

Static Public Member Functions

static MdnsCacheGetInstance ()
 

Detailed Description

Singleton cache for hosts looked up using mdns.

A critical region accessed both by timer routines and the main thread.

Entries are added by the various Add() signatures. The Validate() method removes all entries where host does not respond to a http request on port 8443.

Definition at line 41 of file mdns_cache.h.

Member Function Documentation

◆ Add() [1/3]

bool MdnsCache::Add ( const Entry entry)

Add new entry to the cache.

Returns
true if entry was added, false if entry with same ip address already exists.

Definition at line 54 of file mdns_cache.cpp.

◆ Add() [2/3]

bool MdnsCache::Add ( const std::string &  _ip,
const std::string &  _port 
)

Add a manual entry where only IP and port is known.

Returns
true if entry was added, false if entry with same ip address already exists.

Definition at line 70 of file mdns_cache.cpp.

◆ Add() [3/3]

bool MdnsCache::Add ( const std::string &  service,
const std::string &  host,
const std::string &  _ip,
const std::string &  _port 
)

Add new entry to the cache.

Returns
true if entry was added, false if entry with same ip address already exists.

Definition at line 65 of file mdns_cache.cpp.

◆ GetCache()

const std::vector< Entry > & MdnsCache::GetCache ( ) const
inline

Return read-only cached entries reference.

Definition at line 84 of file mdns_cache.h.

◆ GetInstance()

MdnsCache & MdnsCache::GetInstance ( )
static

Definition at line 49 of file mdns_cache.cpp.

◆ Validate()

void MdnsCache::Validate ( )

Check that all entries are accessible, remove stale ones.

Definition at line 74 of file mdns_cache.cpp.


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