miniserver.h File Reference
`#include "UpnpStdInt.h"`
`#include "httpparser.h"`
`#include "sock.h"`
Include dependency graph for miniserver.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | MServerSockArray

## Typedefs

typedef struct MServerSockArray | MiniServerSockArray
typedef void(* | MiniServerCallback) (http_parser_t *parser, http_message_t *request, SOCKINFO *info)

## Functions

void | SetHTTPGetCallback (MiniServerCallback callback)
| Set HTTP Get Callback.
void | SetSoapCallback (MiniServerCallback callback)
| Set SOAP Callback.
void | SetGenaCallback (MiniServerCallback callback)
| Set GENA Callback.
int | StartMiniServer (uint16_t *listen_port4, uint16_t *listen_port6, uint16_t *listen_port6UlaGua)
| Initialize the sockets functionality for the Miniserver.
int | StopMiniServer ()
| Stop and Shutdown the MiniServer and free socket resources.

## Variables

SOCKET | gMiniServerStopSock

## Typedef Documentation

## MiniServerCallback

typedef void(* MiniServerCallback) ( http_parser_t *parser, http_message_t *request, SOCKINFO *info)

## Function Documentation

## SetGenaCallback()

void SetGenaCallback | ( | MiniServerCallback | callback | ) |

Set GENA Callback.

Parameters

  [in] | callback | GENA Callback to be invoked.

Referenced by UpnpInitPreamble().

## SetHTTPGetCallback()

void SetHTTPGetCallback | ( | MiniServerCallback | callback | ) |

Set HTTP Get Callback.

Parameters

  [in] | callback | HTTP Callback to be invoked .

Referenced by UpnpEnableWebserver().

## SetSoapCallback()

void SetSoapCallback | ( | MiniServerCallback | callback | ) |

Set SOAP Callback.

Parameters

  [in] | callback | SOAP Callback to be invoked .

Referenced by UpnpInitPreamble().

## StartMiniServer()

int StartMiniServer | ( | uint16_t * | listen_port4,
|  | uint16_t * | listen_port6,
|  | uint16_t * | listen_port6UlaGua
| ) |  |

Initialize the sockets functionality for the Miniserver.

Initialize a thread pool job to run the MiniServer and the job to the thread pool.

If listen port is 0, port is dynamically picked.

Use timer mechanism to start the MiniServer, failure to meet the allowed delay aborts the attempt to launch the MiniServer.

Returns
  - On success: UPNP_E_SUCCESS.
  - On error: UPNP_E_XXX.

Parameters

  [in,out] | listen_port4 | Port on which the server listens for incoming IPv4 connections.
  [in,out] | listen_port6 | Port on which the server listens for incoming IPv6 LLA connections.
  [in,out] | listen_port6UlaGua | Port on which the server listens for incoming IPv6 ULA or GUA connections.

References get_miniserver_stopsock(), get_ssdp_sockets(), gMiniServerThreadPool, gMServState, MServerSockArray::miniServerSock4, MServerSockArray::miniServerSock6, MServerSockArray::miniServerSock6UlaGua, MServerSockArray::miniServerStopSock, MSERV_IDLE, MSERV_RUNNING, RunMiniServer(), sock_close(), MServerSockArray::ssdpReqSock4, MServerSockArray::ssdpReqSock6, MServerSockArray::ssdpSock4, MServerSockArray::ssdpSock6, MServerSockArray::ssdpSock6UlaGua, ThreadPoolAddPersistent(), TPJobInit(), TPJobSetFreeFunction(), TPJobSetPriority(), UPNP_E_INTERNAL_ERROR, UPNP_E_OUTOF_MEMORY, and UPNP_E_SUCCESS.

Referenced by UpnpInitStartServers().

## StopMiniServer()

int StopMiniServer | ( |  | ) |

Stop and Shutdown the MiniServer and free socket resources.

Returns
  Always returns 0.

References gMServState, INVALID_SOCKET, miniStopSockPort, MSERV_IDLE, MSERV_RUNNING, MSERV_STOPPING, sock_close(), and UpnpPrintf().

Referenced by UpnpFinish().