summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-14 15:41:13 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-14 15:41:13 +0300
commit404e6d597145751d4b829774f9bc56f44e1fa9fc (patch)
tree60015376de8b9e29c0e41b8d2efa699072e86ad2 /seggetd
parentAdd arguments to request tool: --help, --keep-pkglist-file. (diff)
downloadidfetch-404e6d597145751d4b829774f9bc56f44e1fa9fc.tar.gz
idfetch-404e6d597145751d4b829774f9bc56f44e1fa9fc.tar.bz2
idfetch-404e6d597145751d4b829774f9bc56f44e1fa9fc.zip
Move /tmp folders/files to /var/tmp
Diffstat (limited to 'seggetd')
-rw-r--r--seggetd/COPYING.GPLv2339
-rw-r--r--seggetd/COPYING.GPLv3674
-rw-r--r--seggetd/COPYING.LGPLv2.1504
-rw-r--r--seggetd/COPYING.LGPLv3165
-rw-r--r--seggetd/Makefile44
-rw-r--r--seggetd/checksum.cpp188
-rw-r--r--seggetd/checksum.h49
-rw-r--r--seggetd/client.cpp0
-rw-r--r--seggetd/config.cpp196
-rw-r--r--seggetd/config.h54
-rw-r--r--seggetd/connection.cpp350
-rw-r--r--seggetd/connection.h81
-rw-r--r--seggetd/distfile.cpp982
-rw-r--r--seggetd/distfile.h172
-rw-r--r--seggetd/distfiles/.gitignore0
-rwxr-xr-xseggetd/init.d/seggetd90
-rw-r--r--seggetd/log.cpp179
-rw-r--r--seggetd/log.h48
-rw-r--r--seggetd/logs/.gitignore0
-rw-r--r--seggetd/mirror.cpp137
-rw-r--r--seggetd/mirror.h66
-rw-r--r--seggetd/network.cpp169
-rw-r--r--seggetd/network.h145
-rw-r--r--seggetd/network0.conf293
-rw-r--r--seggetd/network0_mirrors.conf1
-rw-r--r--seggetd/networkbroker.cpp97
-rw-r--r--seggetd/networkbroker.h60
-rw-r--r--seggetd/phase.cpp37
-rw-r--r--seggetd/phase.h43
-rw-r--r--seggetd/pkg.cpp135
-rw-r--r--seggetd/pkg.h70
-rw-r--r--seggetd/pkg.list1248
-rw-r--r--seggetd/provide_mirror_dir/.gitignore0
-rw-r--r--seggetd/proxyfetcher.cpp146
-rw-r--r--seggetd/proxyfetcher.h45
-rw-r--r--seggetd/requestserver.cpp145
-rw-r--r--seggetd/requestserver.h45
-rw-r--r--seggetd/response.cpp67
-rw-r--r--seggetd/response.h69
-rw-r--r--seggetd/responses.h57
-rw-r--r--seggetd/restrict.conf2
-rw-r--r--seggetd/scripts/client.py7
-rw-r--r--seggetd/scripts/functions.py77
-rw-r--r--seggetd/scripts/net0.py15
-rw-r--r--seggetd/scriptserver.cpp322
-rw-r--r--seggetd/scriptserver.h73
-rw-r--r--seggetd/seggetd.conf463
-rw-r--r--seggetd/seggetd.cpp557
-rw-r--r--seggetd/seggetd.h81
-rw-r--r--seggetd/segment.cpp235
-rw-r--r--seggetd/segment.h100
-rw-r--r--seggetd/settings.cpp150
-rw-r--r--seggetd/settings.h169
-rw-r--r--seggetd/shorttypes.h33
-rw-r--r--seggetd/stats.cpp97
-rw-r--r--seggetd/stats.h82
-rw-r--r--seggetd/str.cpp159
-rw-r--r--seggetd/str.h51
-rw-r--r--seggetd/tmp/.gitignore0
-rw-r--r--seggetd/tui.cpp105
-rw-r--r--seggetd/tui.h61
-rw-r--r--seggetd/ui_server.cpp747
-rw-r--r--seggetd/ui_server.h85
-rw-r--r--seggetd/utils.cpp124
-rw-r--r--seggetd/utils.h41
-rw-r--r--seggetd/webui/img/blue_progress.jpgbin0 -> 815 bytes
-rw-r--r--seggetd/webui/img/bw_progress.jpgbin0 -> 727 bytes
-rw-r--r--seggetd/webui/img/connections.jpgbin0 -> 5382 bytes
-rw-r--r--seggetd/webui/img/distfiles.pngbin0 -> 6761 bytes
-rw-r--r--seggetd/webui/img/errors_log.jpgbin0 -> 4754 bytes
-rw-r--r--seggetd/webui/img/favicon.icobin0 -> 15086 bytes
-rw-r--r--seggetd/webui/img/green_progress.jpgbin0 -> 876 bytes
-rw-r--r--seggetd/webui/img/log.pngbin0 -> 3771 bytes
-rw-r--r--seggetd/webui/img/mirrors.jpgbin0 -> 7609 bytes
-rw-r--r--seggetd/webui/img/rss.jpgbin0 -> 4591 bytes
-rw-r--r--seggetd/webui/img/stats.jpgbin0 -> 4360 bytes
76 files changed, 11026 insertions, 0 deletions
diff --git a/seggetd/COPYING.GPLv2 b/seggetd/COPYING.GPLv2
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/seggetd/COPYING.GPLv2
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser General
+Public License instead of this License.
diff --git a/seggetd/COPYING.GPLv3 b/seggetd/COPYING.GPLv3
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/seggetd/COPYING.GPLv3
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. 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
+them 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 prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. 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.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey 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;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If 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 convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU 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 that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ 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.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+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.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ 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
+state 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 3 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, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program 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, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU 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 Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/seggetd/COPYING.LGPLv2.1 b/seggetd/COPYING.LGPLv2.1
new file mode 100644
index 0000000..00b4fed
--- /dev/null
+++ b/seggetd/COPYING.LGPLv2.1
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+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 and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, 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 library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+ 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 Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+ If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be 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.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+ 9. 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 Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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 with
+this License.
+
+ 11. 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 Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser 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 Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/seggetd/COPYING.LGPLv3 b/seggetd/COPYING.LGPLv3
new file mode 100644
index 0000000..65c5ca8
--- /dev/null
+++ b/seggetd/COPYING.LGPLv3
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser 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
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/seggetd/Makefile b/seggetd/Makefile
new file mode 100644
index 0000000..497ba70
--- /dev/null
+++ b/seggetd/Makefile
@@ -0,0 +1,44 @@
+BINS = segget
+OBJS = $(addsuffix .o,$(BINS))
+PKGCONFIG_MODULES = json libcurl libcrypto
+MISSING_PLUGINS_LIBS =
+LIBS_PKGCONFIG := $(foreach mod,$(PKGCONFIG_MODULES),$(shell pkg-config --libs $(mod)))
+CXXFLAGS_PKGCONFIG := $(foreach mod,$(PKGCONFIG_MODULES),$(shell pkg-config --libs $(mod)))
+
+CXXFLAGS_WARNINGS = -pedantic -Wall -Wextra -Wformat -Weffc++
+#CXXFLAGS_WARNINGS = -pedantic -Wextra -Wformat -Weffc++
+CXXFLAGS_OPT = -O2 -g
+
+LIBS = $(LIBS_PKGCONFIG)
+#MIBS = -lncurses
+CXXFLAGS = $(CXXFLAGS_PKGCONFIG) -lncurses $(CXXFLAGS_WARNINGS) $(CXXFLAGS_OPT)
+
+all: $(BINS)
+
+%.o: %.cxx
+ $(CXX) -c -o $@ $(CXXFLAGS) $^
+
+segget: segget.o connection.o checksum.o config.o distfile.o log.o mirror.o network.o networkbroker.o phase.o pkg.o response.o segment.o settings.o stats.o str.o tui.o utils.o ui_server.o proxyfetcher.o requestserver.o scriptserver.o
+ $(CXX) -o $@ -lncurses $(LIBS) $(CIBS) $^
+#%: %.o
+# $(CXX) -o $@ $(LIBS) $(CIBS) $^
+
+clean:
+ -rm -f $(BINS) $(OBJS)
+ -rm -f *.o
+ -rm -f *.log
+
+install:
+ -mkdir /etc/seggetd
+ -cp *.conf /etc/seggetd
+ -cp segget /usr/bin/seggetd
+ -cp ./init.d/seggetd /etc/init.d/seggetd
+ -mkdir -p /usr/share/seggetd
+ -cp -R ./webui /usr/share/seggetd
+ -mkdir -p /usr/share/seggetd/scripts
+ -cp -R ./scripts /usr/share/seggetd
+ -mkdir -p /tmp/seggetd/segments
+ -mkdir -p /usr/portage/distfiles
+ -mkdir -p /var/log/seggetd
+
+.PRECIOUS: %.o
diff --git a/seggetd/checksum.cpp b/seggetd/checksum.cpp
new file mode 100644
index 0000000..396c196
--- /dev/null
+++ b/seggetd/checksum.cpp
@@ -0,0 +1,188 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "checksum.h"
+
+bool rmd160_ok(string distfile_filename, string portage_hash){
+ try{
+ if (portage_hash=="") return true;
+ std::string digest;
+ CryptoPP::RIPEMD160 hash;
+ CryptoPP::FileSource distfile_to_hash(distfile_filename.c_str(), true,
+ new CryptoPP::HashFilter(hash,
+ new CryptoPP::HexEncoder(
+ new CryptoPP::StringSink(digest))));
+ if (portage_hash==noupper(digest)){
+ log("RMD160 checksum for distfile:"+distfile_filename+" is [OK]");
+ return true;
+ }else{
+ log("Error: RMD160 checksum for distfile:"+distfile_filename+" [FAILED]");
+ error_log("Error: RMD160 checksum for distfile:"+distfile_filename+" [FAILED]");
+ return false;
+ }
+ }catch(...){
+ error_log("Error in checksum.cpp : rmd160_ok()");
+ return false;
+ }
+}
+bool sha1_ok(string distfile_filename, string portage_hash){
+ try{
+ if (portage_hash=="") return true;
+ std::string digest;
+ CryptoPP::SHA1 hash;
+ CryptoPP::FileSource distfile_to_hash(distfile_filename.c_str(), true,
+ new CryptoPP::HashFilter(hash,
+ new CryptoPP::HexEncoder(
+ new CryptoPP::StringSink(digest))));
+// debug("SHA1:"+noupper(digest));
+ if (portage_hash==noupper(digest)){
+ log("SHA1 checksum for distfile:"+distfile_filename+" is [OK]");
+ return true;
+ }else{
+ log("Error: SHA1 checksum for distfile:"+distfile_filename+" [FAILED]");
+ error_log("Error: SHA1 checksum for distfile:"+distfile_filename+" [FAILED]");
+ return false;
+ }
+ }catch(...){
+ error_log("Error in checksum.cpp : sha1_ok()");
+ return false;
+ }
+}
+bool sha256_ok(string distfile_filename, string portage_hash){
+ try{
+ if (portage_hash=="") return true;
+ std::string digest;
+ CryptoPP::SHA256 hash;
+ CryptoPP::FileSource distfile_to_hash(distfile_filename.c_str(), true,
+ new CryptoPP::HashFilter(hash,
+ new CryptoPP::HexEncoder(
+ new CryptoPP::StringSink(digest))));
+// debug("SHA256:"+noupper(digest));
+ if (portage_hash==noupper(digest)){
+ log("SHA256 checksum for distfile:"+distfile_filename+" is [OK]");
+ return true;
+ }else{
+ log("Error: SHA256 checksum for distfile:"+distfile_filename+" [FAILED]");
+ error_log("Error: SHA256 checksum for distfile:"+distfile_filename+" [FAILED]");
+ return false;
+ }
+ }catch(...){
+ error_log("Error in checksum.cpp : sha256_ok()");
+ return false;
+ }
+}
+bool sha512_ok(string distfile_filename, string portage_hash){
+ try{
+ if (portage_hash=="") return true;
+ std::string digest;
+ CryptoPP::SHA512 hash;
+ CryptoPP::FileSource distfile_to_hash(distfile_filename.c_str(), true,
+ new CryptoPP::HashFilter(hash,
+ new CryptoPP::HexEncoder(
+ new CryptoPP::StringSink(digest))));
+// debug("SHA256:"+noupper(digest));
+ if (portage_hash==noupper(digest)){
+ log("SHA512 checksum for distfile:"+distfile_filename+" is [OK]");
+ return true;
+ }else{
+ log("Error: SHA512 checksum for distfile:"+distfile_filename+" [FAILED]");
+ error_log("Error: SHA512 checksum for distfile:"+distfile_filename+" [FAILED]");
+ return false;
+ }
+ }catch(...){
+ error_log("Error in checksum.cpp : sha512_ok()");
+ return false;
+ }
+}
+bool whirlpool_ok(string distfile_filename, string portage_hash){
+ try{
+ if (portage_hash=="") return true;
+ std::string digest;
+ CryptoPP::Whirlpool hash;
+ CryptoPP::FileSource distfile_to_hash(distfile_filename.c_str(), true,
+ new CryptoPP::HashFilter(hash,
+ new CryptoPP::HexEncoder(
+ new CryptoPP::StringSink(digest))));
+// debug("SHA256:"+noupper(digest));
+ if (portage_hash==noupper(digest)){
+ log("WHIRLPOOL checksum for distfile:"+distfile_filename+" is [OK]");
+ return true;
+ }else{
+ log("Error: WHIRLPOOL checksum for distfile:"+distfile_filename+" [FAILED]");
+ error_log("Error: WHIRLPOOL checksum for distfile:"+distfile_filename+" [FAILED]");
+ return false;
+ }
+ }catch(...){
+ error_log("Error in checksum.cpp : whirlpool_ok()");
+ return false;
+ }
+}
+bool md5_ok(string distfile_filename, string portage_hash){
+ try{
+ if (portage_hash=="") return true;
+ std::string digest;
+ CryptoPP::Weak::MD5 hash;
+ CryptoPP::FileSource distfile_to_hash(distfile_filename.c_str(), true,
+ new CryptoPP::HashFilter(hash,
+ new CryptoPP::HexEncoder(
+ new CryptoPP::StringSink(digest))));
+// debug("SHA256:"+noupper(digest));
+ if (portage_hash==noupper(digest)){
+ log("MD5 checksum for distfile:"+distfile_filename+" is [OK]");
+ return true;
+ }else{
+ log("Error: MD5 checksum for distfile:"+distfile_filename+" [FAILED]");
+ error_log("Error: MD5 checksum for distfile:"+distfile_filename+" [FAILED]");
+ return false;
+ }
+ }catch(...){
+ error_log("Error in checksum.cpp : md5_ok()");
+ return false;
+ }
+}
+bool crc32_ok(string distfile_filename, string portage_hash){
+ try{
+ if (portage_hash=="") return true;
+ std::string digest;
+ CryptoPP::CRC32 hash;
+ CryptoPP::FileSource distfile_to_hash(distfile_filename.c_str(), true,
+ new CryptoPP::HashFilter(hash,
+ new CryptoPP::HexEncoder(
+ new CryptoPP::StringSink(digest))));
+// debug("SHA256:"+noupper(digest));
+ if (portage_hash==noupper(digest)){
+ log("CRC32 checksum for distfile:"+distfile_filename+" is [OK]");
+ return true;
+ }else{
+ log("Error: CRC32 checksum for distfile:"+distfile_filename+" [FAILED]");
+ error_log("Error: CRC32 checksum for distfile:"+distfile_filename+" [FAILED]");
+ return false;
+ }
+ }catch(...){
+ error_log("Error in checksum.cpp : crc32_ok()");
+ return false;
+ }
+} \ No newline at end of file
diff --git a/seggetd/checksum.h b/seggetd/checksum.h
new file mode 100644
index 0000000..9a0cccb
--- /dev/null
+++ b/seggetd/checksum.h
@@ -0,0 +1,49 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __CHECKSUM_H__
+#define __CHECKSUM_H__
+
+#include <string>
+#include "cryptopp/crc.h"
+#include "cryptopp/sha.h"
+#include "cryptopp/whrlpool.h"
+#include "cryptopp/ripemd.h"
+#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
+#include "cryptopp/md5.h"
+#include "cryptopp/files.h"
+#include "cryptopp/hex.h"
+#include "tui.h"
+#include "str.h"
+
+bool rmd160_ok(string distfile_filename, string portage_hash);
+bool sha1_ok(string distfile_filename, string portage_hash);
+bool sha256_ok(string distfile_filename, string portage_hash);
+bool sha512_ok(string distfile_filename, string portage_hash);
+bool whirlpool_ok(string distfile_filename, string portage_hash);
+bool md5_ok(string distfile_filename, string portage_hash);
+bool crc32_ok(string distfile_filename, string portage_hash);
+#endif \ No newline at end of file
diff --git a/seggetd/client.cpp b/seggetd/client.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/seggetd/client.cpp
diff --git a/seggetd/config.cpp b/seggetd/config.cpp
new file mode 100644
index 0000000..2dc7421
--- /dev/null
+++ b/seggetd/config.cpp
@@ -0,0 +1,196 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "config.h"
+
+void Tconfig::load_settings_from_config_file(){
+ try{
+ ifstream file;
+ file.exceptions (ifstream::failbit | ifstream::badbit);
+ try{
+ file.open((settings.conf_dir+"/"+config_file_name).c_str());
+ }
+ catch(...){
+ error_log("Error opening settings file: "+settings.conf_dir+"/"+config_file_name+". Default settings will be used. Check if config file: "+config_file_name+" exists and segget has rights to access it.");
+ return;
+ }
+ try{
+ //processing file
+ string line;
+ string name;
+ string value;
+ string inSection;
+ int posEqual;
+ while (not(file.eof())) {
+ getline(file,line);
+ if (! line.length()) continue;
+ if (line[0] == '#') continue;
+ if (line[0] == ';') continue;
+ if (line[0] == '[') {
+ inSection=noupper(trim(line.substr(1,line.find(']')-1)));
+ continue;
+ }
+ posEqual=line.find('=');
+ name = noupper(trim(line.substr(0,posEqual)));
+ value = trim(line.substr(posEqual+1));
+ content_[inSection+'/'+name]=value;
+ }
+ }catch(ifstream::failure e){
+ if (!file.eof()){
+ error_log("Settings file: "+config_file_name+" was opened, but an error occured while reading it.");
+ return;
+ }
+ }catch(...){
+ error_log("Settings file: "+config_file_name+" was opened, but an error occured while reading settings from it.");
+ }
+ }catch(...){
+ error_log("Error in config.cpp: load_settings_from_config_file()");
+ }
+}
+
+int Tconfig::set(string const& section, string const& entry, string &dst) const {
+ try{
+ map<string,string>::const_iterator ci = content_.find(section + '/' + entry);
+ if (ci == content_.end()){
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set.");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst+". Default value forced.");
+ return 1;
+ }
+ else{
+ dst=noupper(ci->second);
+ log("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst);
+ return 0;
+ }
+ }catch(...){
+ error_log("Error in config.cpp: set(string &dst, string const& section, string const& entry)");
+ return 1;
+ }
+}
+
+int Tconfig::set_keep_case(string const& section, string const& entry, string &dst) const {
+ try{
+ map<string,string>::const_iterator ci = content_.find(section + '/' + entry);
+ if (ci == content_.end()){
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set.");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst+". Default value forced.");
+ return 1;
+ }
+ else{
+ dst=ci->second;
+ log("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+dst);
+ return 0;
+ }
+ }catch(...){
+ error_log("Error in config.cpp: set(string &dst, string const& section, string const& entry)");
+ return 1;
+ }
+}
+
+int Tconfig::set(string const& section, string const& entry, ulong &dst, uint const& min_limit, uint const& max_limit) const {
+ try{
+ uint return_value;
+ map<string,string>::const_iterator ci = content_.find(section + '/' + entry);
+ if (ci == content_.end()){
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set.");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced.");
+ return 1;
+ }
+ else{
+ return_value=atoi(ci->second.c_str());
+ if (return_value==0)
+ if (toString(return_value)!=ci->second){
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry
+ +" must have an integer value in range from "+toString(min_limit)
+ +" to "+toString(max_limit)
+ +". Can't convert "+ci->second
+ +" to integer. ");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced.");
+ return 1;
+ }
+ if ((return_value>=min_limit) and (return_value<=max_limit)){
+ //everything is ok
+ log("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(return_value));
+ dst=return_value;
+ return 0;
+ }else{
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry
+ +" must have an integer value in range from "+toString(min_limit)
+ +" to "+toString(max_limit)+".");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced.");
+ return 1;
+ }
+ }
+ }catch(...){
+ error_log("Error in config.cpp: set(ulong &dst, string const& section, string const& entry, uint const& min_limit, uint const& max_limit)");
+ return 1;
+ }
+}
+
+int Tconfig::set(string const& section, string const& entry, bool &dst) const {
+ try{
+ uint return_value;
+ map<std::string,string>::const_iterator ci = content_.find(section + '/' + entry);
+ if (ci == content_.end()){
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+" has not been set.");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced.");
+ return 1;
+ }
+ else{
+ return_value=atoi(ci->second.c_str());
+ if (return_value==0)
+ if (toString(return_value)!=ci->second){
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry
+ +" must have a boolean value: 0 or 1"
+ +". Can't convert "+ci->second
+ +" to 0 or 1. ");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced.");
+ return 1;
+ }
+ if ((return_value==0) or (return_value==1)){
+ //everything is ok
+ log("Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(return_value));
+ dst=return_value;
+ return 0;
+ }else{
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry
+ +" must have a boolean value: 0 or 1");
+ log("! Settings in file:"+config_file_name+" ["+section+"]."+entry+"="+toString(dst)+". Default value forced.");
+ return 1;
+ }
+ }
+ }catch(...){
+ error_log("Error in config.cpp: set(bool &dst, string const& section, string const& entry)");
+ return 1;
+ }
+}
+
+void Tconfig::clear(){
+ try{
+ content_.clear();
+ }catch(...){
+ error_log("Error in config.cpp: clear()");
+ }
+} \ No newline at end of file
diff --git a/seggetd/config.h b/seggetd/config.h
new file mode 100644
index 0000000..79e9ba4
--- /dev/null
+++ b/seggetd/config.h
@@ -0,0 +1,54 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#include <string>
+#include <map>
+#include <fstream>
+#include "str.h"
+#include "tui.h"
+using namespace std;
+
+class Tconfig {
+ private:
+ map<string,string> content_;
+ string config_file_name;
+ public:
+ Tconfig(string const& file_name):
+ content_(),
+ config_file_name("")
+ {config_file_name=file_name;load_settings_from_config_file();};
+ void load_settings_from_config_file();
+ int set(string const& section, string const& entry, string &dst) const;
+ int set_keep_case(string const& section, string const& entry, string &dst) const;
+ int set(string const& section, string const& entry, ulong &dst, uint const& min_limit, uint const& max_limit) const;
+ int set(string const& section, string const& entry, bool &dst) const;
+ void clear();
+};
+
+#endif \ No newline at end of file
diff --git a/seggetd/connection.cpp b/seggetd/connection.cpp
new file mode 100644
index 0000000..88f6069
--- /dev/null
+++ b/seggetd/connection.cpp
@@ -0,0 +1,350 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#include "connection.h"
+#include "utils.h"
+#include "settings.h"
+
+long script_waiting_connection_num=-1;
+uint Tconnection::total_connections=0;
+Tconnection connection_array[MAX_CONNECTS];
+
+void init_connections(){
+ for (ulong connection_num=0; connection_num<MAX_CONNECTS; connection_num++){
+ connection_array[connection_num].connection_num=connection_num;
+ };
+}
+
+int Tconnection::start(CURLM *cm, uint network_number, uint distfile_num, Tsegment *started_segment, uint best_mirror_num){
+ try{
+ segment=started_segment;
+ debug("Starting connection for distfile: "+segment->parent_distfile->name);
+ mirror_num=best_mirror_num;
+ network_num=network_number;
+ total_dld_bytes=0;
+ bytes_per_last_interval=0;
+ gettimeofday(&start_time,NULL);
+ debug("Connecting network"+toString(network_num));
+
+ segment->parent_distfile->set_status(DDOWNLOADING);
+
+ if (network_array[network_num].network_mode==MODE_PROXY_FETCHER){
+ connection_start_time_network_phase_for_pf_networks=segment->parent_distfile->network_distfile_brokers_array[network_num].phase;
+ }
+
+ Tmirror *Pcurr_mirror;
+ switch (network_array[network_num].network_mode){
+ case MODE_REMOTE:{
+ url=segment->parent_distfile->url_list[mirror_num];
+ Pcurr_mirror=find_mirror(strip_mirror_name(url));
+ break;
+ }
+ case MODE_CORAL_CDN:{
+ url=convert_to_coral_cdn_url(segment->parent_distfile->url_list[mirror_num]);
+ Pcurr_mirror=find_mirror(strip_mirror_name(url));
+ break;
+ }
+ default:{
+ Pcurr_mirror=&network_array[network_num].benchmarked_mirror_list[mirror_num];
+ url=Pcurr_mirror->url+segment->parent_distfile->name;
+ }
+ }
+ debug(" URL:"+url);
+
+ if (run_user_python_script(connection_num)){
+ if (segment->parent_distfile->active_connections_num<=0){
+ segment->parent_distfile->set_status(DSCRIPTREJECTED);
+ }
+ return REJECTED_BY_USER_PYTHON_SCRIPT;
+ }
+ stats.active_connections_counter++;
+ ulong segment_start_result=segment->start(cm, connection_num, network_num, distfile_num, url);
+ if (segment_start_result){
+ return segment_start_result;
+ }else{
+ segment->parent_distfile->active_connections_num++;
+ active=true;
+ Pcurr_mirror->start();
+ network_array[network_num].connect();
+ }
+ debug("Started connection for distfile: "+segment->parent_distfile->name);
+ return 0;
+ }catch(...){
+ error_log("Error in connection.cpp: start()");
+ }
+ return ERROR_WHILE_PREPARING_CONNECTION;
+}
+/*
+string explain_curl_error(int error_code){
+ try{
+ //curl_easy_strerror(
+ }catch(...){
+ error_log("Error in connection.cpp: explain_curl_error()");
+ }
+ return "Error in connection.cpp: explain_curl_error()";
+}
+*/
+void Tconnection::stop(CURLcode connection_result){
+ try{
+ stats.active_connections_counter--;
+ Tmirror *Pcurr_mirror;
+ switch (network_array[network_num].network_mode){
+ case MODE_REMOTE:
+ case MODE_CORAL_CDN:{
+ Pcurr_mirror=find_mirror(strip_mirror_name(url));
+ break;
+ }
+ default:{
+ Pcurr_mirror=&network_array[network_num].benchmarked_mirror_list[mirror_num];
+ }
+ }
+ debug("Finished connection for distfile: "+segment->parent_distfile->name+" Segment#:"+toString(segment->segment_num)+" Network#"+toString(network_num)+" Status: "+toString(connection_result));
+ if (connection_result){
+ string error_str=curl_easy_strerror(connection_result);
+ debug(" ERROR "+toString(connection_result)+": "+error_str);
+ error_log("Finished connection for distfile: "+segment->parent_distfile->name+" Segment#:"+toString(segment->segment_num)+" Network#"+toString(network_num)+" Status: "+toString(connection_result));
+ error_log(" ERROR "+toString(connection_result)+": "+error_str);
+ }
+ active=false;
+ network_array[network_num].disconnect();
+// network_array[network_num].benchmarked_mirror_list[mirror_num].stop();
+ segment->segment_file.close();
+ if (connection_result==0){
+ if (! segment->segment_verification_is_ok()){
+ connection_result=CURLE_READ_ERROR;
+ Pcurr_mirror->stop(time_left_since(connection_array[connection_num].start_time),0);
+ debug("curl_lies - there is a problem downloading segment");
+ error_log("curl_lies - there is a problem downloading segment");
+ }else{
+ Pcurr_mirror->stop(time_left_since(connection_array[connection_num].start_time),segment->segment_size);
+ }
+ }else{
+ Pcurr_mirror->stop(time_left_since(connection_array[connection_num].start_time),0);
+ }
+ segment->parent_distfile->active_connections_num--;
+
+ msg_clean_connection(connection_num);
+
+/*
+ Tmirror *Pcurr_mirror;
+ if (network_array[network_num].network_mode==MODE_LOCAL){
+ Pcurr_mirror=&network_array[network_num].benchmarked_mirror_list[mirror_num];
+ prnt_distfile->network_distfile_brokers_array[network_num].mirror_fails_vector[mirror_num]=true;
+// find_mirror(strip_mirror_name(segment->url));
+ }else{
+ Pcurr_mirror=find_mirror(strip_mirror_name(segment->url));
+ }
+*/
+ debug("before gettimeofday");
+ timeval now_time;
+ gettimeofday(&now_time,NULL);
+
+ if (connection_result!=0){
+ stats.fails_counter++;
+ switch (network_array[network_num].network_mode){
+ case MODE_LOCAL:{
+ // prnt_distfile->network_distfile_brokers_array[network_num].mirror_fails_vector[mirror_num]=true;
+ debug("before setting mirror fail");
+ segment->parent_distfile->network_distfile_brokers_array[network_num].local_mirror_failed(mirror_num);
+ debug("after setting mirror fail");
+ // find_mirror(strip_mirror_name(segment->url));
+ break;
+ }
+ case MODE_PROXY_FETCHER:{
+ // prnt_distfile->network_distfile_brokers_array[network_num].mirror_fails_vector[mirror_num]=true;
+ if (connection_start_time_network_phase_for_pf_networks==E_USE_AS_LOCAL_MIRRORS){
+ segment->parent_distfile->network_distfile_brokers_array[network_num].local_mirror_failed(mirror_num);
+ }else{ // proxy-fetcher mirror failed, if everything correct it must be in phase E_PROXY_FETCHER_DOWNLOADED,
+ segment->parent_distfile->network_distfile_brokers_array[network_num].proxy_fetcher_mirror_failed(mirror_num);
+ }
+ // find_mirror(strip_mirror_name(segment->url));
+ break;
+ }
+ default:{ // MODE REMOTE MIRRORS
+ }
+ }
+ // error -> start downloading again
+// msg_status2(segment->connection_num, toString(connection_result)+"]- Failed download "+segment->file_name);
+ debug(toString(connection_result)+"]- Failed download "+segment->url);
+ if (segment->try_num>=settings.max_tries){
+ segment->status=SFAILED;
+ segment->parent_distfile->set_status(DFAILED);
+ error_log("Segget failed to download distfile: "+segment->parent_distfile->name);
+ error_log("Segment:"+segment->file_name+" has reached max_tries limit - segment.status set to FAILED");
+ }
+ else segment->status=SWAITING;
+ }else{
+ // no error => count this one and start new
+ log("Succesfully downloaded "+segment->file_name+" on connection#"+toString(connection_num));
+ debug(" Successful download "+segment->url);
+// already done earlier in this function Pcurr_mirror=find_mirror(strip_mirror_name(segment->url));
+ segment->status=SDOWNLOADED;
+ segment->parent_distfile->inc_dld_segments_count(segment);
+ };
+ if ((segment->parent_distfile->get_status()!=DFAILED)
+ and (segment->parent_distfile->get_status()!=DDOWNLOADED)
+ and (segment->parent_distfile->get_status()!=DALL_LM_AND_PF_MIRRORS_FAILED)){
+ if (segment->parent_distfile->active_connections_num>0){
+ segment->parent_distfile->set_status(DDOWNLOADING);
+ }else{
+ segment->parent_distfile->set_status(DWAITING);
+ }
+ }
+ }catch(...){
+ error_log("Error in connection.cpp: stop()");
+ }
+}
+
+void Tconnection::inc_bytes_per_last_interval(ulong new_bytes_count){
+ try{
+ total_dld_bytes+=new_bytes_count;
+ bytes_per_last_interval+=new_bytes_count;
+ }catch(...){
+ error_log("Error in connection.cpp: inc_bytes_per_last_interval()");
+ }
+}
+
+void Tconnection::show_connection_progress(ulong time_diff){
+ try{
+ stats.total_bytes_per_last_interval+=bytes_per_last_interval;
+ ulong speed=(bytes_per_last_interval*1000)/time_diff;
+ ulong avg_speed=(total_dld_bytes*1000)/time_left_since(start_time);
+ string eta_string;
+ if (avg_speed==0){
+ eta_string=" ETA: inf";
+ }else{
+ eta_string=" ETA: "+secsToString((segment->segment_size-segment->downloaded_bytes)/avg_speed);
+ }
+ string speed_str;
+ string avg_speed_str;
+ speed_str=" Speed: "+speedToString(speed);
+ avg_speed_str=" AVG speed: "+speedToString(avg_speed);
+ int percent=segment->downloaded_bytes*100/segment->segment_size;
+ string network_type_str;
+ switch (network_array[network_num].network_mode){
+ case MODE_REMOTE: network_type_str="REM"; break;
+ case MODE_PROXY_FETCHER: network_type_str="P-F"; break;
+ case MODE_LOCAL: network_type_str="LOC"; break;
+ case MODE_CORAL_CDN: network_type_str="CDN"; break;
+ }
+ string progress_text=field("[Net",network_num,1)
+ +":"+network_type_str+"]"
+ +field(" Segment:",segment->segment_num, 5)
+ +field(" Try:",segment->try_num,4)
+ +field(" Bytes:",segment->downloaded_bytes,7)
+ +field(" / ",segment->segment_size,7)
+ +field(" = ",percent,3)+"%"
+ +speed_str
+ +avg_speed_str
+ +eta_string;
+ msg_segment_progress(segment->connection_num, progress_text);
+ bytes_per_last_interval=0;
+ }catch(...){
+ error_log("Error in connection.cpp: show_connection_progress()");
+ }
+}
+
+string Tconnection::get_html_connection_progress(){
+ try{
+ ulong time_diff=time_left_since(stats.previous_time);
+// stats.total_bytes_per_last_interval+=bytes_per_last_interval;
+ ulong speed=(bytes_per_last_interval*1000)/time_diff;
+ ulong avg_speed=(total_dld_bytes*1000)/time_left_since(start_time);
+ string eta_string;
+ if (avg_speed==0){
+ eta_string="inf";
+ }else{
+ eta_string=secsToString((segment->segment_size-segment->downloaded_bytes)/avg_speed);
+ }
+ string speed_str;
+ string avg_speed_str;
+ speed_str=speedToString(speed);
+ avg_speed_str=speedToString(avg_speed);
+ int segment_percent;
+ if (segment->segment_size>0){
+ segment_percent=segment->downloaded_bytes*100/segment->segment_size;
+ }else{
+ segment_percent=100;
+ }
+ int distfile_percent;
+ if (segment->parent_distfile->size>0){
+ distfile_percent=segment->parent_distfile->dld_bytes*100/segment->parent_distfile->size;
+ }else{
+ distfile_percent=100;
+ }
+
+ int unfinished_segments_distfile_percent;
+ //TO-DO: it's necessary to check all connections and add dld bytes to be correct !!!
+ if (segment->parent_distfile->size>0){
+ unfinished_segments_distfile_percent=segment->downloaded_bytes*100/segment->parent_distfile->size;
+ }else{
+ unfinished_segments_distfile_percent=0;
+ }
+ string network_type_str;
+ switch (network_array[network_num].network_mode){
+ case MODE_REMOTE: network_type_str="Remote"; break;
+ case MODE_PROXY_FETCHER: network_type_str="Proxy-Fetcher"; break;
+ case MODE_LOCAL: network_type_str="Local"; break;
+ case MODE_CORAL_CDN: network_type_str="CDN"; break;
+ }
+ string progress_text=
+ (string)"<td align=\"center\">\n<table width=\"100\" border=\"0\" cellpadding=\"0\" frame=\"void\">\n<tr>\n"
+ +((distfile_percent>0)?"<td bgcolor=\"#0000FF\">\n<img src=\"/img/blue_progress.jpg\" height=\"20\" width=\""+toString(distfile_percent)+"\"/>\n</td>\n"
+ :"")
+ +((unfinished_segments_distfile_percent>0)?"<td bgcolor=\"#00FF00\">\n<img src=\"/img/green_progress.jpg\" height=\"20\" width=\""+toString(unfinished_segments_distfile_percent)+"\"/>\n</td>\n"
+ :"")
+ +((100-distfile_percent-unfinished_segments_distfile_percent>0)?"<td bgcolor=\"#555555\">\n<img src=\"/img/bw_progress.jpg\" height=\"20\" width=\""+toString(100-distfile_percent-unfinished_segments_distfile_percent)+"\" />\n</td>\n"
+ :"")
+ +"</tr>\n</table>\n"
+// +"&nbsp;"+toString(distfile_percent+unfinished_segments_distfile_percent)+"%"
+ +toString(distfile_percent)+"%"
+ +"</td>\n<td>\n"
+ +"<table>\n"
+ +"<tr>\n<td>"+segment->parent_distfile->name+"</td>\n</tr>\n"
+ +"<tr>\n<td>\n"+segment->url+"</td>\n</tr>\n"
+ +"</table>\n"
+ +"</td><td align=\"center\"><table width=\"100\" border=\"0\" cellpadding=\"0\" frame=\"void\"><tr>"
+ +((segment_percent>0)?"<td bgcolor=\"#00FF00\"><img src=\"/img/green_progress.jpg\" height=\"20\" width=\""+toString(segment_percent)+"\"/></td>"
+ :"")
+ +((100-segment_percent>0)?"<td bgcolor=\"#555555\"><img src=\"/img/bw_progress.jpg\" height=\"20\" width=\""+toString(100-segment_percent)+"\" /></td>"
+ :"")
+ +"</tr></table>"
+ +toString(segment_percent)+"%"
+ +"</td><td align=\"right\">"+toString(segment->segment_num)
+ +"</td><td align=\"right\">"+toString(segment->try_num)
+ +"</td><td align=\"right\">"+toString(network_num)
+ +"</td><td align=\"center\">"+network_type_str
+ +"</td><td align=\"right\">"+toString(segment->downloaded_bytes)
+ +"</td><td align=\"right\">"+toString(segment->segment_size)
+ +"</td><td align=\"right\">"+speed_str
+ +"</td><td align=\"right\">"+avg_speed_str
+ +"</td><td align=\"right\">"+eta_string
+ +"</td>";
+ return progress_text;
+ }catch(...){
+ error_log("Error in connection.cpp: show_connection_progress()");
+ }
+ return "";
+} \ No newline at end of file
diff --git a/seggetd/connection.h b/seggetd/connection.h
new file mode 100644
index 0000000..65b0ce1
--- /dev/null
+++ b/seggetd/connection.h
@@ -0,0 +1,81 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __CONNECTION_H__
+#define __CONNECTION_H__
+
+#include <time.h>
+#include <curl/curl.h>
+class Tsegment;
+#include "segment.h"
+#include "networkbroker.h"
+#include "scriptserver.h"
+
+using namespace std;
+
+#define MAX_CONNECTS 20
+
+class Tconnection{
+ static uint total_connections;
+ private:
+ Tnetwork_distfile_broker_phases connection_start_time_network_phase_for_pf_networks;
+ public:
+ uint network_num;
+ uint mirror_num;
+ string url;
+ ulong total_dld_bytes;
+ ulong bytes_per_last_interval;
+ uint connection_num;
+ ulong max_speed_limit;
+ bool active;
+ timeval start_time;
+ Tsegment *segment;
+ Tconnection():
+ connection_start_time_network_phase_for_pf_networks(E_USE_AS_LOCAL_MIRRORS),
+ network_num(0),
+ mirror_num(0),
+ url(""),
+ total_dld_bytes(0),
+ bytes_per_last_interval(0),
+ connection_num(0),
+ max_speed_limit(0),
+ active(0),
+ start_time(),
+ segment(0)
+ {};
+ Tconnection(const Tconnection &L); // copy constructor
+ Tconnection & operator=(const Tconnection &L);
+ int start(CURLM *cm, uint network_number, uint distfile_num, Tsegment *started_segment, uint best_mirror_num);
+ void stop(CURLcode connection_result);
+ void inc_bytes_per_last_interval(ulong new_bytes_count);
+ void show_connection_progress(ulong time_diff);
+ string get_html_connection_progress();
+};
+
+extern long script_waiting_connection_num;
+extern Tconnection connection_array[MAX_CONNECTS];
+void init_connections();
+#endif \ No newline at end of file
diff --git a/seggetd/distfile.cpp b/seggetd/distfile.cpp
new file mode 100644
index 0000000..883532a
--- /dev/null
+++ b/seggetd/distfile.cpp
@@ -0,0 +1,982 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "distfile.h"
+#include "mirror.h"
+#include "checksum.h"
+#include "network.h"
+#include "segment.h"
+#include "response.h"
+
+//Make the necessary includes and set up the variables:
+using namespace std;
+
+/*
+#define R_LM_WAIT_FOR_LOCAL_MIRRORS 100
+
+#define R_PF_ADDED_TO_PROXY_QUEUE 101
+#define R_PF_ALREADY_WAS_IN_QUEUE 102
+#define R_PF_DOWNLOADED 103
+#define R_PF_BE_MORE_PATIENT 104
+#define R_PF_ERROR_ADDING_TO_PROXY_QUEUE 105
+#define R_PF_FAILED 106
+#define R_PF_REJECTED 107
+
+// 0 for succesfull return of provide_segment()
+#define R_R_DOWNLOAD_STARTED 0
+#define R_R_WAITING 108
+#define R_R_DOWNLOADING 109
+
+#define R_LM_PF_R_NO_FREE_NETWORK_CONNECTION_FOUND 110
+
+#define ALLOW_PROXY_FETCHER_NETWORKS 201
+#define DO_NOT_ALLOW_PROXY_FETCHER_NETWORKS 202
+#define ALLOW_REMOTE_NETWORKS 203
+#define DO_NOT_ALLOW_REMOTE_NETWORKS 204
+#define ALLOW_LOWER_PRIORITY_NETWORKS 205
+*/
+
+string Tdistfile::statusToString(){
+ try{
+ switch(status){
+ case DNEW: return "Added";
+ case D_NOT_PROXY_REQUESTED: return "Not proxy requested";
+ case DPROXY_REJECTED: return "Proxy rejected";
+ case DPROXY_QUEUED: return "Proxy queued";
+ case DPROXY_DOWNLOADING: return "Downloading via proxy";
+ case DPROXY_DOWNLOADED: return "Downloaded via proxy";
+ case DPROXY_FAILED: return "Failed";
+ case DALL_LM_AND_PF_MIRRORS_FAILED: return "All mirrors failed";
+ case DWAITING: return "Waiting";
+ case DSCRIPTREJECTED: return "Rejected by script";
+ case DDOWNLOADING: return "Downloading";
+ case DDOWNLOADED: return "Downloaded";
+ case DFAILED: return "Failed";
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: statusToString()");
+ }
+ return "UNKNOWN status";
+}
+
+string Tdistfile::statusToColor(){
+ try{
+ switch(status){
+ case DNEW: return "#FFFFFF";
+ case D_NOT_PROXY_REQUESTED: return "#FFFFFF";
+ case DPROXY_REJECTED: return "#FFAAAA";
+ case DPROXY_QUEUED: return "#AAAAFF";
+ case DPROXY_DOWNLOADING: return "#AAAAFF";
+ case DPROXY_DOWNLOADED: return "#AAAAFF";
+ case DPROXY_FAILED: return "#FFAAAA";
+ case DALL_LM_AND_PF_MIRRORS_FAILED: return "#FFAAAA";
+ case DWAITING: return "#AAAAFF";
+ case DSCRIPTREJECTED: return "#FFFFAA";
+ case DDOWNLOADING: return "#77DDFF";
+ case DDOWNLOADED: return "#AAFFAA";
+ case DFAILED: return "#FF8888";
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: statusToString()");
+ }
+ return "#FFFFFF";
+}
+
+
+void Tdistfile::set_status(Tdistfile_status new_status){
+ try{
+ status=new_status;
+ ui_server.send_distfile_progress_msg_to_all_clients(get_distfile_progress_str());
+ }catch(...){
+ error_log("Error: distfile.cpp: set_status()");
+ }
+}
+
+int Tdistfile::request(ulong network_num, string msg){
+ gettimeofday(&network_distfile_brokers_array[network_num].last_request_time, NULL);
+ int sockfd;
+ int len;
+ struct sockaddr_in address;
+ int result;
+ //Create a socket for the client:
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
+
+ //Name the socket, as agreed with the server:
+ address.sin_family = AF_INET;
+ address.sin_addr.s_addr = inet_addr(network_array[network_num].proxy_fetcher_ip.c_str());
+ address.sin_port = htons(network_array[network_num].proxy_fetcher_port);
+ len = sizeof(address);
+
+ //Connect your socket to the server’s socket:
+ result = connect(sockfd, (struct sockaddr *)&address, len);
+ if(result == -1) {
+ error_log("Network:"+toString(network_num)+"Can't connect to proxy-fetcher");
+ return R_PF_ERROR_ADDING_TO_PROXY_QUEUE;
+ }
+ if (msg.length()>90000){return R_PF_ERROR_ADDING_TO_PROXY_QUEUE;};
+ char send_buffer[100000];
+ // char recv_buffer[256];
+ strcpy(send_buffer,msg.c_str());
+ //You can now read and write via sockfd:
+ if (write(sockfd, send_buffer, strlen(send_buffer))!=(int)msg.length()){
+ error_log("Error in distfile.cpp: request(): Network:"+toString(network_num)+"request msg size and sent data size are different.");
+ };
+
+ fd_set readfds, testfds;
+ FD_ZERO(&readfds);
+ FD_SET(sockfd, &readfds);
+ testfds = readfds;
+
+ struct timeval response_timeout;
+ response_timeout.tv_sec=1;
+ response_timeout.tv_usec=0;
+
+ result = select(FD_SETSIZE, &testfds, (fd_set *)0,
+ (fd_set *)0, &response_timeout);
+
+ if(FD_ISSET(sockfd,&testfds)) {
+ int nread;
+ ioctl(sockfd, FIONREAD, &nread);
+
+ char recv_buffer[1000];
+ if(nread == 0) {
+ close(sockfd);
+ error_log("Error in distfile.cpp: request(): Network:"+toString(network_num)+" no response from proxy-fetcher");
+ }else{
+ if (nread!=read(sockfd, recv_buffer, nread)){
+ error_log("Error in distfile.cpp: request(): Network:"+toString(network_num)+"response msg size and received data size are different.");
+ };
+ return decode_server_response(recv_buffer);
+ }
+ }else{
+ error_log("Error in distfile.cpp: request(): Network:"+toString(network_num)+" zero size response from proxy-fetcher");
+ }
+ close(sockfd);
+ return R_PF_ERROR_ADDING_TO_PROXY_QUEUE;
+}
+
+bool Tdistfile::allows_new_actions(){
+// if (downloaded) return false;
+// else return true;
+// int time_left=0;
+ if (status==DDOWNLOADED){
+ debug("No new connection for distfile:"+name+". Distfile has DDOWNLOADED status");
+ return false;
+ }
+ if (status==DFAILED){
+ debug("No new connection for distfile:"+name+". Distfile has DFAILED status");
+ return false;
+ }
+ if (status==DALL_LM_AND_PF_MIRRORS_FAILED){
+ debug("No new connection for distfile:"+name+". Distfile has DALL_LM_AND_PF_MIRRORS_FAILED status");
+ return false;
+ }
+// debug("Distfile "+Ppkg_array[pkg_num]->distfile_vector[distfile_num]->name+" allows new connections");
+// debug(" distfile_num:"+toString(distfile_num));
+ if (active_connections_num<settings.max_connection_num_per_distfile){
+ debug("Allow new connection for ============================================= Distfile "+name);
+ debug("max_connection limit has not been reached");
+ return true;
+ }else{
+ debug("No new connection for distfile: "+name+". It already has "
+ +toString(active_connections_num)
+ +" connections => choose another distfile.");
+ return false;
+ }
+// if (((status==DPROXY_QUEUED) || (status==DPROXY_DOWNLOADING)) && (time_left<100)) return false;
+//oterwise allow connections
+// DNEW,
+// D_NOT_PROXY_REQUESTED,
+// DPROXY_REJECTED,
+// DPROXY_FAILED,
+// DPROXY_DOWNLOADED,
+// DWAITING,
+// DDOWNLOADING,json_object_object_get(json_obj_distfile,"SHA512")
+}
+
+void Tdistfile::init(){
+ try{
+ for (uint network_num=0; network_num<MAX_NETWORKS; network_num++){
+ network_distfile_brokers_array[network_num].init(network_num);
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: init()");
+ }
+}
+void Tdistfile::load_url_list(json_object* json_array_distfile_urllist){
+ try{
+ url_count=json_object_array_length(json_array_distfile_urllist);
+ url_list= new string [url_count];
+ for(uint urllist_array_item_num=0;urllist_array_item_num<url_count;urllist_array_item_num++){
+ url_list[urllist_array_item_num]=json_object_get_string(json_object_array_get_idx(json_array_distfile_urllist,urllist_array_item_num));
+ }
+ if (url_count){
+ num=++stats.distfiles_count;
+ stats.inc_total_size(size);
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: load_url_list()");
+ }
+}
+
+bool Tdistfile::check_if_dld(){
+ try{
+ ifstream filec((settings.distfiles_dir+"/"+name).c_str());
+ ulong start = filec.tellg();
+ filec.seekg (0, ios::end);
+ ulong end = filec.tellg();
+ ulong d_size;
+ d_size = end - start;
+ //debug("seg:"+toString(seg_num)+" Dsize="+toString(downloaded_size)+" seg_size="+toString(segment_size));
+ filec.close();
+ if (d_size==size){
+ status=DDOWNLOADED;
+// downloaded=true;
+ num=++stats.distfiles_count;
+ stats.inc_total_size(size);
+ stats.inc_dld_distfiles_count();
+ stats.inc_dld_size(size);
+ debug("Distfile:"+name+" already downloaded");
+ return true;
+ }
+ else{
+ debug("Distfile:"+name+" not downloaded");
+ return false;
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: check_if_dld()");
+ return false;
+ }
+}
+
+bool Tdistfile::load_distfile_from_json(json_object* json_obj_distfile){
+ try{
+ debug("Entered distfile.cpp: load_distfile_from_json()");
+ json_object* json_obj_buffer;
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"name");
+ if (json_obj_buffer){
+ name=json_object_get_string(json_obj_buffer);
+ }else{
+ return true;
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"size");
+ if (json_obj_buffer){
+ size=atoi(json_object_get_string(json_obj_buffer));
+ }else{
+ return true;
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"RMD160");
+ if (json_obj_buffer){
+ RMD160=json_object_get_string(json_obj_buffer);
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"SHA1");
+ if (json_obj_buffer){
+ SHA1=json_object_get_string(json_obj_buffer);
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"SHA256");
+ if (json_obj_buffer){
+ SHA256=json_object_get_string(json_obj_buffer);
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"SHA512");
+ if (json_obj_buffer){
+ SHA512=json_object_get_string(json_obj_buffer);
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"WHIRLPOOL");
+ if (json_obj_buffer){
+ WHIRLPOOL=json_object_get_string(json_obj_buffer);
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"MD5");
+ if (json_obj_buffer){
+ MD5=json_object_get_string(json_obj_buffer);
+ }
+ json_obj_buffer=json_object_object_get(json_obj_distfile,"CRC32");
+ if (json_obj_buffer){
+ CRC32=json_object_get_string(json_obj_buffer);
+ }
+ if (not(check_if_dld())){
+ json_data=json_object_to_json_string(json_obj_distfile);
+ split_into_segments();
+ load_url_list(json_object_object_get(json_obj_distfile,"url_list"));
+ }
+ debug("Added distfile: "+name+" to download queue");
+ ui_server.send_distfile_progress_msg_to_all_clients(get_distfile_progress_str());
+ }catch(...){
+ error_log("Error: distfile.cpp: load_distfile_from_json()");
+ }
+ return false;
+}
+
+void Tdistfile::split_into_segments(){
+ try{
+ int range_end;
+ if (size>settings.max_segment_size){
+ segments_count=size/settings.max_segment_size;
+ // set segments to have equal size, only last segment may be somewhat large (up to segment_count bytes large)
+ segment_size=size/segments_count;
+ }
+ else{
+ segment_size=size;
+ segments_count=1;
+ };
+ stats.segments_count+=segments_count;
+ dn_segments = new Tsegment [segments_count];
+ //none downloaded yet
+ for (uint segment_num=0; segment_num<segments_count; segment_num++){
+ if (segment_num == (segments_count-1)){
+ range_end=size-1;
+ debug("last_segment ends"+toString(range_end));
+ }
+ else{
+ range_end=(segment_num+1)*segment_size-1;
+ debug("segment_range:"+toString(range_end));
+ };
+ dn_segments[segment_num].set_segment(this, segment_num, name, segment_size, range_end);
+ if (dn_segments[segment_num].status==SDOWNLOADED)
+ inc_dld_segments_count(&dn_segments[segment_num]);
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: split_into_segments()");
+ }
+}
+
+Tdistfile::~Tdistfile(){
+ try{
+ delete [] url_list;
+ }catch(...){
+ error_log("Error: distfile.cpp: ~Tdistfile()");
+ }
+}
+
+bool Tdistfile::choose_best_mirror(CURLM* cm, uint connection_num, uint network_num, uint seg_num){
+ try{
+ Tmirror *Pcurr_mirror;
+ Tmirror *Pbest_mirror=0; // the best isn't set let's find it
+ uint best_mirror_num=-1; // the best isn't set let's find it
+
+ ulong best_mirror_self_rating=-1;
+ ulong curr_mirror_self_rating;
+ string url_str;
+ for (url_num=0; url_num<url_count; url_num++){
+ if (network_array[network_num].network_mode==MODE_CORAL_CDN){
+ url_str=convert_to_coral_cdn_url(url_list[url_num]);
+ if (url_str=="") continue;
+ }else{ // MODE_REMOTE
+ url_str=url_list[url_num];
+ }
+ Pcurr_mirror=find_mirror(strip_mirror_name(url_str));
+ debug("Evaluating url:"+url_str
+ +" active_connections:"+toString(Pcurr_mirror->get_active_num())
+ +" connection limit:"+toString(settings.max_connections_num_per_mirror));
+ if (Pcurr_mirror->get_active_num()<settings.max_connections_num_per_mirror){
+ debug("Url satisfies connection num per mirror limit");
+ curr_mirror_self_rating=Pcurr_mirror->mirror_on_the_wall();
+ if (curr_mirror_self_rating<best_mirror_self_rating){
+ best_mirror_num=url_num;
+ best_mirror_self_rating=curr_mirror_self_rating;
+ Pbest_mirror=Pcurr_mirror;
+ }
+ if (best_mirror_self_rating==0)
+ // 0 can not be improved - it's one of the best
+ break;
+ }
+ }
+ if (Pbest_mirror){
+ debug("Downloading from BEST_MIRROR:"+url_str);
+// Pbest_mirror->start();
+// active_connections_num++;
+ int result=connection_array[connection_num].start(cm, network_num, num, &dn_segments[seg_num], best_mirror_num);
+ if (result){
+ return result;
+ }else{
+ return R_R_DOWNLOAD_STARTED;
+ }
+ }
+ else{
+ debug("Can't choose mirror for segment:"+dn_segments[seg_num].file_name);
+ return 1;
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: choose_best_mirror()");
+ return 1;
+ }
+}
+bool Tdistfile::choose_best_local_mirror(CURLM* cm, uint connection_num, uint network_num, uint seg_num){
+ try{
+ long best_mirror_num=-1; // the best isn't set let's find it
+ bool all_mirrors_failed=true;
+ ulong best_mirror_self_rating=-1;
+ ulong curr_mirror_self_rating;
+ debug("Choosing mirror for network"+toString(network_num));
+ for (ulong mirror_num=0; mirror_num<network_array[network_num].benchmarked_mirror_list.size(); mirror_num++){
+ debug("Evaluating mirror:"+network_array[network_num].benchmarked_mirror_list[mirror_num].url);
+ if (network_distfile_brokers_array[network_num].mirror_fails_vector[mirror_num]){
+ debug("mirror:"+network_array[network_num].benchmarked_mirror_list[mirror_num].url+" has FAILED status - will be skipped");
+ }else{
+ all_mirrors_failed=false;
+ if (network_array[network_num].benchmarked_mirror_list[mirror_num].get_active_num()<settings.max_connections_num_per_mirror){
+ curr_mirror_self_rating=network_array[network_num].benchmarked_mirror_list[mirror_num].mirror_on_the_wall();
+ if (curr_mirror_self_rating<best_mirror_self_rating){
+ best_mirror_num=mirror_num;
+ best_mirror_self_rating=curr_mirror_self_rating;
+ }
+ if (best_mirror_self_rating==0)
+ // 0 can not be improved - it's one of the best
+ break;
+ }else{
+ debug("Mirror already has:"
+ +toString(network_array[network_num].benchmarked_mirror_list[mirror_num].get_active_num())
+ +" connections which doesn't meet limit:"+toString(settings.max_connections_num_per_mirror));
+ }
+ }
+ }
+ if (best_mirror_num!=-1){
+ debug("Downloading from BEST_LOCAL_MIRROR:"+network_array[network_num].benchmarked_mirror_list[best_mirror_num].url);
+// active_connections_num++;
+ int result=connection_array[connection_num].start(cm, network_num, num, &dn_segments[seg_num], best_mirror_num);
+ if (result){
+ return result;
+ }else{
+ return R_R_DOWNLOAD_STARTED;
+ }
+ return R_R_DOWNLOAD_STARTED;
+ }
+ else{
+ debug("Can't choose LOCAL mirror for segment:"+dn_segments[seg_num].file_name);
+// error_log("Can't choose LOCAL mirror for segment:"+dn_segments[seg_num].file_name);
+ if (all_mirrors_failed){
+ debug("All local mirrors failed in network#"+toString(network_num));
+// error_log("All local mirrors failed in network#"+toString(network_num));
+ }
+ return 1;
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: choose_best_local_mirror()");
+ return 1;
+ }
+}
+
+uint Tdistfile::provide_local_network(CURLM* cm, uint connection_num, uint seg_num, uint network_priority){
+ try{
+ debug("network_priority="+toString(network_priority));
+ //choose network
+//----------------------------------------------------------------------------------------------------------
+//
+// Several criterions can be used here to choose among networks with equal priority:
+// min_active_connection, min_ratio_active_to_max_connection, best_speed_accocding_to_stats, etc
+// add these options to segget.conf file
+//
+//----------------------------------------------------------------------------------------------------------
+ int best_local_network_num=-1;
+ bool allow_proxy_fetcher_mirrors=true;
+ for (uint network_num=0; network_num<MAX_NETWORKS; network_num++){
+ if (network_array[network_num].priority==network_priority){
+ debug(" network_priority="+toString(network_array[network_num].priority));
+ if (network_array[network_num].network_mode==MODE_LOCAL){
+ debug(" network#:"+toString(network_num)+" has MODE_LOCAL");
+ debug(" phase#"+phaseToString(network_distfile_brokers_array[network_num].phase));
+ if (network_distfile_brokers_array[network_num].phase==E_USE_AS_LOCAL_MIRRORS){
+ if (network_array[network_num].has_free_connections()){
+ debug(" has free connections");
+// debug(" Allowed network#:"+toString(network_num));
+ if ((best_local_network_num==-1)
+ or (network_array[best_local_network_num].active_connections_num>network_array[network_num].active_connections_num)){
+ best_local_network_num=network_num;
+ debug(" Replace best LOCAL network to network#:"+toString(network_num));
+ }
+ }else{
+ debug(" does NOT have free connections");
+ if (network_array[network_num].only_local_when_possible){
+ allow_proxy_fetcher_mirrors=false;
+ debug("Network"+toString(network_num)+" forbids using remote mirrors because not all local mirrors have failed");
+ }
+ }
+ }
+ }
+ if (network_array[network_num].network_mode==MODE_PROXY_FETCHER){
+ debug(" network#:"+toString(network_num)+" has MODE_PROXY_FETCHER");
+ debug(" with phase:"+phaseToString(network_distfile_brokers_array[network_num].phase));
+ if ((network_distfile_brokers_array[network_num].phase==E_USE_AS_LOCAL_MIRRORS)
+ or (network_distfile_brokers_array[network_num].phase==E_PROXY_FETCHER_DOWNLOADED))
+ {
+ debug("phase fits");
+ if (network_array[network_num].has_free_connections()){
+ debug(" has free connections");
+// debug(" Allowed network#:"+toString(network_num));
+ if ((best_local_network_num==-1)
+ or (network_array[best_local_network_num].active_connections_num>network_array[network_num].active_connections_num)){
+ best_local_network_num=network_num;
+ debug(" Replace best LOCAL network to network#:"+toString(network_num));
+ }
+ }else{
+ if (network_array[network_num].only_local_when_possible){
+ allow_proxy_fetcher_mirrors=false;
+ debug("Network"+toString(network_num)+" forbids using remote mirrors because not all local mirrors have failed");
+ }
+ }
+ }
+ }
+ }
+ }
+ if (best_local_network_num!=-1){
+ //best network has been found
+ //work with network
+ debug(" So best LOCAL network is network#:"+toString(best_local_network_num));
+ return choose_best_local_mirror(cm, connection_num, best_local_network_num, seg_num);
+ }else{
+ debug(" Haven't found best local network");
+ // if only local and pf networs present, some distfiles may fail all local mirrors => check
+ if (settings.only_local_and_proxy_fetcher_mode_networks_flag){
+ debug(" Checking if all possible mirrors have failed");
+ bool all_neworks_are_local_with_failed_mirrors=true;
+ for (uint network_num=0; network_num<MAX_NETWORKS; network_num++){
+ if (network_array[network_num].priority>0){
+ debug("checking network:"+toString(network_num));
+ if (network_array[network_num].network_mode==MODE_LOCAL){
+ if (network_distfile_brokers_array[network_num].phase!=E_ALL_LOCAL_MIRRORS_FAILED){
+ all_neworks_are_local_with_failed_mirrors=false;
+ break;
+ }
+ }else{ // mode=MODE_PROXY_FETCHER (because only these 2 modes were defined in settings
+ if (network_distfile_brokers_array[network_num].phase!=E_ALL_PROXY_FETCHER_MIRRORS_FAILED){
+ all_neworks_are_local_with_failed_mirrors=false;
+ break;
+ }
+ }
+ }
+ }
+ if (all_neworks_are_local_with_failed_mirrors){
+ set_status(DALL_LM_AND_PF_MIRRORS_FAILED);
+ return R_LM_PF_ALL_MIRRORS_FAILED;
+ }
+ }
+ if (allow_proxy_fetcher_mirrors){
+ return ALLOW_REQUESTS_TO_PROXY_FETCHERS;
+ }else{
+ debug("NOT all local mirrors have failed - restricted to local mirrors only.");
+ return DO_NOT_ALLOW_REQUESTS_TO_PROXY_FETCHERS;
+ }
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: provlocal_networkwork()");
+ return 1;
+ }
+}
+
+uint Tdistfile::request_proxy_fetcher_network(uint network_priority){
+// TO-DO: Add option to go for remote networks or low priority networks even if already DPROXY_QUEUED
+// TO-DO: There can be several proxy-fetchers of the same priority level, define a rule to make a choice
+ try{
+ debug("network_priority="+toString(network_priority));
+ //choose network
+ int best_proxy_fetcher_network_num=-1;
+ bool allow_remote_mirrors=true;
+ for (uint network_num=0; network_num<MAX_NETWORKS; network_num++){
+ if (network_array[network_num].priority==network_priority){
+ if (network_array[network_num].network_mode==MODE_PROXY_FETCHER){
+ //replace this one by does_not_reject_connections
+// if (network_array[network_num].has_free_connections()){
+ if ((network_distfile_brokers_array[network_num].phase==E_USE_AS_LOCAL_MIRRORS)
+ or (network_distfile_brokers_array[network_num].phase==E_ALL_LOCAL_MIRRORS_FAILED)){
+ debug("------//////////// Good phase !!!!!!!!!!!!!!!");
+ decode_server_response(toString(network_distfile_brokers_array[network_num].proxy_fetcher_response));
+ switch (network_distfile_brokers_array[network_num].proxy_fetcher_response){
+ case R_PF_DOWNLOADED:break;
+ case R_PF_ERROR_ADDING_TO_PROXY_QUEUE:break;
+ case R_PF_FAILED:break;
+ case R_PF_REJECTED:break;
+ default:{
+ //if less then 30 secs left don't bother proxy-fetcher
+ if (2000>time_left_since(network_distfile_brokers_array[network_num].last_request_time)){
+ debug("====================== Be more patient with proxy-fetcher - network#:"+toString(network_num)
+ +" because time left:"+toString(time_left_since(network_distfile_brokers_array[network_num].last_request_time)));
+ return R_PF_BE_MORE_PATIENT;
+ }else{
+// (network_array[best_proxy_fetcher_network_num].active_connections_num>network_array[network_num].active_connections_num)
+ best_proxy_fetcher_network_num=network_num;
+ debug("-------------------------------");
+ debug(" Replace best_proxy_fetcher network_num to network#:"+toString(best_proxy_fetcher_network_num));
+ };
+ break;
+ }
+ }
+ }
+ if (best_proxy_fetcher_network_num!=-1) break;
+/*
+ }else{
+ if (network_array[network_num].only_local_when_possible){
+ if (network_distfile_brokers_array[network_num].some_mirrors_have_NOT_failed_yet()){
+ allow_remote_mirrors=false;
+ debug("Network"+toString(network_num)+" forbids using remote mirrors because not all local mirrors have failed");
+ }
+ }
+ }
+*/
+ }
+ }
+ }
+ if (best_proxy_fetcher_network_num != -1){
+ // request from proxy fethcer
+ network_distfile_brokers_array[best_proxy_fetcher_network_num].proxy_fetcher_response=request(best_proxy_fetcher_network_num, json_data);
+ if ((network_distfile_brokers_array[best_proxy_fetcher_network_num].proxy_fetcher_response==R_PF_DOWNLOADED)
+ and (network_distfile_brokers_array[best_proxy_fetcher_network_num].phase==E_ALL_LOCAL_MIRRORS_FAILED))
+ {
+ network_distfile_brokers_array[best_proxy_fetcher_network_num].phase=E_PROXY_FETCHER_DOWNLOADED;
+ }
+ debug("Trying to dowload distfile"+name+" via proxy_fetcher. status="+toString(status));
+ if (network_distfile_brokers_array[best_proxy_fetcher_network_num].phase==E_PROXY_FETCHER_DOWNLOADED){
+ // start download from the proxy_fetcher
+ debug(" So best proxy_fetcher_network is network#:"+toString(best_proxy_fetcher_network_num));
+ return R_PF_DOWNLOADED;
+ //choose_best_local_mirror(cm, connection_num, best_proxy_fetcher_network_num, seg_num);
+ }
+ //return - don't switch to low priority networks
+ return network_distfile_brokers_array[best_proxy_fetcher_network_num].proxy_fetcher_response;
+ }else{
+ if (allow_remote_mirrors){
+ debug(" So best_proxy_fetcher_failed num="+toString(best_proxy_fetcher_network_num));
+ return ALLOW_REMOTE_NETWORKS;
+ }else{
+ debug("NOT all proxy-fetcher mirrors have failed - restricted to proxy-fetcher mirrors only.");
+ return DO_NOT_ALLOW_REMOTE_NETWORKS;
+ }
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: provproxy_fetcher_networkwork()");
+ return 1;
+ }
+}
+
+uint Tdistfile::provide_remote_or_coral_cdn_network(CURLM* cm, uint connection_num, uint seg_num, uint network_priority){
+ try{
+ debug("network_priority="+toString(network_priority));
+ //choose network
+//----------------------------------------------------------------------------------------------------------
+//
+// Several criterions can be used here to choose among networks with equal priority:
+// min_active_connection, min_ratio_active_to_max_connection, best_speed_accocding_to_stats, etc
+// add these options to segget.conf file
+//
+//----------------------------------------------------------------------------------------------------------
+ int best_remote_network_num=-1;
+ for (uint network_num=0; network_num<MAX_NETWORKS; network_num++){
+ if (network_array[network_num].priority==network_priority){
+ if ((network_array[network_num].network_mode==MODE_REMOTE) or (network_array[network_num].network_mode==MODE_CORAL_CDN)){
+ if (network_array[network_num].has_free_connections()){
+ if
+ ((best_remote_network_num==-1)
+ or
+ (network_array[best_remote_network_num].active_connections_num>network_array[network_num].active_connections_num)){
+ best_remote_network_num=network_num;
+ debug(" Replace best_remote_network_num to network#:"+toString(network_num));
+ }
+ }
+ }
+ }
+ }
+ if (best_remote_network_num!=-1){
+ //best network has been found
+ //work with network
+ debug(" So best network is network#:"+toString(best_remote_network_num));
+ return choose_best_mirror(cm, connection_num, best_remote_network_num, seg_num);
+ }
+ // haven't found anything suitable
+ return ALLOW_LOWER_PRIORITY_NETWORKS;
+ }catch(...){
+ error_log("Error: distfile.cpp: provide_remote_network()");
+ return 1;
+ }
+}
+
+int Tdistfile::provide_segment(CURLM* cm, uint connection_num, uint seg_num){
+ try{
+ int result=R_NOT_SET;
+ for (uint network_priority=10; network_priority>0; network_priority--){
+ do {
+ debug("Switching to local networks with priority:"+toString(network_priority));
+ result=provide_local_network(cm, connection_num, seg_num, network_priority);
+ if (result==ALLOW_REQUESTS_TO_PROXY_FETCHERS){
+ debug("Requesting proxy-fetcher networks with priority:"+toString(network_priority));
+ result=request_proxy_fetcher_network(network_priority);
+ switch (result){
+ case ALLOW_REMOTE_NETWORKS:{
+ debug("Switching to remote networks with priority:"+toString(network_priority));
+ result=provide_remote_or_coral_cdn_network(cm, connection_num, seg_num, network_priority);
+ // if not lower_priority_networks => result found => return it
+ if (result!=ALLOW_LOWER_PRIORITY_NETWORKS){
+ return result;
+ };
+ break;
+ }
+ // don't switch to remote and lower priority networks => return results
+ case DO_NOT_ALLOW_REMOTE_NETWORKS: return result;
+ case R_PF_DOWNLOADED: {debug("Yep, R_PF_DONWLOADED => LOOP AGAIN"); break;};
+ // if already in queue, etc...
+ // don't switch to remote and lower priority networks => return results
+ default: return result;
+ }
+ }else{
+ // don't switch to proxy-fetcher requests, remote,
+ // and lower priority networks => return results
+ return result;
+ }
+ // try to download from local mirrors again because one of the proxy-fetcher
+ // claims that distfile has been donwloaded
+ debug("----- JUST BEFORE THE LOOP ----");
+ }while (result==R_PF_DOWNLOADED);
+ }
+ // haven't found anything suitable
+ return R_LM_PF_R_NO_FREE_NETWORK_CONNECTION_FOUND;
+ }catch(...){
+ error_log("Error: distfile.cpp: provide_segment()");
+ return 1;
+ }
+}
+
+string Tdistfile::get_distfile_progress_str(){
+ try{
+ return name+"<>"+toString(status)+"<>"+toString(dld_segments_count)+"<>"+toString(segments_count)\
+ +"<>"+toString(dld_bytes)+"<>"+toString(size);
+ }catch(...){
+ error_log("Error: distfile.cpp: get_distfile_progress_str()");
+ return "";
+ }
+}
+
+void Tdistfile::inc_dld_segments_count(Tsegment* current_segment){
+ try{
+ stats.dld_segments_count++;
+ stats.inc_dld_size(current_segment->segment_size);
+ if (++dld_segments_count==segments_count){
+ combine_segments();
+ }
+ dld_bytes+=current_segment->segment_size;
+ ui_server.send_distfile_progress_msg_to_all_clients(get_distfile_progress_str());
+ }catch(...){
+ error_log("Error: distfile.cpp: inc_dld_segments_count()");
+ }
+}
+long is_symlink_restricted(string distfile_name){
+ for(ulong pattern_num=0; pattern_num<settings.provide_mirror_files_restricted_patterns_vector.size(); pattern_num++){
+ if (distfile_name.find(settings.provide_mirror_files_restricted_patterns_vector[pattern_num],0)!=distfile_name.npos){
+ return pattern_num;
+ }
+ }
+ return -1;
+}
+
+void Tdistfile::symlink_distfile_to_provide_mirror_dir(){
+ try{
+ long pattern_num=is_symlink_restricted(name);
+ if (pattern_num>=0){
+ log("Symlink to distfile:"+name+" was restricted by pattern <"
+ +settings.provide_mirror_files_restricted_patterns_vector[pattern_num]
+ +"> from line "+toString(pattern_num+1)+" of restrict.conf file");
+ return;
+ }
+ string new_mirror_name;
+ string old_distfile_name;
+ try{
+ string old_distfile_path;
+ char current_path[FILENAME_MAX];
+ if (!GetCurrentDir(current_path, sizeof(current_path)))
+ {
+ error_log("Error in distfile.cpp: symlink_distile_to_provide_mirror_dir(): can't get current dir");
+ return;
+ }
+ if (settings.distfiles_dir.find("./",0)==0){
+ old_distfile_path=current_path+settings.distfiles_dir.substr(1,settings.distfiles_dir.npos);
+ }else{
+ old_distfile_path=settings.distfiles_dir;
+ }
+ new_mirror_name=settings.provide_mirror_dir+"/"+name;
+ old_distfile_name=old_distfile_path+"/"+name;
+ try{
+ if (!symlink(old_distfile_name.c_str(), new_mirror_name.c_str())){
+ log("Distfile:"+old_distfile_path+" was symlinked to the mirror dir:");
+ rss_log(name,size);
+ };
+ }catch(uint errno){
+ switch (errno){
+ case EACCES : error_log("Write access to the directory containing "+settings.provide_mirror_dir+" is denied, or one of the directories in the path prefix of "+settings.provide_mirror_dir+" did not allow search permission. (See also path_resolution(7).");
+ break;
+ case EEXIST : error_log("There is already an existing file named "+new_mirror_name+".");
+ break;
+ case EFAULT : error_log(old_distfile_path+" or "+settings.provide_mirror_dir+" points outside your accessible address space.");
+ break;
+ case EIO : error_log("A hardware error occurred while reading or writing data on the disk.");
+ break;
+ case ELOOP : error_log("Too many symbolic links were encountered in resolving "+settings.provide_mirror_dir+".");
+ break;
+ case ENAMETOOLONG : error_log(old_distfile_path+" or "+settings.provide_mirror_dir+" was too long.");
+ break;
+ case ENOENT : error_log("A directory component in "+settings.provide_mirror_dir+" does not exist or is a dangling symbolic link, or "+old_distfile_path+" is the empty string.");
+ break;
+ case ENOMEM : error_log("Insufficient kernel memory was available.");
+ break;
+ case ENOSPC : error_log("The device containing the file has no room for the new directory entry.");
+ break;
+ case ENOTDIR : error_log("A component used as a directory in "+settings.provide_mirror_dir+" is not, in fact, a directory.");
+ break;
+ case EPERM : error_log("The file system containing "+settings.provide_mirror_dir+" does not support the creation of symbolic links.");
+ break;
+ case EROFS : error_log("The file "+new_mirror_name+" would exist on a read-only file system.");
+ break;
+ default:
+ error_log("Undocumented error while trying to symlink "+old_distfile_name+" to "+new_mirror_name);
+ }
+ }catch(...){
+ error_log("Undocumented error (error description is not an integer) while trying to symlink "+old_distfile_name+" to "+new_mirror_name);
+ }
+ }catch(...){
+ error_log("Error in distfile.cpp :: symlink_distfile_to_provide_mirror_dir() while trying to symlink "+old_distfile_name+" to "+new_mirror_name);
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: symlink_distfile_to_provide_mirror_dir()");
+ }
+}
+int Tdistfile::combine_segments(){
+ try{
+ debug("Combining distfile"+name);
+ ofstream distfile_file;
+ distfile_file.exceptions (ofstream::badbit);
+ string distfile_path=settings.distfiles_dir+"/"+name;
+ try{
+ distfile_file.open(distfile_path.c_str(),ofstream::binary|ios::trunc);
+ if (! distfile_file.is_open()){
+ error_log("Error: distfile.cpp: combine_segments(): opening distfile "+distfile_path+" for writing");
+ error_log("....Check if folder "+settings.distfiles_dir+" exists and seggetd has permissions to write into it.");
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: combine_segments(): opening distfile "+distfile_path+" for writing");
+ error_log("....Check if folder "+settings.distfiles_dir+" exists and seggetd has permissions to write into it.");
+ status=DFAILED;
+ return 1;
+ }
+ char * buffer;
+ ulong cur_seg_size;
+ try{
+ for (uint seg_num=0; seg_num < segments_count; seg_num++){
+ debug("Joining "+name+" segment "+toString(seg_num)+" ");
+ ifstream segment_file;
+ segment_file.exceptions (ofstream::failbit | ofstream::badbit);
+ try{
+ segment_file.open((settings.segments_dir+"/"+dn_segments[seg_num].file_name).c_str(),ifstream::binary);
+ }catch(...){
+ error_log("Error: distfile.cpp: combine_segments(): opening segment:"+settings.segments_dir+"/"+dn_segments[seg_num].file_name);
+ status=DFAILED;
+ return 2;
+ }
+ try{
+ // get size of file
+ ulong start=segment_file.tellg();
+ segment_file.seekg(0,ifstream::end);
+ ulong end=segment_file.tellg();
+ cur_seg_size=end-start;
+ segment_file.seekg(0);
+ debug(">>>>>SEG:"+dn_segments[seg_num].file_name+" Start: "+toString(start)+" End: "+toString(end)+" Size: "+toString(cur_seg_size));
+ // allocate memory for file content
+ buffer = new char [cur_seg_size];
+ // read content of infile
+ segment_file.read (buffer,cur_seg_size);
+ segment_file.close();
+ }catch(...){
+ error_log("Error: distfile.cpp: combine_segments(): segment is open, but error occured while reading it:"+settings.segments_dir+"/"+dn_segments[seg_num].file_name);
+ status=DFAILED;
+ return 3;
+ }
+ try{
+ // write to outfile
+ distfile_file.write (buffer,cur_seg_size);
+ }catch(...){
+ error_log("Error: distfile.cpp: combine_segments(): distfile is open, but error occured while writing into it:"+settings.distfiles_dir+"/"+name);
+ status=DFAILED;
+ return 4;
+ }
+ // release dynamically-allocated memory
+ delete[] buffer;
+ if(remove((settings.segments_dir+"/"+dn_segments[seg_num].file_name).c_str()) != 0 )
+ error_log("Tdistfile::combine_segments() - Error: can't delete:"+settings.segments_dir+"/"+dn_segments[seg_num].file_name);
+ else
+ debug(settings.segments_dir+"/"+dn_segments[seg_num].file_name+" deleted" );
+ }
+
+ distfile_file.close();
+ stats.inc_dld_distfiles_count();
+ log("Distfile "+name+" has been combined");
+ }catch(...){
+ error_log("Error in distfile.cpp: combine_segments() for distfile:"+settings.distfiles_dir+"/"+name);
+ status=DFAILED;
+ return 5;
+ }
+ try{
+ if (! rmd160_ok(settings.distfiles_dir+"/"+name,RMD160)){
+ status=DFAILED;
+ return 10;
+ };
+
+ if (! sha1_ok(settings.distfiles_dir+"/"+name,SHA1)){
+ status=DFAILED;
+ return 11;
+ }
+
+ if (! sha256_ok(settings.distfiles_dir+"/"+name,SHA256)){
+ status=DFAILED;
+ return 12;
+ }
+
+ if (! sha512_ok(settings.distfiles_dir+"/"+name,SHA512)){
+ status=DFAILED;
+ return 13;
+ }
+
+ if (! whirlpool_ok(settings.distfiles_dir+"/"+name,WHIRLPOOL)){
+ status=DFAILED;
+ return 14;
+ }
+
+ if (! md5_ok(settings.distfiles_dir+"/"+name,MD5)){
+ status=DFAILED;
+ return 15;
+ }
+
+ if (! crc32_ok(settings.distfiles_dir+"/"+name,CRC32)){
+ status=DFAILED;
+ return 16;
+ }
+ status=DDOWNLOADED;
+ if (settings.provide_mirror_dir!="none"){
+ symlink_distfile_to_provide_mirror_dir();
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: combine_segments() for segment:"+settings.distfiles_dir+"/"+name+" while checking checksums.");
+ return 30;
+ }
+ }catch(...){
+ error_log("Error: distfile.cpp: combine_segments() for segment:"+settings.distfiles_dir+"/"+name+" during procedure.");
+ return 31;
+ }
+ return 0;
+} \ No newline at end of file
diff --git a/seggetd/distfile.h b/seggetd/distfile.h
new file mode 100644
index 0000000..5ca1d95
--- /dev/null
+++ b/seggetd/distfile.h
@@ -0,0 +1,172 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __DISTFILE_H__
+#define __DISTFILE_H__
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef WIN32
+# include <unistd.h>
+#endif
+#include <curl/multi.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fstream>
+#include <iostream>
+#include <json/json.h>
+#ifdef WINDOWS
+ #include <direct.h>
+ #define GetCurrentDir _getcwd
+#else
+ #include <unistd.h>
+ #define GetCurrentDir getcwd
+#endif
+//class Tui_server;
+#include "segment.h"
+#include "networkbroker.h"
+//#include "settings.h"
+//class Tsettings;
+class Tsegment;
+
+//#include <sys/types.h>
+//#include <sys/socket.h>
+//#include <stdio.h>
+//#include <netinet/in.h>
+//#include <arpa/inet.h>
+//#include <sys/ioctl.h>
+//#include <unistd.h>
+//#include <stdlib.h>
+//#include <string>
+//#include <string.h>
+
+
+//#include "client.cpp"
+
+using namespace std;
+
+#define MAX_NETWORKS 10
+typedef unsigned int uint;
+
+enum Tdistfile_status{
+ DNEW,
+ D_NOT_PROXY_REQUESTED,
+ DPROXY_REJECTED,
+ DPROXY_QUEUED,
+ DPROXY_DOWNLOADING,
+ DPROXY_DOWNLOADED,
+ DPROXY_FAILED,
+ DALL_LM_AND_PF_MIRRORS_FAILED,
+ DWAITING,
+ DSCRIPTREJECTED,
+ DDOWNLOADING,
+ DDOWNLOADED,
+ DFAILED
+};
+
+long is_symlink_restricted(string distfile_name);
+
+class Tdistfile{
+ private:
+ bool choose_best_local_mirror(CURLM* cm, uint connection_num, uint network_num, uint seg_num);
+ bool choose_best_mirror(CURLM* cm, uint connection_num, uint network_num, uint seg_num);
+ Tdistfile_status status;
+ public:
+ uint dld_segments_count;
+ ulong dld_bytes;
+ Tnetwork_distfile_broker network_distfile_brokers_array[MAX_NETWORKS];
+ string json_data;
+// bool downloaded;
+ uint active_connections_num;
+ string *url_list;
+ uint url_num;
+ uint segment_num;
+ uint segments_count;
+ Tsegment *dn_segments;
+ string name;
+ uint num;
+ ulong size;
+ string RMD160;
+ string SHA1;
+ string SHA256;
+ string SHA512;
+ string WHIRLPOOL;
+ string MD5;
+ string CRC32;
+ uint url_count;
+ uint segment_size;
+ Tdistfile():
+ status(DNEW),
+ dld_segments_count(0),
+ dld_bytes(0),
+ json_data(""),
+// downloaded(0),
+ active_connections_num(0),
+ url_list(0),
+ url_num(0),
+ segment_num(0),
+ segments_count(0),
+ dn_segments(0),
+ name(""),
+ num(0),
+ size(0),
+ RMD160(""),
+ SHA1(""),
+ SHA256(""),
+ SHA512(""),
+ WHIRLPOOL(""),
+ MD5(""),
+ CRC32(""),
+ url_count(0),
+// segment_size(settings.max_segment_size)
+ segment_size(500000)
+ {init();};
+ Tdistfile(const Tdistfile &L); // copy constructor
+ Tdistfile & operator=(const Tdistfile &L);
+ ~Tdistfile();
+ string statusToString();
+ string statusToColor();
+ int request(ulong network_num, string msg);
+ void init();
+ void set_status(Tdistfile_status new_status);
+ Tdistfile_status get_status(){return status;};
+ bool allows_new_actions();
+ bool load_distfile_from_json(json_object* json_obj_distfile);
+ void load_url_list(json_object* json_array_distfile_urllist);
+ void split_into_segments();
+ uint provide_local_network(CURLM* cm, uint connection_num, uint seg_num, uint network_priority);
+ uint request_proxy_fetcher_network(uint network_priority);
+ uint provide_remote_or_coral_cdn_network(CURLM* cm, uint connection_num, uint seg_num, uint network_priority);
+ int provide_segment(CURLM* cm, uint connection_num, uint seg_num);
+ string get_distfile_progress_str();
+ void inc_dld_segments_count(Tsegment * current_segment);
+ void symlink_distfile_to_provide_mirror_dir();
+ int combine_segments();
+ bool check_if_dld();
+};
+
+#endif \ No newline at end of file
diff --git a/seggetd/distfiles/.gitignore b/seggetd/distfiles/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/seggetd/distfiles/.gitignore
diff --git a/seggetd/init.d/seggetd b/seggetd/init.d/seggetd
new file mode 100755
index 0000000..5e83746
--- /dev/null
+++ b/seggetd/init.d/seggetd
@@ -0,0 +1,90 @@
+#!/bin/sh
+# startup script for seggetd
+
+if [ -f /etc/rc.d/init.d/functions ]; then
+ if [ -f /etc/slackware-version ]; then
+ SYS_F="SL"
+ else
+ . /etc/rc.d/init.d/functions
+ SYS_F="RH"
+ fi
+elif [ -x /sbin/startproc ]; then
+ SYS_F="Su"
+elif [ -x /sbin/start-stop-daemon ]; then
+ SYS_F="De"
+fi
+
+DAEMON=/usr/bin/seggetd
+CONF_DIR=/etc/seggetd
+LOCKFILE=/var/lock/subsys/seggetd
+
+export PATH=$PATH:/usr/local/sbin:/usr/local/bin
+
+segget_start ()
+{
+ echo -n "Starting ${DAEMON}: "
+
+ if [ "$SYS_F" = "RH" ]; then
+ daemon ${DAEMON} --conf-dir=${CONF_DIR}
+ [ "$?" = "0" ] && touch ${LOCKFILE}
+ echo "."
+ elif [ "$SYS_F" = "Su" ]; then
+ startproc ${DAEMON} --conf-dir=${CONF_DIR}
+ echo "."
+ elif [ "$SYS_F" = "De" ]; then
+ start-stop-daemon --start --quiet --oknodo --exec ${DAEMON} -- --conf-dir=${CONF_DIR}
+ echo "."
+ else
+ `${DAEMON} --conf-dir=${CONF_DIR}`
+ fi
+}
+
+segget_stop ()
+{
+ echo -n "Shutting down ${DAEMON}: "
+
+ if [ "$SYS_F" = "De" ]; then
+ start-stop-daemon --stop --quiet --oknodo --signal 15 --exec ${DAEMON}
+ echo "."
+ elif [ "$SYS_F" = "SL" ]; then
+ kill -KILL `pidof ${DAEMON}`
+ [ "$?" = "0" ] && rm -f ${LOCKFILE}
+ echo
+ else
+ killproc ${DAEMON}
+ [ "$?" = "0" ] && rm -f ${LOCKFILE}
+ echo
+ fi
+}
+
+
+case $1 in
+
+ start)
+ segget_start
+ ;;
+
+ stop)
+ segget_stop
+ ;;
+
+ status)
+ pid=`pidof ${DAEMON}`
+ if [ "${pid}" ]; then
+ echo "${DAEMON} is running, pid: $pid"
+ else
+ echo "${DAEMON} is not running"
+ fi
+ ;;
+
+ restart)
+ segget_stop
+ segget_start
+ ;;
+
+ *)
+ echo "Usage: seggetd {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/seggetd/log.cpp b/seggetd/log.cpp
new file mode 100644
index 0000000..a2df826
--- /dev/null
+++ b/seggetd/log.cpp
@@ -0,0 +1,179 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "log.h"
+
+vector<string> rss_distfile_lines;
+vector<ulong> rss_size_lines;
+vector<string> rss_time_lines;
+vector<string> log_lines;
+vector<string> error_log_lines;
+
+string get_time(string time_format){
+ try{
+ time_format=time_format+" ";
+ time_t rawtime;
+ struct tm * timeinfo;
+ char buffer [80];
+ time ( &rawtime );
+ timeinfo = localtime ( &rawtime );
+ strftime(buffer,80,time_format.c_str(),timeinfo);
+ return buffer;
+ }catch(...){
+ error_log("Error in log.cpp: get_time()");
+ return "";
+ }
+}
+
+void log_no_msg(string log_msg_text){
+ try{
+ if (settings.general_log_file!="none"){
+ ofstream file;
+ file.exceptions (ofstream::failbit | ofstream::badbit);
+ try{
+ file.open((settings.logs_dir+"/"+settings.general_log_file).c_str(), ios::app);
+ if (! file.is_open()){
+ error_log("Error opening "+settings.logs_dir+"/"+settings.general_log_file+" for writing.");
+ error_log("....Check if folder "+settings.logs_dir+" exists and seggetd has rights to write into it.");
+ return;
+ }
+ }catch(...){
+ error_log("Error opening "+settings.logs_dir+"/"+settings.general_log_file+" for writing.");
+ error_log("....Check if folder "+settings.logs_dir+" exists and seggetd has rights to write into it.");
+ return;
+ }
+ try{
+ file << get_time(settings.general_log_time_format) << log_msg_text << endl;
+ file.close();
+ }
+ catch(...){
+ error_log("Error while writing "+settings.logs_dir+"/"+settings.general_log_file+".");
+ return;
+ }
+ }
+ }catch(...){
+ error_log("Error in log.cpp: log()");
+ }
+}
+
+void rss_log(string distfile_name, ulong distfile_size){
+// save to file here
+// log_no_msg(log_msg_text);
+ try{
+ rss_distfile_lines.push_back(distfile_name);
+ rss_size_lines.push_back(distfile_size);
+ rss_time_lines.push_back(get_time(settings.general_log_time_format));
+ if (rss_distfile_lines.size()>LOG_LINES_MAX_NUM){
+ rss_distfile_lines.erase(rss_distfile_lines.begin(),rss_distfile_lines.begin()+rss_distfile_lines.size()-LOG_LINES_MAX_NUM);
+ rss_size_lines.erase(rss_size_lines.begin(),rss_size_lines.begin()+rss_size_lines.size()-LOG_LINES_MAX_NUM);
+ rss_time_lines.erase(rss_time_lines.begin(),rss_time_lines.begin()+rss_time_lines.size()-LOG_LINES_MAX_NUM);
+ }
+ }catch(...){
+ error_log("Error in log.cpp: rss_log()");
+ }
+}
+
+void log(string log_msg_text){
+ log_no_msg(log_msg_text);
+ try{
+ string time_str=get_time(settings.general_log_time_format);
+ log_lines.push_back(time_str+log_msg_text);
+ if (log_lines.size()>LOG_LINES_MAX_NUM){
+ log_lines.erase(log_lines.begin(),log_lines.begin()+log_lines.size()-LOG_LINES_MAX_NUM);
+ }
+ msg_log(time_str+log_msg_text);
+ }catch(...){
+ error_log("Error in log.cpp: log()");
+ }
+}
+
+void debug_no_msg(string debug_msg_text){
+ try{
+ if (settings.debug_log_file!="none"){
+ ofstream file;
+ file.exceptions (ofstream::failbit | ofstream::badbit);
+ try{
+ file.open((settings.logs_dir+"/"+settings.debug_log_file).c_str(), ios::app);
+ if (! file.is_open()){
+ error_log("Error opening "+settings.logs_dir+"/"+settings.debug_log_file+" for writing.");
+ error_log("....Check if folder "+settings.logs_dir+" exists and seggetd has permissions to write into it.");
+ return;
+ }
+ }
+ catch(...){
+ error_log("Error opening "+settings.logs_dir+"/"+settings.debug_log_file+" for writing.");
+ error_log("....Check if folder "+settings.logs_dir+" exists and seggetd has permissions to write into it.");
+ return;
+ }
+ try{
+ file << get_time(settings.debug_log_time_format) << debug_msg_text << endl;
+ file.close();
+ }
+ catch(...){
+ error_log("Error while writing "+settings.logs_dir+"/"+settings.debug_log_file+".");
+ return;
+ }
+ }
+ }catch(...){
+ error_log("Error in log.cpp: debug()");
+ }
+}
+
+void debug(string debug_msg_text){
+ debug_no_msg(debug_msg_text);
+ try{
+// msg(DEBUG_LINE_NUM,0, "DEBUG:"+get_time(settings.debug_time_format)+debug_msg_text);
+ }catch(...){
+ error_log("Error in log.cpp: debug()");
+ }
+}
+
+void error_log_no_msg(string error_msg_text){
+ try{
+ if (settings.error_log_file!="none"){
+ ofstream file ((settings.logs_dir+"/"+settings.error_log_file).c_str(), ios::app);
+ file << get_time(settings.error_log_time_format) << error_msg_text << endl;
+ file.close();
+ }
+ }catch(...){
+ fprintf(stderr, "Error opening error log file.");
+ fprintf(stderr, "Error log file: %s/%s",settings.logs_dir.c_str(),settings.error_log_file.c_str());
+ }
+}
+
+void error_log(string error_msg_text){
+ error_log_no_msg(error_msg_text);
+ try{
+ string time_str=get_time(settings.error_log_time_format);
+ error_log_lines.push_back(time_str+error_msg_text);
+ if (error_log_lines.size()>LOG_LINES_MAX_NUM){
+ error_log_lines.erase(error_log_lines.begin(),error_log_lines.begin()+error_log_lines.size()-LOG_LINES_MAX_NUM);
+ }
+ msg_error_log(time_str+error_msg_text);
+ }catch(...){
+ error_log_no_msg("Error in log.cpp: error_log()");
+ }
+} \ No newline at end of file
diff --git a/seggetd/log.h b/seggetd/log.h
new file mode 100644
index 0000000..e6a98cc
--- /dev/null
+++ b/seggetd/log.h
@@ -0,0 +1,48 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __LOG_H__
+#define __LOG_H__
+#include "settings.h"
+#include "utils.h"
+#define LOG_LINES_MAX_NUM 200
+
+using namespace std;
+extern vector<string> rss_distfile_lines;
+extern vector<ulong> rss_size_lines;
+extern vector<string> rss_time_lines;
+extern vector<string> log_lines;
+extern vector<string> error_log_lines;
+
+void rss_log(string distfile_name, ulong distfile_size);
+void log_no_msg(string log_msg_text);
+void log(string log_msg_text);
+void debug_no_msg(string debug_msg_text);
+void debug(string debug_msg_text);
+void error_log_no_msg(string error_msg_text);
+void error_log(string error_msg_text);
+string get_time(string time_format);
+#endif \ No newline at end of file
diff --git a/seggetd/logs/.gitignore b/seggetd/logs/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/seggetd/logs/.gitignore
diff --git a/seggetd/mirror.cpp b/seggetd/mirror.cpp
new file mode 100644
index 0000000..5144e9b
--- /dev/null
+++ b/seggetd/mirror.cpp
@@ -0,0 +1,137 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "mirror.h"
+
+map<string,Tmirror *> mirror_list;
+
+string strip_mirror_name(string path){
+ try{
+ string mirror_name;
+ mirror_name=path.substr(0,path.find("/",(path.find("://",0)+3)));
+ return mirror_name;
+ }catch(...){
+ error_log("Error in mirror.cpp: strip_mirror_name()");
+ return "";
+ }
+}
+
+string convert_to_coral_cdn_url(string url_address){
+ try{
+ string protocol, after_protocol;
+ if (split("://",url_address, protocol, after_protocol)){
+ error_log("Can't convert url:"+url_address+"to CoralCDN url");
+ return "";
+ }
+ if (protocol!="http") return "";
+ string site_name_and_port, path;
+ if (split("/",after_protocol,site_name_and_port,path)){
+ error_log("Can't convert url:"+url_address+"to CoralCDN url");
+ return "";
+ }
+ string site_name,site_port;
+ string new_coral_cdn_url;
+ if (split(":",site_name_and_port,site_name,site_port)){
+ string site_name=site_name_and_port;
+ new_coral_cdn_url=protocol+"://"+site_name+".nyud.net/"+path;
+ }else{;
+ new_coral_cdn_url=protocol+"://"+site_name+"."+site_port+".nyud.net/"+path;
+ }
+ return new_coral_cdn_url;
+ }catch(...){
+ error_log("Error in mirror.cpp: convert_to_coral_cdn_url()");
+ }
+ return "";
+}
+
+double Tmirror::mirror_on_the_wall(){
+ try{
+ double criterion;
+ if (dld_size>0){
+ criterion=honesty*1000000000*dld_time/dld_size;
+ }else{
+ criterion=honesty*1000000000*dld_time;
+ }
+ honesty=honesty*100/(100+settings.benchmark_oblivion);
+ return criterion;
+ }catch(...){
+ error_log("Error in mirror.cpp: mirror_on_the_wall()");
+ return 0;
+ }
+}
+void Tmirror::start(){
+ try{
+ if (!dld_time)
+ dld_time=1;
+ active_num++;
+ honesty=1;
+ }catch(...){
+ error_log("Error in mirror.cpp: start()");
+ }
+}
+
+void Tmirror::stop(ulong time, ulong size){
+ try{
+ if (size==0){
+ failed_downloads++;
+ }else{
+ successful_downloads++;
+ };
+
+ dld_time+=time/1000;
+ dld_size+=size;
+ honesty=1;
+ debug("Connnection to Mirror stopped: Time spent:"+toString(time)+"--- Size downloaded:"+toString(size));
+ active_num--;
+ }catch(...){
+ error_log("Error in mirror.cpp: stop()");
+ }
+}
+
+Tmirror* find_mirror(string mirror_url){
+ try{
+ map<string,Tmirror*>::const_iterator mirror_iterator = mirror_list.find(mirror_url);
+ if (mirror_iterator==mirror_list.end()){
+ Tmirror * Pnew_mirror=new Tmirror;
+ debug("Cant find mirror:"+mirror_url+" - creating new record");
+ mirror_list[mirror_url]=Pnew_mirror;
+ return Pnew_mirror;
+ }
+ else{
+ debug("Found mirror:"+mirror_url);
+ debug("==================>>");
+ debug(" time:"+toString((uint)mirror_iterator->second->dld_time));
+ debug(" size:"+toString(mirror_iterator->second->dld_size));
+ debug(" honesty:"+toString((uint)mirror_iterator->second->honesty));
+ debug(" criterion:"+toString((uint)mirror_iterator->second->mirror_on_the_wall()));
+ return mirror_iterator->second;
+ }
+ }catch(...){
+ error_log("Error in mirror.cpp: find_mirror()");
+ return 0;
+ }
+}
+
diff --git a/seggetd/mirror.h b/seggetd/mirror.h
new file mode 100644
index 0000000..1cdca2e
--- /dev/null
+++ b/seggetd/mirror.h
@@ -0,0 +1,66 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#ifndef __MIRROR_BENCHMARKER_H__
+#define __MIRROR_BENCHMARKER_H__
+
+#include <string>
+#include <map>
+#include "str.h"
+#include "tui.h"
+#include "settings.h"
+using namespace std;
+
+//extern Tsettings settings;
+
+class Tmirror{
+ private:
+ public:
+ uint active_num;
+ string url;
+ ulong dld_time;
+ ulong dld_size;
+ ulong failed_downloads;
+ ulong successful_downloads;
+ double honesty;
+ Tmirror():
+ active_num(0),
+ url(""),
+ dld_time(0),
+ dld_size(0),
+ failed_downloads(0),
+ successful_downloads(0),
+ honesty(1){};
+ void start();
+ void stop(ulong time, ulong size);
+ double mirror_on_the_wall();
+ uint get_active_num(){return active_num;};
+};
+
+extern map<string,Tmirror *> mirror_list;
+string strip_mirror_name(string path);
+Tmirror* find_mirror(string mirror_url);
+string convert_to_coral_cdn_url(string url_address);
+#endif \ No newline at end of file
diff --git a/seggetd/network.cpp b/seggetd/network.cpp
new file mode 100644
index 0000000..ccde337
--- /dev/null
+++ b/seggetd/network.cpp
@@ -0,0 +1,169 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#include "network.h"
+
+Tnetwork network_array[MAX_NETWORKS];
+
+void Tnetwork::load_mirror_list(){
+ try{
+ ifstream file;
+ string mirror_list_file_name="network"+toString(network_num)+"_mirrors.conf";
+ file.exceptions (ifstream::failbit | ifstream::badbit);
+ try{
+ file.open(mirror_list_file_name.c_str());
+ }
+ catch(...){
+ error_log("Can NOT open mirror list file: "+mirror_list_file_name+". Network will be disabled");
+ priority=0;
+ return;
+ }
+ try{
+ //processing file
+ string mirror_line;
+ while (not(file.eof())) {
+ getline(file,mirror_line);
+ if (! mirror_line.length()) continue;
+ if (mirror_line[0] == '#') continue;
+ if (mirror_line[0] == ';') continue;
+ Tmirror cur_mirror;
+ cur_mirror.url=mirror_line;
+ benchmarked_mirror_list.push_back(cur_mirror);
+ debug("LOCAL_MIRROR_ADDED:"+mirror_line);
+ }
+ }catch(ifstream::failure e){
+ if (!file.eof()){
+ error_log("Mirror list file: "+mirror_list_file_name+" was opened, but an error occured while reading from it.");
+ return;
+ }
+ }catch(...){
+ error_log("Mirror list file: "+mirror_list_file_name+" was opened, but an error occured while reading from it.");
+ }
+ }catch(...){
+ error_log_no_msg("Error in network.cpp: load_mirror_list()");
+ }
+}
+
+void Tnetwork::init(uint priority_value){
+ try{
+ priority=priority_value;
+ Tconfig conf("network"+toString(network_num)+".conf");
+ conf.set("mode","network_mode",network_mode,0,3);
+ conf.set("network_bind","bind_interface",bind_interface);
+ conf.set("network_bind","bind_local_port",bind_local_port,0,65535);
+ conf.set("network_bind","bind_local_port_range",bind_local_port_range,1,65535);
+ conf.set("network_connections","max_connections",max_connections,1,MAX_CONNECTS);
+ conf.set("network_connections","connection_timeout",connection_timeout,1,1000);
+ conf.set("network_connections","ftp_response_timeout",ftp_response_timeout,1,-1);
+ conf.set("network_connections","timeout",time_out,100,-1);
+ conf.set("network_connections","low_connection_speed_limit",low_connection_speed_limit,1,-1);
+ conf.set("network_connections","low_connection_speed_time",low_connection_speed_time,1,600);
+ conf.set("network_connections","max_connection_speed",max_connection_speed,1,-1);
+ conf.set("network_connections","follow_location",follow_location);
+ conf.set("network_connections","max_redirs",max_redirs,0,100);
+ conf.set("network_user_data","user_agent",user_agent);
+
+ conf.set("network_proxy","proxy_ip_or_name",proxy_ip_or_name);
+ conf.set("network_proxy","proxy_port",proxy_port,1,65535);
+ conf.set("network_proxy","proxy_off",proxy_off);
+ conf.set("network_proxy","proxy_user",proxy_user);
+ conf.set("network_proxy","proxy_password",proxy_password);
+
+ ulong raw_proxy_type=0;
+ conf.set("network_proxy","proxy_type",raw_proxy_type,0,5);
+ switch (raw_proxy_type){
+ case HTTP: proxy_type=CURLPROXY_HTTP; break;
+ case HTTP_1_0: proxy_type=CURLPROXY_HTTP_1_0; break;
+ case SOCKS4: proxy_type=CURLPROXY_SOCKS4; break;
+ case SOCKS4a: proxy_type=CURLPROXY_SOCKS4A; break;
+ case SOCKS5: proxy_type=CURLPROXY_SOCKS5; break;
+ case SOCKS5_HOSTNAME: proxy_type=CURLPROXY_SOCKS5_HOSTNAME; break;
+ default : proxy_type=CURLPROXY_HTTP; break;
+ }
+
+// conf.set(use_own_mirror_list_only_on, "network_mirrors", "use_own_mirror_list_only_on");
+
+ switch (network_mode){
+ case MODE_LOCAL:
+ {
+ conf.set("network_mirrors","only_local_when_possible",only_local_when_possible);
+ load_mirror_list();
+ log("Settings in file:network"+toString(network_num)+"_mirrors.conf local mirror_list size:"+toString(benchmarked_mirror_list.size()));
+ break;
+ };
+ case MODE_PROXY_FETCHER:
+ {
+ conf.set("network_proxy_fetcher","proxy_fetcher_ip",proxy_fetcher_ip);
+ if (proxy_fetcher_ip=="none"){
+ error_log("Network"+toString(network_num)+" in PROXY_FETCHER mode, but proxy_fetcher_ip="+proxy_fetcher_ip+". Network will be disabled.");
+ priority=0;
+ }else{
+ conf.set("network_proxy_fetcher","proxy_fetcher_port",proxy_fetcher_port,1,65535);
+ if (proxy_fetcher_ip==settings.provide_proxy_fetcher_ip && proxy_fetcher_port==settings.provide_proxy_fetcher_port){
+ error_log("Error: Network"+toString(network_num)+" settings have the same ip and port for proxy-fetcher as the ones in [provide_proxy_fetcher_to_others] section of segget.conf file.");
+ error_log(" Segget instance can NOT serve as a proxy-fetcher for itself - network will be disabled");
+ priority=0;
+ }else{
+ conf.set("network_mirrors","only_local_when_possible",only_local_when_possible);
+ load_mirror_list();
+ log("Settings: Network"+toString(network_num)+" local fetcher_local_mirrors_list size:"+toString(mirror_list.size()));
+ }
+ }
+ break;
+ }
+ default: break; // network in MODE_REMOTE
+ }
+ conf.clear();
+ }catch(...){
+ error_log("Error in network.cpp: init()");
+ }
+}
+
+bool Tnetwork::has_free_connections(){
+ try{
+ if (active_connections_num<max_connections){
+ return true;
+ }else{
+ return false;
+ }
+ }catch(...){
+ error_log_no_msg("Error in network.cpp: has_free_connections()");
+ return false;
+ }
+}
+
+bool Tnetwork::connect(){
+ try{
+ if (active_connections_num<max_connections){
+ active_connections_num++;
+ return true;
+ }else{
+ return false;
+ }
+ }catch(...){
+ error_log_no_msg("Error in network.cpp: connect()");
+ return false;
+ }
+} \ No newline at end of file
diff --git a/seggetd/network.h b/seggetd/network.h
new file mode 100644
index 0000000..58c77b1
--- /dev/null
+++ b/seggetd/network.h
@@ -0,0 +1,145 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#ifndef __NETWORK_H__
+#define __NETWORK_H__
+
+//#include <string>
+//#include <map>
+#include <vector>
+#include <curl/curl.h>
+#include "str.h"
+#include "mirror.h"
+class Tmirror;
+#include "config.h"
+//#include "tui.h"
+//#include "settings.cpp"
+using namespace std;
+
+#define MAX_NETWORKS 10
+
+#define MODE_REMOTE 0
+#define MODE_PROXY_FETCHER 1
+#define MODE_LOCAL 2
+#define MODE_CORAL_CDN 3
+
+#define HTTP 0
+#define HTTP_1_0 1
+#define SOCKS4 2
+#define SOCKS4a 3
+#define SOCKS5 4
+#define SOCKS5_HOSTNAME 5
+
+class Tnetwork{
+ static uint network_count;
+ private:
+ void load_mirror_list();
+ public:
+// vector<int> benchmarked_mirror_list;
+ vector<Tmirror> benchmarked_mirror_list;
+ uint active_connections_num;
+ //network
+ uint network_num;
+ uint priority;
+ //mode
+ ulong network_mode;
+ //network_bind
+ string bind_interface;
+ ulong bind_local_port;
+ ulong bind_local_port_range;
+ //connections
+ ulong max_connections;
+ ulong connection_timeout;
+ ulong ftp_response_timeout;
+ ulong time_out;
+ ulong low_connection_speed_limit;
+ ulong low_connection_speed_time;
+ ulong max_connection_speed;
+ ulong current_speed_time_interval_msecs;
+ bool follow_location;
+ ulong max_redirs;
+ //user-data
+ string user_agent;
+ //proxy
+ string proxy_ip_or_name;
+ ulong proxy_port;
+ bool proxy_off;
+ string proxy_user;
+ string proxy_password;
+ ulong proxy_type;
+ //proxy_fetcher
+ string proxy_fetcher_ip;
+ ulong proxy_fetcher_port;
+ //mirrors
+// bool use_own_mirror_list_only_on;
+ bool only_local_when_possible;
+ Tnetwork():
+ benchmarked_mirror_list(),
+ active_connections_num(0),
+ //network
+ network_num(0),
+ priority(0),
+ //mode
+ network_mode(0),
+ //network_bind
+ bind_interface("none"),
+ bind_local_port(0),
+ bind_local_port_range(20),
+ //connections
+ max_connections(6),
+ connection_timeout(15),
+ ftp_response_timeout(180),
+ time_out(500),
+ low_connection_speed_limit(1000),
+ low_connection_speed_time(10),
+ max_connection_speed(0),
+ current_speed_time_interval_msecs(1000),
+ follow_location(1),
+ max_redirs(5),
+ //user-data
+ user_agent("segget"),
+ //proxy
+ proxy_ip_or_name("none"),
+ proxy_port(3128),
+ proxy_off(1),
+ proxy_user("none"),
+ proxy_password("none"),
+ proxy_type(CURLPROXY_HTTP),
+ //proxy_fetcher
+ proxy_fetcher_ip("none"),
+ proxy_fetcher_port(3131),
+ //mirrors
+// use_own_mirror_list_only_on(0),
+ only_local_when_possible(1)
+ {};
+ void init(uint priority_value);
+ bool has_free_connections();
+ bool connect();
+ void disconnect(){active_connections_num--;};
+};
+
+//extern uint Tnetwork::network_count=0;
+extern Tnetwork network_array[MAX_NETWORKS];
+#endif \ No newline at end of file
diff --git a/seggetd/network0.conf b/seggetd/network0.conf
new file mode 100644
index 0000000..ccc4586
--- /dev/null
+++ b/seggetd/network0.conf
@@ -0,0 +1,293 @@
+[mode]
+# SYNOPSIS: NETWORK_MODE= 0 | 1 | 2 | 3
+# 0 - remote mirrors (default)
+# 1 - proxy fetcher
+# 2 - local mirrors
+# 3 - CoralCDN
+# - If set to 0, segget will use ONLY mirror list provided by portage
+# system, and will NOT use the list from network0_mirrors.conf file.
+# - If set to 1 or 2, segget will replace mirror list provided by portage
+# system with the list from network#_mirrors.conf file
+# - If set to 3, segget will convert mirrors provided by portage system
+# to use CoralCDN caches.
+# In some cases it's necessary to make segget prefer local mirrors over
+# the remote ones. For this purpose define settings for 2 networks:
+# settings for network0 (to provide access to local mirrors),
+# settings for network1 (to provide access to remote ones).
+# 1) Set the following options in segget.conf file:
+# [networks]
+# network0_priority=10
+# network1_priority=9
+# As you can see network0 (with local mirrors) has higher priority than
+# network1 (with mirrors provided by portage).
+# 2) Set NETWORK_MODE=2 in network0.conf file.
+# 3) Create network0_mirrors.conf file with the list of your local
+# mirrors.
+# For example, network0_mirrors.conf may look like this:
+# http://192.168.210.12/
+# ftp://192.168.210.205/
+# http://192.168.210.56/
+# 4) Set NETWORK_MODE=0 in network1.conf file,
+# so segget will use remote mirrors working via this network.
+# NOTE: Actually network0 and network1 can be the same LAN with only
+# one ip address set on the host. The only difference is that in case of
+# network1 segget will have to use a gateway to access remote mirrors.
+# Default:
+# network_mode=0
+network_mode=0
+
+[network_bind]
+# BIND INTERFACE / IP
+# Pass a string as parameter. This sets the interface name to use as outgoing
+# network interface. The name can be an interface name, an IP address, or a host
+# name. No binding is set by default.
+# Default:
+# bind_interface=none
+bind_interface=none
+
+# BIND_LOCAL_PORT
+# This sets the local port number of the socket used for connection. This option
+# can be used in combination with BIND_INTERFACE and you are recommended to
+# use BIND_LOCAL_PORT_RANGE as well when this is set. Set to 0 - to disable
+# binding. Valid port numbers are 1 - 65535.
+# Minimum value: 0 (no binding)
+# Maximum value: 65535
+# Default:
+# bind_local_port=0
+bind_local_port=0
+
+# BIND_LOCAL_PORT_RANGE
+# If BIND_LOCAL_PORT=0 this option will be ignored.
+# This is the number of attempts segget should make to find a
+# working local port number. It starts with the given BIND_LOCAL_PORT and adds
+# one to the number for each retry. Setting this to 1 or below will make segget
+# do only one try for the exact port number. Port numbers by nature are scarce
+# resources that will be busy at times so setting this value to something too
+# low might cause unnecessary connection setup failures.
+# Minimum value: 1
+# Maximum value: 65535
+# Default:
+# bind_local_port_range=20
+bind_local_port_range=20
+
+[network_connections]
+# NETWORK_MAX_CONNECTIONS
+# Define maximum number of connections
+# Minimum value: 1
+# Maximum value: 20
+# Default:
+# max_connections=10
+max_connections=3
+
+# CONNECTION_TIMEOUT
+# Set the number of seconds to wait while trying to connect. Use 0 to wait
+# indefinitely. Pass a long. It should contain the maximum time in seconds that
+# you allow the connection to the server to take. This only limits the connection
+# phase, once it has connected, this option is of no more use. Set to zero to
+# disable connection timeout (it will then only timeout on the system's internal
+# timeouts). See also the TIMEOUT option.
+# Minimum value: 1
+# Maximum value: 1000
+# Default:
+# connection_timeout=15
+connection_timeout=150
+
+# FTP_RESPONSE_TIMEOUT
+# Set a timeout period (in seconds) on the amount of time that the server is
+# allowed to take in order to generate a response message for a command before the
+# session is considered hung. While awaiting for a response, this value overrides
+# TIMEOUT. It is recommended that if used in conjunction with TIMEOUT, you set
+# FTP_RESPONSE_TIMEOUT to a value smaller than TIMEOUT.
+# Minimum value: 1
+# Maximum value: -1 (for no limit)
+# Default:
+# ftp_response_timeout=180
+ftp_response_timeout=1800
+
+# TIMEOUT
+# maximum amount of time to download segment in seconds
+# Set the maximum number of seconds for a connection to execute.
+# Pass a long as parameter containing the maximum time in seconds that you allow
+# the transfer operation to take. Normally, name lookups can take a considerable
+# time and limiting operations to less than a few minutes risk aborting perfectly
+# normal operations.
+# Minimum value: 100
+# Maximum value: -1 (for no limit)
+# Default:
+# timeout=500
+timeout=5000
+
+# LOW_CONNECTION_SPEED_LIMIT
+# Define the low speed limit for connection. Pass a long as parameter. It
+# contains the transfer speed in bytes per second that the transfer should be
+# below during LOW_CONNECTION_SPEED_TIME seconds to consider it too slow and abort.
+# Minimum value: 1
+# Maximum value: -1 (-1 for no limit)
+# Default:
+# low_connection_speed_limit=1000
+low_connection_speed_limit=1000
+
+# LOW_CONNECTION_SPEED_TIME
+# Pass a long as parameter. It contains the time in seconds that the transfer
+# should be below the LOW_CONNECTION_SPEED_LIMIT to consider it too slow and abort.
+# Minimum value: 1
+# Maximum value: 600
+# Default:
+# low_connection_speed_time=10
+low_connection_speed_time=10
+
+# MAX_CONNECTION_SPEED
+# If a download exceeds this speed (counted in bytes per second) on cumulative
+# average during the transfer, the transfer will pause to keep the average rate
+# less than or equal to the parameter value. Defaults to unlimited speed.
+# Minimum value: 1
+# Maximum value: -1 (-1 for no limit)
+# Default:
+# max_connection_speed=0
+max_connection_speed=3000
+
+# SYNOPSIS: FOLLOW_LOCATION= 0 | 1
+# A parameter set to 1 tells segget to follow any Location: header that the server
+# sends as part of an HTTP header. This means that the segget will re-send the
+# same request on the new location and follow new Location: headers all the way
+# until no more such headers are returned. MAX_REDIRS can be used to limit the
+# number of redirects segget will follow.
+# Default:
+# follow_location=1
+follow_location=1
+
+# MAX_REDIRS
+# The set number will be the redirection limit. If that many redirections have
+# been followed, the next redirect will cause an error. This option only makes
+# sense if the FOLLOW_LOCATION is used at the same time.
+# Setting the limit to 0 will make segget refuse any redirect.
+# Minimum value: 0
+# Maximum value: 100
+# Default:
+# max_redirs=5
+max_redirs=5
+
+[network_protocols]
+# SYNOPSIS: http_on=0 | 1
+# Default:
+# http_on=1
+# NOT IMPLEMENTED YET: http_on=1
+
+# SYNOPSIS: ftp_on=0 | 1
+# Default:
+# ftp_on=1
+# NOT IMPLEMENTED YET: ftp_on=1
+
+[network_user_data]
+# USER_AGENT
+# Set the User-Agent: header in the http request sent to the remote server.
+# This can be used to fool servers or scripts.
+# Default:
+# user_agent=segget
+user_agent=segget
+
+# Specify the user and password for authentication on a ftp servers.
+# NOT IMPLEMENTED YET: ftp-user=anonymous
+# NOT IMPLEMENTED YET: ftp-password=me@mail.ru
+
+[network_proxy]
+# PROXY_IP_OR_NAME
+# Specify a proxy to use (address and port).
+# Set HTTP proxy to use. The parameter should be a string holding the proxy host
+# name or dotted IP address. To specify port number in this string,
+# append :[port] to the end of the host name. The proxy string may be prefixed
+# with [protocol]:// since any such prefix will be ignored. The proxy's port
+# number may optionally be specified with the separate option. If not specified,
+# by default port 1080 will be used for proxies.
+# When you tell segget to use an HTTP proxy, segget will transparently convert
+# operations to HTTP even if you specify an FTP URL etc.
+# Segget respects the environment variables http_proxy, ftp_proxy, all_proxy etc,
+# if any of those are set. The PROXY option does however override any possibly
+# set environment variables.
+# Default:
+# proxy_ip_or_name=none
+proxy_ip_or_name=none
+
+# PROXY_PORT
+# Set the proxy port to connect to unless it is specified in the PROXY option.
+# Minimum value: 1
+# Maximum value: 65535
+# Default:
+# proxy_port=3128
+proxy_port=3128
+
+# PROXY_USER
+# Set user name to use for the transfer while connecting to Proxy.
+# The PROXY_USER option should be used in same way as the PROXY_PASSWORD is used.
+# In order to specify the password to be used in conjunction with the user name
+# use the PROXY_PASSWORD option.
+# Default:
+# proxy_user=none
+proxy_user=none
+
+# PROXY_PASSWORD
+# Set password to use for the transfer while connecting to Proxy.
+# The PROXY_PASSWORD option should be used in conjunction with the PROXY_USER
+# option.
+# Default:
+# proxy_password=none
+proxy_password=none
+
+# SYNOPSIS: PROXY_TYPE = 0 | 1 | 2 | 3 | 4 | 5
+# 0 - HTTP
+# 1 - HTTP_1_0
+# 2 - SOCKS4
+# 3 - SOCKS4a
+# 4 - SOCKS5
+# 5 - SOCKS5_HOSTNAME
+# Specify type of the proxy.
+# Default:
+# proxy_type=0
+proxy_type=0
+
+# SYNOPSIS: proxy_off=0 | 1
+# Setting the proxy_off=1 will explicitly disable the use of a proxy, even if
+# there is an environment variable set for it.
+# Default:
+# proxy_off=1
+proxy_off=1
+
+[network_proxy_fetcher]
+# PROXY_FETCHER_IP
+# This option is active only when NETWORK_MODE=1, in other cases it's ignored.
+# Specify IP addres of the proxy-fetcher
+# Default:
+# proxy_fetcher_ip=none
+proxy_fetcher_ip=none
+
+# PROXY_FETCHER_PORT
+# This option is active only when NETWORK_MODE=1, in other cases it's ignored.
+# Specify proxy-fetcher address
+# Default:
+# proxy_fetcher_port=3131
+proxy_fetcher_port=3131
+
+# Specify the user and password for authentication on a proxy-fetcher-server.
+# NOT IMPLEMENTED YET: proxy-fetcher-user=user
+# NOT IMPLEMENTED YET: proxy-fetcher-password=password
+
+[network_mirrors]
+# SYNOPSIS: ONLY_LOCAL_WHEN_POSSIBLE=0 | 1
+# If NETWORK_MODE=0 or NETWORK_MODE=1 this option will be ignored.
+# - If set to 1, segget will not use remote mirrors with equal or lower
+# priority until all mirrors in network#_mirrors.conf file have failed.
+# - If set to 0, segget will use remote mirrors with equal priority or
+# mirrors with lower priority when this network has NO free connections
+# (see option NETWORK_MAX_CONNECTIONS in [network_connections] section
+# of this file).
+# NOTE: Following example for NETWORK_MODE option,
+# if in network0.conf has option ONLY_LOCAL_WHEN_POSSIBLE=1, segget
+# will NOT start to use network1 for a particular distfile until all
+# mirrors specified in network0_mirrors.conf file will have failed
+# to provide this distfile.
+# On the other hand if ONLY_LOCAL_WHEN_POSSIBLE=0 segget will start
+# to use network1 as soon as NETWORK_MAX_CONNECTIONS limit, set
+# in network0.conf file has been reached.
+# Default:
+# only_local_when_possible=1
+only_local_when_possible=0 \ No newline at end of file
diff --git a/seggetd/network0_mirrors.conf b/seggetd/network0_mirrors.conf
new file mode 100644
index 0000000..529a268
--- /dev/null
+++ b/seggetd/network0_mirrors.conf
@@ -0,0 +1 @@
+ftp://192.168.56.101/ \ No newline at end of file
diff --git a/seggetd/networkbroker.cpp b/seggetd/networkbroker.cpp
new file mode 100644
index 0000000..36e3d7e
--- /dev/null
+++ b/seggetd/networkbroker.cpp
@@ -0,0 +1,97 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "networkbroker.h"
+#include "network.h"
+
+string phaseToString(int phase_num);
+
+
+
+void Tnetwork_distfile_broker::init(ulong network_number){
+ try{
+ network_num=network_number;
+ // init mirror_fail_vector for LOCAL AND PROXY-FETCHER NETWORK BUT NOT REMOTE NETWORK
+ if (network_array[network_num].network_mode!=MODE_REMOTE){
+ // create flags for each mirror from this network
+ mirror_fails_vector.insert(mirror_fails_vector.begin(),network_array[network_num].benchmarked_mirror_list.size(),false);
+ gettimeofday(&last_request_time, NULL);
+ }
+ }catch(...){
+ error_log("Error in networkbroker.cpp: init()");
+ }
+}
+
+void Tnetwork_distfile_broker::local_mirror_failed(uint mirror_num){
+ if (phase==E_USE_AS_LOCAL_MIRRORS){
+ if (! mirror_fails_vector[mirror_num]){
+ mirror_fails_vector[mirror_num]=true;
+ failed_mirrors_num++;
+ }
+ if (failed_mirrors_num>=mirror_fails_vector.size()){
+ phase=E_ALL_LOCAL_MIRRORS_FAILED;
+ failed_mirrors_num=0;
+ // clean the vector, to use it again when we switch to E_PROXY_FETCHER_DOWNLOADED phase
+ for (ulong mirr_num=0; mirr_num<mirror_fails_vector.size(); mirr_num++){
+ mirror_fails_vector[mirr_num]=false;
+ }
+ }
+ }
+}
+
+void Tnetwork_distfile_broker::proxy_fetcher_mirror_failed(uint mirror_num){
+ if (phase==E_PROXY_FETCHER_DOWNLOADED){
+ if (! mirror_fails_vector[mirror_num]){
+ mirror_fails_vector[mirror_num]=true;
+ failed_mirrors_num++;
+ }
+ if (failed_mirrors_num>=mirror_fails_vector.size()){
+ phase=E_ALL_PROXY_FETCHER_MIRRORS_FAILED;
+ failed_mirrors_num=0;
+ }
+ }
+}
+
+/*
+bool Tnetwork_distfile_broker::some_mirrors_have_NOT_failed_yet(){
+ try{
+ if (failed_mirrors_num<mirror_fails_vector.size()){
+ return false;
+ }else{
+ return true;
+ }
+// for (ulong cur_mirror_num=0; cur_mirror_num<mirror_fails_vector.size();cur_mirror_num++){
+// if (! mirror_fails_vector[cur_mirror_num]){
+// return true;
+// }
+// }
+// return false;
+ }catch(...){
+ error_log("Error in networkbroker.cpp: init()");
+ return false;
+ }
+}
+*/ \ No newline at end of file
diff --git a/seggetd/networkbroker.h b/seggetd/networkbroker.h
new file mode 100644
index 0000000..9c43ec3
--- /dev/null
+++ b/seggetd/networkbroker.h
@@ -0,0 +1,60 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#ifndef __NETWORK_DISTFILE_BROKER_H__
+#define __NETWORK_DISTFILE_BROKER_H__
+
+#include <vector>
+#include <sys/time.h>
+#include "shorttypes.h"
+#include "response.h"
+#include "phase.h"
+using namespace std;
+
+class Tnetwork_distfile_broker{
+ public:
+// map<string,Tmirror *> benchmarked_mirror_list;
+ vector<bool> mirror_fails_vector;
+ timeval last_request_time;
+ ulong network_num;
+ ulong failed_mirrors_num;
+ Tnetwork_distfile_broker_phases phase;
+ uint proxy_fetcher_response;
+ Tnetwork_distfile_broker():
+ mirror_fails_vector(),
+ last_request_time(),
+ network_num(0),
+ failed_mirrors_num(0),
+ phase(E_USE_AS_LOCAL_MIRRORS),
+ proxy_fetcher_response(R_PF_NOT_REQUESTED_YET)
+ {};
+ void init(ulong network_number);
+// void mirror_failed(uint mirror_num);
+ void local_mirror_failed(uint mirror_num);
+ void proxy_fetcher_mirror_failed(uint mirror_num);
+// bool some_mirrors_have_NOT_failed_yet();
+};
+
+#endif
diff --git a/seggetd/phase.cpp b/seggetd/phase.cpp
new file mode 100644
index 0000000..04aef35
--- /dev/null
+++ b/seggetd/phase.cpp
@@ -0,0 +1,37 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "phase.h"
+
+string phaseToString(int phase_num){
+ switch(phase_num){
+ case E_USE_AS_LOCAL_MIRRORS: return "E_USE_AS_LOCAL_MIRRORS";
+ case E_ALL_LOCAL_MIRRORS_FAILED: return "E_ALL_LOCAL_MIRRORS_FAILED";
+ case E_PROXY_FETCHER_DOWNLOADED: return "E_PROXY_FETCHER_DOWNLOADED";
+ case E_ALL_PROXY_FETCHER_MIRRORS_FAILED: return "E_ALL_PROXY_FETCHER_MIRRORS_FAILED";
+ default: return "Unknown phase";
+ }
+}
diff --git a/seggetd/phase.h b/seggetd/phase.h
new file mode 100644
index 0000000..221c33d
--- /dev/null
+++ b/seggetd/phase.h
@@ -0,0 +1,43 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __PHASE_H__
+#define __PHASE_H__
+
+#include <string>
+
+using namespace std;
+
+enum Tnetwork_distfile_broker_phases{
+ E_USE_AS_LOCAL_MIRRORS,
+ E_ALL_LOCAL_MIRRORS_FAILED,
+ E_PROXY_FETCHER_DOWNLOADED,
+ E_ALL_PROXY_FETCHER_MIRRORS_FAILED
+};
+
+string phaseToString(int phase_num);
+
+#endif \ No newline at end of file
diff --git a/seggetd/pkg.cpp b/seggetd/pkg.cpp
new file mode 100644
index 0000000..737bb5d
--- /dev/null
+++ b/seggetd/pkg.cpp
@@ -0,0 +1,135 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "pkg.h"
+Tpkg **Ppkg_array;
+Tpkg proxy_fetcher_pkg;
+Tpkg request_server_pkg;
+
+//#define R_DOWNLOAD_STARTED 0
+//#define R_ADDED_TO_PROXY_QUEUE 100
+//#define R_ALREADY_WAS_IN_QUEUE 101
+//#define R_WAIT_FOR_LOCAL_MIRRORS 102
+//#define R_NO_FREE_NETWORK_CONNECTION_FOUND 103
+//#define R_ERROR_ADDING_TO_PROXY_QUEUE 200
+
+int Tpkg::push_back_distfile(json_object* json_obj_distfile){
+ try{
+ Tdistfile * Pcur_distfile=new Tdistfile();
+ if (Pcur_distfile->load_distfile_from_json(json_obj_distfile)){
+ error_log("Error in pkg.cpp: push_back_distfile(): while loading distfile");
+ return R_PF_ERROR_ADDING_TO_PROXY_QUEUE;
+ }else{
+ debug("pkg.cpp: push_back_distfile(): json import ok - pushback distfile");
+ Pdistfile_list.push_back(Pcur_distfile);
+ distfile_count++;
+ return R_PF_ADDED_TO_PROXY_QUEUE;
+ }
+ }catch(...){
+ error_log("Error in pkg.cpp: pushback_distfile()");
+ return R_PF_ERROR_ADDING_TO_PROXY_QUEUE;
+ }
+}
+
+int Tpkg::find_distfile(string distfile_name){
+ try{
+ for (ulong distfile_num=0; distfile_num<distfile_count; distfile_num++){
+ if (Pdistfile_list[distfile_num]->name==distfile_name){
+ switch (Pdistfile_list[distfile_num]->get_status()){
+ case DDOWNLOADED: {
+ debug("find_distfile(): distfile: "+distfile_name+" was downloaded");
+ return R_PF_DOWNLOADED;
+ };
+ case DFAILED:{
+ debug("find_distfile(): failed to download distfile: "+distfile_name);
+ return R_PF_FAILED;
+ }
+ default:{
+ debug("find_distfile(): distfile: "+distfile_name+" was already in queue");
+ return R_PF_ALREADY_WAS_IN_QUEUE;
+ }
+ }
+ }
+ }
+ return R_PF_NOT_REQUESTED_YET;
+ }catch(...){
+ error_log("Error in pkg.cpp: find_distfile()");
+ }
+ debug("Error in pkg.cpp: find_distfile(): distfile: "+distfile_name);
+ return R_PF_ERROR_ADDING_TO_PROXY_QUEUE;
+}
+
+void Tpkg::load_distfile_list(json_object* json_array_distfile_list){
+ try{
+ ulong distfile_counter=json_object_array_length(json_array_distfile_list);
+ for(uint distfile_array_item_num=0;distfile_array_item_num<distfile_counter;distfile_array_item_num++){
+ push_back_distfile(json_object_array_get_idx(json_array_distfile_list,distfile_array_item_num));
+ }
+ }catch(...){
+ error_log("Error in pkg.cpp: load_distfile_list()");
+ }
+}
+/*
+void Tpkg::load_distfile_list(json_object* json_array_distfile_list){
+ try{
+ distfile_count=json_object_array_length(json_array_distfile_list);
+// Pdistfile_list= new Tdistfile* [distfile_count];
+ for(uint distfile_array_item_num=0;distfile_array_item_num<distfile_count;distfile_array_item_num++){
+// Pdistfile_list[distfile_array_item_num]=new Tdistfile();
+ Pdistfile_list.push_back(new Tdistfile());
+// Tdistfile a_distfile;
+// a_distfile.load_distfile_from_json(json_object_array_get_idx(json_array_distfile_list,distfile_array_item_num));
+ Pdistfile_list[distfile_array_item_num]->load_distfile_from_json(json_object_array_get_idx(json_array_distfile_list,distfile_array_item_num));
+ }
+ }catch(...){
+ error_log("Error in pkg.cpp: load_distfile_list()");
+ }
+}
+*/
+
+
+
+void Tpkg::load_pkg_from_json(json_object* json_obj_pkg){
+ try{
+ // printf("\t%d %s\n",array_item_num, json_object_to_json_string(json_obj_pkg));
+ name=json_object_to_json_string(json_object_object_get(json_obj_pkg,"pkg_name"));
+ category=json_object_to_json_string(json_object_object_get(json_obj_pkg,"CATEGORY"));
+ load_distfile_list(json_object_object_get(json_obj_pkg,"distfile_list"));
+ }catch(...){
+ error_log("Error in pkg.cpp: load_pkg_from_json()");
+ }
+}
+
+Tpkg::~Tpkg(){
+ try{
+ for (uint i=0;i<distfile_count;i++)
+ delete Pdistfile_list[i];
+ Pdistfile_list.clear();
+// delete [] Pdistfile_list;
+ }catch(...){
+ error_log("Error in pkg.cpp: ~Tpkg");
+ }
+} \ No newline at end of file
diff --git a/seggetd/pkg.h b/seggetd/pkg.h
new file mode 100644
index 0000000..63a913e
--- /dev/null
+++ b/seggetd/pkg.h
@@ -0,0 +1,70 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+#ifndef __PKG_H__
+#define __PKG_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fstream>
+#include <iostream>
+#include <json/json.h>
+class Tdistfile;
+#include "distfile.h"
+
+using namespace std;
+typedef unsigned int uint;
+typedef Tdistfile* Pdistfile;
+
+#define Q_ADDED_TO_QUEUE 0
+#define Q_ALREADY_EXISTS 1
+#define Q_ERROR 100
+
+class Tpkg{
+ public:
+ vector<Pdistfile> Pdistfile_list;
+ string name;
+ string category;
+ uint distfile_count;
+ void load_distfile_list(json_object* json_array_distfile_list);
+ Tpkg():
+ Pdistfile_list(),
+ name(""),
+ category(""),
+ distfile_count(0)
+ {};
+ Tpkg(const Tpkg &L); // copy constructor
+ Tpkg & operator=(const Tpkg &L);
+ ~Tpkg();
+ int push_back_distfile(json_object* json_obj_distfile);
+ int find_distfile(string distfile_name);
+ void load_pkg_from_json(json_object* json_obj_pkg);
+};
+
+extern Tpkg **Ppkg_array;
+extern Tpkg proxy_fetcher_pkg;
+extern Tpkg request_server_pkg;
+
+#endif \ No newline at end of file
diff --git a/seggetd/pkg.list b/seggetd/pkg.list
new file mode 100644
index 0000000..bb2559f
--- /dev/null
+++ b/seggetd/pkg.list
@@ -0,0 +1,1248 @@
+[
+ {
+ "CATEGORY": "dev-libs",
+ "distfile_list": [],
+ "pkg_name": "json-c-0.9"
+ },
+ {
+ "CATEGORY": "media-fonts",
+ "distfile_list": [],
+ "pkg_name": "gnu-gs-fonts-std-8.11"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "xextproto-7.1.1"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "xtrans-1.2.5"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "5f3fea120f2dba274c4150b02162bba40b65a872",
+ "SHA1": "977c10b88a2230e96868edc78a9e3789c0fcbf70",
+ "SHA256": "176f51ddb06dce67ab4b2efc6b327dc21ed8f764c5d97acc15ff1f907c2affae",
+ "name": "qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "size": 160601949,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.osuosl.org/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.hoobly.com/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://www.cyberuse.com/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.datapipe.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirrors.rit.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.cs.uni.edu/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://lug.mtu.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://lug.mtu.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.llarian.net/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.netnitco.net/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz"
+ ]
+ }
+ ],
+ "pkg_name": "qt-core-4.6.2-r1"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "inputproto-2.0"
+ },
+ {
+ "CATEGORY": "media-libs",
+ "distfile_list": [],
+ "pkg_name": "libpng-1.2.43-r2"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "renderproto-0.11"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "kbproto-1.0.4"
+ },
+ {
+ "CATEGORY": "dev-libs",
+ "distfile_list": [],
+ "pkg_name": "libgpg-error-1.7"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "fontsproto-2.1.0"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "4a890690422cc1051cef6f167b0474ff4dd77ef1",
+ "SHA1": "e71370c349e93ba70f91ad1148ca9e5cabfcca4f",
+ "SHA256": "7f3cde0331e9ad3da720b1a8255e121673701199df0802b62380436e74222700",
+ "name": "libfontenc-1.0.5.tar.bz2",
+ "size": 250146,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libfontenc-1.0.5.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/libfontenc-1.0.5.tar.bz2",
+ "http://xorg.freedesktop.org/releases/individual/lib/libfontenc-1.0.5.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "libfontenc-1.0.5"
+ },
+ {
+ "CATEGORY": "media-libs",
+ "distfile_list": [],
+ "pkg_name": "tiff-3.9.2-r1"
+ },
+ {
+ "CATEGORY": "dev-lang",
+ "distfile_list": [],
+ "pkg_name": "tcl-8.5.7"
+ },
+ {
+ "CATEGORY": "dev-libs",
+ "distfile_list": [
+ {
+ "RMD160": "efe2f03ae37512636d33c7d285c46d9050e9296b",
+ "SHA1": "b815899dff10d245b31257f434230f8e45f2446a",
+ "SHA256": "b59845ebbad959f86a349873fda75af02a69105a4e5c6a7eb40225358677411a",
+ "name": "xmlrpc-c-1.18.02.tar.bz2",
+ "size": 552233,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirror.ovh.net/gentoo-distfiles/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.free.fr/mirrors/ftp.gentoo.org/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://open-systems.ufl.edu/mirrors/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://ftp.jaist.ac.jp/pub/Linux/Gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://gentoo.mirrors.pair.com/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://mirror.bytemark.co.uk/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirror.bytemark.co.uk/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.gentoo.mesh-solutions.com/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.osuosl.org/pub/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "http://mirrors.tds.net/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2",
+ "ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/xmlrpc-c/xmlrpc-c-1.18.02.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "xmlrpc-c-1.18.02"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [
+ {
+ "RMD160": "3b61572ace8c33f57e4fab0995c8c8006b406c54",
+ "SHA1": "36731bae6e815453af4b055c26ad8e9e2653ca05",
+ "SHA256": "d93ca3c0ae710a45da6a27e1eeadfb3c9d4aee47f23657c996e1124c0d9985ca",
+ "name": "randrproto-1.3.1.tar.bz2",
+ "size": 110435,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/randrproto-1.3.1.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/randrproto-1.3.1.tar.bz2",
+ "http://xorg.freedesktop.org/releases/individual/proto/randrproto-1.3.1.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "randrproto-1.3.1"
+ },
+ {
+ "CATEGORY": "dev-lang",
+ "distfile_list": [],
+ "pkg_name": "yasm-0.8.0"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "xf86bigfontproto-1.2.0"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "xcb-proto-1.6"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libXau-1.0.5"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libXdmcp-1.0.3"
+ },
+ {
+ "CATEGORY": "dev-libs",
+ "distfile_list": [],
+ "pkg_name": "libpthread-stubs-0.1"
+ },
+ {
+ "CATEGORY": "dev-libs",
+ "distfile_list": [],
+ "pkg_name": "libgcrypt-1.4.5"
+ },
+ {
+ "CATEGORY": "x11-proto",
+ "distfile_list": [],
+ "pkg_name": "fixesproto-4.1.1"
+ },
+ {
+ "CATEGORY": "media-video",
+ "distfile_list": [],
+ "pkg_name": "ffmpeg-0.5_p20373"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "5f3fea120f2dba274c4150b02162bba40b65a872",
+ "SHA1": "977c10b88a2230e96868edc78a9e3789c0fcbf70",
+ "SHA256": "176f51ddb06dce67ab4b2efc6b327dc21ed8f764c5d97acc15ff1f907c2affae",
+ "name": "qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "size": 160601949,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.osuosl.org/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.hoobly.com/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://www.cyberuse.com/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.datapipe.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirrors.rit.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.cs.uni.edu/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://lug.mtu.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://lug.mtu.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.llarian.net/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.netnitco.net/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz"
+ ]
+ }
+ ],
+ "pkg_name": "qt-script-4.6.2"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "a3368fb979409aaaf577b3c8ff6e3aa906f63114",
+ "SHA1": "f8dc669760975b41885143f828b54164224c8a31",
+ "SHA256": "112bfc30820b98deec4c9914536c5aa2f8b5162bd2b0bdb342343168e06f7679",
+ "name": "libXfont-1.4.1.tar.bz2",
+ "size": 428802,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXfont-1.4.1.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/libXfont-1.4.1.tar.bz2",
+ "http://xorg.freedesktop.org/releases/individual/lib/libXfont-1.4.1.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "libXfont-1.4.1"
+ },
+ {
+ "CATEGORY": "dev-util",
+ "distfile_list": [
+ {
+ "RMD160": "e4217067537f76e52317514cb5bb0cf38733d16a",
+ "SHA1": "c7e295683e061c2ed19773a1f0444972f75db092",
+ "SHA256": "9cdd2152e37b05d0d40d334a1bb2dfc0250021797360f971c6ea3d457ac9fdf2",
+ "name": "cmake-2.6.4.tar.gz",
+ "size": 3285371,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.osuosl.org/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.mirrors.hoobly.com/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://www.cyberuse.com/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://mirror.datapipe.net/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://mirrors.rit.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.cs.uni.edu/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://lug.mtu.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://lug.mtu.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.llarian.net/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://gentoo.netnitco.net/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/cmake-2.6.4.tar.gz",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/cmake-2.6.4.tar.gz",
+ "http://www.cmake.org/files/v2.6/cmake-2.6.4.tar.gz"
+ ]
+ }
+ ],
+ "pkg_name": "cmake-2.6.4-r3"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libICE-1.0.6"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libSM-1.1.1"
+ },
+ {
+ "CATEGORY": "dev-libs",
+ "distfile_list": [],
+ "pkg_name": "libxslt-1.1.26"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libxcb-1.5"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libX11-1.3.3"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libXext-1.1.1"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "efb078aa00d8a3463a2f8267f600579372ded38d",
+ "SHA1": "278f762feb8e754aa5214175abf580ff486281f7",
+ "SHA256": "bc0590438a4be2b674cbac6f4ad46e5a89acd02aa94817da0fa8eb3ef05ed5d5",
+ "name": "libXrender-0.9.5.tar.bz2",
+ "size": 261483,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXrender-0.9.5.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/libXrender-0.9.5.tar.bz2",
+ "http://xorg.freedesktop.org/releases/individual/lib/libXrender-0.9.5.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "libXrender-0.9.5"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libXfixes-4.0.4"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libXt-1.0.8"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "2b63caf8c6c26685f2b77f4fad6d9fd15db610ce",
+ "SHA1": "33dd2f67060465f872db9ea03f597e28517f0c8e",
+ "SHA256": "5961ce0f77c5173a8208b3ed669ac01719f2bf4a10517ffa6c33a5e064802e78",
+ "name": "libXrandr-1.3.0.tar.bz2",
+ "size": 262270,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXrandr-1.3.0.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/libXrandr-1.3.0.tar.bz2",
+ "http://xorg.freedesktop.org/releases/individual/lib/libXrandr-1.3.0.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "libXrandr-1.3.0"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "4d142c811d35175280f566abc918f289752877c7",
+ "SHA1": "096d0e538d37fd865705e5f45b0e96c7294c1f2f",
+ "SHA256": "b9446df62203f2c3204b6bcc0057dc909d0dc792f0dd97bc491581b08be36cbd",
+ "name": "libXcursor-1.1.10.tar.bz2",
+ "size": 264543,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/libXcursor-1.1.10.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/libXcursor-1.1.10.tar.bz2",
+ "http://xorg.freedesktop.org/releases/individual/lib/libXcursor-1.1.10.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "libXcursor-1.1.10"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [],
+ "pkg_name": "libXi-1.3"
+ },
+ {
+ "CATEGORY": "dev-lang",
+ "distfile_list": [],
+ "pkg_name": "tk-8.5.7"
+ },
+ {
+ "CATEGORY": "dev-lang",
+ "distfile_list": [],
+ "pkg_name": "swig-1.3.36"
+ },
+ {
+ "CATEGORY": "media-libs",
+ "distfile_list": [],
+ "pkg_name": "lcms-1.19"
+ },
+ {
+ "CATEGORY": "media-libs",
+ "distfile_list": [],
+ "pkg_name": "fontconfig-2.8.0"
+ },
+ {
+ "CATEGORY": "app-text",
+ "distfile_list": [
+ {
+ "RMD160": "a8fd07ec4dc918cc17390a5236aff9a43e1f7253",
+ "SHA1": "bce8b675fb7c22d507b1965efa7bd71d9ce09460",
+ "SHA256": "7a4ffe6d2950c446c285700d3b2dc399540a27ce635dd712aff646f02f8dfbcc",
+ "name": "poppler-0.12.3.tar.gz",
+ "size": 1616883,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.osuosl.org/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.mirrors.hoobly.com/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://www.cyberuse.com/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://mirror.datapipe.net/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://mirrors.rit.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.cs.uni.edu/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://lug.mtu.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://lug.mtu.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.llarian.net/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://gentoo.netnitco.net/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/poppler-0.12.3.tar.gz",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/poppler-0.12.3.tar.gz",
+ "http://poppler.freedesktop.org/poppler-0.12.3.tar.gz"
+ ]
+ }
+ ],
+ "pkg_name": "poppler-0.12.3-r3"
+ },
+ {
+ "CATEGORY": "net-print",
+ "distfile_list": [
+ {
+ "RMD160": "a0646f2ba29fbd39d211ea5c3fdbd24a00f66a78",
+ "SHA1": "df5cfb64fb608fc128acadde670dc30af49bdb18",
+ "SHA256": "5e310fd324a15fae1e1c9721879f5c948d788e04735a5263a40c6146fff607b8",
+ "name": "cups-1.3.11-source.tar.bz2",
+ "size": 3799393,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/cups-1.3.11-source.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/cups-1.3.11-source.tar.bz2",
+ "http://ftp.rz.tu-bs.de/pub/mirror/ftp.easysw.com/ftp/pub/cups/1.3.11/cups-1.3.11-source.tar.bz2",
+ "http://ftp.easysw.com/pub/cups/1.3.11/cups-1.3.11-source.tar.bz2",
+ "http://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/cups/1.3.11/cups-1.3.11-source.tar.bz2",
+ "http://ftp2.easysw.com/pub/cups/1.3.11/cups-1.3.11-source.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "cups-1.3.11-r1"
+ },
+ {
+ "CATEGORY": "app-text",
+ "distfile_list": [
+ {
+ "RMD160": "565134dcfe1e823b435c3761461c5eb394bd633c",
+ "SHA1": "4c2a6e04145428d35da73fbc4db9c66a75e336e0",
+ "SHA256": "012f7fec58480c728580836fec6f865588d8a33fe8ada7ae73b1f971440d02bb",
+ "name": "ghostscript-8.64.tar.bz2",
+ "size": 16921504,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/ghostscript-8.64.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/ghostscript-8.64.tar.bz2",
+ "http://ufpr.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://ncu.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://heanet.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://cdnetworks-kr-2.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://biznetnetworks.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://garr.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://cdnetworks-kr-1.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://sunet.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://switch.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://transact.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://kent.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://nchc.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://freefr.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://cdnetworks-us-1.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://surfnet.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://waix.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://puzzle.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://voxel.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://iweb.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://jaist.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://internode.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://cdnetworks-us-2.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://mesh.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://ignum.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://softlayer.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://dfn.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://internap.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2",
+ "http://ovh.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.64.tar.bz2"
+ ]
+ },
+ {
+ "RMD160": "5649eb8e2782c8cb147312917d3f8e4f283567d2",
+ "SHA1": "36b229a1071116b05be3e17c04b521ded922919a",
+ "SHA256": "58f37993e52ec8182586effa1760e49369dfc8977895f2f0ef13d57263ef8954",
+ "name": "ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "size": 12171,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://mirror.bytemark.co.uk/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://ftp.jaist.ac.jp/pub/Linux/Gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.free.fr/mirrors/ftp.gentoo.org/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.mirrors.pair.com/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirrors.tds.net/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://open-systems.ufl.edu/mirrors/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirror.ovh.net/gentoo-distfiles/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.gentoo.mesh-solutions.com/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "http://mirror.bytemark.co.uk/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2",
+ "ftp://ftp.osuosl.org/pub/gentoo/distfiles/ghostscript-gpl-8.64-patchset-4.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "ghostscript-gpl-8.64-r3"
+ },
+ {
+ "CATEGORY": "x11-libs",
+ "distfile_list": [
+ {
+ "RMD160": "5f3fea120f2dba274c4150b02162bba40b65a872",
+ "SHA1": "977c10b88a2230e96868edc78a9e3789c0fcbf70",
+ "SHA256": "176f51ddb06dce67ab4b2efc6b327dc21ed8f764c5d97acc15ff1f907c2affae",
+ "name": "qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "size": 160601949,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.osuosl.org/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.hoobly.com/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://www.cyberuse.com/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.datapipe.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirrors.rit.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.cs.uni.edu/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://lug.mtu.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://lug.mtu.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.llarian.net/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://gentoo.netnitco.net/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/qt-everywhere-opensource-src-4.6.2.tar.gz",
+ "http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz"
+ ]
+ }
+ ],
+ "pkg_name": "qt-gui-4.6.2"
+ },
+ {
+ "CATEGORY": "media-video",
+ "distfile_list": [
+ {
+ "RMD160": "2185eb418748f2aadfce5e61b7a9de66a62ef2d1",
+ "SHA1": "834346a84a71d915440b7741e04b6e02de451786",
+ "SHA256": "f521933e7a1021746d8ecde6caa2f9d1b43187ab2e13df6abc07540e415e1842",
+ "name": "vlc-1.0.6.tar.bz2",
+ "size": 22149704,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/vlc-1.0.6.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/vlc-1.0.6.tar.bz2",
+ "http://download.videolan.org/pub/videolan/vlc/1.0.6/vlc-1.0.6.tar.bz2"
+ ]
+ },
+ {
+ "RMD160": "b585a84187f42c3e5cb557e6d752ffde26585506",
+ "SHA1": "91bcd66f3b393202153595e8c44926cc051d7451",
+ "SHA256": "c3c2b7841bde69762feed36758d95ccd5cc0ee390310cfad91bbfa3bca72b1e3",
+ "name": "vlc-patches-83.tar.bz2",
+ "size": 9277,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.mirrors.pair.com/distfiles/vlc-patches-83.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/vlc-patches-83.tar.bz2",
+ "http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://mirror.bytemark.co.uk/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://open-systems.ufl.edu/mirrors/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirror.bytemark.co.uk/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirror.ovh.net/gentoo-distfiles/distfiles/vlc-patches-83.tar.bz2",
+ "http://mirrors.tds.net/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.osuosl.org/pub/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "http://ftp.jaist.ac.jp/pub/Linux/Gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.gentoo.mesh-solutions.com/gentoo/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.free.fr/mirrors/ftp.gentoo.org/distfiles/vlc-patches-83.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/vlc-patches-83.tar.bz2"
+ ]
+ },
+ {
+ "RMD160": "14775ca0d23a348d0d2809f8fa0a6b86e2f1623f",
+ "SHA1": "0310423bf9157b402f66107c365dd39abedb0d33",
+ "SHA256": "6feee6c520c8fcfa45c1bcc07475304c7a68d31985bb1b432b5b7b174a277a54",
+ "name": "vlc-m4-1.tar.bz2",
+ "size": 1685,
+ "url_list": [
+ "ftp://gentoo.mirrors.tds.net/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.lug.udel.edu/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://www.gtlib.gatech.edu/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.mirrors.easynews.com/linux/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirror.usu.edu/mirrors/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://gentoo.chem.wisc.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.mirrors.hoobly.com/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://mirror.its.uidaho.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://gentoo.llarian.net/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://mirrors.rit.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://www.cyberuse.com/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirror.datapipe.net/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.mirrors.tds.net/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirrors.cs.wmich.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirrors.rit.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://mirror.iawnet.sandia.gov/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirror.mcs.anl.gov/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.cs.uni.edu/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://gentoo.cites.uiuc.edu/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://mirror.datapipe.net/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://lug.mtu.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirror.its.uidaho.edu/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://lug.mtu.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.chem.wisc.edu/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.llarian.net/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.netnitco.net/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://mirror.mcs.anl.gov/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirror.lug.udel.edu/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.gtlib.gatech.edu/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.osuosl.org/pub/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.free.fr/mirrors/ftp.gentoo.org/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://mirror.bytemark.co.uk/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.ussg.iu.edu/pub/linux/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.gentoo.mesh-solutions.com/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://open-systems.ufl.edu/mirrors/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirrors.tds.net/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirror.bytemark.co.uk/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://mirror.ovh.net/gentoo-distfiles/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.osuosl.org/distfiles/vlc-m4-1.tar.bz2",
+ "http://gentoo.mirrors.pair.com/distfiles/vlc-m4-1.tar.bz2",
+ "http://ftp.snt.utwente.nl/pub/os/linux/gentoo/distfiles/vlc-m4-1.tar.bz2",
+ "http://ftp.jaist.ac.jp/pub/Linux/Gentoo/distfiles/vlc-m4-1.tar.bz2"
+ ]
+ }
+ ],
+ "pkg_name": "vlc-1.0.6"
+ }
+] \ No newline at end of file
diff --git a/seggetd/provide_mirror_dir/.gitignore b/seggetd/provide_mirror_dir/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/seggetd/provide_mirror_dir/.gitignore
diff --git a/seggetd/proxyfetcher.cpp b/seggetd/proxyfetcher.cpp
new file mode 100644
index 0000000..6f91680
--- /dev/null
+++ b/seggetd/proxyfetcher.cpp
@@ -0,0 +1,146 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "proxyfetcher.h"
+
+void *run_proxy_fetcher_server(void * ){
+ try{
+ int server_sockfd, client_sockfd;
+ socklen_t server_len, client_len;
+ struct sockaddr_in server_address;
+ struct sockaddr_in client_address;
+ int result;
+ fd_set readfds, testfds;
+
+ // Create and name a socket for the server:
+ server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
+
+ int on=1;
+ setsockopt(server_sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ server_address.sin_family = AF_INET;
+ //server_address.sin_addr.s_addr = htonl(INADDR_ANY);
+ server_address.sin_addr.s_addr = inet_addr(settings.provide_proxy_fetcher_ip.c_str());
+ server_address.sin_port = htons(settings.provide_proxy_fetcher_port);
+ server_len = sizeof(server_address);
+
+ bind(server_sockfd, (struct sockaddr *)&server_address, server_len);
+
+ //Create a connection queue and initialize readfds to handle input from server_sockfd:
+ listen(server_sockfd, 5);
+
+ FD_ZERO(&readfds);
+ FD_SET(server_sockfd, &readfds);
+
+ //Now wait for clients and requests. Because you have passed a null pointer as the timeout parameter, no timeout will occur. The program will exit and report an error if select returns a value less than 1:
+ while(1) {
+ int fd;
+ int nread;
+ testfds = readfds;
+
+ debug("proxyfether is waiting for connections");
+ result = select(FD_SETSIZE, &testfds, (fd_set *)0, (fd_set *)0, (struct timeval *) 0);
+// debug("proxyfether done waiting");
+
+
+ if(result < 1) {
+ error_log("Error in proxyfetcher.cpp : run");
+ exit(1);
+ }
+
+ //Once you know you’ve got activity, you can find which descriptor it’s on by checking each in turn using FD_ISSET:
+ for(fd = 0; fd < FD_SETSIZE; fd++) {
+ if(FD_ISSET(fd,&testfds)) {
+
+ //If the activity is on server_sockfd, it must be a request for a new connection, and you add the associated client_sockfd to the descriptor set:
+
+ if(fd == server_sockfd) {
+ debug("new client - read");
+ client_len = sizeof(client_address);
+ client_sockfd = accept(server_sockfd,
+ (struct sockaddr *)&client_address, &client_len);
+ FD_SET(client_sockfd, &readfds);
+ debug("adding client on fd:"+toString(client_sockfd));
+
+ //If it isn’t the server, it must be client activity. If close is received, the client has gone away, and you remove it from the descriptor set. Otherwise, you “serve” the client as in the previous examples.
+ }else{
+// debug("old client - read");
+ ioctl(fd, FIONREAD, &nread);
+ if(nread == 0) {
+ close(fd);
+ FD_CLR(fd, &readfds);
+ debug("removing client on fd:"+toString(fd));
+ }else{
+ char buffer[100000]="";
+ if (nread!=read(fd, &buffer, nread)){
+ error_log("Error in proxyfetcher.cpp : run_proxy_fetcher_server(): Not all data has been read from proxy-fetcher-client");
+ }
+// debug("serving client - read");
+// debug("serving client on fd"+toString(fd));
+ string recv_msg=buffer;
+// error_log("Received a msg from the client:"+recv_msg);
+ string send_response;
+// char send_buffer[10]="";
+
+ json_object* json_obj_distfile=json_tokener_parse(buffer);
+ string distfile_name=json_object_get_string(json_object_object_get(json_obj_distfile,"name"));
+ int result=request_server_pkg.find_distfile(distfile_name);
+ switch (result){
+ case R_PF_NOT_REQUESTED_YET:
+ case R_PF_ERROR_ADDING_TO_PROXY_QUEUE: // if error - try with proxy_fetcher
+ {
+ result=proxy_fetcher_pkg.find_distfile(distfile_name);
+ switch (result){
+ case R_PF_NOT_REQUESTED_YET:{
+ if (is_symlink_restricted(distfile_name)!=-1){
+ debug("PROXY_FETCHER: distfile: "+distfile_name+" restricted (name matches restriting pattern");
+ result=R_PF_REJECTED;
+ }else{
+ result=proxy_fetcher_pkg.push_back_distfile(json_obj_distfile);
+ break;
+ }
+ }
+ default: break;
+ }
+ break;
+ }
+ default: break;
+ }
+ send_response=toString(result);
+// if (write(sockfd, send_buffer, strlen(send_buffer))!=(int)msg.length()){
+ if (write(fd, send_response.c_str(), send_response.length())!=(int)send_response.length()){
+ error_log("Error in proxyfetcher.cpp: run_proxy_fetcher_server(): response msg size and sent data size are different.");
+ };
+ }
+ }
+ }
+ }
+ }
+ }catch(...){
+ error_log("Error in proxyfetcher.cpp: run_proxy_fetcher_server()");
+ return (void*)1;
+ }
+}
diff --git a/seggetd/proxyfetcher.h b/seggetd/proxyfetcher.h
new file mode 100644
index 0000000..4300f06
--- /dev/null
+++ b/seggetd/proxyfetcher.h
@@ -0,0 +1,45 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __PROXYFETCHER_H__
+#define __PROXYFETCHER_H__
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <json/json.h>
+#include "tui.h"
+#include "pkg.h"
+
+void *run_proxy_fetcher_server(void * );
+#endif \ No newline at end of file
diff --git a/seggetd/requestserver.cpp b/seggetd/requestserver.cpp
new file mode 100644
index 0000000..7fd76d3
--- /dev/null
+++ b/seggetd/requestserver.cpp
@@ -0,0 +1,145 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "requestserver.h"
+
+void *run_request_server(void * ){
+ try{
+ int server_sockfd, client_sockfd;
+ socklen_t server_len, client_len;
+ struct sockaddr_in server_address;
+ struct sockaddr_in client_address;
+ int result;
+ fd_set readfds, testfds;
+
+ // Create and name a socket for the server:
+ server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
+
+ int on=1;
+ setsockopt(server_sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ server_address.sin_family = AF_INET;
+ //server_address.sin_addr.s_addr = htonl(INADDR_ANY);
+ server_address.sin_addr.s_addr = inet_addr(settings.request_ip.c_str());
+ server_address.sin_port = htons(settings.request_port);
+ server_len = sizeof(server_address);
+
+ bind(server_sockfd, (struct sockaddr *)&server_address, server_len);
+
+ //Create a connection queue and initialize readfds to handle input from server_sockfd:
+ listen(server_sockfd, 5);
+
+ FD_ZERO(&readfds);
+ FD_SET(server_sockfd, &readfds);
+
+ //Now wait for clients and requests. Because you have passed a null pointer as the timeout parameter, no timeout will occur. The program will exit and report an error if select returns a value less than 1:
+ while(1) {
+ int fd;
+ int nread;
+ testfds = readfds;
+
+ debug("requestserver is waiting for connections");
+ result = select(FD_SETSIZE, &testfds, (fd_set *)0, (fd_set *)0, (struct timeval *) 0);
+// debug("proxyfether done waiting");
+
+
+ if(result < 1) {
+ error_log("Error in requestserver.cpp : run");
+ exit(1);
+ }
+
+ //Once you know you’ve got activity, you can find which descriptor it’s on by checking each in turn using FD_ISSET:
+ for(fd = 0; fd < FD_SETSIZE; fd++) {
+ if(FD_ISSET(fd,&testfds)) {
+
+ //If the activity is on server_sockfd, it must be a request for a new connection, and you add the associated client_sockfd to the descriptor set:
+
+ if(fd == server_sockfd) {
+ debug("requestserver: new client - read");
+ client_len = sizeof(client_address);
+ client_sockfd = accept(server_sockfd,
+ (struct sockaddr *)&client_address, &client_len);
+ FD_SET(client_sockfd, &readfds);
+ debug("requestserver: adding client on fd:"+toString(client_sockfd));
+
+ //If it isn’t the server, it must be client activity. If close is received, the client has gone away, and you remove it from the descriptor set. Otherwise, you “serve” the client as in the previous examples.
+ }else{
+// debug("old client - read");
+ ioctl(fd, FIONREAD, &nread);
+ if(nread == 0) {
+ close(fd);
+ FD_CLR(fd, &readfds);
+ debug("requestserver: removing client on fd:"+toString(fd));
+ }else{
+ char buffer[100000]="";
+ if (nread!=read(fd, &buffer, nread)){
+ error_log("Error in requestserver.cpp : run_request_server(): Not all data has been read from proxy-fetcher-client");
+ }
+// debug("serving client - read");
+// debug("serving client on fd"+toString(fd));
+ string recv_msg=buffer;
+// error_log("Received a msg from the client:"+recv_msg);
+// char send_buffer[10]="";
+ debug("trying to add distfile via requestserver");
+ json_object* json_obj_distfile=json_tokener_parse(buffer);
+ string distfile_name=json_object_get_string(json_object_object_get(json_obj_distfile,"name"));
+ int result=proxy_fetcher_pkg.find_distfile(distfile_name);
+ debug("search for distfile ended");
+ switch (result){
+ case R_PF_NOT_REQUESTED_YET:
+ case R_PF_ERROR_ADDING_TO_PROXY_QUEUE: // if error - try with request_server
+ {
+ debug("Search in proxy_fetcher distfiles list");
+ result=proxy_fetcher_pkg.find_distfile(distfile_name);
+ debug("ENDED search in proxy_fetcher distfiles list");
+ switch (result){
+ case R_PF_NOT_REQUESTED_YET:{
+ debug("push_back distfile to the queue");
+ result=request_server_pkg.push_back_distfile(json_obj_distfile);
+ break;
+ }
+ default: break;
+ }
+ break;
+ }
+ default: break;
+ }
+ debug("Ended trying to add distfile");
+ string send_response=toString(result);
+// if (write(sockfd, send_buffer, strlen(send_buffer))!=(int)msg.length()){
+ if (write(fd, send_response.c_str(), send_response.length())!=(int)send_response.length()){
+ error_log("Error in requestserver.cpp: run_request_server(): response msg size and sent data size are different.");
+ };
+ }
+ }
+ }
+ }
+ }
+ }catch(...){
+ error_log("Error in requestserver.cpp: run_request_server()");
+ return (void*)1;
+ }
+}
diff --git a/seggetd/requestserver.h b/seggetd/requestserver.h
new file mode 100644
index 0000000..0ba2316
--- /dev/null
+++ b/seggetd/requestserver.h
@@ -0,0 +1,45 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __REQUESTSERVER_H__
+#define __REQUESTSERVER_H__
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <json/json.h>
+#include "tui.h"
+#include "pkg.h"
+
+void *run_request_server(void * );
+#endif \ No newline at end of file
diff --git a/seggetd/response.cpp b/seggetd/response.cpp
new file mode 100644
index 0000000..f8456c0
--- /dev/null
+++ b/seggetd/response.cpp
@@ -0,0 +1,67 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "response.h"
+#include "tui.h"
+
+int decode_server_response(string server_response){
+ int int_server_response=atoi(server_response.c_str());
+ switch (int_server_response){
+ case R_PF_NOT_REQUESTED_YET:{
+ debug("Server response:"+server_response+" - R_PF_NOT_REQUESTED_YET");
+ return int_server_response;
+ };
+ case R_PF_REJECTED:{
+ debug("Server response:"+server_response+" - R_PF_REJECTED");
+ return int_server_response;
+ };
+ case R_PF_ERROR_ADDING_TO_PROXY_QUEUE:{
+ debug("Server response:"+server_response+" - R_PF_ERROR_ADDING_TO_PROXY_QUEUE");
+ return int_server_response;
+ };
+ case R_PF_ADDED_TO_PROXY_QUEUE:{
+ debug("Server response:"+server_response+" - R_PF_ADDED_TO_PROXY_QUEUE");
+ return int_server_response;
+ };
+ case R_PF_ALREADY_WAS_IN_QUEUE:{
+ debug("Server response:"+server_response+" - R_PF_ALREADY_WAS_IN_QUEUE");
+ return int_server_response;
+ };
+ case R_PF_DOWNLOADED:{
+ debug("Server response:"+server_response+" - R_PF_DOWNLOADED");
+ return int_server_response;
+ };
+ case R_PF_FAILED:{
+ debug("Server response:"+server_response+" - R_PF_FAILED");
+ return int_server_response;
+ };
+ default :{
+ debug("Server response:"+server_response+" - unknown => R_PF_FAILED");
+ return R_PF_FAILED;
+ };
+ }
+}
+
diff --git a/seggetd/response.h b/seggetd/response.h
new file mode 100644
index 0000000..b24645b
--- /dev/null
+++ b/seggetd/response.h
@@ -0,0 +1,69 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __RESPONSE_H__
+#define __RESPONSE_H__
+#include <string>
+
+using namespace std;
+
+#define R_NOT_SET 300
+#define R_LM_WAIT_FOR_LOCAL_MIRRORS 50
+
+#define R_PF_NOT_REQUESTED_YET 100
+#define R_PF_ADDED_TO_PROXY_QUEUE 101
+#define R_PF_ALREADY_WAS_IN_QUEUE 102
+#define R_PF_DOWNLOADED 103
+#define R_PF_BE_MORE_PATIENT 104
+#define R_PF_ERROR_ADDING_TO_PROXY_QUEUE 105
+#define R_PF_FAILED 106
+#define R_PF_REJECTED 107
+
+// 0 for succesfull return of provide_segment()
+#define R_R_DOWNLOAD_STARTED 0
+#define R_R_WAITING 108
+#define R_R_DOWNLOADING 109
+
+#define R_LM_PF_R_NO_FREE_NETWORK_CONNECTION_FOUND 110
+#define R_LM_PF_ALL_MIRRORS_FAILED 111
+
+#define ALLOW_REQUESTS_TO_PROXY_FETCHERS 201
+#define DO_NOT_ALLOW_REQUESTS_TO_PROXY_FETCHERS 202
+#define ALLOW_REMOTE_NETWORKS 203
+#define DO_NOT_ALLOW_REMOTE_NETWORKS 204
+#define ALLOW_LOWER_PRIORITY_NETWORKS 205
+
+#define REJECTED_BY_USER_PYTHON_SCRIPT 301
+#define ERROR_WHILE_PREPARING_CONNECTION 302
+
+#define ERROR_DURING_SEGMENT_START 400
+
+#define ERROR_WHILE_OPENING_SEGMENT_FOR_WRITING 500
+#define ERROR_ADDING_EASY_HANDLE_TO_MULTI 501
+
+int decode_server_response(string server_response);
+
+#endif \ No newline at end of file
diff --git a/seggetd/responses.h b/seggetd/responses.h
new file mode 100644
index 0000000..331b4ee
--- /dev/null
+++ b/seggetd/responses.h
@@ -0,0 +1,57 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __RESPONSES_H__
+#define __RESPONSES_H__
+
+using namespace std;
+
+#define R_NOT_SET 300
+#define R_LM_WAIT_FOR_LOCAL_MIRRORS 50
+
+#define R_PF_NOT_REQUESTED_YET 100
+#define R_PF_ADDED_TO_PROXY_QUEUE 101
+#define R_PF_ALREADY_WAS_IN_QUEUE 102
+#define R_PF_DOWNLOADED 103
+#define R_PF_BE_MORE_PATIENT 104
+#define R_PF_ERROR_ADDING_TO_PROXY_QUEUE 105
+#define R_PF_FAILED 106
+#define R_PF_REJECTED 107
+
+// 0 for succesfull return of provide_segment()
+#define R_R_DOWNLOAD_STARTED 0
+#define R_R_WAITING 108
+#define R_R_DOWNLOADING 109
+
+#define R_LM_PF_R_NO_FREE_NETWORK_CONNECTION_FOUND 110
+
+#define ALLOW_REQUESTS_TO_PROXY_FETCHERS 201
+#define DO_NOT_ALLOW_REQUESTS_TO_PROXY_FETCHERS 202
+#define ALLOW_REMOTE_NETWORKS 203
+#define DO_NOT_ALLOW_REMOTE_NETWORKS 204
+#define ALLOW_LOWER_PRIORITY_NETWORKS 205
+
+#endif \ No newline at end of file
diff --git a/seggetd/restrict.conf b/seggetd/restrict.conf
new file mode 100644
index 0000000..e554a5b
--- /dev/null
+++ b/seggetd/restrict.conf
@@ -0,0 +1,2 @@
+libX
+bz2 \ No newline at end of file
diff --git a/seggetd/scripts/client.py b/seggetd/scripts/client.py
new file mode 100644
index 0000000..87b97bf
--- /dev/null
+++ b/seggetd/scripts/client.py
@@ -0,0 +1,7 @@
+# TCP client example
+from functions import *
+from net0 import *
+#user_script
+
+schedule()
+accept_segment() \ No newline at end of file
diff --git a/seggetd/scripts/functions.py b/seggetd/scripts/functions.py
new file mode 100644
index 0000000..c2527b2
--- /dev/null
+++ b/seggetd/scripts/functions.py
@@ -0,0 +1,77 @@
+import sys
+import socket
+
+def get(var_name):
+ print("GET::"+var_name)
+ client_socket.send ("g<c>"+var_name)
+ data = client_socket.recv(512)
+ print "RECIEVED:" , data
+ #connection.num,
+ #connection.max_speed_limit,
+ #network.num,
+ #network.active_connections_count,
+ #distfile.size,
+ #distfile.dld_segments_count,
+ #distfile.segments_count,
+ #distfile.active_connections_count,
+ #segment.num,
+ #segment.try_num,
+ #segment.size,
+ if ((var_name=="connection.url") or (var_name=="distfile.name") or (var_name=="segment.range")):
+ return data
+ else:
+ return int(data)
+
+def set(var_name,var_value):
+ var_value_str=str(var_value);
+ print("SET::"+var_name+"="+var_value_str)
+ client_socket.send ("s<c>"+var_name+"<n>"+var_value_str)
+ data = client_socket.recv(512)
+ print "RECIEVED:" , data
+ if (data=="o<r>"):
+ return 0
+ else:
+ return 1
+
+def accept_segment():
+ print "Accepting segment"
+ client_socket.send ("a<c>")
+ client_socket.close()
+ sys.exit(0)
+
+def reject_segment():
+ print "Rejecting segment"
+ client_socket.send ("r<c>")
+ client_socket.close()
+ sys.exit(0)
+# in case users forget to use quotes
+class Tconnection:
+ num="connection.num"
+ max_speed_limit="connection.max_speed_limit"
+ url="connection.url"
+
+class Tnetwork:
+ num="network.num"
+ mode="network.mode"
+ active_connections_count="network.active_connections_count"
+
+class Tdistfile:
+ name="distfile.name"
+ size="distfile.size"
+ dld_segments_count="distfile.dld_segments_count"
+ segments_count="distfile.segments_count"
+ active_connections_count="distfile.active_connections_count"
+
+class Tsegment:
+ num="segment.num"
+ try_num="segment.try_num"
+ size="segment.size"
+ range="segment.range"
+
+connection=Tconnection
+network=Tnetwork
+distfile=Tdistfile
+segment=Tsegment
+
+client_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+client_socket.connect("/tmp/seggetd/script_socket") \ No newline at end of file
diff --git a/seggetd/scripts/net0.py b/seggetd/scripts/net0.py
new file mode 100644
index 0000000..8d87955
--- /dev/null
+++ b/seggetd/scripts/net0.py
@@ -0,0 +1,15 @@
+from functions import *
+import time;
+def schedule():
+ localtime = time.localtime(time.time());
+ hour=localtime[3];
+ # disable downloading distfiles that have size more than 5 000 000 bytes
+ # from 8-00 to 22-00.
+ if hour>8 and hour<21 and (get("distfile.size"))>5000000:
+ print "reject because distfile is too big"
+ reject_segment()
+ # set speed limit 50 000 cps for distfiles larger than 1 000 000 bytes
+ if get("distfile.size")>1000000:
+ print "limit connection speed"
+ set(connection.max_speed_limit, 50000)
+ accept_segment() \ No newline at end of file
diff --git a/seggetd/scriptserver.cpp b/seggetd/scriptserver.cpp
new file mode 100644
index 0000000..512e177
--- /dev/null
+++ b/seggetd/scriptserver.cpp
@@ -0,0 +1,322 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "scriptserver.h"
+
+map<std::string, Tvar_nums> variables_;
+
+#define RESPONSE_OK "o<r>";
+#define RESPONSE_UNKNOWN_VARIABLE "u<r>";
+#define RESPONSE_ERROR "e<r>";
+
+#define ACCEPT_SEGMENT 0;
+#define ERROR_HAPPEND_SO_ACCEPT_SEGMENT 0;
+#define REJECT_SEGMENT 1;
+
+FILE * stderr_file;
+FILE * stdout_file;
+int script_server_sockfd, script_client_sockfd;
+
+string set(uint connection_num, string var_name_and_value){
+ try{
+ string var_name, var_value;
+ if (! split("<n>",var_name_and_value,var_name,var_value)){
+ map<string,Tvar_nums>::const_iterator ci = variables_.find(var_name);
+ if (ci == variables_.end()){
+ return RESPONSE_UNKNOWN_VARIABLE;
+ }else{
+ switch (ci->second){
+ case CONNECTION_MAX_SPEED_LIMIT:{
+ ulong new_max_speed_limit=atol(var_value.c_str());
+ if (new_max_speed_limit==0){
+ error_log("Error in scriptserver.cpp: set("+var_name+"="
+ +var_value+"): Can't convert "+var_value+" to integer");
+ return RESPONSE_ERROR;
+ }else{
+ connection_array[connection_num].max_speed_limit=new_max_speed_limit;
+ debug("set("+var_name+"="+var_value+")");
+ return RESPONSE_OK;
+ }
+ }
+ default:{
+ error_log("Error in scriptserver.cpp: set("+var_name+"="
+ +var_value+"): UNKNOWN VARIABLE");
+ return RESPONSE_UNKNOWN_VARIABLE;
+ }
+ }
+ }
+ }
+ return RESPONSE_ERROR;
+ }catch(...){
+ error_log("Error in scriptserver.cpp: set()");
+ return RESPONSE_ERROR;
+ }
+}
+
+string get(uint connection_num, string var_name){
+ try{
+ map<string,Tvar_nums>::const_iterator ci = variables_.find(var_name);
+ if (ci == variables_.end()){
+ return RESPONSE_UNKNOWN_VARIABLE;
+ }else{
+ switch (ci->second){
+ case DISTFILE_NAME:{
+ return connection_array[connection_num].segment->parent_distfile->name;
+ }
+ case DISTFILE_SIZE:{
+ return toString(connection_array[connection_num].segment->parent_distfile->size);
+ }
+ case DISTFILE_DLD_SEGMENTS_COUNT:{
+ return toString(connection_array[connection_num].segment->parent_distfile->dld_segments_count);
+ }
+ case DISTFILE_SEGMENTS_COUNT:{
+ return toString(connection_array[connection_num].segment->parent_distfile->segments_count);
+ }
+ case DISTFILE_ACTIVE_CONNECTIONS_COUNT:{
+ return toString(connection_array[connection_num].segment->parent_distfile->active_connections_num);
+ }
+ case SEGMENT_NUM:{
+ return toString(connection_array[connection_num].segment->segment_num);
+ }
+ case SEGMENT_TRY_NUM:{
+ return toString(connection_array[connection_num].segment->try_num);
+ }
+ case SEGMENT_SIZE:{
+ return toString(connection_array[connection_num].segment->segment_size);
+ }
+ case SEGMENT_RANGE:{
+ return connection_array[connection_num].segment->range;
+ }
+ case CONNECTION_NUM:{
+ return toString(connection_num);
+ }
+ case CONNECTION_URL:{
+ return connection_array[connection_num].url;
+ }
+ case NETWORK_NUM:{
+ return toString(connection_array[connection_num].network_num);
+ }
+ case NETWORK_MODE:{
+ return toString(network_array[connection_array[connection_num].network_num].network_mode);
+ }
+ case NETWORK_ACTIVE_CONNECTIONS_COUNT:{
+ return toString(network_array[connection_array[connection_num].network_num].active_connections_num);
+ }
+ default: return RESPONSE_UNKNOWN_VARIABLE; //unknown variable
+ }
+ }
+ return RESPONSE_ERROR;
+ }catch(...){
+ error_log("Error in scriptserver.cpp: get()");
+ return RESPONSE_ERROR;
+ }
+}
+void init_variables(){
+ try{
+ variables_["connection.num"]=CONNECTION_NUM;
+ variables_["connection.url"]=CONNECTION_URL;
+ variables_["connection.max_speed_limit"]=CONNECTION_MAX_SPEED_LIMIT;
+ variables_["network.num"]=NETWORK_NUM;
+ variables_["network.mode"]=NETWORK_MODE;
+ variables_["network.active_connections_count"]=NETWORK_ACTIVE_CONNECTIONS_COUNT;
+ variables_["distfile.name"]=DISTFILE_NAME;
+ variables_["distfile.size"]=DISTFILE_SIZE;
+ variables_["distfile.dld_segments_count"]=DISTFILE_DLD_SEGMENTS_COUNT;
+ variables_["distfile.segments_count"]=DISTFILE_SEGMENTS_COUNT;
+ variables_["distfile.active_connections_count"]=DISTFILE_ACTIVE_CONNECTIONS_COUNT;
+ variables_["segment.num"]=SEGMENT_NUM;
+ variables_["segment.try_num"]=SEGMENT_TRY_NUM;
+ variables_["segment.size"]=SEGMENT_SIZE;
+ variables_["segment.range"]=SEGMENT_RANGE;
+// variables_[""]=;
+ }catch(...){
+ error_log("Error in scriptserver.cpp: init_variables()");
+ }
+}
+void send(int fd, string response){
+ try{
+ if (write(fd, response.c_str(), response.length())!=(int)response.length()){
+ error_log("Error in scriptserver.cpp: send(): response msg size and sent data size are different.");
+ };
+ }catch(...){
+ error_log("Error in scriptserver.cpp: send()");
+ }
+}
+
+void killscript(int pID){
+ try{
+ debug("Before killing script");
+/* int killReturn = kill( pID, SIGKILL); // Kill child process
+ if( killReturn == ESRCH){ // pid does not exist
+ error_log("Python script does not exist!");
+ }else if( killReturn == EPERM){ // No permission to send signal
+ error_log("No permission to kill python script");
+ }else debug("Signal to kill python script sent. All Ok!");
+*/
+ waitpid(pID, NULL, 0);
+ close(script_server_sockfd);
+ close(script_client_sockfd);
+ debug("After killing script");
+ }catch(...){
+ error_log("Error in scriptserver.cpp: killscript()");
+ }
+}
+
+bool run_user_python_script(uint connection_num){
+ pid_t pID;
+ try{
+ init_variables();
+ socklen_t server_len, client_len;
+ struct sockaddr_un server_address;
+ struct sockaddr_un client_address;
+
+ int result;
+ fd_set readfds, testfds;
+
+ unlink(settings.script_socket_path.c_str());
+ // Create and name a socket for the server:
+ script_server_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ server_address.sun_family = AF_UNIX;
+ strcpy(server_address.sun_path, settings.script_socket_path.c_str());
+ server_len = sizeof(server_address);
+ bind(script_server_sockfd, (struct sockaddr *)&server_address, server_len);
+ //Create a connection queue and initialize readfds to handle input from server_sockfd:
+ listen(script_server_sockfd, 5);
+ FD_ZERO(&readfds);
+ FD_SET(script_server_sockfd, &readfds);
+
+ pID = fork();
+ if (pID == 0){ // child
+ alarm(2); // 2 second limit for script to execute
+ stderr_file = fopen((settings.logs_dir+"/net"
+ +toString(connection_array[connection_num].network_num)
+ +"_script_stderr.log").c_str(), "a+");
+ if(stderr_file) {
+ dup2(fileno(stderr_file), 2);
+ fclose(stderr_file);
+ }
+ stdout_file = fopen((settings.logs_dir+"/net"
+ +toString(connection_array[connection_num].network_num)
+ +"_script_stdout.log").c_str(), "a+");
+ if(stdout_file) {
+ dup2(fileno(stdout_file), 1);
+ fclose(stdout_file);
+ }
+ if (system((settings.python_path+" "+settings.scripts_dir+"/client.py").c_str())){
+ error_log_no_msg("Error in scriptserver.cpp: run_user_python_script calling system()");
+ }
+ _exit(0);
+ }else{
+ if (pID < 0){ // failed to fork
+ error_log("Error in scriptserver.cpp: failed to fork");
+ return 0;
+ }
+ }
+
+ debug("Launched python script, pid:"+toString(pID));
+ // parent
+ //Now wait for clients and requests. Because you have passed a null pointer as the timeout parameter, no timeout will occur. The program will exit and report an error if select returns a value less than 1:
+ struct timeval user_script_start_time;
+ gettimeofday(&user_script_start_time,NULL);
+
+ while(1000>time_left_since(user_script_start_time)) {
+ int fd;
+ int nread;
+ testfds = readfds;
+
+ debug("scriptserver is waiting for connections");
+ struct timeval timeout;
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ result = select(FD_SETSIZE, &testfds, (fd_set *)0, (fd_set *)0, &timeout);
+ if(result < 1) {
+ error_log("Error in scriptserver.cpp: run_script_server(): error on select ");
+ killscript(pID);
+ return ERROR_HAPPEND_SO_ACCEPT_SEGMENT;
+ }
+ //Once you know you’ve got activity, you can find which descriptor it’s on by checking each in turn using FD_ISSET:
+ for(fd = 0; fd < FD_SETSIZE; fd++) {
+ if(FD_ISSET(fd,&testfds)) {
+ //If the activity is on server_sockfd, it must be a request for a new connection, and you add the associated client_sockfd to the descriptor set:
+ if (fd==script_server_sockfd){
+ debug("new script client - read");
+ client_len = sizeof(client_address);
+ script_client_sockfd = accept(script_server_sockfd,
+ (struct sockaddr *)&client_address, &client_len);
+ FD_SET(script_client_sockfd, &readfds);
+ debug("adding script client on fd:"+toString(script_client_sockfd));
+ break;
+ }else{
+ script_client_sockfd=fd;
+ ioctl(fd, FIONREAD, &nread);
+ if(nread == 0) {
+ debug("removing script client from fd:"+toString(fd));
+ }else{
+ char buffer[100000]="";
+ if (nread!=read(fd, &buffer, nread)){
+ error_log("Error in scriptserver.cpp : run_script_server(): Not all data has been read from script-client");
+ }
+ string recv_msg=noupper(buffer);
+ debug("SCRIPT-SERVER RECIVED:"+recv_msg);
+ string command, arguments, send_response;
+ if (! split("<c>",recv_msg,command,arguments)){
+ switch (command[0]){
+ case 'g':{
+ debug("getting: "+arguments);
+ send(fd,get(connection_num,arguments));
+ break;
+ }
+ case 's':{
+ debug("setting: "+arguments);
+ send(fd,set(connection_num,arguments));
+ break;
+ }
+ case 'a':{
+ debug("accepting segment: ");
+ killscript(pID);
+ return ACCEPT_SEGMENT;
+ }
+ case 'r':{
+ debug("rejecting segment: ");
+ killscript(pID);
+ return REJECT_SEGMENT;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ killscript(pID);
+ return ACCEPT_SEGMENT;
+ }catch(...){
+ error_log("Error in scriptserver.cpp: run_script_server()");
+ return ERROR_HAPPEND_SO_ACCEPT_SEGMENT;
+ }
+ killscript(pID);
+} \ No newline at end of file
diff --git a/seggetd/scriptserver.h b/seggetd/scriptserver.h
new file mode 100644
index 0000000..4b3c916
--- /dev/null
+++ b/seggetd/scriptserver.h
@@ -0,0 +1,73 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __SCRIPTSERVER_H__
+#define __SCRIPTSERVER_H__
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <stdio.h>
+//#include <netinet/in.h>
+//#include <arpa/inet.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <string.h>
+#include <json/json.h>
+#include "tui.h"
+#include "pkg.h"
+
+enum Tvar_nums{
+ CONNECTION_NUM,
+ CONNECTION_URL,
+ CONNECTION_MAX_SPEED_LIMIT,
+ NETWORK_NUM,
+ NETWORK_MODE,
+ NETWORK_ACTIVE_CONNECTIONS_COUNT,
+ DISTFILE_NAME,
+ DISTFILE_SIZE,
+ DISTFILE_DLD_SEGMENTS_COUNT,
+ DISTFILE_SEGMENTS_COUNT,
+ DISTFILE_ACTIVE_CONNECTIONS_COUNT,
+ SEGMENT_NUM,
+ SEGMENT_TRY_NUM,
+ SEGMENT_SIZE,
+ SEGMENT_RANGE
+};
+
+extern map<std::string, Tvar_nums> variables_;
+
+extern FILE *stdin;
+extern FILE *stdout;
+extern FILE *stderr;
+
+//void *run_script_server(void * );
+bool run_user_python_script(uint connection_num);
+#endif \ No newline at end of file
diff --git a/seggetd/seggetd.conf b/seggetd/seggetd.conf
new file mode 100644
index 0000000..219530e
--- /dev/null
+++ b/seggetd/seggetd.conf
@@ -0,0 +1,463 @@
+[folders]
+# By default segget daemon will use the following folders for its files:
+# /etc/seggetd - for config files for seggetd, tuiclient and request tool
+# /etc/init.d/seggetd - init file for segget daemon
+# /usr/bin - binary files: seggetd, tuiclient, request
+# /usr/share/seggetd/scripts - for user-side python script files
+# /usr/share/seggetd/webui - for webui files
+# /tmp/seggetd/pkg.list - to save distfile list generated by portage and parse it
+# by request tool to segget daemon
+# /tmp/seggetd/segments - to store segments
+# /usr/portage/distfiles - to store ready to use distfiles
+# /var/log/seggetd - to store log files
+
+# DISTFILES_DIR
+# Define a dir to store distfiles
+# Default:
+# distfiles_dir=/usr/portage/distfiles
+distfiles_dir=/usr/portage/distfiles
+
+# SEGMENTS_DIR
+# Define a dir to store distfiles' segments
+# Default:
+# segments_dir=/tmp/seggetd/segments
+segments_dir=/tmp/seggetd/segments
+
+[portage]
+# SYNOPSIS: fetch_only=0 | 1
+# NOT IMPLEMENTED YET: fetch_only=0
+
+[distfiles]
+# MAX_CONNECTION_NUM_PER_DISTFILE
+# Each distfile can have up to max_connection_num_per_distfile simultaneous
+# connections.
+# Minimum value: 1
+# Maximum value: 20
+# Default:
+# max_connection_num_per_distfile=3
+max_connection_num_per_distfile=3
+
+[segments]
+# MAX_SEGMENT_SIZE
+# Define maximum segment size in bytes.
+# Minimum value: 10000
+# Maximum value: 10000000
+# Default:
+# max_segment_size=500000
+max_segment_size=500000
+
+# SYNOPSIS: resume_on=0 | 1
+# - If resume_on set to 1:
+# Before starting downloading a segment segget checks whether this segment is
+# already downloaded, checks segments size and if size mathces considers this
+# segment to be downloaded and skips downloading process.
+# - If resume_on set to 0:
+# Segget always starts new fetch for a segment regardless of the fact whether it
+# is downloaded or not.
+# Default:
+# resume_on=1
+resume_on=1
+
+# MAX_TRIES
+# If segment download was unsuccessful, new attempts are made. When attempts
+# number reaches max_tries, segment gets FAILED status and error logged to error_log
+# Minimum value: 1
+# Maximum value: -1 (for no limit)
+# Default:
+# max_tries=10
+max_tries=10
+
+[connections]
+# MAX_CONNECTIONS
+# Define maximum number of connections
+# Minimum value: 1
+# Maximum value: 20
+# Default:
+# max_connections=10
+max_connections=10
+
+# CURRENT_SPEED_TIME_INTERVAL_MSECS
+# segget transfers may have bursty nature of their traffic. Therefore, while
+# measuring current speed, segget actually calculates average speed during
+# current_speed_time_interval_msecs time interval, defined in milliseconds.
+# Minimum value: 100
+# Maximum value: 60000
+# Default:
+# current_speed_time_interval_msecs=1000
+current_speed_time_interval_msecs=1000
+
+[mirrors]
+# MAX_CONNECTIONS_NUM_PER_MIRROR
+# Define how many simultaneous downloads from one mirror segget is allowed to
+# have. While choosing a mirror segget will skip mirrors with
+# max_connections_num_per_mirror active downloads.
+# Minimum value: 1
+# Maximum value: 10
+# Default:
+# max_connections_num_per_mirror=1
+max_connections_num_per_mirror=1
+
+# SYNOPSIS: collect_benchmark_stats_on=0 | 1
+# - If set to 1, stats on mirrors performance will be collected.
+# default:
+# collect_benchmark_stats_on=1 (Note: at the moment can NOT be changed)
+collect_benchmark_stats_on=1
+
+# SYNOPSIS: use_benchmark_stats=0 | 1
+# If use_benchmark_stats=1 statistics on mirrors is used to rate them
+# and therefore improve performance.
+# Each time connection from a particular mirror closes mirror->dld_time,
+# and mirror->dld_size get increased (in case of unsuccessful connection
+# only time gets increased), so avg speed for a mirror can be
+# calculated:
+#
+# mirror->avg_speed=mirror->dld_size/mirror->dld_time. (1)
+#
+# When new segment is going to be started segget goes through the list of
+# the mirrors distfile/segment has, and asks each mirror for self_rating:
+#
+# "ulong self_rating=mirror->mirror_on_the_wall();".
+#
+# This way segget chooses a mirror with the best self_rating. To calculate
+# self_rating mirrors use the following formula:
+#
+# self_rating=dld_time/dld_size*honesty. (2)
+#
+# So mirrors actually say how bad they are.
+# Even mirrors can have critical times, so to give mirrors another chance
+# honesty was added to the formula (2). honesty can get values in
+# interval (0,1]. Each time connection from a mirror opens or closes mirror
+# sets its honesty=1. If mirror was asked for self_evaluation with
+# mirror->mirror_on_the_wall(), but wasn't chosen its honesty decreases
+# somewhat (see [mirror].benchmark_oblivion option), so next time it will
+# lie little bit more about how bad it's.
+# Default:
+# use_benchmark_results=1
+# ***Note: at the moment use_benchmark_results can NOT be set to 0
+use_benchmark_stats=1
+
+# BENCHMARK_OBLIVION
+# benchmark_oblivion option allows to adjust how fast segget "forgets"
+# benchmarking statistics on mirrors performance.
+# Each time mirror->mirror_on_the_wall() called, mirror decreases its
+# honesty (to have more chances next time) using the following formula:
+#
+# honesty=honesty*100/(100+settings.benchmark_oblivion) (3)
+#
+# Therefore, setting benchmark_oblivion=100 will make mirror look twice
+# less bad next time mirror->mirror_on_the_wall() called.
+# Minimum value: 0 (Beware: setting to 0, will can exclude unlucky mirrors)
+# Maximum value: 1000
+# Default:
+# benchmark_oblivion=5
+benchmark_oblivion=5
+
+[provide_mirror_to_others]
+# PROVIDE_MIRROR_DIR
+# Define a dir for making symlinks to downloaded distfiles. This dir can be
+# used to provide local mirror for other hosts (with help of Apache, vsftp, etc).
+# If set to none, segget will not make symlinks.
+# Default:
+# provide_mirror_dir=none
+provide_mirror_dir=none
+
+# SYNOPSIS: PROVIDE_MIRROR_FILES_RESTRICT_LIST_ON= 0 | 1
+# If PROVIDE_MIRROR_DIR=none this option will be ignored.
+# - If set to 1, segget will compare distfile name with the list of forbiden
+# patterns from the restricted.conf file. If distfile name contains any of the
+# patterns, no symlink will be provided to this distfile.
+# Default:
+# provide_mirror_files_restrict_list_on=0
+provide_mirror_files_restrict_list_on=0
+
+# PROVIDE_MIRROR_TO_OTHERS_URL
+# Specify url to the provided mirror.
+# This option is used to generate rss feed.
+# By default UI_IP is used for this.
+# Default:
+# provide_mirror_to_others_url=ui_ip
+provide_mirror_to_others_url=ui_ip
+
+[provide_proxy_fetcher_to_others]
+# PROVIDE_PROXY_FETCHER_IP
+# Define an ip address segget will use to provide access for tuiclients.
+# The parameter should be a string holding your host dotted IP address.
+# Default:
+# provide_proxy_fetcher_ip=none
+provide_proxy_fetcher_ip=127.0.0.1
+
+# PROVIDE_PROXY_FETCHER_PORT
+# Define a port segget will use to provide access for tuiclients.
+# The parameter should be an integer.
+# Minimum value: 1
+# Maximum value: 65535
+# Default:
+# provide_proxy_fetcher_port=3131
+provide_proxy_fetcher_port=3130
+
+[networks]
+# NETWORK0_PRIORITY
+# Define priority as a value in range from lowest 0 to highest 10.
+# Segget tries to use networks with higher priority levels first, and in case of
+# failure will switch to networks with lower priority levels.
+# Segget will NOT use network if its priority level set to 0. Therefore at least
+# one network must have priority level higher than 0.
+# Networks with local mirrors usually would have higher priority than that of
+# networks with remote mirrors.
+# Segget can have up to 10 networks (from network0 to network9).
+# Settings for each network should be defined in network#.conf file, where
+# instead of # should be network number. For network0 it's network0.conf
+# Default:
+# network0_priority=10
+# network1_priority=0
+# network2_priority=0
+# network3_priority=0
+# network4_priority=0
+# network5_priority=0
+# network6_priority=0
+# network7_priority=0
+# network8_priority=0
+# network9_priority=0
+network0_priority=10
+network1_priority=0
+network2_priority=0
+network3_priority=0
+network4_priority=0
+network5_priority=0
+network6_priority=0
+network7_priority=0
+network8_priority=0
+network9_priority=0
+
+[user-data]
+# USER_AGENT
+# Set the User-Agent: header in the http request sent to the remote server.
+# This can be used to fool servers or scripts.
+# Default:
+# user_agent=segget
+user_agent=segget
+
+# Specify the user and password for authentication on a ftp servers.
+# NOT IMPLEMENTED YET: ftp-user=anonymous
+# NOT IMPLEMENTED YET: ftp-password=me@mail.ru
+
+[ui_server]
+# tuiclient monitors segget's activity by establishing tcp connection
+# with segget daemon (ui_server part of it).
+# Same ip and port are used for WebUI which can be accessed from web
+# browser via http://ui_ip:ui_port/
+
+# UI_IP
+# Define an ip address segget will use to provide access for tuiclients.
+# The parameter should be a string holding your host dotted IP address.
+# Default:
+# ui_ip=127.0.0.1
+ui_ip=127.0.0.1
+
+# UI_PORT
+# Define a port segget will use to provide access for tuiclients.
+# The parameter should be an integer.
+# Minimum value: 1
+# Maximum value: 65535
+# Default:
+# ui_port=9999
+ui_port=9999
+
+# UI_WEB_UI_DIR
+# Define a dir where segget stores webui files
+# Default:
+# ui_web_ui_dir=/usr/share/seggetd/webui
+ui_web_ui_dir=/usr/share/seggetd/webui
+
+[rss]
+# RSS feed provides information on the files added (symlinked)
+# to PROVIDE_MIRROR_DIR and can be accessed from feedreader
+# via http://ui_ip:ui_port/rss.xml
+
+# RSS_TITLE
+# Specify a title for the RSS feed
+# Default:
+# rss_title=Seggetd feed
+rss_title=Seggetd feed
+
+# RSS_DESCRIPTION
+# Specify description for the RSS feed
+# Default:
+# rss_description=Files downloaded by seggetd and provided in the local mirror
+rss_description=Files downloaded by seggetd and provided in the local mirror
+
+[request_server]
+# request application adds distfiles to segget daemon queue by establishing tcp connection
+# with segget daemon (request_server part of it).
+
+# REQUEST_IP
+# Define an ip address segget will use to provide access for tuiclients.
+# The parameter should be a string holding your host dotted IP address.
+# Default:
+# request_ip=127.0.0.1
+request_ip=127.0.0.1
+
+# REQUEST_PORT
+# Define a port segget will use to provide access for tuiclients.
+# The parameter should be an integer.
+# Minimum value: 1
+# Maximum value: 65535
+# Default:
+# request_port=10000
+request_port=10000
+
+[scripting_and_scheduling]
+# Segget provides Python scripting functionalyty to support scheduling.
+# Each time segget tries to start a new connection certain network it calls
+# a python script (client.py) to accept or reject this connection and
+# if necessary adjusts its settings.
+
+# PYTHON_PATH
+# Define path to python
+# Default:
+# python_path=/usr/bin/python
+python_path=/usr/bin/python
+
+# SCRIPTS_DIR
+# Define a path to the dir with python scripts. Before establishing connection for
+# a particular segment via network# segget checks SCRIPTS_DIR.
+# If SCRIPTS_DIR contains net#.py file, segget will launch schedule() function
+# from this file to apply settings for connetion and accept or reject this
+# segment for the moment. net#.py file is a python script file
+# with a user-writen schedule() function.
+# It's necessary to import functions before using get("variable"),
+# set("variable",value), accept_segment() and reject_segment() in schedule().
+# get() function can obtain values for the following variables:
+# connection.num, connection.url, connection.max_speed_limit,
+# network.num, network.mode, network.active_connections_count,
+# distfile.name, distfile.size, distfile.dld_segments_count,
+# distfile.segments_count, distfile.active_connections_count,
+# segment.num, segment.try_num, segment.size, segment.range
+# set() function can change connection.max_speed_limit, see example:
+# -----------------EXAMPLE STARTS-----------------
+# from functions import *
+# import time;
+# def schedule():
+# localtime = time.localtime(time.time());
+# hour=localtime[3];
+# # disable downloading distfiles that have size more than 5 000 000 bytes
+# # from 8-00 to 22-00.
+# if hour>8 and hour<22 and (get("distfile.size"))>5000000:
+# print "reject because distfile is too big"
+# reject_segment()
+# # set speed limit 50 000 cps for distfiles larger than 1 000 000 bytes
+# if get("distfile.size")>1000000:
+# print "limit connection speed"
+# set(connection.max_speed_limit, 50000)
+# accept_segment()
+# -----------------EXAMPLE ENDS-----------------
+# From example above localtime returns following tuple:
+# Index Attributes Values
+# 0 tm_year e.i.: 2008
+# 1 tm_mon 1 to 12
+# 2 tm_mday 1 to 31
+# 3 tm_hour 0 to 23
+# 4 tm_min 0 to 59
+# 5 tm_sec 0 to 61 (60 or 61 are leap-seconds)
+# 6 tm_wday 0 to 6 (0 is Monday)
+# 7 tm_yday 1 to 366 (Julian day)
+# 8 tm_isdst -1, 0, 1, -1 means library determines DST
+# Therefore localtime[3] provides hours.
+# Segment will be accecpted by default if it was neither accepted nor rejected
+# during the schedule() function.
+# sagget saves logs of resulting stdout and stderr in the log folder
+# separatly for each network. Hence, if there's an error in net3.py file python
+# error message would be saved to net3_script_stderr.log. Results of print would
+# be saved in net3_script_stdout.log.
+# Default:
+# scripts_dir=/usr/share/seggetd/scripts
+scripts_dir=/usr/share/seggetd/scripts
+
+# SCRIPT_SOCKET_PATH
+# Segget uses AF_UNIX domain sockets for communication with python.
+# Specify path for the socket on your filesystem.
+# NOTE !: Default value can NOT be changed yet (option under development).
+# Default:
+# script_socket_path=/tmp/seggetd/script_socket
+script_socket_path=/tmp/seggetd/script_socket
+
+[logs]
+# LOGS_DIR
+# Define a dir to store log files.
+# Default:
+# logs_dir=/var/log/seggetd
+logs_dir=/var/log/seggetd
+
+# GENERAL_LOG_FILE
+# Define a file name to store general log.
+# Set to none to disable loggin.
+# Default:
+# general_log_file=segget.log
+general_log_file=segget.log
+
+# GENERAL_LOG_TIME_FORMAT
+# Set time format for general log as a string containing any combination of
+# regular characters and special format specifiers. These format specifiers are
+# replaced by the function to the corresponding values to represent the time
+# specified in timeptr. They all begin with a percentage (%) sign, and are:
+# %a Abbreviated weekday name [For example: Thu]
+# %A Full weekday name [For example: Thursday]
+# %b Abbreviated month name [For example: Aug]
+# %B Full month name [For example: August]
+# %c Date and time representation [For example: Thu Aug 23 14:55:02 2001]
+# %d Day of the month (01-31) [For example: 23]
+# %H Hour in 24h format (00-23) [For example: 14]
+# %I Hour in 12h format (01-12) [For example: 02]
+# %j Day of the year (001-366) [For example: 235]
+# %m Month as a decimal number (01-12) [For example: 08]
+# %M Minute (00-59) [For example: 55]
+# %p AM or PM designation [For example: PM]
+# %S Second (00-61) [For example: 02]
+# %U Week number with the first Sunday
+# as the first day of week one (00-53) [For example: 33]
+# %w Weekday as a decimal number with
+# Sunday as 0 (0-6) [For example: 4]
+# %W Week number with the first Monday as
+# the first day of week one (00-53) [For example: 34]
+# %x Date representation [For example: 08/23/01]
+# %X Time representation [For example: 14:55:02]
+# %y Year, last two digits (00-99) [For example: 01]
+# %Y Year [For example: 2001]
+# %Z Timezone name or abbreviation [For example: CDT]
+# %% A % sign [For example: %]
+#
+# For instace general_log_time_format=Time: %m/%d %X
+#
+# Default:
+# general_log_time_format=%m/%d %X
+general_log_time_format=%m/%d %X
+
+# ERROR_LOG_FILE
+# Define a file name to store error log.
+# Set to none to disable loggin.
+# Default:
+# error_log_file=segget.log
+error_log_file=error.log
+
+# ERROR_LOG_TIME_FORMAT
+# Set time format for error log as a string containing any combination of
+# regular characters and special format specifiers. See GENERAL_LOG_TIME_FORMAT
+# for details on format specifiers.
+# Default:
+# error_log_time_format=%m/%d %X
+error_log_time_format=%m/%d %X
+
+# DEBUG_LOG_FILE
+# Define a file name to store debug log.
+# Set to none to disable loggin.
+# Default:
+# debug_log_file=segget.log
+debug_log_file=debug.log
+
+# DEBUG_LOG_TIME_FORMAT
+# Set time format for debug log as a string containing any combination of
+# regular characters and special format specifiers. See GENERAL_LOG_TIME_FORMAT
+# for details on format specifiers.
+# Default:
+# debug_log_time_format=%m/%d %X
+debug_log_time_format=%m/%d %X \ No newline at end of file
diff --git a/seggetd/seggetd.cpp b/seggetd/seggetd.cpp
new file mode 100644
index 0000000..a34b2f9
--- /dev/null
+++ b/seggetd/seggetd.cpp
@@ -0,0 +1,557 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "segget.h"
+/*
+int load_pkgs(){
+ try{
+
+ ifstream json_pkg_list_file;
+ json_pkg_list_file.exceptions (ofstream::failbit | ofstream::badbit);
+ try{
+ json_pkg_list_file.open((settings.pkg_list_dir+"/pkg.list").c_str());
+ }catch(...){
+ error_log("Error: Can't open "+settings.pkg_list_dir+"/pkg.list"+" file");
+ return 1;
+ }
+ string buff((std::istreambuf_iterator<char>(json_pkg_list_file)), std::istreambuf_iterator<char>());
+ try{
+ json_pkg_list_file>>buff;
+ }catch(std::ifstream::failure e){
+ if (!json_pkg_list_file.eof()){
+ error_log("Error: Can't read pkg.list file: "+(string)e.what());
+ return 1;
+ }
+ }catch(...){
+ error_log("Unknown Error: Can't read pkg.list file");
+ return 1;
+ }
+ try{
+ json_pkg_list_file.close();
+ }catch(...){
+ error_log("Error: Can't close pkg.list file");
+ }
+ try{
+ // cout<< buff<<"\n";
+ json_object *json_array_pkg_list;
+ json_array_pkg_list = json_tokener_parse(buff.c_str());
+ if (is_error(json_array_pkg_list))
+ printf("error parsing json: %s\n",json_tokener_errors[-(unsigned long)json_array_pkg_list]);
+ else {
+ stats.pkg_count=json_object_array_length(json_array_pkg_list);
+ Ppkg_array= new Tpkg* [stats.pkg_count];
+ // create 0 pkg for distfiles to provide proxy-fetcher
+ for(uint array_item_num=0;array_item_num<stats.pkg_count;array_item_num++){
+ Ppkg_array[array_item_num]=new Tpkg;
+ Ppkg_array[array_item_num]->load_pkg_from_json(json_object_array_get_idx(json_array_pkg_list,array_item_num));
+ }
+ }
+ return 0;
+ }catch(...){
+ error_log("Error: Can't parse json data from pkg.list file");
+ return 1;
+ }
+ }catch(...){
+ error_log("Error in segget.cpp: load_pkgs()");
+ return 1;
+ }
+}
+*/
+/*
+void show_pkgs(){
+ try{
+ for (uint array_item_num=0;array_item_num<stats.pkg_count;array_item_num++){
+ cout <<"PKG:"<<array_item_num<<") cat:"<< Ppkg_array[array_item_num]->category <<" name:"<< Ppkg_array[array_item_num]->name <<"\n";
+ for(uint distfile_array_item_num=0;distfile_array_item_num<Ppkg_array[array_item_num]->distfile_count;distfile_array_item_num++){
+ cout << " "<< distfile_array_item_num<<") distfile_name:"<< Ppkg_array[array_item_num]->Pdistfile_list[distfile_array_item_num]->name<<"\n";
+ for(uint urllist_array_item_num=0;urllist_array_item_num<Ppkg_array[array_item_num]->Pdistfile_list[distfile_array_item_num]->url_count;urllist_array_item_num++){
+ cout <<" "<<Ppkg_array[array_item_num]->Pdistfile_list[distfile_array_item_num]->url_list[urllist_array_item_num]<<"\n";
+ }
+ }
+ }
+ }catch(...){
+ error_log("Error in segget.cpp: show_pkgs()");
+ }
+}
+*/
+int pkg_choose_segment(Tpkg * cur_pkg, uint connection_num){
+ try{
+ uint distfile_num(0);
+ uint segment_num(0);
+ debug("Entered pkg_choose_segment()");
+ while(distfile_num<cur_pkg->distfile_count){
+// if (Ppkg_array[pkg_num]->distfile_vector[distfile_num].allows_new_actions()){
+ debug("considering distfile:"+toString(distfile_num));
+ if (cur_pkg->Pdistfile_list[distfile_num]->allows_new_actions()){
+ debug("segment_num:"+toString(segment_num));
+ debug("segment_count:"+toString(cur_pkg->Pdistfile_list[distfile_num]->segments_count));
+ while (segment_num<cur_pkg->Pdistfile_list[distfile_num]->segments_count){
+ debug("segment_num:"+toString(segment_num));
+// debug(" segment_num:"+toString(segment_num));
+ // segments_in_progress[connection_num]=
+ // if not(Ppkg_array[pkg_num]->Pdistfile_list[distfile_num]->get_segment_downloaded_status(segment_num);
+ debug("Let's get segment status: "+statusToString(cur_pkg->Pdistfile_list[distfile_num]->dn_segments[segment_num].status));
+ if (cur_pkg->Pdistfile_list[distfile_num]->dn_segments[segment_num].status==SWAITING){
+ if (0==cur_pkg->Pdistfile_list[distfile_num]->provide_segment(cm, connection_num, segment_num)){
+ return 0; // download started
+ };
+ // no success with this segment though it's waiting
+ // probably there will be a problem downloading next segment
+ // so let's go for the next distfile
+ // and return to this distfile later - next time pkg_choose_segment is called
+ break;
+ }else{
+ debug("status is not SWAITING - go for the next segment");
+ // haven't managed to provide this segment, go for the next one
+ segment_num++;
+ }
+ }
+ }
+ distfile_num++;
+ segment_num=0;
+ }
+ distfile_num=0;
+ return 1;
+ }catch(...){
+ error_log("Error: segget.cpp : pkg_choose_segment()");
+ return 1;
+ }
+}
+
+int choose_segment(uint connection_num){
+ try{
+ debug("Entered choose_segment()");
+// for (uint pkg_num=0; pkg_num<stats.pkg_count; pkg_num++){
+// debug("pkg_num:"+toString(pkg_num));
+// if (0==pkg_choose_segment(Ppkg_array[pkg_num], connection_num)){
+// return 0;
+// }
+// }
+
+ if (0==pkg_choose_segment(&request_server_pkg, connection_num)){
+ return 0;
+ }
+ debug("choose_segment() goes for proxy-fetcher distfiles");
+ // download distfiles as a proxy-fetcher
+ if (0==pkg_choose_segment(&proxy_fetcher_pkg, connection_num)){
+ return 0;
+ }
+ // for (uint array_item_num=0;array_item_num<pkg_count;array_item_num++){
+ //for(int distfile_array_item_num=0;distfile_array_item_num<Ppkg_array[array_item_num]->distfile_count;distfile_array_item_num++){
+ // if (Ppkg_array[array_item_num]->Pdistfile_list[distfile_array_item_num]->url_count)
+ // Ppkg_array[array_item_num]->Pdistfile_list[distfile_array_item_num]->dosegments();
+ //}
+ //}
+ return 1;
+ }catch(...){
+ error_log("Error: segget.cpp : choose_segment()");
+ return 1;
+ }
+}
+int download_pkgs(){
+ try{
+ // cout << "Need to download: " << segments_count << " segments\n";
+ CURLMsg *msg;
+ long L;
+ int M, Q, U = -1;
+ fd_set R, W, E;
+ struct timeval T;
+
+ try{
+ cm = curl_multi_init();
+ // we can optionally limit the total amount of connections this multi handle uses
+ curl_multi_setopt(cm, CURLMOPT_MAXCONNECTS, (long)MAX_CONNECTS);
+ }catch(...){
+ error_log("Error in segget.cpp: download_pkgs() : while calling curl_global_init() and curl_multi_init()");
+ return EXIT_FAILURE;
+ }
+
+// for (uint connection_num = 0; connection_num < settings.max_connections; ++connection_num) {
+// if ( ! connection_array[connection_num].active){
+// if (choose_segment(connection_num))
+// break;
+// }
+// };
+ bool keep_running_flag=true;
+ struct timeval prev_connection_activation_cycle_time;
+ while (keep_running_flag) {
+ // Use free connections to download segments connections
+ if (1000>time_left_since(prev_connection_activation_cycle_time)){
+ debug("Not enough time left to start connection activation cycle");
+ sleep(1);
+ }else{
+ debug("Entering connection activation cycle");
+ gettimeofday(&prev_connection_activation_cycle_time,NULL);
+ for (uint connection_num = 0; connection_num < settings.max_connections; ++connection_num) {
+ debug("connection_num:"+toString(connection_num));
+ if ( ! connection_array[connection_num].active){
+ debug("connection is not active - choosing segment");
+ if (choose_segment(connection_num)){
+ // if no success don't try the same for other connections
+ debug("No segment found for connection:"+toString(connection_num)+" => no reason to look for a segment for other connections");
+ break;
+ }else{
+// U++;
+ }
+ }
+ else{
+ debug("connection is active");
+ }
+ };
+ debug("Exit connection activation sycle");
+ }
+ debug("After attempt to start connection activation cycle");
+ U=stats.active_connections_counter;
+ debug("before multi_perform");
+// while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(cm, &U)){};
+ if (CURLM_CALL_MULTI_PERFORM != curl_multi_perform(cm, &U)){
+ debug("after multi_perform");
+// if (U) {
+ FD_ZERO(&R);
+ FD_ZERO(&W);
+ FD_ZERO(&E);
+ if (curl_multi_fdset(cm, &R, &W, &E, &M)) {
+ error_log("Error: curl_multi_fdset");
+// fprintf(stderr, "E: curl_multi_fdset\n");
+ return EXIT_FAILURE;
+ }
+ if (curl_multi_timeout(cm, &L)) {
+ error_log("Error: curl_multi_timeout");
+// fprintf(stderr, "E: curl_multi_timeout\n");
+ return EXIT_FAILURE;
+ }
+ if (L == -1)
+ L = 100;
+ if (M == -1) {
+ #ifdef WIN32
+ Sleep(L);
+ #else
+ sleep(L / 1000);
+ #endif
+ } else {
+ T.tv_sec = L/1000;
+ T.tv_usec = (L%1000)*1000;
+ if (0 > select(M+1, &R, &W, &E, &T)) {
+// fprintf(stderr, "E: select(%i,,,,%li): %i: %s\n",
+ error_log("Error: select ("+toString(M+1)+","+toString(L)+"):"+toString(errno)+": "+strerror(errno));
+ return EXIT_FAILURE;
+ }
+ }
+// }
+ debug("before multi_info_read");
+ while ((msg = curl_multi_info_read(cm, &Q))) {
+ debug("inside multi_info_read");
+ if (msg->msg == CURLMSG_DONE) {
+ Tsegment *current_segment;
+ CURL *e = msg->easy_handle;
+ curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &current_segment);
+// CURLcode connection_result=msg->data.result;
+// string result_msg_text="RESULT:"+toString(connection_result)+" "+curl_easy_strerror(msg->data.result)+" while downloading segment";
+// msg_status1(current_segment->connection_num,current_segment->segment_num,result_msg_text);
+ curl_multi_remove_handle(cm, e);
+
+ connection_array[current_segment->connection_num].stop(msg->data.result);
+
+// if (not choose_segment(current_segment->connection_num)) {
+// U++; // just to prevent it from remaining at 0 if there are more URLs to get
+// };
+ stats.show_totals();
+ curl_easy_cleanup(e);
+ }else {
+ error_log("ERROR: CURLMsg: "+msg->msg);
+ }
+ }
+ }
+ }
+ curl_multi_cleanup(cm);
+ curl_global_cleanup();
+ log("Nothing to download - Exiting... (Press any key to exit) ");
+ return EXIT_SUCCESS;
+ }catch(...){
+ error_log("Error in segget.cpp: download_pkgs()");
+ return EXIT_FAILURE;
+ }
+}
+void *refresh_tui_screen(void * ){
+ while (true){
+ ulong time_diff_msecs=time_left_since(stats.previous_time);
+ if (time_diff_msecs >= settings.current_speed_time_interval_msecs){
+ show_progress(time_diff_msecs);
+ };
+ stats.show_totals();
+ sleep(1);
+ }
+ return 0;
+}
+
+void launch_tui_thread(){
+ pthread_t tui_thread;
+ int iret1;
+ iret1 = pthread_create( &tui_thread, NULL, refresh_tui_screen, (void*) NULL);
+}
+
+void launch_ui_server_thread(){
+ pthread_t ui_server_thread;
+ int iret1;
+ debug_no_msg("Creating ui_server_thread.");
+ ui_server.init();
+ iret1 = pthread_create( &ui_server_thread, NULL, run_ui_server, (void*) NULL);
+ debug_no_msg("ui_server_thread launched");
+}
+
+void launch_proxy_fetcher_server_thread(){
+ if (settings.provide_proxy_fetcher_ip!="none"){
+ pthread_t proxy_fetcher_server_thread;
+ int iret1;
+ debug_no_msg("Creating ui_server_thread.");
+// proxy_fetcher_server_thread.init();
+ iret1 = pthread_create( &proxy_fetcher_server_thread, NULL, run_proxy_fetcher_server, (void*) NULL);
+ debug_no_msg("proxy_fetcher_server_thread launched");
+ }
+}
+
+void launch_request_server_thread(){
+ if (settings.request_ip!="none"){
+ pthread_t request_server_thread;
+ int iret1;
+ debug_no_msg("Creating request_server_thread.");
+// proxy_fetcher_server_thread.init();
+ iret1 = pthread_create( &request_server_thread, NULL, run_request_server, (void*) NULL);
+ debug_no_msg("request_server_thread launched");
+ }
+}
+/*
+void launch_script_server_thread(){
+// if (settings.request_ip!="none"){
+ pthread_t script_server_thread;
+ int iret1;
+ debug_no_msg("Creating script_server_thread.");
+// proxy_fetcher_server_thread.init();
+ iret1 = pthread_create( &script_server_thread, NULL, run_script_server, (void*) NULL);
+ debug_no_msg("script_server_thread launched");
+// }
+}
+*/
+void segget_exit(int sig){
+ try{
+ endwin();
+ }
+ catch(...)
+ {
+ //error while ending curses
+ }
+ try{
+ for(uint fd = 0; fd <= ui_server.max_fd_num; fd++) {
+ close(fd);
+ }
+ }
+ catch(...)
+ {
+ //error while clossing server_sockfd
+ }
+ error_log_no_msg("Segget exits because cought signal:"+toString(sig));
+ cout<<"Bye!\n\n";
+ exit(0);
+}
+
+int routine(){
+ try{
+ signal(SIGABRT,segget_exit);//If program aborts go to assigned function "segget_exit".
+ signal(SIGTERM,segget_exit);//If program terminates go to assigned function "segget_exit".
+ signal(SIGINT,segget_exit);//If program terminates go to assigned function "segget_exit".
+ try{
+ gettimeofday(&stats.segget_start_time,NULL);
+// stats.prev_time=time((time_t *)NULL);
+ }catch(...){
+ error_log("Error in stats.cpp: reset_previous_time()");
+ }
+ try{
+ //load settings
+ settings.init();
+ }
+ catch(...)
+ {
+ //error while loading settings
+ }
+ try{
+ init_connections();
+ }catch(...){
+ error_log("error while init_connections");
+ }
+ try{
+ // This function is NOT thread-safe => call it before any other thread is launched
+ curl_global_init(CURL_GLOBAL_ALL);
+ }catch(...){
+ error_log_no_msg("Error in segget.cpp: routine: while calling curl_global_init()");
+ }
+ try{
+ launch_ui_server_thread();
+ }catch(...){
+ error_log_no_msg("Error in segget.cpp launch_ui_server() failed");
+ }
+ try{
+ launch_request_server_thread();
+ }catch(...){
+ error_log_no_msg("Error in segget.cpp launch_proxy_fetcher_server_thread failed");
+ }
+/*
+ try{
+ launch_script_server_thread();
+ }catch(...){
+ error_log_no_msg("Error in segget.cpp launch_script_server_thread failed");
+ }
+*/
+ try{
+ launch_proxy_fetcher_server_thread();
+ }catch(...){
+ error_log_no_msg("Error in segget.cpp launch_proxy_fetcher_server_thread failed");
+ }
+ try{
+ launch_tui_thread();
+ }catch(...){
+ error_log_no_msg("Error in segget.cpp launch_tui_theread() failed");
+ }
+// try{
+// load_pkgs();
+// }catch(...){
+ //error while loading pkgs
+// }
+ try{
+ //show_pkgs();
+ stats.show_totals();
+ }catch(...){
+ //error while showing stats
+ }
+ try{
+ download_pkgs();
+ }catch(...){
+ //error while downloading_pkgs
+ }
+ try{
+ close(ui_server.server_sockfd);
+ }catch(...){
+ //error while clossing server_sockfd
+ }
+ return 0;
+ }catch(...)
+ {
+ perror("Error in segget.cpp: routine()");
+ }
+ return 1;
+}
+
+void start_daemon_mode(){
+ try{
+ debug("start_daemon_mode()");
+ switch (fork())
+ {
+ case 0: break; //child
+ case -1: error_log("Error in segget.cpp: start_daemon_mode() during first fork()"); //fork error
+ default: exit(0); //parent
+ }
+ struct rlimit _ResourceLimit;
+ if (getrlimit(RLIMIT_NOFILE, &_ResourceLimit)!=0) error_log("Error in segget.cpp: start_daemon_mode() during getrlimit()");
+ if (_ResourceLimit.rlim_max==0) throw("Error in segget.cpp: start_daemon_mode() - no open file descriptors");
+ for (uint i=0;i<_ResourceLimit.rlim_max;i++) close(i);
+ if (setsid()==-1) error_log_no_msg("Error in segget.cpp: start_daemon_mode() during setsid()");
+ switch (fork()){
+ case 0: break; // child
+ case -1: error_log_no_msg("Error in segget.cpp: start_daemon_mode() during second fork()");
+ default: exit(0); // parent
+ }
+ umask(0);
+ // prevent unmount problems - switch to root
+// chdir("/");
+ // create descriptors in case someone will use them
+ int fileDesc = open("/dev/null", O_RDWR); //stdin
+ //stdout
+ if (dup(fileDesc)){
+ log_no_msg("Error in segget.cpp: start_daemon_mode: during dup(fileDesc) - stdout");
+// exit(1);
+ }
+ //stderr
+ if (dup(fileDesc)){
+ log_no_msg("Error in segget.cpp: start_daemon_mode: during dup(fileDesc) - stderr");
+// exit(1);
+ }
+ log_no_msg("Starting daemon routine");
+ routine();
+ log_no_msg("Exited daemon routine");
+ }catch (...){
+ error_log_no_msg("Error in segget.cpp: start_daemon_mode()");
+ exit(1);
+ }
+}
+
+int init_curses(){
+ try{
+ initscr();
+ curs_set(0);
+ refresh();
+ return 0;
+ }catch(...){
+ perror("Error in segget.cpp: init_curses()");
+ }
+ return 1;
+}
+int parse_cli_arguments(int argc, char* argv[]){
+ try{
+ string option,name,value;
+ cout << "argc = " << argc << endl;
+ int posEqual;
+ for(int i = 0; i < argc; i++){
+ cout << "argv[" << i << "] = " << argv[i] << endl;
+ option=argv[i];
+ posEqual=option.find('=');
+ name = trim(option.substr(0,posEqual));
+ value = trim(option.substr(posEqual+1));
+ if (name=="--conf-dir") {settings.conf_dir=value; continue;};
+ if (name=="--no-daemon"){settings.no_daemon_flag=true; continue;}
+ }
+ return 0;
+ }catch(...){
+ perror("Error in segget.cpp: init_curses()");
+ }
+ return 1;
+}
+
+int main(int argc, char* argv[])
+{
+ try{
+ parse_cli_arguments(argc, argv);
+ if (settings.no_daemon_flag){
+ init_curses();
+ routine();
+ endwin(); // exit curses
+ }else{
+ start_daemon_mode();
+ }
+ exit (0);
+ }catch(...){
+ perror("Error in segget.cpp main()");
+ }
+ exit(1);
+} \ No newline at end of file
diff --git a/seggetd/seggetd.h b/seggetd/seggetd.h
new file mode 100644
index 0000000..cada6f1
--- /dev/null
+++ b/seggetd/seggetd.h
@@ -0,0 +1,81 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __SEGGET_H__
+#define __SEGGET_H__
+
+#include <stdio.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <fstream>
+#include <iostream>
+#include <json/json.h>
+#include <ncurses.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "checksum.h"
+#include "config.h"
+#include "distfile.h"
+#include "mirror.h"
+#include "network.h"
+#include "networkbroker.h"
+#include "pkg.h"
+#include "segment.h"
+#include "settings.h"
+//#include "stats.h"
+#include "str.h"
+#include "tui.h"
+#include "utils.h"
+#include "ui_server.h"
+#include "proxyfetcher.h"
+#include "requestserver.h"
+#include "scriptserver.h"
+
+using namespace std;
+
+CURLM *cm;
+
+int routine();
+void start_daemon_mode();
+int parse_cli_arguments(int argc, char* argv[]);
+int init_curses();
+//int load_pkgs();
+void show_pkgs();
+int pkg_choose_segment(Tpkg * cur_pkg, uint connection_num);
+int choose_segment(uint connection_num);
+int download_pkgs();
+int main(int argc, char* argv[]);
+void *refresh_tui_screen( void *);
+void launch_tui_thread();
+void launch_ui_server_thread();
+void launch_proxy_fetcher_server_thread();
+void launch_request_server_thread();
+
+#endif \ No newline at end of file
diff --git a/seggetd/segment.cpp b/seggetd/segment.cpp
new file mode 100644
index 0000000..b771948
--- /dev/null
+++ b/seggetd/segment.cpp
@@ -0,0 +1,235 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "segment.h"
+
+Tsegment *segments_in_progress[MAX_CONNECTS]={0};
+
+string statusToString(Tsegment_status the_status){
+ switch (the_status){
+ case SWAITING:return "SWAITING";
+ case SDOWNLOADING:return "SDOWNLOADING";
+ case SDOWNLOADED:return "SDOWNLOADED";
+ case SFAILED:return "SFAILED";
+ default :return "UNKNOWN STATUS";
+ }
+}
+bool Tsegment::segment_verification_is_ok(){
+ try{
+ ulong downloaded_size;
+ ifstream file((settings.segments_dir+"/"+file_name).c_str(), ios::in|ios::binary);
+ ulong start = file.tellg();
+ file.seekg (0, ios::end);
+ ulong end = file.tellg();
+ downloaded_size = end - start;
+ debug("seg:"+toString(segment_num)+" Dsize="+toString(downloaded_size)+" seg_size="+toString(segment_size));
+ file.close();
+ if (downloaded_size==segment_size){
+ return true;
+ }
+ }catch(...){
+ error_log("Error in segment.cpp: segment_verification_is_ok()");
+ }
+ return false;
+}
+
+void Tsegment::set_segment(Tdistfile *prnt_distfile, uint seg_num, string distfile_name, ulong default_seg_size, ulong range_end){
+ try{
+ parent_distfile=prnt_distfile;
+ segment_num=seg_num;
+ segment_size=range_end-seg_num*default_seg_size+1;
+ range=toString(seg_num*default_seg_size)+"-"+toString(range_end);
+ file_name="."+distfile_name+".seg"+toString(seg_num);
+ if (settings.get_resume()){
+ //check if downloaded
+ if (segment_verification_is_ok()){
+ status=SDOWNLOADED;
+ debug("seg:"+toString(seg_num)+" Downloaded");
+ }
+ else{
+ debug("seg:"+toString(seg_num)+" not downloaded");
+ downloaded_bytes=0;
+ }
+ }
+ }catch(...){
+ error_log("Error in segment.cpp: prepare_for_connection()");
+ }
+}
+uint Tsegment::start(CURLM *cm, uint con_num, uint network_num, uint distfile_num, string url_address){
+ try{
+// debug("NETWORK:"+toString(network_num)+(network_array[network_num].use_own_mirror_list_only_on ? " - LOCAL": " - REMOTE"));
+ // if MODE_LOCAL or MODE_PROXY_FETCHER
+ url=url_address;
+ msg_connecting(con_num,distfile_num, segment_num,"Downloading from "+url);
+ segments_in_progress[con_num]=this;
+ status=SDOWNLOADING;
+ downloaded_bytes=0;
+ connection_num=con_num;
+// connection_array[con_num].start(network_num);
+ try_num++;
+ return add_easy_handle_to_multi(cm, network_num);
+ }catch(...){
+ error_log("Error in segment.cpp: prepare_for_connection()");
+ return ERROR_DURING_SEGMENT_START;
+ }
+}
+
+Tsegment::~Tsegment(){
+ try{
+ segment_file.close();
+ }catch(...){
+ error_log("Error in segment.cpp: ~Tsegment()");
+ }
+}
+
+uint Tsegment::add_easy_handle_to_multi(CURLM *cm, uint network_num){
+ try{
+ segment_file.exceptions (ofstream::badbit);
+ segment_file.open((settings.segments_dir+"/"+file_name).c_str(), ios::trunc|ios::binary );
+ if (! segment_file.is_open()){
+ error_log("Can't open for writing segment file "+settings.segments_dir+"/"+file_name);
+ error_log("....Check if folder "+settings.segments_dir+" exists and seggetd has permisions to write into it");
+ return ERROR_WHILE_OPENING_SEGMENT_FOR_WRITING;
+ }
+ }catch(ifstream::failure e){
+ if (!segment_file.eof()){
+ error_log("Can't open for writing segment file: "+settings.segments_dir+"/"+file_name+": "+(string)e.what());
+ error_log("....Check if folder "+settings.segments_dir+" exists and seggetd has permisions to write into it");
+ return ERROR_WHILE_OPENING_SEGMENT_FOR_WRITING;
+ }
+ }catch(...){
+ error_log("Unknown error: Can't open for writing segment file: "+settings.segments_dir+"/"+file_name);
+ error_log("Check if folder "+settings.segments_dir+" exists and seggetd has permisions to write into this folder");
+ return ERROR_WHILE_OPENING_SEGMENT_FOR_WRITING;
+ }
+ try{
+ easyhandle = curl_easy_init();
+ if(easyhandle) {
+ curl_easy_setopt(easyhandle, CURLOPT_URL, url.c_str() );
+ curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, this);
+ curl_easy_setopt(easyhandle, CURLOPT_PRIVATE, this);
+ curl_easy_setopt(easyhandle, CURLOPT_RANGE, range.c_str());
+ curl_easy_setopt(easyhandle, CURLOPT_TIMEOUT, network_array[network_num].time_out);
+ curl_easy_setopt(easyhandle, CURLOPT_FTP_RESPONSE_TIMEOUT, network_array[network_num].ftp_response_timeout);
+ if ((network_array[network_num].low_connection_speed_limit!=0) and (network_array[network_num].low_connection_speed_limit!=(ulong)-1)){
+ curl_easy_setopt(easyhandle, CURLOPT_LOW_SPEED_LIMIT, network_array[network_num].low_connection_speed_limit);
+ }
+ curl_easy_setopt(easyhandle, CURLOPT_LOW_SPEED_TIME, network_array[network_num].low_connection_speed_time);
+
+ if (connection_array[connection_num].max_speed_limit!=0){
+ curl_easy_setopt(easyhandle, CURLOPT_MAX_RECV_SPEED_LARGE, network_array[network_num].max_connection_speed);
+ }else{
+ if ((network_array[network_num].max_connection_speed!=0) and (network_array[network_num].max_connection_speed!=(ulong)-1)){
+ curl_easy_setopt(easyhandle, CURLOPT_MAX_RECV_SPEED_LARGE, network_array[network_num].max_connection_speed);
+ }
+ }
+ curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, network_array[network_num].user_agent.c_str());
+
+ curl_easy_setopt(easyhandle, CURLOPT_FOLLOWLOCATION, network_array[network_num].follow_location);
+ curl_easy_setopt(easyhandle, CURLOPT_MAXREDIRS, network_array[network_num].max_redirs);
+
+ if (network_array[network_num].proxy_off)
+ curl_easy_setopt(easyhandle, CURLOPT_NOPROXY, "*");
+ else{
+ if ((network_array[network_num].proxy_ip_or_name!="none") and (network_array[network_num].proxy_port!=0)){
+ curl_easy_setopt(easyhandle, CURLOPT_PROXY, network_array[network_num].proxy_ip_or_name.c_str());
+ curl_easy_setopt(easyhandle, CURLOPT_PROXYPORT, network_array[network_num].proxy_port);
+ debug("Using proxy:"+network_array[network_num].proxy_ip_or_name+":"+toString(network_array[network_num].proxy_port));
+ }
+ if (network_array[network_num].proxy_user!="none"){
+ curl_easy_setopt(easyhandle, CURLOPT_PROXYUSERNAME, network_array[network_num].proxy_user.c_str());
+ if (network_array[network_num].proxy_password!="none")
+ curl_easy_setopt(easyhandle, CURLOPT_PROXYPASSWORD, network_array[network_num].proxy_password.c_str());
+ }
+ curl_easy_setopt(easyhandle, CURLOPT_PROXYTYPE, network_array[network_num].proxy_type);
+ }
+
+ if ((network_array[network_num].bind_interface!="none")
+ and (network_array[network_num].bind_interface!=""))
+ curl_easy_setopt(easyhandle, CURLOPT_INTERFACE, network_array[network_num].bind_interface.c_str());
+
+ if (network_array[network_num].bind_local_port){
+ curl_easy_setopt(easyhandle, CURLOPT_LOCALPORT, network_array[network_num].bind_local_port);
+ curl_easy_setopt(easyhandle, CURLOPT_LOCALPORTRANGE, network_array[network_num].bind_local_port_range);
+ }
+
+ //set connection timeout
+ curl_easy_setopt(easyhandle, CURLOPT_CONNECTTIMEOUT, network_array[network_num].connection_timeout);
+ curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, write_data);
+ curl_multi_add_handle(cm, easyhandle);
+ return 0;
+ }else
+ return ERROR_ADDING_EASY_HANDLE_TO_MULTI;
+ }catch(...){
+ error_log("Error in segment.cpp: add_easy_handle_to_multi()");
+ return ERROR_ADDING_EASY_HANDLE_TO_MULTI;
+ }
+}
+void show_progress(double time_diff){
+ try{
+ stats.total_bytes_per_last_interval=0;
+ stats.avg_total_speed=0;
+ for (uint con_num=0; con_num<MAX_CONNECTS; con_num++){
+ // ulong speed=bytes_written*1000/(diff_sec+diff_milli);
+ //if connection is not NULL
+ if (connection_array[con_num].active){
+ connection_array[con_num].show_connection_progress(time_diff);
+ if (time_left_since(connection_array[con_num].start_time)>0){
+ stats.avg_total_speed+=(connection_array[con_num].total_dld_bytes*1000)/time_left_since(connection_array[con_num].start_time);
+ }
+ }
+ }
+ stats.last_time_interval=time_diff;
+ stats.show_totals();
+ }
+ catch(...){
+ error_log("Error in segment.cpp: show_progress()");
+ }
+}
+
+size_t write_data(void *buffer, size_t size, size_t nmemb, void *cur_segment){
+ ulong bytes_written=size*nmemb;
+ try{
+ Tsegment *segment;
+ segment =(Tsegment*)cur_segment;
+ segment->downloaded_bytes+=nmemb;
+ try{
+ segment->segment_file.write((char*)buffer,nmemb*size);
+ }
+ catch(...){
+ error_log("Can't write segment file:"+segment->file_name);
+ }
+ connection_array[segment->connection_num].inc_bytes_per_last_interval(bytes_written);
+// ulong time_diff_msecs=time_left_from(stats.previous_time);
+// if (time_diff_msecs >= settings.current_speed_time_interval_msecs){
+// show_progress(time_diff_msecs);
+// };
+ }catch(...){
+ error_log("Error in segment.cpp: write_data()");
+ return 0;
+ }
+ return bytes_written;
+} \ No newline at end of file
diff --git a/seggetd/segment.h b/seggetd/segment.h
new file mode 100644
index 0000000..d64d088
--- /dev/null
+++ b/seggetd/segment.h
@@ -0,0 +1,100 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __SEGMENT_H__
+#define __SEGMENT_H__
+using namespace std;
+
+#include <sstream>
+#include <fstream>
+#include <cstring>
+#include <string>
+#include <iostream>
+#include <stdio.h>
+#include <cstdio>
+#include <ncurses.h>
+#include <curl/curl.h>
+#include "settings.h"
+
+#include "distfile.h"
+class Tdistfile;
+#include "stats.h"
+
+
+#define MAX_CONNECTS 20
+//extern Tsettings settings;
+//unsigned long downloaded_bytes=0;
+size_t write_data(void *buffer, size_t size, size_t nmemb, void *cur_segment);
+
+enum Tsegment_status{SWAITING, SDOWNLOADING, SDOWNLOADED, SFAILED};
+
+class Tsegment{
+ private:
+ CURL *easyhandle;
+ char* urllist;
+ public:
+ string file_name;
+ Tsegment_status status;
+ uint try_num;
+ Tdistfile* parent_distfile;
+ uint connection_num;
+ uint segment_num;
+ uint segment_size;
+ unsigned long downloaded_bytes;
+ string url;
+ string range;
+ ofstream segment_file;
+ Tsegment():
+ easyhandle(0),
+ urllist(0),
+ file_name(""),
+ status(SWAITING),
+ try_num(0),
+ parent_distfile(0),
+ connection_num(0),
+ segment_num(0),
+ segment_size(1000),
+ downloaded_bytes(0),
+ url(""),
+ range(""),
+ segment_file(0)
+ {};
+ Tsegment(const Tsegment &L); // copy constructor
+ Tsegment & operator=(const Tsegment &L);
+ ~Tsegment();
+ bool segment_verification_is_ok();
+ void set_segment(Tdistfile *prnt_distfile, uint seg_num, string distfile_name, ulong default_seg_size, ulong range_end);
+ string get_file_name(){return file_name;};
+ uint start(CURLM *cm, uint con_num, uint network_num, uint distfile_num, string url);
+ uint add_easy_handle_to_multi(CURLM *cm, uint network_num);
+};
+
+extern Tsegment *segments_in_progress[MAX_CONNECTS];
+
+string statusToString(Tsegment_status the_status);
+void show_progress(double time_diff);
+size_t write_data(void *buffer, size_t size, size_t nmemb, void *cur_segment);
+#endif \ No newline at end of file
diff --git a/seggetd/settings.cpp b/seggetd/settings.cpp
new file mode 100644
index 0000000..c3db2b6
--- /dev/null
+++ b/seggetd/settings.cpp
@@ -0,0 +1,150 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "settings.h"
+
+Tsettings settings;
+
+void Tsettings::load_provide_mirror_files_restricted_patterns_vector(){
+ try{
+ ifstream file;
+ file.exceptions (ifstream::failbit | ifstream::badbit);
+ try{
+ file.open("restrict.conf");
+ }
+ catch(...){
+ error_log("Can NOT open pattern list file restrict.conf. Setting provide_mirror_files_restrict_list_on=0 will be forced.");
+ provide_mirror_files_restrict_list_on=0;
+ return;
+ }
+ try{
+ //processing file
+ string restricted_pattern_line;
+ while (not(file.eof())) {
+ getline(file,restricted_pattern_line);
+ if (! restricted_pattern_line.length()) continue;
+ if (restricted_pattern_line[0] == '#') continue;
+ if (restricted_pattern_line[0] == ';') continue;
+ provide_mirror_files_restricted_patterns_vector.push_back(restricted_pattern_line);
+ debug("restricted_pattern_line added:"+restricted_pattern_line);
+ }
+ log(toString(provide_mirror_files_restricted_patterns_vector.size())+" pattern(s) was(were) read from restrict.conf");
+ if (! provide_mirror_files_restricted_patterns_vector.size()){
+ error_log("No patterns were read from restrict.conf file. Setting provide_mirror_files_restrict_list_on=0 will be forced.");
+ provide_mirror_files_restrict_list_on=0;
+ }
+ }
+ catch(...){
+ error_log("Restricted pattern list file restrict.conf was opened, but an error occured while reading it.");
+ }
+ }catch(...){
+ error_log("Error in settings.cpp: load_provide_mirror_files_restricted_patterns_vector()");
+ }
+}
+
+void Tsettings::init(){
+ try{
+ Tconfig conf("segget.conf");
+ conf.set("logs","general_log_file",general_log_file);
+ conf.set("logs","logs_dir",logs_dir);
+ conf.set("logs","error_log_file",error_log_file);
+ conf.set("logs","debug_log_file",debug_log_file);
+ conf.set_keep_case("logs","general_log_time_format",general_log_time_format);
+ conf.set_keep_case("logs","error_log_time_format",error_log_time_format);
+ conf.set_keep_case("logs","debug_log_time_format",debug_log_time_format);
+
+ conf.set("connections","max_connections",max_connections,1,MAX_CONNECTS);
+
+ conf.set("folders","distfiles_dir",distfiles_dir);
+ conf.set("folders","segments_dir",segments_dir);
+
+// conf.set("pkg_list","pkg_list_dir",pkg_list_dir);
+// conf.set("pkg_list","del_pkg_list_when_dld_finished",del_pkg_list_when_dld_finished);
+
+ conf.set("distfiles","max_connection_num_per_distfile",max_connection_num_per_distfile,1,MAX_CONNECTS);
+
+ conf.set("segments","resume_on",resume_on);
+ conf.set("segments","max_segment_size",max_segment_size,10000,10000000);
+ conf.set("segments","max_tries",max_tries,1,-1);
+
+ conf.set("connections","current_speed_time_interval_msecs",current_speed_time_interval_msecs,100,60000);
+
+ conf.set("mirrors","max_connections_num_per_mirror",max_connections_num_per_mirror,1,10);
+ conf.set("mirrors","benchmark_oblivion",benchmark_oblivion,0,1000);
+
+ conf.set("provide_mirror_to_others","provide_mirror_dir",provide_mirror_dir);
+ if (provide_mirror_dir!="none"){
+ conf.set("provide_mirror_to_others","provide_mirror_files_restrict_list_on",provide_mirror_files_restrict_list_on);
+ if (provide_mirror_files_restrict_list_on)
+ load_provide_mirror_files_restricted_patterns_vector();
+ }
+
+ conf.set("provide_proxy_fetcher_to_others","provide_proxy_fetcher_ip",provide_proxy_fetcher_ip);
+ conf.set("provide_proxy_fetcher_to_others","provide_proxy_fetcher_port",provide_proxy_fetcher_port,1,65535);
+
+ ulong cur_network_priority;
+ for (uint network_num=0; network_num<MAX_NETWORKS; network_num++){
+ //set default values, in case segget.conf doesn't have these settings
+ network_array[network_num].network_num=network_num;
+ if (network_num==0){
+ cur_network_priority=10;
+ }else{
+ cur_network_priority=0;
+ }
+
+ conf.set("networks","network"+toString(network_num)+"_priority",cur_network_priority,0,10);
+ if (cur_network_priority>0){
+ network_array[network_num].init(cur_network_priority);
+ if ((network_array[network_num].network_mode==MODE_REMOTE)
+ or (network_array[network_num].network_mode==MODE_CORAL_CDN)){
+ only_local_and_proxy_fetcher_mode_networks_flag=false;
+ }
+ }
+ }
+ conf.set("ui_server","ui_ip",ui_ip);
+ conf.set("ui_server","ui_port",ui_port,1,65535);
+ conf.set("ui_server","ui_web_ui_dir",ui_web_ui_dir);
+
+ conf.set("provide_mirror_to_others","provide_mirror_to_others_url",provide_mirror_to_others_url);
+ if (provide_mirror_to_others_url=="ui_ip"){
+ provide_mirror_to_others_url="http://"+ui_ip;
+ }
+
+ conf.set("rss","rss_title",rss_title);
+ conf.set("rss","rss_description",rss_description);
+
+ conf.set("request_server","request_ip",request_ip);
+ conf.set("request_server","request_port",request_port,1,65535);
+
+ conf.set("scripting_and_scheduling","python_path",python_path);
+ conf.set("scripting_and_scheduling","scripts_dir",scripts_dir);
+ conf.set("scripting_and_scheduling","script_socket_path",script_socket_path);
+
+ conf.clear();
+ }catch(...){
+ error_log_no_msg("Error in settings.cpp: init()");
+ }
+} \ No newline at end of file
diff --git a/seggetd/settings.h b/seggetd/settings.h
new file mode 100644
index 0000000..0328501
--- /dev/null
+++ b/seggetd/settings.h
@@ -0,0 +1,169 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __SETTINGS_H__
+#define __SETTINGS_H__
+
+#include <string>
+#include "config.h"
+#include "network.h"
+//#include "tui.cpp"
+#define MAX_CONNECTS 20 /* number of simultaneous transfers */
+
+using namespace std;
+
+class Tsettings{
+ private:
+ void load_provide_mirror_files_restricted_patterns_vector();
+ public:
+ string conf_dir;
+ bool no_daemon_flag;
+ //folders
+ string distfiles_dir;
+ string segments_dir;
+ //pkg_list
+// string pkg_list_dir;
+// bool del_pkg_list_when_dld_finished;
+ //distfiles
+ ulong max_connection_num_per_distfile;
+ //segments
+ ulong max_segment_size;
+ bool resume_on;
+ ulong max_tries;
+ //connections
+ ulong max_connections;
+ ulong connection_timeout;
+ ulong ftp_response_timeout;
+ ulong time_out;
+ ulong low_connection_speed_limit;
+ ulong low_connection_speed_time;
+ ulong max_connection_speed;
+ ulong current_speed_time_interval_msecs;
+ string bind_interface;
+ //mirrors
+ ulong max_connections_num_per_mirror;
+ ulong benchmark_oblivion;
+ //provide_mirror_to_others
+ string provide_mirror_dir;
+ bool provide_mirror_files_restrict_list_on;
+ vector<string> provide_mirror_files_restricted_patterns_vector;
+ //provide_proxy_fether_to_others
+ string provide_proxy_fetcher_ip;
+ ulong provide_proxy_fetcher_port;
+ //networks
+ bool only_local_and_proxy_fetcher_mode_networks_flag;
+ //ui_server
+ string ui_ip;
+ ulong ui_port;
+ string ui_web_ui_dir;
+ //rss
+ string provide_mirror_to_others_url;
+ string rss_title;
+ string rss_description;
+ //request_server
+ string request_ip;
+ ulong request_port;
+ //scripting_and_scheduling
+ string python_path;
+ string scripts_dir;
+ string script_socket_path;
+ //logs
+ string logs_dir;
+ string general_log_file;
+ string error_log_file;
+ string debug_log_file;
+ string general_log_time_format;
+ string error_log_time_format;
+ string debug_log_time_format;
+
+ Tsettings():
+ conf_dir("/etc/seggetd"),
+ no_daemon_flag(false),
+ //folders
+ distfiles_dir("/usr/portage/distfiles"),
+ segments_dir("/tmp/seggetd/segments"),
+ //pkg_list
+// pkg_list_dir("./"),
+// del_pkg_list_when_dld_finished(1),
+ //distfiles
+ max_connection_num_per_distfile(3),
+ //segments
+ max_segment_size(500000),
+ resume_on(1),
+ max_tries(10),
+ //connections
+ max_connections(6),
+ connection_timeout(15),
+ ftp_response_timeout(180),
+ time_out(500),
+ low_connection_speed_limit(1000),
+ low_connection_speed_time(10),
+ max_connection_speed(0),
+ current_speed_time_interval_msecs(1000),
+ bind_interface("none"),
+ //mirrors
+ max_connections_num_per_mirror(1),
+ benchmark_oblivion(5),
+ //provide_mirror_to_others
+ provide_mirror_dir("none"),
+ provide_mirror_files_restrict_list_on(0),
+ provide_mirror_files_restricted_patterns_vector(),
+ //provide_proxy_fether_to_others
+ provide_proxy_fetcher_ip("127.0.0.1"),
+ provide_proxy_fetcher_port(9888),
+ //networks
+ only_local_and_proxy_fetcher_mode_networks_flag(true),
+ //ui_server
+ ui_ip("127.0.0.1"),
+ ui_port(9999),
+ ui_web_ui_dir("/usr/share/seggetd/webui"),
+ //rss
+ provide_mirror_to_others_url("http://"+ui_ip), // init after ui_ip
+ rss_title("Seggetd feed"),
+ rss_description("Files downloaded by seggetd and provided in the local mirror"),
+ //request_server
+ request_ip("127.0.0.1"),
+ request_port(10000),
+ //scripting_and_scheduling
+ python_path("/usr/bin/python"),
+ scripts_dir("/usr/share/seggetd/scripts"),
+ script_socket_path("/tmp/seggetd/script_socket"),
+ //logs
+ logs_dir("/var/log/seggetd"),
+ general_log_file("segget.log"),
+ error_log_file("error.log"),
+ debug_log_file("none"),
+ general_log_time_format("%m/%d %X"),
+ error_log_time_format("%m/%d %X"),
+ debug_log_time_format("%m/%d %X")
+ {};
+ void set_resume(bool resume_setting){resume_on=resume_setting;};
+ bool get_resume(){return resume_on;};
+ void init();
+};
+
+extern Tsettings settings;
+#endif \ No newline at end of file
diff --git a/seggetd/shorttypes.h b/seggetd/shorttypes.h
new file mode 100644
index 0000000..5d99613
--- /dev/null
+++ b/seggetd/shorttypes.h
@@ -0,0 +1,33 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef _TYPES_H_
+#define _TYPES_H_
+
+typedef unsigned long ulong;
+typedef unsigned int uint;
+
+#endif \ No newline at end of file
diff --git a/seggetd/stats.cpp b/seggetd/stats.cpp
new file mode 100644
index 0000000..7bff34e
--- /dev/null
+++ b/seggetd/stats.cpp
@@ -0,0 +1,97 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "stats.h"
+
+Tstats stats;
+
+void Tstats::inc_dld_distfiles_count(){
+ try{
+ dld_distfiles_count++;
+// if ((settings.del_pkg_list_when_dld_finished) and (dld_distfiles_count>distfiles_count)){
+ //delete pkg.list file;
+// if(remove((settings.pkg_list_dir+"/pkg.list").c_str()) != 0 )
+// error_log("Error in stats.cpp: inc_dld_distfiles_count(): Can't delete:"+settings.pkg_list_dir+"/pkg.list");
+// else
+// debug(settings.pkg_list_dir+"/pkg.list"+" deleted" );
+// }
+ }catch(...){
+ error_log("Error in stats.cpp: show_totals()");
+ }
+}
+
+void Tstats::show_totals(){
+ try{
+ ulong show_last_time_interval=1;
+ ulong show_total_size=1;
+ if (last_time_interval>1)
+ show_last_time_interval=last_time_interval;
+ if (total_size>1)
+ show_total_size=total_size;
+ struct timeval now_timee;
+ gettimeofday(&now_timee,NULL);
+ string eta_str;
+ if (avg_total_speed==0){
+ eta_str=" ETA: inf";
+ }else{
+ eta_str=" ETA: "+secsToString((total_size-dld_size)/avg_total_speed);
+ }
+
+ string avg_speed_str=" AVG speed: "+speedToString(avg_total_speed);
+
+ msg_total("Total CON:"
+ +field("", active_connections_counter,2)+"/"
+ +field("", settings.max_connections,2)
+// +field(" PKGs:", pkg_count,4)
+// +field(" = DFs:", dld_distfiles_count,4)
+ +" = DF:"+toString(dld_distfiles_count)
+ +field("/", distfiles_count,4)
+ +" = Sg:"+toString(dld_segments_count)
+ +field("/", segments_count,5)
+// +field(" = Size:", dld_size/1000,7)
+ +" = Size:"+toString(dld_size/1000)
+ +field("(", ((double)dld_size/show_total_size)*100,3)+"%)"
+// +field("/", total_size/1000,7)+" Kb "
+ +"/"+toString(total_size/1000)+"Kb"
+ +" Total spd: "+speedToString(total_bytes_per_last_interval*1000/show_last_time_interval)
+ +avg_speed_str
+ +eta_str
+ // +" Secs:"+toString(now_timee.tv_sec)
+ // +" usecs:"+toString(now_timee.tv_usec)
+ );
+ reset_previous_time();
+ }catch(...){
+ error_log("Error in stats.cpp: show_totals()");
+ }
+}
+
+void Tstats::reset_previous_time(){
+ try{
+ gettimeofday(&previous_time,NULL);
+ }catch(...){
+ error_log("Error in stats.cpp: reset_previous_time()");
+ }
+} \ No newline at end of file
diff --git a/seggetd/stats.h b/seggetd/stats.h
new file mode 100644
index 0000000..b27971c
--- /dev/null
+++ b/seggetd/stats.h
@@ -0,0 +1,82 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __STATS_H__
+#define __STATS_H__
+
+#include <sys/time.h>
+#include "connection.h"
+#include "tui.h"
+#include "settings.h"
+using namespace std;
+
+class Tstats{
+ public:
+ ulong dld_size;
+ ulong dld_distfiles_count;
+ uint total_size;
+ ulong total_bytes_per_last_interval;
+// time_t prev_time;
+ struct timeval segget_start_time;
+ struct timeval previous_time;
+ double last_time_interval;
+ ulong avg_total_speed;
+ uint pkg_count;
+ ulong distfiles_count;
+ ulong segments_count;
+ ulong dld_segments_count;
+ ulong active_connections_counter;
+ ulong fails_counter;
+ Tstats():
+ dld_size(0),
+ dld_distfiles_count(0),
+ total_size(0),
+ total_bytes_per_last_interval(0),
+// prev_time(),
+ segget_start_time(),
+ previous_time(),
+ last_time_interval(1),
+ avg_total_speed(0),
+ pkg_count(0),
+ distfiles_count(0),
+ segments_count(0),
+ dld_segments_count(0),
+ active_connections_counter(0),
+ fails_counter(0)
+ {};
+ void inc_dld_size(ulong more_bytes){ dld_size+=more_bytes;};
+ ulong get_dld_size(){return dld_size;};
+ void inc_dld_distfiles_count();
+ ulong get_dld_distfiles_count(){return dld_distfiles_count;};
+ void inc_total_size(ulong more_bytes){ total_size+=more_bytes;};
+ ulong get_total_size(){return total_size;};
+ void show_totals();
+ void reset_previous_time();
+};
+
+extern Tstats stats;
+
+#endif \ No newline at end of file
diff --git a/seggetd/str.cpp b/seggetd/str.cpp
new file mode 100644
index 0000000..cc7e813
--- /dev/null
+++ b/seggetd/str.cpp
@@ -0,0 +1,159 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "str.h"
+
+string toString(uint t){
+ stringstream s;
+ s << t;
+ return s.str();
+}
+string toString(int t){
+ stringstream s;
+ s << t;
+ return s.str();
+}
+string toString(ulong t){
+ stringstream s;
+ s << t;
+ return s.str();
+}
+string toString(long t){
+ stringstream s;
+ s << t;
+ return s.str();
+}
+string toString(bool t){
+ stringstream s;
+ s << t;
+ return s.str();
+}
+string toString(double t){
+ stringstream s;
+ s << t;
+ return s.str();
+}
+
+vector <string> split_to_vector(string splitter, string str){
+ vector <string> parts;
+ uint splitter_pos=str.find(splitter);
+ while (splitter_pos!=str.npos){
+ parts.push_back(str.substr(0,splitter_pos));
+ str=str.substr(splitter_pos+splitter.length());
+ splitter_pos=str.find(splitter);
+ }
+ if (str.length()>0){
+ parts.push_back(str);
+ }
+ return parts;
+}
+
+/*
+template<typename T> string toString(T t){
+ stringstream s;
+ s << t;
+ return s.str();
+}
+*/
+/*
+template<typename T> string field(string prefix,T t, int width){
+ try{
+ stringstream s1,s2;
+ s1 << t;
+ width=width+prefix.length();
+ s2.width(width);
+ s2 << prefix+s1.str();
+ return s2.str();
+ }catch(...){
+ error_log("Error in str.cpp: field()");
+ return "";
+ }
+}
+*/
+string field(string prefix,ulong t, int width){
+ try{
+ stringstream s1,s2;
+ s1 << t;
+ width=width+prefix.length();
+ s2.width(width);
+ s2 << prefix+s1.str();
+ return s2.str();
+ }catch(...){
+ error_log("Error in str.cpp: field()");
+ return "";
+ }
+}
+
+int lower_char(int c){
+ try{
+ return tolower((unsigned char)c);
+ }catch(...){
+ error_log("Error in str.cpp: lower_char()");
+ return 0;
+ }
+}
+
+string noupper(string s){
+ try{
+ transform(s.begin(), s.end(), s.begin(), lower_char);
+ return s;
+ }catch(...){
+ error_log("Error in str.cpp: noupper()");
+ return "";
+ }
+}
+
+bool split(string splitter, string str, string &before, string &after){
+ try{
+ uint splitter_pos=str.find(splitter);
+ if (splitter_pos==str.npos) return 1;
+ before=str.substr(0,splitter_pos);
+ after=str.substr(splitter_pos+splitter.length());
+ return 0;
+ }catch(...){
+ error_log("Error in str.cpp: split()");
+ return 1;
+ }
+}
+
+string trim(std::string const& source, char const* delims) {
+ try{
+ string result(source);
+ string::size_type index = result.find_last_not_of(delims);
+ if(index != string::npos)
+ result.erase(++index);
+
+ index = result.find_first_not_of(delims);
+ if(index != string::npos)
+ result.erase(0, index);
+ else
+ result.erase();
+ return result;
+ }catch(...){
+ error_log("Error in str.cpp: trim()");
+ return "";
+ }
+} \ No newline at end of file
diff --git a/seggetd/str.h b/seggetd/str.h
new file mode 100644
index 0000000..dcb9b13
--- /dev/null
+++ b/seggetd/str.h
@@ -0,0 +1,51 @@
+ /*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __STR_H__
+#define __STR_H__
+#include <string>
+#include <algorithm>
+#include <sstream>
+#include "tui.h"
+using namespace std;
+
+//template<typename T> string toString(T t);
+//template<typename T> string field(string prefix,T t, int width);
+
+string trim(std::string const& source, char const* delims = " \t\r\n");
+int lower_char(int c);
+string noupper(string s);
+bool split(string splitter, string str, string &before, string &after);
+vector <string> split_to_vector(string splitter, string str);
+string toString(uint t);
+string toString(int t);
+string toString(ulong t);
+string toString(long t);
+string toString(bool t);
+string toString(double t);
+string field(string prefix,ulong t, int width);
+
+#endif \ No newline at end of file
diff --git a/seggetd/tmp/.gitignore b/seggetd/tmp/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/seggetd/tmp/.gitignore
diff --git a/seggetd/tui.cpp b/seggetd/tui.cpp
new file mode 100644
index 0000000..2357fe7
--- /dev/null
+++ b/seggetd/tui.cpp
@@ -0,0 +1,105 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "tui.h"
+extern Tsettings settings;
+
+const uint CONNECTION_LINES=3;
+string screenlines[DEBUG_LINE_NUM+1];
+//vector<string> log_lines;
+uint log_lines_counter=0;
+uint max_published_screenline_num;
+
+//bool msg_idle=true;
+void msg(uint y, uint x, string msg_text){
+// if (msg_idle){
+// msg_idle=false;
+ try{
+ if (max_published_screenline_num<y && y<MAX_LINES) max_published_screenline_num=y;
+ screenlines[y]=msg_text;
+ ui_server.send_connection_msg_to_all_clients(y,msg_text);
+// string ready_msg_text=msg_text+" ";
+ string ready_msg_text=msg_text+"";
+ mvaddstr(y,x,ready_msg_text.c_str());
+ refresh();
+ }catch(...){
+ error_log_no_msg("Error in tui.cpp: msg()");
+ }
+// msg_idle=true;
+// }
+}
+
+void msg_segment_progress(uint connection_num, string progress_text){
+ try{
+ msg(connection_num*CONNECTION_LINES,0,
+ field("[",connection_num,2)+"]"+progress_text);
+ }catch(...){
+ error_log_no_msg("Error in tui.cpp: msg_segment_progress()");
+ }
+}
+void msg_connecting(uint connection_num, uint distfile_num, uint segment_num, string msg_text){
+ try{
+ msg(connection_num*CONNECTION_LINES+1,0,"DF#"+toString(distfile_num)+" Seg#"+toString(segment_num)+" "+msg_text);
+ }catch(...){
+ error_log_no_msg("Error in tui.cpp: msg_connecting()");
+ }
+}
+
+void msg_clean_connection(uint connection_num){
+ try{
+ msg(connection_num*CONNECTION_LINES,0,"");
+ msg(connection_num*CONNECTION_LINES+1,0,"");
+ msg(connection_num*CONNECTION_LINES+2,0,"");
+ msg(connection_num*CONNECTION_LINES+3,0,"");
+ }catch(...){
+ error_log_no_msg("Error in tui.cpp: msg_clean_connection()");
+ }
+}
+
+void msg_log(string log_text){
+ try{
+ ui_server.send_log_msg_to_all_clients(log_text);
+// msg(20,0, error_text);
+ }catch(...){
+ error_log_no_msg("Error in tui.cpp: msg_error()");
+ }
+}
+void msg_error_log(string error_log_text){
+ try{
+ ui_server.send_error_log_msg_to_all_clients(error_log_text);
+// msg(20,0, error_text);
+ }catch(...){
+ error_log_no_msg("Error in tui.cpp: msg_error()");
+ }
+}
+
+void msg_total(string msg_text){
+ try{
+ msg(TOTAL_LINE_NUM,0,msg_text);
+ }catch(...){
+ error_log_no_msg("Error in tui.cpp: msg_total()");
+ }
+} \ No newline at end of file
diff --git a/seggetd/tui.h b/seggetd/tui.h
new file mode 100644
index 0000000..aa2041c
--- /dev/null
+++ b/seggetd/tui.h
@@ -0,0 +1,61 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __TUI_H__
+#define __TUI_H__
+#include <ncurses.h>
+#include <vector>
+#include "settings.h"
+#include "ui_server.h"
+#include "utils.h"
+#include "log.h"
+
+using namespace std;
+
+const uint MAX_LINES=200;
+const uint TOTAL_LINE_NUM=MAX_LINES;
+const uint ERROR_LINE_NUM=MAX_LINES+1;
+const uint LOG_LINE_NUM=MAX_LINES+2;
+const uint DEBUG_LINE_NUM=MAX_LINES+3;
+//const uint LOG_LINES_MAX_NUM=200;
+
+extern string screenlines[DEBUG_LINE_NUM+1];
+extern uint max_published_screenline_num;
+
+extern vector<string> log_lines;
+extern uint log_lines_counter;
+
+void msg_total(string msg_text);
+void msg(uint y, uint x, string msg_text);
+void msg_connecting(uint connection_num, uint distfile_num, uint segment_num, string msg_text);
+void msg_segment_progress(uint connection_num, string progress_text);
+void msg_status1(uint connection_num, uint segment_num, string msg_text);
+void msg_status2(uint connection_num, string msg_text);
+void msg_clean_connection(uint connection_num);
+void msg_log(string log_text);
+void msg_error_log(string error_log_text);
+void msg_total(string msg_text);
+#endif \ No newline at end of file
diff --git a/seggetd/ui_server.cpp b/seggetd/ui_server.cpp
new file mode 100644
index 0000000..c92f079
--- /dev/null
+++ b/seggetd/ui_server.cpp
@@ -0,0 +1,747 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "ui_server.h"
+
+Tui_server ui_server;
+
+enum TDFsearch_rusults{
+ NOT_FOUND,
+ DOWNLOADED,
+ IN_QUEUE
+};
+
+void Tui_server::init(){
+ socklen_t server_len;
+ struct sockaddr_in server_address;
+ // Create and name a socket for the server:
+ server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ // Set socket options. We would like the socket to disappear
+ // as soon as it has been closed for whatever reason.
+ // Set socket options.
+ // Allow local port reuse in TIME_WAIT.
+
+ int on=1;
+ setsockopt(server_sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ max_fd_num=server_sockfd;
+
+ server_address.sin_family = AF_INET;
+ //server_address.sin_addr.s_addr = htonl(INADDR_ANY);
+ string bind_address=settings.ui_ip;
+ server_address.sin_addr.s_addr = inet_addr(bind_address.c_str());
+ server_address.sin_port = htons(settings.ui_port);
+ server_len = sizeof(server_address);
+ int res;
+ res=bind(server_sockfd, (struct sockaddr *)&server_address, server_len);
+ if (res != 0){
+ error_log("Error: "+toString(res)
+ +" in ui_server.cpp binding socket address "+bind_address
+ +":"+toString(ntohs(server_address.sin_port)));
+ }
+ //Create a connection queue and initialize readfds to handle input from server_sockfd:
+ listen(server_sockfd, 5);
+ FD_ZERO(&readfds);
+ FD_SET(server_sockfd, &readfds);
+ send_to_fd_busy=false;
+}
+
+//prevent simultaneous writes
+
+ulong Tui_server::send_binary_to_fd(uint fd, string image_file_name){
+// if (send_to_fd_idle) {
+ ifstream image_file;
+ try{
+ image_file.open (image_file_name.c_str(), ios::in|ios::binary|ios::ate);
+ // file.open((settings.conf_dir+"/"+config_file_name).c_str());
+ }
+ catch(...){
+ error_log("Error opening image file: ");
+ // return;
+ }
+ try{
+ //processing file
+ ifstream::pos_type size;
+ char * memblock;
+ if (image_file.is_open()){
+ size = image_file.tellg();
+ memblock = new char [size];
+ image_file.seekg (0, ios::beg);
+ image_file.read (memblock, size);
+
+ while (send_to_fd_busy){
+ sleep(1);
+ }
+ send_to_fd_busy=true;
+ if (fd !=server_sockfd){
+ if(FD_ISSET(fd,&ui_server.readfds)) {
+ ulong bytes_written=write(fd, memblock, size);
+ if (bytes_written!=size){
+ debug("Error: Not all data has been sent to ui_client during send_binary_to_fd()");
+ }
+ }
+ }
+ send_to_fd_busy=false;
+ image_file.close();
+ delete[] memblock;
+ }
+ }catch(ifstream::failure e){
+//
+ }catch(...){
+ // error_log("Settings file: "+config_file_name+" was opened, but an error occured while reading settings from it.");
+ }
+
+ return 0;
+}
+
+
+ulong Tui_server::send_to_fd(uint fd, string msg){
+// if (send_to_fd_idle) {
+ while (send_to_fd_busy){
+ sleep(1);
+ }
+ send_to_fd_busy=true;
+ if (fd !=server_sockfd){
+ if(FD_ISSET(fd,&ui_server.readfds)) {
+ ulong bytes_written=write(fd, msg.c_str(), msg.length());
+ if (bytes_written!=msg.length()){
+ debug("Error: Not all data has been sent to ui_client()");
+ }
+ }
+ }
+ send_to_fd_busy=false;
+ return 0;
+}
+
+void Tui_server::send_connection_msg_to_fd(uint fd, uint y, string msg){
+ string message="<m>c<t>"+toString(y)+"<y>"+msg+"<.>";
+ send_to_fd(fd, message);
+}
+
+void Tui_server::send_connection_msg_to_all_clients(uint y, string msg){
+ string message="<m>c<t>"+toString(y)+"<y>"+msg+"<.>";
+ for(uint fd = 0; fd <= ui_server.max_fd_num; fd++){
+ if FD_ISSET(fd, &tuiclient_fds_set){
+ send_to_fd(fd, message);
+ }
+ }
+}
+
+void Tui_server::send_log_msg_to_all_clients(string msg){
+ string message="<m>l<t>"+msg+"<.>";
+ for(uint fd = 0; fd <= ui_server.max_fd_num; fd++){
+ if FD_ISSET(fd, &tuiclient_fds_set){
+ send_to_fd(fd, message);
+ }
+ }
+}
+
+void Tui_server::send_distfile_progress_msg_to_fd(uint fd, string msg){
+ string message="<m>d<t>"+msg+"<.>";
+ send_to_fd(fd, message);
+}
+
+void Tui_server::send_distfile_progress_msg_to_all_clients(string msg){
+ string message="<m>d<t>"+msg+"<.>";
+ for(uint fd = 0; fd <= ui_server.max_fd_num; fd++){
+ if FD_ISSET(fd, &tuiclient_fds_set){
+ send_to_fd(fd, message);
+ }
+ }
+}
+
+void Tui_server::send_error_log_msg_to_all_clients(string msg){
+ string message="<m>e<t>"+msg+"<.>";
+ for(uint fd = 0; fd <= ui_server.max_fd_num; fd++){
+ if FD_ISSET(fd, &tuiclient_fds_set){
+ send_to_fd(fd, message);
+ }
+ }
+}
+
+void Tui_server::serve_tuiclient(uint fd, string msg){
+ try{
+ debug("tuiclient connected");
+ string request_str_before,request_str_after;
+ split("<d>",msg,request_str_before,request_str_after);
+ split("<.>",request_str_after,request_str_before,request_str_after);
+ vector <string> wait_distfiles_vector;
+ wait_distfiles_vector=split_to_vector(",", request_str_before);
+ TDFsearch_rusults ALL_distfiles_search_result;
+ if (wait_distfiles_vector.size()<1){
+ // if no distfile specified just wait for the ones in queue
+ ALL_distfiles_search_result=IN_QUEUE;
+ }else{
+ // Let's start from DONWLOADED, and if we find one IN_QUEUE or even NOT_FOUND we'll change it
+ ALL_distfiles_search_result=DOWNLOADED;
+ }
+ for (ulong cur_tuiwaited_distfile=0;cur_tuiwaited_distfile<wait_distfiles_vector.size();cur_tuiwaited_distfile++){
+ debug("Search distfile:"+wait_distfiles_vector[cur_tuiwaited_distfile]);
+// string distfile_by_name_lookup_request=request_str_before;
+ TDFsearch_rusults distfile_search_result=NOT_FOUND;
+ if (wait_distfiles_vector[cur_tuiwaited_distfile].length()>0){
+ for (ulong distfile_num=0; distfile_num<request_server_pkg.distfile_count; distfile_num++){
+ debug("..Name:"+request_server_pkg.Pdistfile_list[distfile_num]->name);
+ if (wait_distfiles_vector[cur_tuiwaited_distfile]==request_server_pkg.Pdistfile_list[distfile_num]->name){
+ if (request_server_pkg.Pdistfile_list[distfile_num]->get_status()==DDOWNLOADED){
+ distfile_search_result=DOWNLOADED;
+ debug("....downloaded:"+wait_distfiles_vector[cur_tuiwaited_distfile]);
+ }else{
+ debug("....in queue:"+wait_distfiles_vector[cur_tuiwaited_distfile]);
+ distfile_search_result=IN_QUEUE;
+ ALL_distfiles_search_result=IN_QUEUE;
+ }
+ break;
+ }
+ }
+ if (distfile_search_result==NOT_FOUND){
+ for (ulong distfile_num=0; distfile_num<proxy_fetcher_pkg.distfile_count; distfile_num++){
+ if (wait_distfiles_vector[cur_tuiwaited_distfile]==proxy_fetcher_pkg.Pdistfile_list[distfile_num]->name){
+ if (proxy_fetcher_pkg.Pdistfile_list[distfile_num]->get_status()==DDOWNLOADED){
+ debug("2....downloaded:"+wait_distfiles_vector[cur_tuiwaited_distfile]);
+ distfile_search_result=DOWNLOADED;
+ }else{
+ debug("2....in queue:"+wait_distfiles_vector[cur_tuiwaited_distfile]);
+ distfile_search_result=IN_QUEUE;
+ ALL_distfiles_search_result=IN_QUEUE;
+ }
+ break;
+ }
+ }
+ }
+ }else{
+ // if no name for distfile specified -> no need to find distfile
+ // just keep an eye on the ones in queue
+ distfile_search_result=IN_QUEUE;
+ }
+ if (distfile_search_result==NOT_FOUND){
+ ALL_distfiles_search_result=NOT_FOUND;
+ break;
+ }
+ }
+ switch (ALL_distfiles_search_result){
+ case NOT_FOUND:
+ send_to_fd(fd, "<m>n<t><.>"); //distfile is not in the list quit
+ error_log_no_msg("Distfile(s) not found");
+ break;
+ case DOWNLOADED:
+ send_to_fd(fd, "<m>N<t><.>"); //distfile is not in the list quit
+ error_log_no_msg("Distfile(s) downloaded");
+ break;
+ case IN_QUEUE:
+ error_log_no_msg("Distfile(s) in queue");
+ send_to_fd(fd, "<m>y<t><.>"); //distfile is in the list continue
+ // Get this info to catch up!
+ for (uint line_num=0; line_num<=max_published_screenline_num;line_num++){
+ send_connection_msg_to_fd(fd, line_num, screenlines[line_num]);
+ debug("Sending to client line:"+toString(line_num)+" "+screenlines[line_num]);
+ }
+ debug("Sending to client distfiles_num:"+toString(request_server_pkg.Pdistfile_list.size()));
+ for (ulong distfile_num=0; distfile_num<request_server_pkg.Pdistfile_list.size(); distfile_num++){
+ send_distfile_progress_msg_to_fd(fd, request_server_pkg.Pdistfile_list[distfile_num]->get_distfile_progress_str());
+ debug("Sending to client:"+request_server_pkg.Pdistfile_list[distfile_num]->get_distfile_progress_str());
+ }
+ for (ulong distfile_num=0; distfile_num<proxy_fetcher_pkg.Pdistfile_list.size(); distfile_num++){
+ send_distfile_progress_msg_to_fd(fd, proxy_fetcher_pkg.Pdistfile_list[distfile_num]->get_distfile_progress_str());
+ debug("Sending to client:"+proxy_fetcher_pkg.Pdistfile_list[distfile_num]->get_distfile_progress_str());
+ }
+ }
+ }catch(...){
+ error_log_no_msg("Error in ui_server.cpp: serve_server()");
+ }
+}
+
+string Tui_server::serve_browser_distfile_progress(Tdistfile * a_distfile){
+ try{
+ uint distfile_percent;
+ if (a_distfile->size>0){
+ distfile_percent=a_distfile->dld_bytes*100/a_distfile->size;
+ }else{
+ distfile_percent=50;
+ }
+ string result=(string)"<td align=\"center\"><table width=\"100\" border=\"0\" cellpadding=\"0\" frame=\"void\"><tr>"
+ +((distfile_percent>0)?"<td><img src=\"/img/blue_progress.jpg\" height=\"20\" width=\""+toString(distfile_percent)+"\"/></td>"
+ :"")
+ +((100-distfile_percent>0)?"<td><img src=\"/img/bw_progress.jpg\" height=\"20\" width=\""+toString(100-distfile_percent)+"\" /></td>"
+ :"")
+ +"</tr></table>"
+ +toString(distfile_percent)+"%"
+ +"</td><td>"+a_distfile->name
+ +"</td><td align=\"center\" bgcolor=\""+a_distfile->statusToColor()+"\">"+a_distfile->statusToString()
+ +"</td><td align=\"right\">"+toString(a_distfile->dld_segments_count)
+ +"</td><td align=\"right\">"+toString(a_distfile->segments_count)
+ +"</td><td align=\"right\">"+toString(a_distfile->dld_bytes)
+ +"</td><td align=\"right\">"+toString(a_distfile->size)
+ +"</td>";
+ return result;
+ }catch(...){
+ error_log("Error: ui_server.cpp: serve_browser_distfile_progress()");
+ return "";
+ }
+}
+
+string Tui_server::get_html_header(string title){
+ string header;
+ header=(string)"HTTP/1.0 200 OK\n\n"
+ +"<html><head>"
+// +"<meta http-equiv=\"refresh\" content=\"1\" >"
+ +"<title> Segget - "+title+"</title></head>"
+ +"<body>"
+ +"<table border=\"0\">\n"
+ +"<tr align=\"center\">"
+ +"<td><a href=\"connections\"><img src=\"/img/connections.jpg\" alt=\"Segments\" height=50 width=50/></a></td>"
+ +"<td><a href=\"distfiles\"><img src=\"/img/distfiles.png\" alt=\"Distfiles\" height=50 width=50/></a></td>"
+ +"<td><a href=\"stats\"><img src=\"/img/stats.jpg\" alt=\"Stats\" height=50 width=50/></a></td>"
+ +"<td><a href=\"mirrors_stats\"><img src=\"/img/mirrors.jpg\" alt=\"mirrors\" height=50 width=50/></a></td>"
+ +"<td><a href=\"log\"><img src=\"/img/log.png\" alt=\"Log\" height=50 width=50/></a></td>"
+ +"<td><a href=\"errors_log\"><img src=\"/img/errors_log.jpg\" alt=\"Errors log\" height=50 width=50/></a></td>"
+ +"<td><a href=\"rss\"><img src=\"/img/rss.jpg\" alt=\"Log\" height=50 width=50/></a></td>"
+ +"</tr>\n"
+ +"<tr align=\"center\">"
+ +"<td><a href=\"connections\">Connections</a></td>"
+ +"<td><a href=\"distfiles\">Distfiles</a></td>"
+ +"<td><a href=\"stats\">Stats</a></td>"
+ +"<td><a href=\"mirrors_stats\">Mirrors</a></td>"
+ +"<td><a href=\"log\">Log</a></td>"
+ +"<td><a href=\"errors_log\">Errors log</a></td>"
+ +"<td><a href=\"rss\">RSS</a></td>"
+ +"</tr>\n"
+ +"</table>\n"
+ +"<h1>"+title+"</h1>\n";
+ return header;
+}
+
+string Tui_server::get_html_footer(){
+ return "</body></html>";
+}
+
+string Tui_server::get_html_stats(){
+ ulong total_progress;
+ if (stats.total_size>0){
+ total_progress=(stats.total_size-stats.dld_size)*100/stats.total_size;
+ }else total_progress=0;
+ string stats_str=
+ (string)"<table border=\"1\">\n"
+ +"<tr>\n"
+ +" <td>Up time</td>\n"
+ +" <td align=\"right\">"+secsToString(time_left_since(stats.segget_start_time)/1000)+"</td>\n"
+ +"</tr>\n"
+ +"<tr>\n"
+ +" <th colspan=\"2\">Distfiles</th>\n"
+ +"</tr>\n"
+ +"<tr><td>Downloaded distfiles</td><td align=\"right\">"+toString(stats.dld_distfiles_count)+"</td></tr>\n"
+ +"<tr><td>Bytes downloaded</td><td align=\"right\">"+toString(stats.dld_size)+"</td></tr>\n"
+ +"<tr><td>Total progress</td><td align=\"right\">"+toString(total_progress)+"%</td></tr>\n"
+ +"<tr><td>Distfiles left to download</td><td align=\"right\">"+toString(stats.distfiles_count-stats.dld_distfiles_count)+"</td></tr>\n"
+ +"<tr><td>Bytes left to download</td><td align=\"right\">"+toString(stats.total_size-stats.dld_size)+"</td></tr>\n"
+ +"<tr><td>Distfiles total</td><td align=\"right\">"+toString(stats.distfiles_count)+"</td></tr>\n"
+ +"<tr><td>Bytes total</td><td align=\"right\">"+toString(stats.total_size)+"</td></tr>\n"
+ +"<tr><th colspan=\"2\">Segments</th></tr>\n"
+ +"<tr><td>Downloaded segments</td><td align=\"right\">"+toString(stats.dld_segments_count)+"</td></tr>\n"
+ +"<tr><td>Segmentss left to download</td><td align=\"right\">"+toString(stats.segments_count-stats.dld_segments_count)+"</td></tr>\n"
+ +"<tr><td>Segments total</td><td align=\"right\">"+toString(stats.segments_count)+"</td></tr>\n"
+ +"<tr><th colspan=\"2\">Connections</th></tr>\n"
+ +"<tr><td>Failed connections</td><td align=\"right\">"+toString(stats.fails_counter)+"</td></tr>\n"
+ +"<tr><td>AVG speed of active connections</td><td align=\"right\">"+speedToString(stats.avg_total_speed)+"</td></tr>\n"
+// +"<tr><td>AVG speed since segget start</td><td align=\"right\">"+speedToString(stats.dld_size*1000/time_left_since(stats.segget_start_time))+"</td></tr>"
+// +"<tr><td>AVG speed since segget start except idle times</td><td align=\"right\">"+speedToString(stats.avg_total_speed)+"</td></tr>"
+ +"</table>\n";
+ return stats_str;
+}
+
+
+string Tui_server::get_html_mirrors_stats(){
+ string stats_str=(string)"<table border=\"1\" width=\"100%\">\n"
+ +"<tr>\n<th>URL</th>\n"
+ +"<th>Active connections</th>\n"
+ +"<th>AVG speed per connection**</th>\n"
+ +"<th>Failed downloads</th>\n"
+ +"<th>Successful downloads</th>\n"
+ +"<th>Fail ratio</th>\n"
+ +"<th>Usage time**, sec</th>\n"
+ +"<th>Succesfuly downloaded bytes</th>\n"
+ +"<th>Honesty</th>\n"
+ +"</tr>\n";
+ map<string,Tmirror *>::iterator iter;
+ for( iter = mirror_list.begin(); iter != mirror_list.end(); iter++ ) {
+ ulong avg_speed;
+ if ((iter->second->dld_size!=1) and (iter->second->dld_time>0)){
+ avg_speed=(iter->second->dld_size)/iter->second->dld_time;
+ }else avg_speed=0;
+
+ ulong fail_ratio;
+ if (iter->second->failed_downloads+iter->second->successful_downloads>0){
+ fail_ratio=(iter->second->failed_downloads)*100/(iter->second->failed_downloads+iter->second->successful_downloads);
+ }else fail_ratio=0;
+ stats_str=stats_str
+ +"<tr>\n<td>\n"+iter->first+"</td>\n"
+ +"<td align=\"right\">"+toString(iter->second->active_num)+"</td>\n"
+ +"<td align=\"right\">"+speedToString(avg_speed)+"</td>\n"
+ +"<td align=\"right\">"+toString(iter->second->failed_downloads)+"</td>\n"
+ +"<td align=\"right\">"+toString(iter->second->successful_downloads)+"</td>\n"
+ +"<td align=\"right\">"+toString(fail_ratio)+"%</td>\n"
+ +"<td align=\"right\">"+toString(iter->second->dld_time)+"</td>\n"
+ +"<td align=\"right\">"+toString(iter->second->dld_size)+"</td>\n"
+ +"<td align=\"right\" width=\"15%\">"+toString(iter->second->honesty)+"</td>\n"
+ +"</tr>\n";
+ }
+ stats_str=stats_str+"</table>\n";
+
+ stats_str=stats_str+"<br><p>** NOTE: When a mirror has N simultaneous connections "
+ +"\"Usage time\" will be increasing N times faster, therefore \"AVG speed per connection\" will "
+ +"be smaller than average outgoing rate provided by this mirror to your host "
+ +"(which is a summary speed of the simultaneous connections to this mirror)</p>";
+ return stats_str;
+}
+
+
+string Tui_server::get_html_connections(){
+ try{
+ string result=(string)"<center>\n"
+ +"<h3>Active connections: "+toString(stats.active_connections_counter)+"/"+toString(settings.max_connections)+"</h3>\n"
+ +"<table border=\"1\" width=\"100%\">\n"
+ +"<tr>\n"
+ +"<th rowspan=\"2\" width=\"110\">Distfile progress</th>\n"
+ +"<th rowspan=\"2\">Distfile name</th>\n"
+ +"<th rowspan=\"2\" width=\"110\">Segment progress</th>\n"
+ +"<th rowspan=\"2\">Segment #</th>\n"
+ +"<th rowspan=\"2\">Try</th>\n"
+ +"<th colspan=\"2\">Network</th>\n"
+ +"<th colspan=\"2\">Bytes</th>\n"
+ +"<th colspan=\"2\">Speed</th>\n"
+ +"<th rowspan=\"2\" width=\"100\">ETA</th>\n"
+ +"</tr>\n"
+ +"<tr>\n"
+ +"<th>Num</th>\n"
+ +"<th>Type</th>\n"
+ +"<th>Downloaded</th>\n"
+ +"<th>Total</th>\n"
+ +"<th width=\"100\">Current</th>\n"
+ +"<th width=\"100\">Average</th>\n"
+ +"</tr>\n";
+ for (uint connection_num = 0; connection_num < settings.max_connections; ++connection_num) {
+// debug("connection_num:"+toString(connection_num));
+ if (connection_array[connection_num].active){
+ result=result+"<tr>"+connection_array[connection_num].get_html_connection_progress()+"</tr>\n";
+ }
+ }
+ result=result+"</table>\n</center>\n";
+ return result;
+ }catch(...){
+ error_log("Error: ui_server.cpp: get_connections_info()");
+ return "";
+ }
+}
+string Tui_server::get_html_distfiles(){
+ try{
+ debug("Sending to client distfiles_num:"+toString(request_server_pkg.Pdistfile_list.size()));
+ string distfiles_html=(string)"<center><table border=\"1\" width=\"100%\">\n"
+ +"<tr>"
+ +" <th rowspan=\"2\" width=\"110\">Progress"
+ +" </th><th rowspan=\"2\">Name"
+ +" </th><th rowspan=\"2\">Status"
+ +" </th><th colspan=\"2\">Segments"
+ +" </th><th colspan=\"2\">Bytes"
+ +" </th>"
+ +"</tr>\n<tr>"
+ +" <th>Downloaded"
+ +" </th><th>Total"
+ +" </th><th>Downloaded"
+ +" </th><th>Total"
+ +" </th></tr>\n";
+ for (ulong distfile_num=0; distfile_num<request_server_pkg.Pdistfile_list.size(); distfile_num++){
+ distfiles_html=distfiles_html+"<tr>"+serve_browser_distfile_progress(request_server_pkg.Pdistfile_list[distfile_num])+"</tr>\n";
+ debug("Sending to client:"+request_server_pkg.Pdistfile_list[distfile_num]->get_distfile_progress_str());
+ }
+ for (ulong distfile_num=0; distfile_num<proxy_fetcher_pkg.Pdistfile_list.size(); distfile_num++){
+ distfiles_html=distfiles_html+"<tr>"+serve_browser_distfile_progress(proxy_fetcher_pkg.Pdistfile_list[distfile_num])+"</tr>\n";
+ debug("Sending to client:"+proxy_fetcher_pkg.Pdistfile_list[distfile_num]->get_distfile_progress_str());
+ }
+ distfiles_html=distfiles_html+"</table></center>";
+ return distfiles_html;
+ }catch(...){
+ error_log("Error: ui_server.cpp: get_connections_info()");
+ return "";
+ }
+}
+
+string Tui_server::get_html_log(){
+ try{
+ string log_html=(string)"<center><table border=\"1\" width=\"100%\">";
+ for (uint log_line_num=0; log_line_num<log_lines.size(); log_line_num++){
+ log_html=log_html+"<tr><td>"+log_lines[log_line_num]+"</td></tr>";
+ }
+ log_html=log_html+"</table></center>";
+ return log_html;
+ }catch(...){
+ error_log("Error: ui_server.cpp: get_html_log()");
+ return "";
+ }
+}
+
+string Tui_server::get_html_errors_log(){
+ try{
+ debug("Sending to client distfiles_num:"+toString(request_server_pkg.Pdistfile_list.size()));
+ string error_log_html=(string)"<center><table border=\"1\" width=\"100%\">";
+ for (uint error_log_line_num=0; error_log_line_num<error_log_lines.size(); error_log_line_num++){
+ error_log_html=error_log_html+"<tr><td>"+error_log_lines[error_log_line_num]+"</td></tr>";
+ }
+ error_log_html=error_log_html+"</table></center>";
+ return error_log_html;
+ }catch(...){
+ error_log("Error: ui_server.cpp: get_html_error_log()");
+ return "";
+ }
+}
+
+string Tui_server::get_rss_info(){
+ try{
+ string rss_result=
+ (string)"<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss version=\"2.0\"> "
+ "<channel>"
+ +"<title>"+settings.rss_title+"</title>"
+ +"<description>"+settings.rss_description+"</description>"
+ +"<link>"+settings.provide_mirror_to_others_url+"</link>"
+ +"<pubDate>"+get_time(settings.general_log_time_format)+"</pubDate>"
+ +"<ttl>5</ttl>"
+ +"<image>"
+ +"<title>"+"settings.rss_title"+"</title>"
+ +"<url>/img/segget_feed.jpg</url>"
+ +"<link>http://simsim/forum/index.php</link>"
+ +"</image>";
+ for (uint rss_line_num=0; rss_line_num<rss_distfile_lines.size(); rss_line_num++){
+ rss_result=rss_result+
+ "<item>"
+ +"<title>"+rss_distfile_lines[rss_line_num]+"</title>"
+ +"<link><![CDATA["+settings.provide_mirror_to_others_url+"/"+rss_distfile_lines[rss_line_num]+"]]></link> "
+ +"<starter>"+"settings.rss_starter"+"</starter>"
+ +"<author>seggetd</author>"
+ +"<description><![CDATA[Downloaded distfile "+rss_distfile_lines[rss_line_num]
+ +" (size: "+toString(rss_size_lines[rss_line_num])+" B)]]></description>"
+ +"<pubDate>"+rss_time_lines[rss_line_num]+"</pubDate>"
+ +"<guid isPermaLink=\"false\">"+toString(rss_line_num)+"</guid>"
+ +"</item>";
+ }
+ rss_result=rss_result+"</channel></rss>";
+ return rss_result;
+ }catch(...){
+ error_log("Error: ui_server.cpp: get_rss_info()");
+ return "";
+ }
+}
+string Tui_server::get_ajax_for(string content_name){
+ string ajax_str=(string)"\n<script type=\"text/javascript\">\n"
+ +" var xmlDoc;"
+ +" function process(){\n"
+ +" if ( xmlDoc.readyState != 4 ) return;\n"
+ +" document.getElementById(\""+content_name+"\").innerHTML = xmlDoc.responseText;\n"
+ +" }\n"
+ +" function load() {"
+ +" if (window.XMLHttpRequest) {\n" // Mozilla, Safari, ...
+ +" xmlDoc = new XMLHttpRequest();\n"
+ +" xmlDoc.onload = process ;\n"
+ +" } else if (window.ActiveXObject) {\n" // IE
+ +" xmlDoc = new ActiveXObject(\"Microsoft.XMLHTTP\");\n"
+ +" xmlDoc.onreadystatechange = process ;\n"
+ +" }else{\n"
+ +" return false;\n"
+ +" }\n"
+ +" xmlDoc.abort();\n"
+ +" xmlDoc.open(\"GET\",\""+content_name+"_"+"\",true);\n"
+ +" xmlDoc.send(null);\n"
+ +" }\n"
+ +" function refresh(){\n"
+ +" if ( xmlDoc.readyState != 4 ){\n"
+ +" document.getElementById(\""+content_name+"\").innerHTML=\"<h2 color='#FF0000'>Disconnected</h2>\"\n"
+ +" };\n"
+ +" xmlDoc.abort();\n"
+ +" load();\n"
+ +" setTimeout(\"refresh()\", 1000);\n"
+ +" };\n"
+ +" load();\n"
+ +" setTimeout(\"refresh()\", 1000);\n"
+ +"</script>\n";
+ return ajax_str;
+}
+
+void Tui_server::serve_browser(uint fd, string msg){
+ try{
+ debug("Web browser connected");
+ uint pos_uri_start=msg.find("GET");
+ uint pos_uri_end=msg.find("HTTP",pos_uri_start);
+ string uri;
+ if (pos_uri_end!=msg.npos){
+ uri=msg.substr(pos_uri_start+4,pos_uri_end-pos_uri_start-5);
+ debug("Web browser requests URI:"+uri);
+ }
+ if (uri=="/connections"){
+ send_to_fd(fd,get_html_header("Connections"));
+ send_to_fd(fd,"<span id=\"connections\">\n");
+ send_to_fd(fd,get_html_connections());
+ send_to_fd(fd,"</span>\n");
+ send_to_fd(fd,get_ajax_for("connections"));
+ send_to_fd(fd,get_html_footer());
+ }else if (uri=="/connections_"){
+ send_to_fd(fd,get_html_connections());
+ }else if ((uri=="/rss") or (uri=="/rss.rss") or (uri=="/rss.xml")){
+ send_to_fd(fd,get_rss_info());
+ }else if (uri=="/stats"){
+ send_to_fd(fd,get_html_header("Stats"));
+ send_to_fd(fd,"<span id=\"stats\">\n");
+ send_to_fd(fd,get_html_stats());
+ send_to_fd(fd,"</span>\n");
+ send_to_fd(fd,get_ajax_for("stats"));
+ send_to_fd(fd,get_html_footer());
+ }else if (uri=="/stats_"){
+ ui_server.send_to_fd(fd,get_html_stats());
+ }else if (uri=="/mirrors_stats"){
+ send_to_fd(fd,get_html_header("Mirrors stats"));
+ send_to_fd(fd,"<span id=\"mirrors_stats\">\n");
+ send_to_fd(fd,get_html_mirrors_stats());
+ send_to_fd(fd,"</span>\n");
+ send_to_fd(fd,get_ajax_for("mirrors_stats"));
+ send_to_fd(fd,get_html_footer());
+ }else if (uri=="/mirrors_stats_"){
+ send_to_fd(fd,get_html_mirrors_stats());
+ }else if (uri=="/log"){
+ send_to_fd(fd,get_html_header("Log"));
+ send_to_fd(fd,"<span id=\"log\">\n");
+ send_to_fd(fd,get_html_log());
+ send_to_fd(fd,"</span>\n");
+ send_to_fd(fd,get_ajax_for("log"));
+ send_to_fd(fd,get_html_footer());
+ }else if (uri=="/log_"){
+ send_to_fd(fd,get_html_log());
+ }else if (uri=="/errors_log"){
+ send_to_fd(fd,get_html_header("Errors log"));
+ send_to_fd(fd,"<span id=\"errors_log\">\n");
+ send_to_fd(fd,get_html_errors_log());
+ send_to_fd(fd,"</span>\n");
+ send_to_fd(fd,get_ajax_for("errors_log"));
+ send_to_fd(fd,get_html_footer());
+ }else if (uri=="/errors_log_"){
+ send_to_fd(fd,get_html_errors_log());
+ }else if (uri=="/distfiles"){
+ send_to_fd(fd,get_html_header("Distfiles"));
+ send_to_fd(fd,"<span id=\"distfiles\">\n");
+ send_to_fd(fd,get_html_distfiles());
+ send_to_fd(fd,"</span>\n");
+ send_to_fd(fd,get_ajax_for("distfiles"));
+ send_to_fd(fd,get_html_footer());
+ }else if (uri=="/distfiles_"){
+ ui_server.send_to_fd(fd,get_html_distfiles());
+ }else if (uri=="/favicon.ico"){
+ ui_server.send_binary_to_fd(fd,settings.ui_web_ui_dir+"/favicon.ico");
+ }else if (uri.find("/img")!=uri.npos){
+ ui_server.send_binary_to_fd(fd,settings.ui_web_ui_dir+uri);
+ }else{
+ send_to_fd(fd,get_html_header("Connections"));
+ send_to_fd(fd,"<span id=\"connections\">\n");
+ send_to_fd(fd,get_html_connections());
+ send_to_fd(fd,"</span>\n");
+ send_to_fd(fd,get_ajax_for("connections"));
+ send_to_fd(fd,get_html_footer());
+ }
+ shutdown(fd,2);
+ close(fd);
+ }catch(...){
+ error_log_no_msg("Error in ui_server.cpp: serve_server()");
+ }
+}
+
+void *run_ui_server(void * ){
+ while(1) {
+ max_published_screenline_num=0;
+ uint fd;
+ int nread;
+ ui_server.testfds = ui_server.readfds;
+ int result;
+ //Now wait for clients and requests. Because you have passed a null pointer as the timeout parameter, no timeout will occur. The program will logg an error if select returns a value less than 1:
+ result = select(FD_SETSIZE, &ui_server.testfds, (fd_set *)0,
+ (fd_set *)0, (struct timeval *) 0);
+ if(result < 1) {
+ error_log_no_msg("Error in ui_server on select");
+ break;
+ }
+ //Once you know you’ve got activity, you can find which descriptor it’s on by checking each in turn using FD_ISSET:
+ for(fd = 0; fd <= ui_server.max_fd_num; fd++) {
+ if(FD_ISSET(fd,&ui_server.testfds)) {
+ //If the activity is on server_sockfd, it must be a request for a new connection, and you add the associated client_sockfd to the descriptor set:
+ if(fd == ui_server.server_sockfd) {
+ uint client_sockfd;
+ socklen_t client_len;
+ struct sockaddr_in client_address;
+
+ client_len = sizeof(client_address);
+ client_sockfd = accept(ui_server.server_sockfd,
+ (struct sockaddr *)&client_address, &client_len);
+
+ debug("Connected new ui client");
+
+ if (client_sockfd>ui_server.max_fd_num) ui_server.max_fd_num=client_sockfd;
+
+ FD_SET(client_sockfd, &ui_server.readfds);
+// close(client_sockfd);
+
+ //If it isn’t the server, it must be client activity. If close is received, the client has gone away, and you remove it from the descriptor set. Otherwise, you “serve” the client as in the previous examples.
+ }else{
+ debug("else");
+ ioctl(fd, FIONREAD, &nread);
+ if(nread == 0) {
+ debug("nothing to read");
+ FD_CLR(fd, &ui_server.readfds);
+ if FD_ISSET(fd, &ui_server.tuiclient_fds_set){
+ FD_CLR(fd, &ui_server.tuiclient_fds_set);
+ }
+ close(fd);
+ debug("Client parted from fd:"+toString(fd));
+ }else{
+ debug("reading buffer");
+ char buffer[1000]="";
+ if (nread!=read(fd, &buffer, nread)){
+ debug("Not all data has been read from ui_client()");
+ }
+ string buffer_as_str=buffer;
+ debug("received_from ui_client:"+buffer_as_str);
+ if FD_ISSET(fd, &ui_server.tuiclient_fds_set){
+ ui_server.serve_tuiclient(fd,buffer_as_str);
+ }else{
+ if (buffer_as_str.find("Host:")==buffer_as_str.npos){
+ // it's tuiclient else it's browser
+ FD_SET(fd, &ui_server.tuiclient_fds_set);
+ ui_server.serve_tuiclient(fd,buffer_as_str);
+ }else{ // it's browser
+ ui_server.serve_browser(fd,buffer_as_str);
+ FD_CLR(fd, &ui_server.readfds);
+ close(fd);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return 0;
+}
diff --git a/seggetd/ui_server.h b/seggetd/ui_server.h
new file mode 100644
index 0000000..0b0a092
--- /dev/null
+++ b/seggetd/ui_server.h
@@ -0,0 +1,85 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __UI_SERVER_H__
+#define __UI_SERVER_H__
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string>
+//#include "settings.h"
+//class Tpkg;
+//class Tdistfile;
+//#include "tui.h"
+#include "pkg.h"
+using namespace std;
+
+#define MAX_BIND_ATTEMPTS 5
+
+//const uint MAX_LINES=200;
+
+class Tui_server{
+ public:
+ bool send_to_fd_busy;
+ uint server_sockfd;
+ uint max_fd_num;
+ fd_set readfds, tuiclient_fds_set, testfds;
+ void init();
+ ulong send_to_fd(uint fd, string msg);
+ void send_connection_msg_to_fd(uint fd, uint y, string msg);
+ void send_connection_msg_to_all_clients(uint y, string msg);
+ void send_log_msg_to_all_clients(string msg);
+ void send_error_log_msg_to_all_clients(string msg);
+ void send_distfile_progress_msg_to_fd(uint fd, string msg);
+ void send_distfile_progress_msg_to_all_clients(string msg);
+ void serve_tuiclient(uint fd, string msg);
+ ulong send_binary_to_fd(uint fd, string image_file_name);
+ string serve_browser_distfile_progress(Tdistfile * a_distfile);
+ string get_html_header(string title);
+ string get_html_footer();
+ string get_html_connections();
+ string get_html_distfiles();
+ string get_html_stats();
+ string get_html_log();
+ string get_html_errors_log();
+ string get_html_mirrors_stats();
+ string get_ajax_for(string content_name);
+ string get_rss_info();
+ void serve_browser(uint fd, string msg);
+};
+
+extern Tui_server ui_server;
+
+void *run_ui_server(void *);
+
+#endif \ No newline at end of file
diff --git a/seggetd/utils.cpp b/seggetd/utils.cpp
new file mode 100644
index 0000000..851484f
--- /dev/null
+++ b/seggetd/utils.cpp
@@ -0,0 +1,124 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "utils.h"
+
+ulong time_left_since(timeval from_time){
+ try{
+ timeval now_time;
+ gettimeofday(&now_time,NULL);
+ ulong timeleft=(now_time.tv_sec-from_time.tv_sec)*1000+(now_time.tv_usec-from_time.tv_usec)/1000;
+ if (timeleft<1)
+ timeleft=1;
+ return timeleft;
+ }catch(...){
+ error_log("Error in utils.cpp: time_left_from()");
+ return 1;
+ }
+}
+
+string secsToString(ulong secs){
+ string result="";
+ ulong mins=0;
+ ulong hours=0;
+ ulong days=0;
+ ldiv_t time_div_spliter;
+ if (secs>60){
+ time_div_spliter = ldiv (secs,60);
+ secs=time_div_spliter.rem;
+ if (time_div_spliter.quot>60){
+ time_div_spliter = ldiv (time_div_spliter.quot,60);
+ mins=time_div_spliter.rem;
+ if (time_div_spliter.quot>24){
+ time_div_spliter = ldiv (time_div_spliter.quot,24);
+ hours=time_div_spliter.rem;
+ days=time_div_spliter.quot;
+ if (days>999) return ("inf");
+ result=result+field(" ", days,3)+"d";
+ }else{
+ hours=time_div_spliter.quot;
+ }
+ result=result+field(" ", hours,2)+"h";
+ }else{
+ mins=time_div_spliter.quot;
+ }
+ result=result+field(" ", mins,2)+"m";
+ }
+ result=result+field(" ", secs,2)+"s";
+
+ return result;
+}
+
+string speedToString(ulong dld_bytes, ulong time_left){
+ try{
+ string speed_str;
+ if (time_left==0){
+ speed_str="N/a";
+ }else{
+ ulong speed=(dld_bytes*1000/time_left);
+ string suffix;
+ if (speed>1500){
+ if (speed>1500000){
+ suffix=" MB/s";
+ speed=speed/1000000;
+ }else{
+ suffix=" KB/s";
+ speed=speed/1000;
+ }
+ }else{
+ suffix=" B/s";
+ }
+ speed_str=field("",speed,4)+suffix;
+ }
+ return speed_str;
+ }catch(...){
+ error_log("Error in utils.cpp: speedToString()");
+ }
+ return "";
+}
+
+string speedToString(ulong speed){
+ try{
+ string speed_str;
+ string suffix;
+ if (speed>1500){
+ if (speed>1500000){
+ suffix=" MB/s";
+ speed=speed/1000000;
+ }else{
+ suffix=" KB/s";
+ speed=speed/1000;
+ }
+ }else{
+ suffix=" B/s";
+ }
+ speed_str=field("",speed,4)+suffix;
+ return speed_str;
+ }catch(...){
+ error_log("Error in utils.cpp: speedToString()");
+ }
+ return "";
+} \ No newline at end of file
diff --git a/seggetd/utils.h b/seggetd/utils.h
new file mode 100644
index 0000000..ae95c29
--- /dev/null
+++ b/seggetd/utils.h
@@ -0,0 +1,41 @@
+/*
+* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>.
+*
+* Project: IDFetch.
+* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine).
+* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead).
+* Mentoring organization: Gentoo Linux.
+* Sponsored by GSOC 2010.
+*
+* This file is part of Segget.
+*
+* Segget is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* Segget 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
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with Segget; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef __UTILS_H__
+#define __UTILS_H__
+
+#include "sys/time.h"
+#include "shorttypes.h"
+#include "tui.h"
+
+using namespace std;
+
+ulong time_left_since(timeval from_time);
+string secsToString(ulong secs);
+string speedToString(ulong dld_bytes, ulong time_left);
+string speedToString(ulong speed);
+
+#endif \ No newline at end of file
diff --git a/seggetd/webui/img/blue_progress.jpg b/seggetd/webui/img/blue_progress.jpg
new file mode 100644
index 0000000..8bbefa5
--- /dev/null
+++ b/seggetd/webui/img/blue_progress.jpg
Binary files differ
diff --git a/seggetd/webui/img/bw_progress.jpg b/seggetd/webui/img/bw_progress.jpg
new file mode 100644
index 0000000..3ddcc2c
--- /dev/null
+++ b/seggetd/webui/img/bw_progress.jpg
Binary files differ
diff --git a/seggetd/webui/img/connections.jpg b/seggetd/webui/img/connections.jpg
new file mode 100644
index 0000000..9e01fef
--- /dev/null
+++ b/seggetd/webui/img/connections.jpg
Binary files differ
diff --git a/seggetd/webui/img/distfiles.png b/seggetd/webui/img/distfiles.png
new file mode 100644
index 0000000..3ab0137
--- /dev/null
+++ b/seggetd/webui/img/distfiles.png
Binary files differ
diff --git a/seggetd/webui/img/errors_log.jpg b/seggetd/webui/img/errors_log.jpg
new file mode 100644
index 0000000..f5fd776
--- /dev/null
+++ b/seggetd/webui/img/errors_log.jpg
Binary files differ
diff --git a/seggetd/webui/img/favicon.ico b/seggetd/webui/img/favicon.ico
new file mode 100644
index 0000000..5de5955
--- /dev/null
+++ b/seggetd/webui/img/favicon.ico
Binary files differ
diff --git a/seggetd/webui/img/green_progress.jpg b/seggetd/webui/img/green_progress.jpg
new file mode 100644
index 0000000..6c8a48d
--- /dev/null
+++ b/seggetd/webui/img/green_progress.jpg
Binary files differ
diff --git a/seggetd/webui/img/log.png b/seggetd/webui/img/log.png
new file mode 100644
index 0000000..dd2a17a
--- /dev/null
+++ b/seggetd/webui/img/log.png
Binary files differ
diff --git a/seggetd/webui/img/mirrors.jpg b/seggetd/webui/img/mirrors.jpg
new file mode 100644
index 0000000..e1457d1
--- /dev/null
+++ b/seggetd/webui/img/mirrors.jpg
Binary files differ
diff --git a/seggetd/webui/img/rss.jpg b/seggetd/webui/img/rss.jpg
new file mode 100644
index 0000000..9365ab8
--- /dev/null
+++ b/seggetd/webui/img/rss.jpg
Binary files differ
diff --git a/seggetd/webui/img/stats.jpg b/seggetd/webui/img/stats.jpg
new file mode 100644
index 0000000..049f1dd
--- /dev/null
+++ b/seggetd/webui/img/stats.jpg
Binary files differ