diff options
Diffstat (limited to 'vdr-androvdr')
-rw-r--r-- | vdr-androvdr/.cproject | 143 | ||||
-rw-r--r-- | vdr-androvdr/.project | 79 | ||||
-rw-r--r-- | vdr-androvdr/COPYING | 340 | ||||
-rw-r--r-- | vdr-androvdr/HISTORY | 6 | ||||
-rw-r--r-- | vdr-androvdr/Makefile | 82 | ||||
-rw-r--r-- | vdr-androvdr/README | 8 | ||||
-rw-r--r-- | vdr-androvdr/androvdr.cpp | 122 | ||||
-rw-r--r-- | vdr-androvdr/androvdrthread.cpp | 62 | ||||
-rw-r--r-- | vdr-androvdr/androvdrthread.h | 36 | ||||
-rw-r--r-- | vdr-androvdr/handler.cpp | 92 | ||||
-rw-r--r-- | vdr-androvdr/handler.h | 20 | ||||
-rw-r--r-- | vdr-androvdr/helpers.cpp | 467 | ||||
-rw-r--r-- | vdr-androvdr/helpers.h | 37 | ||||
-rw-r--r-- | vdr-androvdr/select.cpp | 205 | ||||
-rw-r--r-- | vdr-androvdr/select.h | 41 | ||||
-rw-r--r-- | vdr-androvdr/sock.cpp | 286 | ||||
-rw-r--r-- | vdr-androvdr/sock.h | 63 |
17 files changed, 0 insertions, 2089 deletions
diff --git a/vdr-androvdr/.cproject b/vdr-androvdr/.cproject deleted file mode 100644 index f3eed9d..0000000 --- a/vdr-androvdr/.cproject +++ /dev/null @@ -1,143 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?fileVersion 4.0.0?> - -<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> - <storageModule moduleId="org.eclipse.cdt.core.settings"> - <cconfiguration id="cdt.managedbuild.toolchain.gnu.base.189548183"> - <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.189548183" moduleId="org.eclipse.cdt.core.settings" name="Default"> - <externalSettings/> - <extensions> - <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> - <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> - <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> - <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> - <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> - <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> - </extensions> - </storageModule> - <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.base.189548183" name="Default" parent="org.eclipse.cdt.build.core.emptycfg"> - <folderInfo id="cdt.managedbuild.toolchain.gnu.base.189548183.1555344799" name="/" resourcePath=""> - <toolChain id="cdt.managedbuild.toolchain.gnu.base.107645851" name="cdt.managedbuild.toolchain.gnu.base" superClass="cdt.managedbuild.toolchain.gnu.base"> - <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.229496351" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/> - <builder id="cdt.managedbuild.target.gnu.builder.base.325094895" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.base"/> - <tool id="cdt.managedbuild.tool.gnu.archiver.base.782170606" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> - <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1881829081" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/> - <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.2050235224" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"/> - <tool id="cdt.managedbuild.tool.gnu.c.linker.base.410295810" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/> - <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.1652873432" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/> - <tool id="cdt.managedbuild.tool.gnu.assembler.base.1996757503" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"/> - </toolChain> - </folderInfo> - </configuration> - </storageModule> - <storageModule moduleId="scannerConfiguration"> - <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> - <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="makefileGenerator"> - <runAction arguments="-E -P -v -dD" command="" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> - <buildOutputProvider> - <openAction enabled="true" filePath=""/> - <parser enabled="true"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile"> - <buildOutputProvider> - <openAction enabled="false" filePath=""/> - <parser enabled="false"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlc" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - <profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP"> - <buildOutputProvider> - <openAction enabled="false" filePath=""/> - <parser enabled="false"/> - </buildOutputProvider> - <scannerInfoProvider id="specsFile"> - <runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlC" useDefault="true"/> - <parser enabled="true"/> - </scannerInfoProvider> - </profile> - </storageModule> - <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> - </cconfiguration> - </storageModule> - <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <project id="vdr-vdrmanager.null.1041659956" name="vdr-vdrmanager"/> - </storageModule> -</cproject> diff --git a/vdr-androvdr/.project b/vdr-androvdr/.project deleted file mode 100644 index d38dd69..0000000 --- a/vdr-androvdr/.project +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>vdr-androvdr</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> - <triggers>clean,full,incremental,</triggers> - <arguments> - <dictionary> - <key>?name?</key> - <value></value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.append_environment</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.autoBuildTarget</key> - <value>all</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.buildArguments</key> - <value></value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.buildCommand</key> - <value>make</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.cleanBuildTarget</key> - <value>clean</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.contents</key> - <value>org.eclipse.cdt.make.core.activeConfigSettings</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.enableAutoBuild</key> - <value>false</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.enableCleanBuild</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.enableFullBuild</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.fullBuildTarget</key> - <value>all</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.stopOnError</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> - <value>true</value> - </dictionary> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> - <triggers>full,incremental,</triggers> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.cdt.core.cnature</nature> - <nature>org.eclipse.cdt.core.ccnature</nature> - <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> - <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> - </natures> -</projectDescription> diff --git a/vdr-androvdr/COPYING b/vdr-androvdr/COPYING deleted file mode 100644 index 5b6e7c6..0000000 --- a/vdr-androvdr/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/vdr-androvdr/HISTORY b/vdr-androvdr/HISTORY deleted file mode 100644 index cc16537..0000000 --- a/vdr-androvdr/HISTORY +++ /dev/null @@ -1,6 +0,0 @@ -VDR Plugin 'androvdr' Revision History ------------------------------------- - -2011-03-19: Version 0.1 - -- Initial revision.
\ No newline at end of file diff --git a/vdr-androvdr/Makefile b/vdr-androvdr/Makefile deleted file mode 100644 index 0027bb7..0000000 --- a/vdr-androvdr/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# -# Makefile for a Video Disk Recorder plugin -# -# $Id$ - -# The official name of this plugin. -# This name will be used in the '-P...' option of VDR to load the plugin. -# By default the main source file also carries this name. -# -PLUGIN = androvdr - -### The version number of this plugin (taken from the main source file): - -VERSION = $(shell grep 'const char \*VERSION *=' $(PLUGIN).cpp | awk '{ print $$5 }' | sed -e 's/[";]//g') - -### The C++ compiler and options: - -CXX ?= g++ -CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual -fPIC -g - -### The directory environment: - -DVBDIR = ../../../../DVB -VDRDIR = ../../.. -LIBDIR = ../../lib -TMPDIR = /tmp - -### Allow user defined options to overwrite defaults: - --include $(VDRDIR)/Make.config - -### The version number of VDR (taken from VDR's "config.h"): - -APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') - -### The name of the distribution archive: - -ARCHIVE = $(PLUGIN)-$(VERSION) -PACKAGE = vdr-$(ARCHIVE) - -### Includes and Defines (add further entries here): - -INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include - -DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' - -### The object files (add further files here): - -OBJS = $(PLUGIN).o sock.o androvdrthread.o select.o handler.o helpers.o - -### Implicit rules: - -%.o: %.cpp - $(CXX) -g $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< - -# Dependencies: - -MAKEDEP = $(CXX) -MM -MG -DEPFILE = .dependencies -$(DEPFILE): Makefile - @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@ - --include $(DEPFILE) - -### Targets: - -all: libvdr-$(PLUGIN).so - -libvdr-$(PLUGIN).so: $(OBJS) - $(CXX) -g $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) - -dist: clean - @-rm -rf $(TMPDIR)/$(ARCHIVE) - @mkdir $(TMPDIR)/$(ARCHIVE) - @cp -a * $(TMPDIR)/$(ARCHIVE) - @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) - @-rm -rf $(TMPDIR)/$(ARCHIVE) - @echo Distribution package created as $(PACKAGE).tgz - -clean: - @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ diff --git a/vdr-androvdr/README b/vdr-androvdr/README deleted file mode 100644 index 489499c..0000000 --- a/vdr-androvdr/README +++ /dev/null @@ -1,8 +0,0 @@ -This is a "plugin" for the Video Disk Recorder (VDR). - -See the file COPYING for license information. - -Description: - -This helper plugin allows remote programming VDR using -Andro-VDR running on Android devices.
\ No newline at end of file diff --git a/vdr-androvdr/androvdr.cpp b/vdr-androvdr/androvdr.cpp deleted file mode 100644 index 65e1646..0000000 --- a/vdr-androvdr/androvdr.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * vdrmon.c: A plugin for the Video Disk Recorder - * - * See the README file for copyright information and how to reach the author. - * - * $Id$ - */ - -#include <vdr/plugin.h> -#include <vdr/thread.h> -#include <vdr/status.h> -#include <vdr/device.h> -#include <vdr/player.h> -#include "androvdrthread.h" - -#define ANDROVDR_PORT 6420 - -const char *VERSION = "0.1"; -static const char *DESCRIPTION = "Andro-VDR support plugin"; - -class cPluginAndroVdr : public cPlugin { -private: - // Add any member variables or functions you may need here. - cAndroVdrThread * Thread; - int port; - const char * password; -protected: -public: - cPluginAndroVdr(void); - virtual ~cPluginAndroVdr(); - virtual const char *Version(void) { return VERSION; } - virtual const char *Description(void) { return DESCRIPTION; } - virtual const char *CommandLineHelp(void); - virtual bool Initialize(void); - virtual bool Start(void); - virtual void Stop(void); - virtual void Housekeeping(void); - virtual const char *MainMenuEntry(void) { return NULL; } - virtual cOsdObject *MainMenuAction(void); - virtual cMenuSetupPage *SetupMenu(void); - virtual bool ProcessArgs(int argc, char *argv[]); -}; - -cPluginAndroVdr::cPluginAndroVdr(void) -{ - // Initialize any member variables here. - // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL - // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! - Thread = NULL; - port = ANDROVDR_PORT; - password = ""; -} - -cPluginAndroVdr::~cPluginAndroVdr() -{ - // Clean up after yourself! -} - -cOsdObject * cPluginAndroVdr::MainMenuAction(void) -{ - return NULL; -} - -cMenuSetupPage * cPluginAndroVdr::SetupMenu(void) -{ - return NULL; -} - -const char * cPluginAndroVdr::CommandLineHelp(void) -{ - return " -p port port number to listen to\n" - " -P password password (none if not given)"; -} - -bool cPluginAndroVdr::ProcessArgs(int argc, char *argv[]) -{ - for(int i = 1; i < argc; i++) { - if (i < argc - 1) { - if (strcmp(argv[i], "-p") == 0) { - port = atoi(argv[++i]); - } else if (strcmp(argv[i], "-P") == 0) { - password = argv[++i]; - } - } - } - - // default port - if (port <= 0) - port = ANDROVDR_PORT; - - return true; -} - -bool cPluginAndroVdr::Initialize(void) -{ - // Initialize any background activities the plugin shall perform. - - // Start any background activities the plugin shall perform. - Thread = new cAndroVdrThread(port, password); - - return Thread != NULL; -} - -bool cPluginAndroVdr::Start(void) -{ - Thread->Start(); - - return true; -} - -void cPluginAndroVdr::Stop(void) -{ - // Stop any background activities the plugin shall perform. - Thread->Shutdown(); -} - -void cPluginAndroVdr::Housekeeping(void) -{ - // Perform any cleanup or other regular tasks. -} - -VDRPLUGINCREATOR(cPluginAndroVdr); // Don't touch this! diff --git a/vdr-androvdr/androvdrthread.cpp b/vdr-androvdr/androvdrthread.cpp deleted file mode 100644 index 3329e3e..0000000 --- a/vdr-androvdr/androvdrthread.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * VdrmonThread - */ -#include <string.h> -#include <vdr/plugin.h> -#include <vdr/thread.h> -#include "androvdrthread.h" -#include "select.h" -#include "helpers.h" - -cAndroVdrThread::cAndroVdrThread(int port, const char * password) -{ - select = NULL; - this->port = port; - this->password = password; -} - -cAndroVdrThread::~cAndroVdrThread() -{ - Cleanup(); -} - -void cAndroVdrThread::Action(void) -{ - // create listener socket - if (!Init()) - return; - - // do processing - select->Action(); - - // cleanup - Cleanup(); -} - -bool cAndroVdrThread::Init() -{ - // create select - select = new cSelect(); - if (select == NULL) - return false; - - // create server socket - cVdrmanagerServerSocket * sock = new cVdrmanagerServerSocket(); - if (sock == NULL || !sock->Create(port, password)) - return false; - - // register server socket - select->SetServerSocket(sock); - - return true; -} - -void cAndroVdrThread::Cleanup() -{ - if (select) - delete select; -} - -void cAndroVdrThread::Shutdown() -{ -} diff --git a/vdr-androvdr/androvdrthread.h b/vdr-androvdr/androvdrthread.h deleted file mode 100644 index 320f4ee..0000000 --- a/vdr-androvdr/androvdrthread.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * VdrmonThread - */ - -#ifndef _VDRMON_THREAD -#define _VDRMON_THREAD - -#include <sys/poll.h> -#include <vdr/plugin.h> -#include <vdr/thread.h> -#include <vdr/device.h> -#include <vdr/player.h> -#include <string> - -using namespace std; - -class cSelect; - -class cAndroVdrThread : public cThread { -private: - cSelect * select; - int port; - const char * password; -public: - cAndroVdrThread(int port, const char * password); - virtual void Action(void); - void Shutdown(); -private: - virtual ~cAndroVdrThread(); - void Cleanup(); - bool Init(); -}; - -#endif - - diff --git a/vdr-androvdr/handler.cpp b/vdr-androvdr/handler.cpp deleted file mode 100644 index 18f6e02..0000000 --- a/vdr-androvdr/handler.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * event und message handler - */ - -#include <unistd.h> -#include <vdr/plugin.h> -#include <vdr/timers.h> -#include "sock.h" -#include "select.h" -#include "androvdrthread.h" -#include "helpers.h" - -bool cHandler::HandleNewClient(cVdrmanagerClientSocket * sock) -{ - return true; -} - -bool cHandler::HandleClientRequest(cVdrmanagerClientSocket * sock) -{ - while(sock->Read()) - { - // get lines - while (sock->IsLineComplete()) - { - string line; - sock->GetLine(line); - - // parse request - size_t space = line.find(' '); - string cmd; - string args; - if (space != string::npos) { - cmd = cHelpers::ToUpper(line.substr(0, space)); - args = cHelpers::Trim(line.substr(space+1)); - } else { - cmd = cHelpers::ToUpper(line); - args = ""; - } - - if (!sock->IsLoggedIn() && cmd != "PASSWD") { - sock->PutLine("!ERROR\r\n"); - } - else if (cmd == "PASSWD") - { - if (args != sock->GetPassword()) { - sock->PutLine("!ERROR\r\n"); - } else { - sock->SetLoggedIn(); - sock->PutLine("!OK\r\n"); - } - } - else if (cmd == "TIMERS") - { - string text = cHelpers::GetTimers(args); - sock->PutLine(text); - } - else if (cmd == "CHANNELS") - { - string text = cHelpers::GetChannels(args); - sock->PutLine(text); - } - else if (cmd == "TEVENTS") - { - string text = cHelpers::GetTimeEvents(args); - sock->PutLine(text); - } - else if (cmd == "CEVENTS") - { - string text = cHelpers::GetChannelEvents(args); - sock->PutLine(text); - } - else if (cmd == "TIMER") - { - string text = cHelpers::SetTimer(args); - sock->PutLine(text); - } - else if (cmd == "SEARCH") - { - string text = cHelpers::SearchEvents(args); - sock->PutLine(text); - } - else if (cmd == "QUIT") - { - // close socket - sock->PutLine(string("Good bye! :-)\n")); - sock->Disconnect(); - } - } - } - - return true; -} diff --git a/vdr-androvdr/handler.h b/vdr-androvdr/handler.h deleted file mode 100644 index 660d4a1..0000000 --- a/vdr-androvdr/handler.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * message and event handling - */ - -#ifndef _VDRMON_HANDLER -#define _VDRMON_HANDLER - - -class cVdrmanagerSocket; -class cSelect; -class cHandler -{ -public: - bool HandleNewClient(cVdrmanagerClientSocket * sock); - bool HandleVdrEvent(cVdrmanagerClientSocket * sock, string& msg); - bool HandleClientRequest(cVdrmanagerClientSocket * sock); - bool HandleNewClient(cSelect * select, cVdrmanagerClientSocket * sock); -}; - -#endif diff --git a/vdr-androvdr/helpers.cpp b/vdr-androvdr/helpers.cpp deleted file mode 100644 index 73ad778..0000000 --- a/vdr-androvdr/helpers.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/* - * event und message handler - */ - -#include <time.h> -#include <unistd.h> -#include <values.h> -#include <vdr/plugin.h> -#include <vdr/timers.h> -#include <vdr/channels.h> -#include <vdr/epg.h> -#include <vdr/videodir.h> -#include "helpers.h" -#include "androvdrthread.h" - -string cHelpers::GetTimers(string args) { - return SafeCall(GetTimersIntern); -} - -string cHelpers::GetChannels(string args) { - return SafeCall(GetChannelsIntern, args); -} - -string cHelpers::GetChannelEvents(string args) { - return SafeCall(GetEventsIntern, Trim(args), ""); -} - -string cHelpers::GetTimeEvents(string args) { - - args = Trim(args); - - size_t space = args.find(' '); - if (space == string::npos) { - return SafeCall(GetEventsIntern, "", args); - } - - string when = args.substr(0, space); - string wantedChannels = args.substr(space+1); - - return SafeCall(GetEventsIntern, Trim(wantedChannels), Trim(when)); -} - -string cHelpers::SetTimer(string args) { - return SafeCall(SetTimerIntern, args); -} - -string cHelpers::SearchEvents(string args) { - - args = Trim(args); - - size_t space = args.find(' '); - if (space == string::npos) { - return "!ERROR\r\n"; - } - - string wantedChannels = args.substr(0, space); - string pattern = args.substr(space+1); - - return SafeCall(SearchEventsIntern, Trim(wantedChannels), Trim(pattern)); - -} - -string cHelpers::GetTimersIntern() { - - string result = "START\r\n"; - - // iterate through all timers - for(cTimer * timer = Timers.First(); timer; timer = Timers.Next(timer)) { - result += ToText(timer); - } - - return result + "END\r\n"; -} - -string cHelpers::GetChannelsIntern(string wantedChannels) { - - string result = "START\r\n"; - string currentGroup = ""; - - char number[10]; - for(cChannel * channel = Channels.First(); channel; channel = Channels.Next(channel)) { - - // channel group - if (channel->GroupSep()) { - currentGroup = channel->Name(); - continue; - } - - // channel filtering - if (IsWantedChannel(channel, wantedChannels)) { - // current group - if (currentGroup.length() > 0) { - result += "C0:"; - result += currentGroup; - result += "\r\n"; - currentGroup = ""; - } - - // channel - sprintf(number, "C%d", channel->Number()); - result += number; - result += ":"; - result += channel->Name(); - result += "\r\n"; - } - } - - return result + "END\r\n"; -} - -string cHelpers::GetEventsIntern(string wantedChannels, string when) { - - when = ToUpper(when); - time_t wantedTime; - if (when == "NOW" || when == "NEXT") { - wantedTime = time(0); - } else { - wantedTime = atol(when.c_str()); - } - - string result = "START\r\n"; - - cSchedulesLock schedulesLock; - const cSchedules * schedules = cSchedules::Schedules(schedulesLock); - for(cSchedule * schedule = schedules->First(); schedule; schedule = schedules->Next(schedule)) { - - cChannel * channel = Channels.GetByChannelID(schedule->ChannelID()); - if (!IsWantedChannel(channel, wantedChannels)) { - continue; - } - - const cList<cEvent> * events = schedule->Events(); - for(cEvent * event = events->First(); event; event = events->Next(event)) { - if (IsWantedTime(wantedTime, event)) { - cEvent * match = event; - if (when == "NEXT") { - match = events->Next(match); - if (!match) { - break; - } - } - - result += ToText(match); - - if (when.length() > 0) { - break; - } - } - } - } - - return result + "END\r\n"; -} - -string cHelpers::SetTimerIntern(string args) { - - // separete timer number - size_t sep = args.find(':'); - if (sep == string::npos) { - return "!ERROR\r\n"; - } - int number = atoi(args.c_str()); - bool delTimer = number < 0; - if (delTimer) { - number = -number; - } - string params = args.substr(sep+1); - - // parse timer - cTimer * timer = new cTimer; - if (!timer->Parse(params.c_str())) { - delete timer; - return "!ERROR\r\n"; - } - - if (!number) { - // new timer - Timers.Add(timer); - } else { - // modify timer - delete timer; - cTimer * oldTimer = Timers.Get(number); - if (!oldTimer) { - return "!ERROR\r\n"; - } - if (delTimer) { - Timers.Del(oldTimer, true); - } else { - oldTimer->Parse(params.c_str()); - } - } - Timers.Save(); - - return "START\r\nEND\r\n"; -} - - -string cHelpers::SearchEventsIntern(string wantedChannels, string pattern) { - - string result = "START\r\n"; - - cSchedulesLock schedulesLock; - const cSchedules * schedules = cSchedules::Schedules(schedulesLock); - for(cSchedule * schedule = schedules->First(); schedule; schedule = schedules->Next(schedule)) { - - cChannel * channel = Channels.GetByChannelID(schedule->ChannelID()); - if (!IsWantedChannel(channel, wantedChannels)) { - continue; - } - - const cList<cEvent> * events = schedule->Events(); - for(cEvent * event = events->First(); event; event = events->Next(event)) { - - if (IsWantedEvent(event, pattern)) { - result += ToText(event); - } - } - } - - return result + "END\r\n"; -} - -string cHelpers::ToText(cTimer * timer) { - - const char * channelName = timer->Channel()->Name(); - - string result; - char buf[100]; - sprintf(buf, "T%d", timer->Index()); - result = buf; - result += ":"; - sprintf(buf, "%u", timer->Flags()); - result += buf; - result += ":"; - sprintf(buf, "%d", timer->Channel()->Number()); - result += buf; - result += ":"; - result += channelName; - result += ":"; - sprintf(buf, "%lu", timer->StartTime()); - result += buf; - result += ":"; - sprintf(buf, "%lu", timer->StopTime()); - result += buf; - result += ":"; - sprintf(buf, "%d", timer->Priority()); - result += buf; - result += ":"; - sprintf(buf, "%d", timer->Lifetime()); - result += buf; - result += ":"; - result += MapSpecialChars(timer->File()); - result += ":"; - result += MapSpecialChars(timer->Aux() ? timer->Aux() : ""); - result += "\r\n"; - - return result; -} - -string cHelpers::ToText(cEvent * event) { - - - cChannel * channel = Channels.GetByChannelID(event->Schedule()->ChannelID()); - - // search assigned timer - cTimer * eventTimer = NULL; - for(cTimer * timer = Timers.First(); timer; timer = Timers.Next(timer)) { - if (timer->Channel() == channel && timer->StartTime() <= event->StartTime() && - timer->StopTime() >= event->StartTime() + event->Duration()) { - eventTimer = timer; - } - } - - char buf[100]; - string result; - sprintf(buf, "E%d", channel->Number()); - result = buf; - result += ":"; - result += channel->Name(); - result += ":"; - sprintf(buf, "%lu", event->StartTime()); - result += buf; - result += ":"; - sprintf(buf, "%lu", event->StartTime() + event->Duration()); - result += buf; - result += ":"; - result += MapSpecialChars(event->Title()); - result += ":"; - result += MapSpecialChars(event->Description() ? event->Description() : ""); - result += "\r\n"; - - if (eventTimer) { - result += ToText(eventTimer); - } - - return result; -} - -bool cHelpers::IsWantedEvent(cEvent * event, string pattern) { - - string text = event->Title(); - if (event->Description()) { - text += event->Description(); - } - - return ToUpper(text).find(ToUpper(pattern)) != string::npos; -} - -bool cHelpers::IsWantedChannel(cChannel * channel, string wantedChannels) { - - if (!channel) { - return false; - } - - if (wantedChannels.length() == 0) { - return true; - } - - int number = channel->Number(); - const char * delims = ",;"; - char * state; - char * buffer = (char *)malloc(wantedChannels.size()+1); - strcpy(buffer, wantedChannels.c_str()); - - bool found = false; - for(char * token = strtok_r(buffer, delims, &state); token; token = strtok_r(NULL, delims, &state)) { - const char * rangeSep = strchr(token, '-'); - if (rangeSep == NULL) { - // single channel - if (atoi(token) == number) { - found = true; - } - } else { - // channel range - int start = atoi(token); - while (*rangeSep && *rangeSep == '-') - rangeSep++; - int end = *rangeSep ? atoi(rangeSep) : INT_MAX; - - if (start <= number && number <= end) { - found = true; - } - } - } - return found; -} - -bool cHelpers::IsWantedTime(time_t when, cEvent * event) { - - time_t startTime = event->StartTime(); - time_t stopTime = startTime + event->Duration(); - - if (when == 0) { - return stopTime >= time(0); - } - - return startTime <= when && when < stopTime; -} - -string cHelpers::ToUpper(string text) -{ - for(unsigned i = 0; i < text.length(); i++) - { - if (islower(text[i])) - text[i] = toupper(text[i]); - } - - return text; -} - -string cHelpers::Trim(string text) { - - const char * start = text.c_str(); - - // skip leading spaces - const char * first = start; - while (*first && isspace(*first)) - first++; - - // find trailing spaces - const char * last = first + strlen(first) - 1; - while (first < last && isspace(*last)) - last--; - - char * dst = (char *)malloc(last - first + 2); - sprintf(dst, "%*s", last - first + 1, first); - - return dst; -} - -string cHelpers::SafeCall(string (*f)()) -{ - // loop, if vdr modified list and we crash - for (int i = 0; i < 3; i++) - { - try - { - return f(); - } - catch (...) - { - usleep(100); - } - } - - return ""; -} - -string cHelpers::SafeCall(string (*f)(string arg), string arg) -{ - // loop, if vdr modified list and we crash - for (int i = 0; i < 3; i++) - { - try - { - return f(arg); - } - catch (...) - { - usleep(100); - } - } - - return ""; -} - - -string cHelpers::SafeCall(string (*f)(string arg1, string arg2), string arg1, string arg2) -{ - // loop, if vdr modified list and we crash - for (int i = 0; i < 3; i++) - { - try - { - return f(arg1, arg2); - } - catch (...) - { - usleep(100); - } - } - - return ""; -} - -string cHelpers::MapSpecialChars(string text) { - - const char * p = text.c_str(); - string result = ""; - while (*p) { - switch (*p) { - case ':': - result += "|##"; - break; - case '\r': - break; - case '\n': - result += "||#"; - break; - default: - result += *p; - break; - } - p++; - } - return result; -} diff --git a/vdr-androvdr/helpers.h b/vdr-androvdr/helpers.h deleted file mode 100644 index 7fc38d4..0000000 --- a/vdr-androvdr/helpers.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * helper tools - */ - -#include <time.h> -#include <string> -#include <vdr/epg.h> - -using namespace std; - -class cHelpers -{ -public: - static string GetTimers(string args); - static string GetChannels(string args); - static string GetChannelEvents(string args); - static string GetTimeEvents(string args); - static string SetTimer(string args); - static string SearchEvents(string args); - static string ToUpper(string text); - static string Trim(string text); -private: - static string SafeCall(string (*)()); - static string SafeCall(string (*)(string), string arg); - static string SafeCall(string (*)(string, string), string arg1, string arg2); - static string GetTimersIntern(); - static string GetChannelsIntern(string wantedChannels); - static string GetEventsIntern(string wantedChannels, string when); - static string SetTimerIntern(string args); - static string SearchEventsIntern(string wantedChannels, string pattern); - static bool IsWantedEvent(cEvent * event, string pattern); - static bool IsWantedChannel(cChannel * channel, string wantedChannels); - static bool IsWantedTime(time_t when, cEvent * event); - static string MapSpecialChars(string text); - static string ToText(cEvent * event); - static string ToText(cTimer * timer); -}; diff --git a/vdr-androvdr/select.cpp b/vdr-androvdr/select.cpp deleted file mode 100644 index 1a463b1..0000000 --- a/vdr-androvdr/select.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * select - */ - -#include <sys/select.h> -#include <vdr/plugin.h> -#include <vdr/timers.h> -#include "sock.h" -#include "select.h" -#include "handler.h" -#include "helpers.h" - -struct node -{ - cVdrmanagerClientSocket * socket; - node * next; -}; - -cSelect::cSelect() -{ - serversocket = NULL; - clientsockets = NULL; - clientsocketcount = 0; - handler = new cHandler; - pollfds = NULL; - stopped = false; - nexttimer = 0; - shutdown = 0; -} - -cSelect::~cSelect() -{ - if (serversocket) - delete serversocket; - - while(clientsockets) - { - node * next = clientsockets->next; - delete clientsockets->socket; - delete clientsockets; - clientsockets = next; - } - - if (handler) - delete handler; - - if (pollfds) - delete pollfds; -} - -void cSelect::SetServerSocket(cVdrmanagerServerSocket * sock) -{ - serversocket = sock; -} - -void cSelect::AddClientSocket(cVdrmanagerClientSocket * sock) -{ - // remember socket - node * newnode = new node; - newnode->next = clientsockets; - newnode->socket = sock; - clientsockets = newnode; - clientsocketcount++; -} - -void cSelect::RemoveClientSocket(cVdrmanagerClientSocket * sock) -{ - node * curnode = clientsockets; - node * lastnode = NULL; - while(curnode) - { - if (curnode->socket == sock) - { - // unlink node - if (lastnode) - lastnode->next = curnode->next; - else - clientsockets = curnode->next; - - // free socket and node - delete curnode->socket; - delete curnode; - - clientsocketcount--; - break; - } - lastnode = curnode; - curnode = curnode->next; - } - - if (clientsockets) - { - curnode = clientsockets; - while (curnode) - { - curnode = curnode->next; - } - } -} - -cVdrmanagerClientSocket * cSelect::GetClientSocket(int sock) -{ - node * curnode = clientsockets; - while (curnode) - { - if (curnode->socket->GetSocket() == sock) - return curnode->socket; - curnode = curnode->next; - } - - return NULL; -} - -bool cSelect::Action() -{ - for(;!stopped;) - { - if (!Poll()) - return false; - } - - return true; -} - -void cSelect::CreatePollfds() -{ - // construct pollfd array - // we need one pollfd for the eventpipe, - // the serversocket and each clientsocket - pollfds = new struct pollfd[clientsocketcount+1]; - pollfds[0].fd = serversocket->GetSocket(); - pollfds[0].events = POLLIN; - - node * curnode = clientsockets; - int i = 1; - while (curnode) - { - pollfds[i].fd = curnode->socket->GetSocket(); - pollfds[i].events = POLLIN; - if (curnode->socket->WritePending()) - pollfds[i].events |= POLLOUT; - pollfds[i++].revents = 0; - curnode = curnode->next; - } -} - -bool cSelect::Poll() -{ - // poll for events - CreatePollfds(); - int rc = poll(pollfds, clientsocketcount+1, -1); - if (rc < 0) - { - LOG_ERROR; - delete pollfds; - return false; - } - - // timeout? - if (rc == 0) - return true; - - // client requests or outstanding writes - for(int i = 1; i < clientsocketcount+1; i++) - { - cVdrmanagerClientSocket * sock = GetClientSocket(pollfds[i].fd); - if (sock) - { - if (pollfds[i].revents & (POLLIN|POLLHUP)) - { - // client request - handler->HandleClientRequest(sock); - - // disconnect? - if (sock->Disconnected()) - { - RemoveClientSocket(sock); - } - } - else if (pollfds[i].revents & POLLOUT) - { - // possibly outstanding writes - sock->Flush(); - } - } - } - - // new client? - if (pollfds[0].revents & POLLIN) - { - // get client socket - cVdrmanagerClientSocket * sock = serversocket->Accept(); - if (sock) - { - // Add client socket - AddClientSocket(sock); - // Send current data - handler->HandleNewClient(sock); - } - } - - delete pollfds; - - return true; -} diff --git a/vdr-androvdr/select.h b/vdr-androvdr/select.h deleted file mode 100644 index fbdeb02..0000000 --- a/vdr-androvdr/select.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * encapsulated poll - */ - -#ifndef _VDRMON_SELECT -#define _VDRMON_SELECT - -#include <string> -#include <sys/select.h> -#include "sock.h" -#include "handler.h" - -struct node; -class cSelect -{ -private: - node * clientsockets; - int clientsocketcount; - cVdrmanagerServerSocket * serversocket; - cHandler * handler; - struct pollfd * pollfds; - bool stopped; - time_t nexttimer; - time_t shutdown; -public: - cSelect(); - virtual ~cSelect(); - void DispatchVdrEvent(string event); - void SetServerSocket(cVdrmanagerServerSocket * sock); - void AddClientSocket(cVdrmanagerClientSocket * sock); - void RemoveClientSocket(cVdrmanagerClientSocket * sock); - bool Action(); - bool Stop(); -private: - void CreatePollfds(); - cVdrmanagerClientSocket * GetClientSocket(int fd); - bool Poll(); - void NotifyClients(string event); -}; - -#endif diff --git a/vdr-androvdr/sock.cpp b/vdr-androvdr/sock.cpp deleted file mode 100644 index 80b03b2..0000000 --- a/vdr-androvdr/sock.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/* - * extendes sockets - */ -#include <unistd.h> -#include <vdr/plugin.h> -#include "sock.h" - -static int clientno = 0; - -/* - * cVdrmonSocket - */ -cVdrmanagerSocket::cVdrmanagerSocket() -{ - sock = -1; -} - -cVdrmanagerSocket::~cVdrmanagerSocket() -{ - Close(); -} - -void cVdrmanagerSocket::Close() -{ - if (socket >= 0) - { - close(sock); - sock = -1; - } -} - -int cVdrmanagerSocket::GetSocket() -{ - return sock; -} - -bool cVdrmanagerSocket::MakeDontBlock() -{ - // make it non-blocking: - int oldflags = fcntl(sock, F_GETFL, 0); - if (oldflags < 0) { - LOG_ERROR; - return false; - } - oldflags |= O_NONBLOCK; - if (fcntl(sock, F_SETFL, oldflags) < 0) { - LOG_ERROR; - return false; - } - - return true; -} - -const char * cVdrmanagerSocket::GetPassword() { - return password; -} - -/* - * cVdrmonServerSocket - */ -cVdrmanagerServerSocket::cVdrmanagerServerSocket() : cVdrmanagerSocket() -{ -} - -cVdrmanagerServerSocket::~cVdrmanagerServerSocket() -{ -} - -bool cVdrmanagerServerSocket::Create(int port, const char * password) -{ - // save password - this->password = password; - - // create socket - sock = socket(PF_INET, SOCK_STREAM, 0); - if (sock < 0) { - LOG_ERROR; - return false; - } - - // allow it to always reuse the same port: - int ReUseAddr = 1; - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &ReUseAddr, sizeof(ReUseAddr)); - - // bind to address - struct sockaddr_in name; - name.sin_family = AF_INET; - name.sin_port = htons(port); - name.sin_addr.s_addr = htonl(INADDR_ANY); - if (bind(sock, (struct sockaddr *)&name, sizeof(name)) < 0) { - LOG_ERROR; - Close(); - return false; - } - - // make it non-blocking: - if (!MakeDontBlock()) - { - Close(); - return false; - } - - // listen to the socket: - if (listen(sock, 100) < 0) { - LOG_ERROR; - Close(); - return false; - } - - return true; -} - -cVdrmanagerClientSocket * cVdrmanagerServerSocket::Accept() -{ - cVdrmanagerClientSocket * newsocket = NULL; - - // accept the connection - struct sockaddr_in clientname; - uint size = sizeof(clientname); - int newsock = accept(sock, (struct sockaddr *)&clientname, &size); - if (newsock > 0) - { - // create client socket - newsocket = new cVdrmanagerClientSocket(password); - if (!newsocket->Attach(newsock)) - { - delete newsocket; - return NULL; - } - - bool accepted = SVDRPhosts.Acceptable(clientname.sin_addr.s_addr); - if (!accepted) - { - newsocket->PutLine(string("NACC Access denied.\n")); - newsocket->Flush(); - delete newsocket; - newsocket = NULL; - } - dsyslog("[vdrmon] connect from %s, port %hd - %s", - inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port), - accepted ? "accepted" : "DENIED"); - } - else if (errno != EINTR && errno != EAGAIN) - LOG_ERROR; - - return newsocket; -} - -/* - * cVdrmonClientSocket - */ -cVdrmanagerClientSocket::cVdrmanagerClientSocket(const char * password) -{ - readbuf = writebuf = ""; - disconnected = false; - client = ++clientno; - this->password = password; - login = false; -} - -cVdrmanagerClientSocket::~cVdrmanagerClientSocket() -{ -} - -bool cVdrmanagerClientSocket::IsLineComplete() -{ - // check a for complete line - string::size_type pos = readbuf.find("\r", 0); - if (pos == string::npos) - pos = readbuf.find("\n"); - return pos != string::npos; -} - -bool cVdrmanagerClientSocket::GetLine(string& line) -{ - // check the line - string::size_type pos = readbuf.find("\r", 0); - if (pos == string::npos) - pos = readbuf.find("\n", 0); - if (pos == string::npos) - return false; - - // extract the line ... - line = readbuf.substr(0, pos); - - // handle \r\n - if (readbuf[pos] == '\r' && readbuf.length() > pos && readbuf[pos+1] == '\n') - pos++; - - // ... and move the remainder - readbuf = readbuf.substr(pos+1); - - return true; -} - -bool cVdrmanagerClientSocket::Read() -{ - if (Disconnected()) - return false; - - int rc; - bool len = 0; - char buf[2001]; - while ((rc = read(sock, buf, sizeof(buf)-1)) > 0) - { - buf[rc] = 0; - readbuf += buf; - len += rc; - } - - if (rc < 0 && errno != EAGAIN) - { - LOG_ERROR; - return false; - } - else if (rc == 0) - { - disconnected = true; - } - - return len > 0; -} - -bool cVdrmanagerClientSocket::Disconnected() -{ - return disconnected; -} - -void cVdrmanagerClientSocket::Disconnect() -{ - disconnected = true; -} - -bool cVdrmanagerClientSocket::PutLine(string line) -{ - // add line to write buffer - writebuf += line; - - // data present? - if (writebuf.length() > 0) - { - // write so many bytes as possible - int rc = write(sock, writebuf.c_str(), writebuf.length()); - if (rc < 0 && errno != EAGAIN) - { - LOG_ERROR; - return false; - } - - // move the remainder - if (rc > 0) - writebuf = writebuf.substr(rc, writebuf.length()-rc); - } - - return true; -} - -bool cVdrmanagerClientSocket::Flush() -{ - string empty = ""; - return PutLine(empty); -} - -bool cVdrmanagerClientSocket::Attach(int fd) -{ - sock = fd; - return MakeDontBlock(); -} - -int cVdrmanagerClientSocket::GetClientId() -{ - return client; -} - -bool cVdrmanagerClientSocket::WritePending() -{ - return writebuf.length() > 0; -} - -bool cVdrmanagerClientSocket::IsLoggedIn() { - return login || !password || !*password; -} - -void cVdrmanagerClientSocket::SetLoggedIn() { - login = true; -} diff --git a/vdr-androvdr/sock.h b/vdr-androvdr/sock.h deleted file mode 100644 index 260efed..0000000 --- a/vdr-androvdr/sock.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * extendes sockets - */ - -#ifndef _VDRMON_SOCK -#define _VDRMON_SOCK - -#include <sys/types.h> -#include <sys/socket.h> -#include <string> - -using namespace std; - -class cVdrmanagerSocket -{ -protected: - int sock; - const char * password; -protected: - cVdrmanagerSocket(); -public: - virtual ~cVdrmanagerSocket(); - void Close(); - int GetSocket(); - bool MakeDontBlock(); - const char * GetPassword(); -}; - -class cVdrmanagerClientSocket : public cVdrmanagerSocket -{ -private: - string readbuf; - string writebuf; - bool disconnected; - int client; - bool login; -public: - cVdrmanagerClientSocket(const char * password); - virtual ~cVdrmanagerClientSocket(); - bool Attach(int fd); - bool IsLineComplete(); - bool GetLine(string& line); - bool PutLine(string line); - bool Read(); - bool Disconnected(); - void Disconnect(); - bool Flush(); - int GetClientId(); - bool WritePending(); - bool IsLoggedIn(); - void SetLoggedIn(); -}; - -class cVdrmanagerServerSocket : public cVdrmanagerSocket -{ -public: - cVdrmanagerServerSocket(); - virtual ~cVdrmanagerServerSocket(); - bool Create(int port, const char * password); - cVdrmanagerClientSocket * Accept(); -}; - -#endif |