MythTV  master
Macros | Typedefs | Functions | Variables
zmserver.cpp File Reference
#include <algorithm>
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cerrno>
#include <sys/socket.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/stat.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
#include "zmserver.h"
Include dependency graph for zmserver.cpp:

Go to the source code of this file.

Macros

#define ZM_PROTOCOL_VERSION   "11"
 
#define ADD_STR(list, s)   list += (s); (list) += "[]:[]";
 
#define ADD_INT(list, n)   (list) += std::to_string(n); (list) += "[]:[]";
 
#define ERROR_TOKEN_COUNT   "Invalid token count"
 
#define ERROR_MYSQL_QUERY   "Mysql Query Error"
 
#define ERROR_MYSQL_ROW   "Mysql Get Row Error"
 
#define ERROR_FILE_OPEN   "Cannot open event file"
 
#define ERROR_INVALID_MONITOR   "Invalid Monitor"
 
#define ERROR_INVALID_POINTERS   "Cannot get shared memory pointers"
 
#define ERROR_INVALID_MONITOR_FUNCTION   "Invalid Monitor Function"
 
#define ERROR_INVALID_MONITOR_ENABLE_VALUE   "Invalid Monitor Enable Value"
 
#define ERROR_NO_FRAMES   "No frames found for event"
 
#define ZM_SUBPIX_ORDER_NONE   2
 
#define ZM_SUBPIX_ORDER_RGB   6
 
#define ZM_SUBPIX_ORDER_BGR   5
 
#define ZM_SUBPIX_ORDER_BGRA   7
 
#define ZM_SUBPIX_ORDER_RGBA   8
 
#define ZM_SUBPIX_ORDER_ABGR   9
 
#define ZM_SUBPIX_ORDER_ARGB   10
 

Typedefs

using reconnect_t = my_bool
 

Functions

bool checkVersion (int major, int minor, int revision)
 
void loadZMConfig (const std::string &configfile)
 
void connectToDatabase (void)
 
void kickDatabase (bool debug)
 

Variables

MYSQL g_dbConn
 
std::string g_zmversion
 
std::string g_password
 
std::string g_server
 
std::string g_database
 
std::string g_webPath
 
std::string g_user
 
std::string g_webUser
 
std::string g_binPath
 
std::string g_mmapPath
 
std::string g_eventsPath
 
int g_majorVersion = 0
 
int g_minorVersion = 0
 
int g_revisionVersion = 0
 
TimePoint g_lastDBKick {}
 

Macro Definition Documentation

◆ ZM_PROTOCOL_VERSION

#define ZM_PROTOCOL_VERSION   "11"

Definition at line 52 of file zmserver.cpp.

◆ ADD_STR

#define ADD_STR (   list,
 
)    list += (s); (list) += "[]:[]";

Definition at line 54 of file zmserver.cpp.

◆ ADD_INT

#define ADD_INT (   list,
 
)    (list) += std::to_string(n); (list) += "[]:[]";

Definition at line 55 of file zmserver.cpp.

◆ ERROR_TOKEN_COUNT

#define ERROR_TOKEN_COUNT   "Invalid token count"

Definition at line 58 of file zmserver.cpp.

◆ ERROR_MYSQL_QUERY

#define ERROR_MYSQL_QUERY   "Mysql Query Error"

Definition at line 59 of file zmserver.cpp.

◆ ERROR_MYSQL_ROW

#define ERROR_MYSQL_ROW   "Mysql Get Row Error"

Definition at line 60 of file zmserver.cpp.

◆ ERROR_FILE_OPEN

#define ERROR_FILE_OPEN   "Cannot open event file"

Definition at line 61 of file zmserver.cpp.

◆ ERROR_INVALID_MONITOR

#define ERROR_INVALID_MONITOR   "Invalid Monitor"

Definition at line 62 of file zmserver.cpp.

◆ ERROR_INVALID_POINTERS

#define ERROR_INVALID_POINTERS   "Cannot get shared memory pointers"

Definition at line 63 of file zmserver.cpp.

◆ ERROR_INVALID_MONITOR_FUNCTION

#define ERROR_INVALID_MONITOR_FUNCTION   "Invalid Monitor Function"

Definition at line 64 of file zmserver.cpp.

