diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/avdetector.cpp | 270 | ||||
-rw-r--r-- | misc/avdetector.h | 105 | ||||
-rw-r--r-- | misc/config.cpp | 22 | ||||
-rw-r--r-- | misc/config.h | 72 | ||||
-rw-r--r-- | misc/menusetup.h | 103 | ||||
-rw-r--r-- | misc/search.h | 156 | ||||
-rw-r--r-- | misc/util.h | 144 |
7 files changed, 19 insertions, 853 deletions
diff --git a/misc/avdetector.cpp b/misc/avdetector.cpp deleted file mode 100644 index bb1c9c8..0000000 --- a/misc/avdetector.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * File: avdetector.cpp - * Author: savop - * - * Created on 26. Oktober 2009, 13:01 - */ - -#include "avdetector.h" -#include <sys/stat.h> - -cAudioVideoDetector::cAudioVideoDetector(const char* Filename) : mResourceType(UPNP_RESOURCE_FILE) { - this->mResource.Filename = Filename; - this->init(); -} - -cAudioVideoDetector::cAudioVideoDetector(const cChannel* Channel) : mResourceType(UPNP_RESOURCE_CHANNEL) { - this->mResource.Channel = Channel; - this->init(); -} - -cAudioVideoDetector::cAudioVideoDetector(const cRecording* Recording) : mResourceType(UPNP_RESOURCE_RECORDING) { - this->mResource.Recording = Recording; - this->init(); -} - -cAudioVideoDetector::~cAudioVideoDetector(){ - this->uninit(); -} - -void cAudioVideoDetector::init(){ - this->mBitrate = 0; - this->mBitsPerSample = 0; - this->mColorDepth = 0; - this->mDLNAProfile = NULL; - this->mDuration = 0; - this->mHeight = 0; - this->mNrAudioChannels = 0; - this->mSampleFrequency = 0; - this->mSize = 0; - this->mWidth = 0; -} - -void cAudioVideoDetector::uninit(){ - this->init(); -} - -int cAudioVideoDetector::detectProperties(){ - int ret = 0; - switch(this->mResourceType){ - case UPNP_RESOURCE_CHANNEL: - ret = this->detectChannelProperties(); - break; - case UPNP_RESOURCE_RECORDING: - ret = this->detectRecordingProperties(); - break; - case UPNP_RESOURCE_FILE: - ret = this->detectFileProperties(); - break; - default: - WARNING("This resource type is not yet implemented."); - ret = -1; - break; - } - - return ret; -} - -int cAudioVideoDetector::detectChannelProperties(){ - this->mBitrate = 0; - this->mBitsPerSample = 0; - this->mColorDepth = 0; - this->mDuration = 0; - this->mHeight = 0; - this->mNrAudioChannels = 0; - this->mSampleFrequency = 0; - this->mSize = (off64_t)-1; - this->mWidth = 0; - - switch(this->mResource.Channel->Vtype()){ - case 0x02: - // MPEG2 Video - this->mDLNAProfile = &DLNA_PROFILE_MPEG_TS_SD_EU_ISO; - break; - case 0x1B: - this->mDLNAProfile = &DLNA_PROFILE_AVC_TS_HD_EU_ISO; - break; - default: - ERROR("Unknown video type %d for channel %s!", this->mResource.Channel->Vtype(), this->mResource.Channel->Name()); - this->mDLNAProfile = NULL; - return -1; - } - - return 0; -} - -int cAudioVideoDetector::detectRecordingProperties(){ - - if(this->mResource.Recording->IsPesRecording()){ - ERROR("Sorry, PES Recordings are not supported"); - return -1; - } - - int ret = 0; - AVFormatContext *FormatCtx = NULL; - - cIndexFile* Index = new cIndexFile(this->mResource.Recording->FileName(), false, this->mResource.Recording->IsPesRecording()); - cFileName* RecFile = new cFileName(this->mResource.Recording->FileName(), false, false, this->mResource.Recording->IsPesRecording()); - if(Index && Index->Ok()){ - this->mDuration = (off64_t) (Index->Last() * AVDETECTOR_TIME_BASE / SecondsToFrames(1, this->mResource.Recording->FramesPerSecond())); - MESSAGE(VERBOSE_METADATA,"Record length: %llds", this->mDuration); - - uint16_t FileNumber = 0; - off_t FileOffset = 0; - - if(Index->Get(Index->Last()-1, &FileNumber, &FileOffset)) - for(int i = 0; i < FileNumber; i++){ - struct stat Stats; - RecFile->SetOffset(i+1); - stat(RecFile->Name(),&Stats); - this->mSize += (off64_t) Stats.st_size; - } - - av_register_all(); - - if(!(ret = av_open_input_file(&FormatCtx, RecFile->Name(), NULL, 0, NULL))){ - if((ret = av_find_stream_info(FormatCtx))<0){ - ERROR("AVDetector: Cannot find the stream information"); - } - else { - if((ret = this->analyseVideo(FormatCtx))<0){ - ERROR("AVDetector: Error while analysing video"); - } - if((ret = this->analyseAudio(FormatCtx))<0){ - ERROR("AVDetector: Error while analysing audio"); - } - } - } - } - else { - ret = -1; - } - - if(ret != 0){ - ERROR("Error occured while detecting properties"); - } - - delete RecFile; - delete Index; - av_free(FormatCtx); - - return ret; -} - -int cAudioVideoDetector::detectFileProperties(){ - av_register_all(); - - int ret = 0; - - AVFormatContext *FormatCtx = NULL; - - if(av_open_input_file(&FormatCtx, this->mResource.Filename, NULL, 0, NULL)){ - ERROR("AVDetector: Error while opening file %s", this->mResource.Filename); - return -1; - } - else { - if(av_find_stream_info(FormatCtx)<0){ - ERROR("AVDetector: Cannot find the stream information"); - return -1; - } - else { - - if((ret = this->analyseFormat(FormatCtx))<0){ - ERROR("AVDetector: Error while analysing format"); - return ret; - } - if((ret = this->analyseVideo(FormatCtx))<0){ - ERROR("AVDetector: Error while analysing video"); - return ret; - } - if((ret = this->analyseAudio(FormatCtx))<0){ - ERROR("AVDetector: Error while analysing audio"); - return ret; - } - - return 0; - } - } -} - -int cAudioVideoDetector::analyseFormat(AVFormatContext* FormatCtx){ - if(!FormatCtx) return -1; - - this->mSize = FormatCtx->file_size; - this->mDuration = FormatCtx->duration; - - MESSAGE(VERBOSE_METADATA, "Format properties: %lld and %lld Bytes", this->mDuration, this->mSize); - - AVMetadataTag* Tag = NULL; - - while((Tag=av_metadata_get(FormatCtx->metadata,"",Tag,AV_METADATA_IGNORE_SUFFIX))){ - MESSAGE(VERBOSE_METADATA, "%s: %s", Tag->key, Tag->value); - } - - return 0; -} - -int cAudioVideoDetector::analyseVideo(AVFormatContext* FormatCtx) -{ -// // Register avformat - - unsigned int i; int videoStream = -1; - - AVCodecContext *CodecCtx = NULL; - for(i = 0; i < FormatCtx->nb_streams; i++){ - if(FormatCtx->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO){ - videoStream = i; - break; - } - } - if(videoStream == -1){ - ERROR("AVDetector: No video stream found"); - return 1; - } - - CodecCtx = FormatCtx->streams[videoStream]->codec; - - AVCodec* Codec = avcodec_find_decoder(CodecCtx->codec_id); - - this->mWidth = CodecCtx->width; - this->mHeight = CodecCtx->height; - this->mBitrate = CodecCtx->bit_rate; - this->mSampleFrequency = CodecCtx->sample_rate; - this->mBitsPerSample = CodecCtx->bits_per_raw_sample; - - // TODO: what's the color depth of the stream - - const char* codecName = (Codec)?Codec->name:"unknown"; - - MESSAGE(VERBOSE_METADATA, "AVDetector: %s-stream %dx%d at %d bit/s", codecName, this->mWidth, this->mHeight, this->mBitrate); - return 0; -} - -int cAudioVideoDetector::analyseAudio(AVFormatContext* FormatCtx){ - - unsigned int i; int audioStream = -1; - - AVCodecContext *CodecCtx = NULL; - for(i = 0; i < FormatCtx->nb_streams; i++){ - if(FormatCtx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO){ - audioStream = i; - break; - } - } - if(audioStream == -1){ - ERROR("AVDetector: No audio stream found"); - return 1; - } - - CodecCtx = FormatCtx->streams[audioStream]->codec; - AVCodec* Codec = avcodec_find_decoder(CodecCtx->codec_id); - - this->mNrAudioChannels = CodecCtx->channels; - - const char* codecName = (Codec)?Codec->name:"unknown"; - - MESSAGE(VERBOSE_METADATA, "AVDetector: %s-stream at %d bit/s", codecName, CodecCtx->bit_rate); - return 0; - -} - diff --git a/misc/avdetector.h b/misc/avdetector.h deleted file mode 100644 index 33b3298..0000000 --- a/misc/avdetector.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * File: avdetector.h - * Author: savop - * - * Created on 26. Oktober 2009, 13:02 - */ - -#ifndef _AVDETECTOR_H -#define _AVDETECTOR_H - -#include "../database/object.h" -#include <vdr/recording.h> -#include <vdr/channels.h> - -extern "C" { -#include <libavcodec/avcodec.h> -#include <libavformat/avformat.h> -} - -/** - * The audio/video detector - * - * This is the audio video detector, which analizes the audio and video stream - * of a file to gather more information about the resource. This is also - * required for determination of a suitable DLNA profile. - */ -class cAudioVideoDetector { -private: - void init(); - void uninit(); - int detectChannelProperties(); - int detectFileProperties(); - int detectRecordingProperties(); - /** - * Detect video properties - * - * This detects video properties of a video stream - * - * @return returns - * - \bc 0, if the detection was successful - * - \bc <0, otherwise - */ - int analyseVideo(AVFormatContext* FormatCtx); - /** - * Detect audio properties - * - * This detects audio properties of a video or audio stream - * - * @return returns - * - \bc 0, if the detection was successful - * - \bc <0, otherwise - */ - int analyseAudio(AVFormatContext* FormatCtx); - int analyseFormat(AVFormatContext* FormatCtx); - int detectDLNAProfile(); - UPNP_RESOURCE_TYPES mResourceType; - union { - const cChannel* Channel; - const cRecording* Recording; - const char* Filename; - } mResource; - int mWidth; - int mHeight; - int mBitrate; - int mBitsPerSample; - int mColorDepth; - off64_t mDuration; - off64_t mSize; - int mSampleFrequency; - int mNrAudioChannels; - DLNAProfile* mDLNAProfile; -public: - cAudioVideoDetector(const char* Filename); - cAudioVideoDetector(const cChannel* Channel); - cAudioVideoDetector(const cRecording* Recording); - virtual ~cAudioVideoDetector(); - /** - * Detect resource properties of the file - * - * This detects the resource properties of a file. If the returned value - * is 0, no erros occured while detection and the properties are properly - * set. Otherwise, in case of an error, the properties may have - * unpredictable values. - * - * @return returns - * - \bc 0, if the detection was successful - * - \bc <0, otherwise - */ - int detectProperties(); - DLNAProfile* getDLNAProfile() const { return this->mDLNAProfile; } - const char* getContentType() const { return (this->mDLNAProfile) ? this->mDLNAProfile->mime : NULL; } - const char* getProtocolInfo() const; - int getWidth() const { return this->mWidth; } - int getHeight() const { return this->mHeight; } - int getBitrate() const { return this->mBitrate; } - int getBitsPerSample() const { return this->mBitsPerSample; } - int getSampleFrequency() const { return this->mSampleFrequency; } - int getNumberOfAudioChannels() const { return this->mNrAudioChannels; } - int getColorDepth() const { return this->mColorDepth; } - off64_t getFileSize() const { return this->mSize; } - off64_t getDuration() const { return this->mDuration; } -}; - -#endif /* _AVDETECTOR_H */ - diff --git a/misc/config.cpp b/misc/config.cpp index 1fa0ccb..10ed166 100644 --- a/misc/config.cpp +++ b/misc/config.cpp @@ -10,8 +10,11 @@ #include <getopt.h> #include "config.h" #include "../common.h" +#include "../upnp.h" cUPnPConfig::cUPnPConfig(){ + this->mDatabaseFolder = NULL; + this->mHTTPFolder = NULL; this->mParsedArgs = NULL; this->mInterface = NULL; this->mAddress = NULL; @@ -42,10 +45,13 @@ bool cUPnPConfig::processArgs(int argc, char* argv[]){ {"port", required_argument, NULL, 'p'}, {"autodetect", no_argument, NULL, 'd'}, {"verbose", no_argument, NULL, 'v'}, + {"httpdir", required_argument, NULL, 0}, + {"dbdir", required_argument, NULL, 0}, {0, 0, 0, 0} }; - int c = 0; + int c = 0; int index = -1; + struct option* opt = NULL; // Check if anything went wrong by setting 'success' to false // As there are multiple tests you may get a faulty behavior @@ -60,7 +66,7 @@ bool cUPnPConfig::processArgs(int argc, char* argv[]){ bool addExcistent = false; static int verbose = 0; - while((c = getopt_long(argc, argv, "i:a:p:dv",long_options, NULL)) != -1){ + while((c = getopt_long(argc, argv, "i:a:p:dv",long_options, &index)) != -1){ switch(c){ case 'i': if(addExcistent) { ERROR("Address given but must be absent!"); return false; } @@ -86,7 +92,15 @@ bool cUPnPConfig::processArgs(int argc, char* argv[]){ case 'v': cUPnPConfig::verbosity++; verbose++; - WARNING("Verbosity level: %i ", verbose); + break; + case 0: + opt = &long_options[index]; + if(!strcasecmp("httpdir", opt->name)){ + success = this->parseSetup(SETUP_WEBSERVER_DIR, optarg) && success; + } + else if(!strcasecmp("dbdir", opt->name)){ + success = this->parseSetup(SETUP_DATABASE_DIR, optarg) && success; + } break; default: return false; @@ -111,6 +125,8 @@ bool cUPnPConfig::parseSetup(const char *Name, const char *Value) else if (!strcasecmp(Name, SETUP_SERVER_INT)) this->mInterface = strdup0(Value); // (Value) ? strn0cpy(this->mInterface, Value, strlen(this->mInterface)) : NULL; else if (!strcasecmp(Name, SETUP_SERVER_ADDRESS)) this->mAddress = strdup0(Value); //(Value) ? strn0cpy(this->mAddress, Value, strlen(this->mAddress)) : NULL; else if (!strcasecmp(Name, SETUP_SERVER_PORT)) this->mPort = atoi(Value); + else if (!strcasecmp(Name, SETUP_WEBSERVER_DIR)) this->mHTTPFolder = strdup0(Value); + else if (!strcasecmp(Name, SETUP_DATABASE_DIR)) this->mDatabaseFolder = strdup0(Value); else return false; this->mParsedArgs = cString::sprintf("%s%s",*this->mParsedArgs,Name); diff --git a/misc/config.h b/misc/config.h deleted file mode 100644 index 40ae6f7..0000000 --- a/misc/config.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * File: config.h - * Author: savop - * - * Created on 15. August 2009, 13:03 - */ - -#ifndef _CONFIG_H -#define _CONFIG_H - -#include <vdr/tools.h> -#include "../common.h" - -/** - * The configuration settings - * - * This holds the configurations for the server. It holds information about the - * network settings as well as some status flags. - */ -class cUPnPConfig { -private: - static cUPnPConfig* mInstance; - cString mParsedArgs; - cUPnPConfig(); -public: - static int verbosity; ///< the verbosity of the plugin, the higher the more messages - ///< are printed. - char* mInterface; ///< the network interface, which the server is bound to - char* mAddress; ///< the IP address which is used by the server - int mPort; ///< the port which the server is listening on - int mEnable; ///< indicates, if the server is enabled or not - int mAutoSetup; ///< indicates, if the settings are automatically detected -public: - virtual ~cUPnPConfig(); - /** - * Get the configuration - * - * This returns the instance of the current configuration settings. - * - * @return the configuration object - */ - static cUPnPConfig* get(); - /** - * Parse setup variable - * - * This parses the setup variable with the according value. The value is a - * string representation and must be converted into the according data type. - * - * @return returns - * - \bc true, if parsing was successful - * - \bc false, otherwise - * @param Name the name of the variable - * @param Value the according value of the variable - */ - bool parseSetup(const char* Name, const char* Value); - /** - * Processes the commandline arguments - * - * This processes the commandline arguments which the user specified at the - * start of the plugin. - * - * @return returns - * - \bc true, if processing was successful - * - \bc false, otherwise - * @param argc the number of arguments in the list - * @param argv the arguments as a char array - */ - bool processArgs(int argc, char* argv[]); -}; - -#endif /* _CONFIG_H */ - diff --git a/misc/menusetup.h b/misc/menusetup.h deleted file mode 100644 index 4e32efc..0000000 --- a/misc/menusetup.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * File: menusetup.h - * Author: savop - * - * Created on 19. April 2009, 16:50 - */ - -#ifndef _CMENUSETUPUPNP_H -#define _CMENUSETUPUPNP_H - -#include <vdr/plugin.h> -#include "../server/server.h" -#include "config.h" - -/** - * The VDR setup page - * - * This class shows and manages the settings within the VDR setup OSD - * - */ -class cMenuSetupUPnP : public cMenuSetupPage { -public: - cMenuSetupUPnP(); -// virtual ~cMenuSetupUPnP(); - /** - * Processes a keystroke - * - * This processes a keystroke which is done by the user and updates the - * menu accordingly - * - * It returns the current state of the VDR after pressing a key - * - * @return The current state of the VDR - */ - virtual eOSState ProcessKey( - eKeys Key ///< Key, pressed by the user - ); -protected: - /** - * Stores the setup information - * - * This stores the setup information in the configuration file - */ - virtual void Store(void); - /** - * Update the menu - * - * This updates the menu osd and refreshes the screen. - */ - void Update(void); - /** - * Loads the setup information - * - * This loads the setup information from the configuration file - */ - void Load(void); -private: - const char* const* getInterfaceList(int *count); - int getInterfaceIndex(const char* Interface); - const char* getInterface(int Index); - cOsdItem *mCtrlBind; - cOsdItem *mCtrlEnabled; - cOsdItem *mCtrlPort; - cOsdItem *mCtrlAutoMode; - cUPnPServer* mUpnpServer; - /** - * Is the server enabled or not - * - * The server can be switched on or off. If it is turned off, the server - * will close open transmissions and ports - * - */ - int mEnable; - int mAutoSetup; - /** - * The port to listen to (Default: 0 autodetect) - * - * The port the server is bound to. The default setting is 0. - * So, the server will determine automatically a free random port between - * 49152 and 65535. If a server should use a specific port it can be set - * to one out of that range. - * - */ - int mPort; - int mDetectPort; - /** - * The Interface the server is bound to - * - * If multiple interfaces exist the server can be bound to a specific - * one - * - */ - int mInterfaceIndex; - /** - * The socket address of the server - * - * The IP address and the port of the server - */ - char *mAddress; -}; - -#endif /* _CMENUSETUPUPNP_H */ - diff --git a/misc/search.h b/misc/search.h deleted file mode 100644 index ef162b1..0000000 --- a/misc/search.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * File: search.h - * Author: savop - * - * Created on 27. August 2009, 21:21 - */ - -#ifndef _SEARCH_H -#define _SEARCH_H - -#include <map> -#include <vdr/tools.h> -#include "util.h" - -/** - * Sort criteria - * - * This is a structure for sorting objects. It has a certain property and - * a direction flag. - */ -struct cSortCrit : public cListObject { - const char* Property; ///< the Property, which shall be sorted - bool SortDescending; ///< sort the objects in descending order -}; - -typedef std::map<const char*, const char*, strCmp> propertyMap; - -/** - * Web path parser - * - * Parses paths which came from the webserver. It splits the path into - * a section, a certain method and its properties. - * - * This can be used to easily determine which file was requested by a client - */ -class cPathParser { -private: - cString mKey; - propertyMap mProperties; - int mSection; - int mMethod; - bool parsePath(const char* Path, int* Section, int* Method, propertyMap* Properties); - void pushPropertyKey(const char* Start, const char* End); - void pushPropertyValue(const char* Start, const char* End); - void pushMethod(int Method); - void pushSection(int Section); - cPathParser(); -public: - virtual ~cPathParser(); - /** - * Parses the path - * - * This will parse the path and stores the result in the pointers given. - * - * @return returns - * - \bc true, if the parsing was successful - * - \bc false, otherwise - */ - static bool parse( - const char* Path, ///< the path which is parsed - int* Section, ///< the number of the registered section - int* Method, ///< the number of the registered method - propertyMap* Properties ///< the properties found in the path - ); -}; - -/** - * Creates a list with sort criteria - * - * This parser creates a list of sort criteria. It parses the sort criteria string - * from a \em Browse or \em Search request and stores the information in a \c cSortCrit - * structure. - */ -class cSortCriteria { -private: - cSortCrit* mCurrentCrit; - cList<cSortCrit>* mCriteriaList; - bool parseSort(const char* Sort); - void pushProperty(const char* Property); - void pushDirection(const char Direction); - cList<cSortCrit>* getSortList() const { return this->mCriteriaList; } - cSortCriteria(); -public: - virtual ~cSortCriteria(); - /** - * Parses the sort criteria - * - * This parses the sort criteria and returns a list with valid criterias - * - * @return returns - * - a list with valid sort criterias - * - \bc null, otherwise - */ - static cList<cSortCrit>* parse( - const char* Sort ///< the string container the sort criteria - ); -}; - -/** - * Parses the filter criteria - * - * This parses the filter criteria which comes from a \em Browse or \em Search - * request. - */ -class cFilterCriteria { -private: - cStringList* mFilterList; - cFilterCriteria(); - bool parseFilter(const char* Filter); - void pushProperty(const char* Property); - void pushAsterisk(const char Asterisk); - cStringList* getFilterList() const { return this->mFilterList; } -public: - virtual ~cFilterCriteria(); - /** - * Parses the filter criteria - * - * This parses the filter criteria. It may be a empty string list, a \bc NULL - * pointer or a list with properties which shall be shown in the \em DIDL-Lite fragment. - * - * @return the stringlist containing the filter - */ - static cStringList* parse( - const char* Filter ///< the filter string - ); -}; - -/** - * @private - * @todo This is implemented very soon - */ -class cSearch { -private: - char* SQLWhereStmt; - const char* CurrentProperty; - const char* CurrentOperator; - const char* CurrentValue; - static cSearch* mInstance; - cSearch(); - bool parseCriteria(const char* Search); - void pushExistance (const char* Exists); - void pushProperty (const char* Property); - void pushOperator (const char* Operator); - void pushConcatOp (const char* Operator); - void pushStartBrackedExp(const char); - void pushEndBrackedExp(const char); - void pushValue (const char* Start, const char* End); - void pushExpression(const char* Start, const char* End); -public: - virtual ~cSearch(); - static const char* parse(const char* Search); -}; - - -#endif /* _SEARCH_H */ - diff --git a/misc/util.h b/misc/util.h deleted file mode 100644 index e5bc061..0000000 --- a/misc/util.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * File: util.h - * Author: savop - * - * Created on 21. Mai 2009, 21:25 - */ - -#ifndef _UTIL_H -#define _UTIL_H - -#include <vdr/tools.h> -#include <vdr/plugin.h> -#include <upnp/ixml.h> - -#ifdef __cplusplus -extern "C" { -#if 0 -} -#endif -/** - * Compares two strings - * - * This struct compares two strings and returns true on equality or false otherwise - * It is used in conjuction with hashmaps - */ -struct strCmp { - /** - * Compares two strings - * @return returns - * - \bc true, in case of equality - * - \bc false, otherwise - * @param s1 the first string - * @param s2 the second string - */ - bool operator()(const char* s1, const char* s2) const { return (strcmp(s1,s2) < 0); } -}; -/** - * Gets the IP address - * - * Returns the IP address of a given interface. The interface must be a valid interface - * identifier like eth0 or wlan1. - * - * @return a structure containing the IP address - * @param Interface to obtain the IP from - */ -const sockaddr_in* getIPFromInterface(const char* Interface); -/** - * Gets the MAC address - * - * Returns a string representation of the MAC address of a given interface. The interface - * must be a valid interface identifier like eth0 or wlan1. - * - * The pattern of the address is sixth byte hex number separated with ":" - * - * @return a string containing the MAC - * @param Interface to obtain the MAC from - */ -const char* getMACFromInterface(const char* Interface); -/** - * List with interfaces - * - * Returns an array with interfaces found on the system. The number of items - * in the array is stored in the parameter \c count. - * - * @return array list of interfaces - * @param count number of interfaces in the array - */ -char** getNetworkInterfaces(int *count); -/** - * First occurance of item - * - * Finds the first occurance of a specified item in a given \bc IXML document and returns its value. - * If an error occures, its code is stored in the last parameter \c 'error'. - * - * @return the value of the item - * @param doc the \c IXML document to be parsed - * @param item the item which shall be found - * @param error the error code in case of an error - */ -char* ixmlGetFirstDocumentItem( IN IXML_Document * doc, IN const char *item, int* error ); -/** - * Adds a property - * - * This adds a UPnP property to an \bc IXML document. - * The property must have the pattern "namespace:property@attribute". - * - * @return returns - * - \bc <0, in case of an error - * - \bc 0, otherwise - * @param document the \c IXML document to put the parameter in - * @param node the specific node where to put the parameter - * @param upnpproperty the upnp property - * @param value the value of the upnp property - */ -int ixmlAddProperty(IN IXML_Document* document, IN IXML_Element* node, const char* upnpproperty, const char* value ); -/** - * creates a part of a string - * - * This creates a substring of a string which begins at the given offset and has the - * specified lenght. - * - * @return the new string - * @param str the full string - * @param offset the starting index - * @param length the length of the new string - */ -char* substr(const char* str, unsigned int offset, unsigned int length); - -char* duration(off64_t duration, unsigned int timeBase = 1); -#if 0 -{ -#endif -} -#endif - -/** - * Escapes XML special characters - * - * This function escapes XML special characters, which must be transformed before - * inserting it into another XML document. - * - * @return the escaped document - * @param Data the data to escape - * @param Buf the pointer where the escaped document shall be stored - */ -const char* escapeXMLCharacters(const char* Data, char** Buf); - -/** @private */ -class cMenuEditIpItem: public cMenuEditItem { -private: - char *value; - int curNum; - int pos; - bool step; -protected: - virtual void Set(void); -public: - cMenuEditIpItem(const char *Name, char *Value); // Value must be 16 bytes - ~cMenuEditIpItem(); - virtual eOSState ProcessKey(eKeys Key); -}; - -#endif /* _UTIL_H */ - |