UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
UPnPsdk Namespace Reference

Reengineered Object Oriented UPnP+ program code. More...

Classes

class  CAddrinfo
 Get information from the operating system about an internet address. More...
 
class  CNetadapter
 Get information from local network adapters. More...
 
class  CNetadapter_platform
 Manage information from Unix like platforms about network adapters. More...
 
class  CPthread_scoped_lock
 Scoped POSIX thread mutex lock is valid for the current scope of the object. More...
 
class  CRootdevice
 This will become a container object for the root device of a network node. More...
 
class  CSigpipe_scoped
 Portable handle SIGPIPE on failed write to a remote closed network socket. More...
 
class  CSocket
 Manage all aspects of a network socket. More...
 
class  CSocket_basic
 Get information from a raw network socket file descriptor. More...
 
class  CSocketErr
 Class for portable handling of network socket errors. More...
 
class  CStrIntMap
 Table with C-strings mapped to an integer id. More...
 
class  CUri
 Stores a URL and provides its host with port part. More...
 
struct  Document_meta
 Mapping of file extension to content-type of document. More...
 
class  INetadapter
 Manage information from different platforms about network adapters. More...
 
union  sockaddr_t
 Helpful union of the different socket address structures. More...
 
struct  SSockaddr
 Trivial ::sockaddr structures enhanced with methods. More...
 
struct  str_int_entry
 String to integer map entry. More...
 

Typedefs

using PNetadapter_platform = std::shared_ptr< INetadapter >
 Smart pointer to hold the injected pointer to the netadapter object for the current used platform.
 

Enumerations

enum  Upnp_HttpMethod {
  UPNP_HTTPMETHOD_PUT , UPNP_HTTPMETHOD_DELETE , UPNP_HTTPMETHOD_GET , UPNP_HTTPMETHOD_HEAD ,
  UPNP_HTTPMETHOD_POST
}
 Different HTTP methods. More...
 
enum  http_method_t {
  HTTPMETHOD_PUT = UPNP_HTTPMETHOD_PUT , HTTPMETHOD_DELETE = UPNP_HTTPMETHOD_DELETE , HTTPMETHOD_GET = UPNP_HTTPMETHOD_GET , HTTPMETHOD_HEAD = UPNP_HTTPMETHOD_HEAD ,
  HTTPMETHOD_POST = UPNP_HTTPMETHOD_POST , HTTPMETHOD_MPOST , HTTPMETHOD_SUBSCRIBE , HTTPMETHOD_UNSUBSCRIBE ,
  HTTPMETHOD_NOTIFY , HTTPMETHOD_MSEARCH , HTTPMETHOD_UNKNOWN , SOAPMETHOD_POST ,
  HTTPMETHOD_SIMPLEGET
}
 Method in a HTTP request. More...
 

Functions

uint8_t netmask_to_bitmask (const ::sockaddr_storage *a_netmask)
 Get prefix bit number from a network address mask.
 
void bitmask_to_netmask (const ::sockaddr_storage *a_saddr, const unsigned int a_prefixlength, SSockaddr &a_saddrObj)
 Get network address mask from address prefix bit number.
 
UPnPsdk_VIS uint64_t pthread_self ()
 Get pthread thread id as unsigned integer.
 
void split_addr_port (const std::string &a_addr_str, std::string &a_addr, std::string &a_serv)
 Free function to split inet address and port(service)
 
UPnPsdk_API::std::ostream & operator<< (::std::ostream &os, SSockaddr &saddr)
 output the netaddress
 
UPnPsdk_VIS const std::string errStr (int error)
 Get error name string.
 
UPnPsdk_VIS const std::string errStrEx (const int error, const int success)
 Get extended error name string.
 
UPnPsdk_VIS const Document_metaselect_filetype (std::string_view a_extension)
 Based on the extension, returns the content type and content subtype.
 

Variables

UPnPsdk_EXTERN bool g_dbug {false}
 Switch to enable verbose (debug) output.
 

Detailed Description

Reengineered Object Oriented UPnP+ program code.