◆ ERROR_INVALID_MONITOR_ENABLE_VALUE

#define ERROR_INVALID_MONITOR_ENABLE_VALUE   "Invalid Monitor Enable Value"

Definition at line 65 of file zmserver.cpp.

◆ ERROR_NO_FRAMES

#define ERROR_NO_FRAMES   "No frames found for event"

Definition at line 66 of file zmserver.cpp.

◆ ZM_SUBPIX_ORDER_NONE

#define ZM_SUBPIX_ORDER_NONE   2

Definition at line 71 of file zmserver.cpp.

◆ ZM_SUBPIX_ORDER_RGB

#define ZM_SUBPIX_ORDER_RGB   6

Definition at line 72 of file zmserver.cpp.

◆ ZM_SUBPIX_ORDER_BGR

#define ZM_SUBPIX_ORDER_BGR   5

Definition at line 73 of file zmserver.cpp.

◆ ZM_SUBPIX_ORDER_BGRA

#define ZM_SUBPIX_ORDER_BGRA   7

Definition at line 74 of file zmserver.cpp.

◆ ZM_SUBPIX_ORDER_RGBA

#define ZM_SUBPIX_ORDER_RGBA   8

Definition at line 75 of file zmserver.cpp.

◆ ZM_SUBPIX_ORDER_ABGR

#define ZM_SUBPIX_ORDER_ABGR   9

Definition at line 76 of file zmserver.cpp.

◆ ZM_SUBPIX_ORDER_ARGB

#define ZM_SUBPIX_ORDER_ARGB   10

Definition at line 77 of file zmserver.cpp.

Typedef Documentation

◆ reconnect_t

using reconnect_t = my_bool

Definition at line 173 of file zmserver.cpp.

Function Documentation

◆ checkVersion()

bool checkVersion ( int  major,
int  minor,
int  revision 
)

◆ loadZMConfig()

void loadZMConfig ( const std::string &  configfile)

Definition at line 104 of file zmserver.cpp.

Referenced by main().

◆ connectToDatabase()

void connectToDatabase ( void  )

Definition at line 176 of file zmserver.cpp.

Referenced by kickDatabase(), and main().

◆ kickDatabase()

void kickDatabase ( bool  debug)

Definition at line 201 of file zmserver.cpp.

Referenced by ZMServer::handleGetLiveFrame(), and main().

Variable Documentation

◆ g_dbConn

MYSQL g_dbConn

◆ g_zmversion

std::string g_zmversion

Definition at line 80 of file zmserver.cpp.

Referenced by loadZMConfig(), and main().

◆ g_password

std::string g_password

Definition at line 81 of file zmserver.cpp.

Referenced by connectToDatabase(), and loadZMConfig().

◆ g_server

std::string g_server

Definition at line 82 of file zmserver.cpp.

Referenced by connectToDatabase(), and loadZMConfig().

◆ g_database

std::string g_database

Definition at line 83 of file zmserver.cpp.

Referenced by connectToDatabase(), and loadZMConfig().

◆ g_webPath

std::string g_webPath

◆ g_user

std::string g_user

Definition at line 85 of file zmserver.cpp.

Referenced by connectToDatabase(), and loadZMConfig().

◆ g_webUser

std::string g_webUser

Definition at line 86 of file zmserver.cpp.

Referenced by loadZMConfig().

◆ g_binPath

std::string g_binPath

◆ g_mmapPath

std::string g_mmapPath

Definition at line 88 of file zmserver.cpp.

Referenced by loadZMConfig(), and ZMServer::ZMServer().

◆ g_eventsPath

std::string g_eventsPath

◆ g_majorVersion

int g_majorVersion = 0

Definition at line 90 of file zmserver.cpp.

Referenced by checkVersion(), and main().

◆ g_minorVersion

int g_minorVersion = 0

Definition at line 91 of file zmserver.cpp.

Referenced by checkVersion(), and main().

◆ g_revisionVersion

int g_revisionVersion = 0

Definition at line 92 of file zmserver.cpp.

Referenced by checkVersion(), and main().

◆ g_lastDBKick

TimePoint g_lastDBKick {}

Definition at line 94 of file zmserver.cpp.

Referenced by kickDatabase().