OpenCPN Partial API docs
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. More...
 
bool Add (const std::string &service, const std::string &host, const std::string &_ip, const std::string &_port)
 Add new entry to the cache. More...
 
bool Add (const std::string &_ip, const std::string &_port)
 Add a manual entry where only IP and port is known. More...
 
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 to host does not respond to a http request on on port 8443.

Definition at line 37 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 51 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 67 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 62 of file mdns_cache.cpp.


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