cond

endcond


Class Documentation

◆ UPnPsdk::Document_meta

struct UPnPsdk::Document_meta

Mapping of file extension to content-type of document.

Definition at line 18 of file webserver.hpp.

Class Members
string extension extension of a filename
string type file type
string subtype file subtype

◆ UPnPsdk::str_int_entry

struct UPnPsdk::str_int_entry

String to integer map entry.

Definition at line 28 of file strintmap.hpp.

Class Members
const char * name A value in string form.
int id Same value in integer form.

Typedef Documentation

◆ PNetadapter_platform

using UPnPsdk::PNetadapter_platform = typedef std::shared_ptr<INetadapter>

Smart pointer to hold the injected pointer to the netadapter object for the current used platform.

Definition at line 120 of file netadapter_if.hpp.

Enumeration Type Documentation

◆ Upnp_HttpMethod

Different HTTP methods.

Enumerator
UPNP_HTTPMETHOD_PUT 

PUT.

UPNP_HTTPMETHOD_DELETE 

DELETE.

UPNP_HTTPMETHOD_GET 

GET.

UPNP_HTTPMETHOD_HEAD 

HEAD.

UPNP_HTTPMETHOD_POST 

POST.

Definition at line 15 of file API.hpp.

◆ http_method_t

Method in a HTTP request.

Warning
The enum values of the standard HTTP method should match those of Upnp_HttpMethod enum defined in <UPnPsdk/API.hpp>

Definition at line 18 of file httpparser.hpp.

Function Documentation

◆ pthread_self()

uint64_t UPnPsdk::pthread_self ( )

Get pthread thread id as unsigned integer.

Actually ::pthread_self() returns pthread_t and not an integer thread id you can work with. The following helper function will get you that in a portable way across different POSIX systems.
Reference: How do I get a thread ID from an arbitrary pthread_t?

Note
This function is only available for macOS and Microsoft Windows. Unix/Linux with GCC compiler can do this authomatically.

Definition at line 20 of file pthread.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ errStr()

const std::string UPnPsdk::errStr ( int  error)

Get error name string.

Returns
Name string of the error

Search for the string name of an error number and return it.

Parameters
[in]errorError number

Definition at line 86 of file upnptools.cpp.

◆ errStrEx()

const std::string UPnPsdk::errStrEx ( const int  error,
const int  success 
)

Get extended error name string.

Returns
Error message with hint what should be correct

Search for the string names of two error numbers, the wrong and the right one, and return an error message with a hint what is expected.

Parameters
[in]errorError number
[in]successMessage number that should be given instead of the error

Definition at line 103 of file upnptools.cpp.

◆ select_filetype()

const Document_meta * UPnPsdk::select_filetype ( std::string_view  a_extension)

Based on the extension, returns the content type and content subtype.

Example

#include <iostream>
const Document_meta* doc_meta = select_filetype("mp3");
if (doc_meta != nullptr) {
std::cout << "type = " << doc_meta->type
<< ", subtype = " << doc_meta->subtype << "\n";
}
Declarations to manage the builtin Webserver.
std::string subtype
file subtype
Definition webserver.hpp:21
std::string type
file type
Definition webserver.hpp:20
UPnPsdk_VIS const Document_meta * select_filetype(std::string_view a_extension)
Based on the extension, returns the content type and content subtype.
Mapping of file extension to content-type of document.
Definition webserver.hpp:18
Returns
  • pointer to a content type structure for a known file extension
  • nullptr if file extension was not known
Todo:
Rework to use reference instead of pointer and use exception.
Parameters
[in]a_extensionfile extension

Definition at line 101 of file webserver.cpp.

+ Here is the caller graph for this function:

Variable Documentation

◆ g_dbug

UPnPsdk_API bool UPnPsdk::g_dbug {false}

Switch to enable verbose (debug) output.

This flag is only modified by user intervention, e.g. on the command line or with an environment variable but never modified by the production code. Only Unit tests may toggle the switch under test.

Definition at line 26 of file global.hpp.