summaryrefslogtreecommitdiffstats
path: root/knetwortdeconf
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:00:43 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:00:43 -0600
commit2c4a290ae270924340991931a9e0ca793f8e9443 (patch)
tree7aa3b953d70dbdd6a5de525cdd7a5f4319ee1dd5 /knetwortdeconf
parent567923f30f7c0700cb526f26c20b5577bfe2a802 (diff)
downloadtdeadmin-2c4a290ae270924340991931a9e0ca793f8e9443.tar.gz
tdeadmin-2c4a290ae270924340991931a9e0ca793f8e9443.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'knetwortdeconf')
-rw-r--r--knetwortdeconf/AUTHORS1
-rw-r--r--knetwortdeconf/COPYING340
-rw-r--r--knetwortdeconf/ChangeLog54
-rw-r--r--knetwortdeconf/Doxyfile232
-rw-r--r--knetwortdeconf/INSTALL167
-rw-r--r--knetwortdeconf/LEAME83
-rw-r--r--knetwortdeconf/Makefile.am1
-rw-r--r--knetwortdeconf/README74
-rw-r--r--knetwortdeconf/TODO5
-rw-r--r--knetwortdeconf/backends/AUTHORS5
-rw-r--r--knetwortdeconf/backends/Makefile.am29
-rw-r--r--knetwortdeconf/backends/NEWS325
-rw-r--r--knetwortdeconf/backends/README9
-rw-r--r--knetwortdeconf/backends/README.NEW_PLATFORMS5
-rw-r--r--knetwortdeconf/backends/configure.in.in15
-rw-r--r--knetwortdeconf/backends/debug.pl.in222
-rw-r--r--knetwortdeconf/backends/file.pl.in934
-rw-r--r--knetwortdeconf/backends/general.pl.in644
-rwxr-xr-xknetwortdeconf/backends/guess_system.sh1121
-rwxr-xr-xknetwortdeconf/backends/mkinstalldirs111
-rwxr-xr-xknetwortdeconf/backends/network-conf.in641
-rw-r--r--knetwortdeconf/backends/network.pl.in6731
-rw-r--r--knetwortdeconf/backends/parse.pl.in1828
-rw-r--r--knetwortdeconf/backends/platform.pl.in732
-rw-r--r--knetwortdeconf/backends/process.pl.in54
-rw-r--r--knetwortdeconf/backends/replace.pl.in1770
-rw-r--r--knetwortdeconf/backends/report.pl.in366
-rw-r--r--knetwortdeconf/backends/service-list.pl.in337
-rw-r--r--knetwortdeconf/backends/service.pl.in2153
-rw-r--r--knetwortdeconf/backends/system-tools-backends.pc.in14
-rwxr-xr-xknetwortdeconf/backends/type1inst1387
-rw-r--r--knetwortdeconf/backends/util.pl.in463
-rw-r--r--knetwortdeconf/backends/xml.pl.in1012
-rw-r--r--knetwortdeconf/config.h.in204
-rw-r--r--knetwortdeconf/knetwortdeconf-mdk.spec159
-rw-r--r--knetwortdeconf/knetwortdeconf.lsm14
-rw-r--r--knetwortdeconf/knetwortdeconf.spec110
-rw-r--r--knetwortdeconf/knetwortdeconf/Makefile.am41
-rw-r--r--knetwortdeconf/knetwortdeconf/hi16-app-knetwortdeconf.pngbin0 -> 883 bytes
-rw-r--r--knetwortdeconf/knetwortdeconf/hi22-app-knetwortdeconf.pngbin0 -> 1058 bytes
-rw-r--r--knetwortdeconf/knetwortdeconf/hi32-app-knetwortdeconf.pngbin0 -> 2535 bytes
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddevicecontainer.cpp205
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddevicecontainer.h84
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddevicedlg.ui411
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddevicedlg.ui.h13
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui156
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui.h18
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddevicewifiext.ui96
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui166
-rw-r--r--knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui.h64
-rw-r--r--knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui303
-rw-r--r--knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui.h102
-rw-r--r--knetwortdeconf/knetwortdeconf/kaddressvalidator.cpp240
-rw-r--r--knetwortdeconf/knetwortdeconf/kaddressvalidator.h116
-rw-r--r--knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule1
-rw-r--r--knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule.desktop177
-rw-r--r--knetwortdeconf/knetwortdeconf/kdetectdistrodlg.ui73
-rw-r--r--knetwortdeconf/knetwortdeconf/kdnsinfo.cpp61
-rw-r--r--knetwortdeconf/knetwortdeconf/kdnsinfo.h55
-rw-r--r--knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui104
-rw-r--r--knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui.h16
-rw-r--r--knetwortdeconf/knetwortdeconf/kknownhostinfo.cpp42
-rw-r--r--knetwortdeconf/knetwortdeconf/kknownhostinfo.h44
-rw-r--r--knetwortdeconf/knetwortdeconf/knetworkinfo.cpp76
-rw-r--r--knetwortdeconf/knetwortdeconf/knetworkinfo.h68
-rw-r--r--knetwortdeconf/knetwortdeconf/knetworkinterface.cpp104
-rw-r--r--knetwortdeconf/knetwortdeconf/knetworkinterface.h83
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconf.cpp1186
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconf.desktop127
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconf.h212
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui1102
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui.h168
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconfiface.h34
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.cpp1239
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.h182
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.cpp118
-rw-r--r--knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.h50
-rw-r--r--knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.cpp16
-rw-r--r--knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.h139
-rw-r--r--knetwortdeconf/knetwortdeconf/kreloadnetworkdlg.ui137
-rw-r--r--knetwortdeconf/knetwortdeconf/kroutinginfo.cpp60
-rw-r--r--knetwortdeconf/knetwortdeconf/kroutinginfo.h58
-rw-r--r--knetwortdeconf/knetwortdeconf/kselectdistrodlg.ui142
-rw-r--r--knetwortdeconf/knetwortdeconf/kwirelessinterface.cpp55
-rw-r--r--knetwortdeconf/knetwortdeconf/kwirelessinterface.h48
-rw-r--r--knetwortdeconf/knetwortdeconf/main.cpp49
-rw-r--r--knetwortdeconf/knetwortdeconf/version.h6
-rw-r--r--knetwortdeconf/pasosRelease.txt14
-rw-r--r--knetwortdeconf/pixmaps/Makefile.am7
-rw-r--r--knetwortdeconf/pixmaps/ark.pngbin0 -> 802 bytes
-rw-r--r--knetwortdeconf/pixmaps/blackpanther.pngbin0 -> 944 bytes
-rw-r--r--knetwortdeconf/pixmaps/conectiva.pngbin0 -> 1161 bytes
-rw-r--r--knetwortdeconf/pixmaps/debian.pngbin0 -> 608 bytes
-rw-r--r--knetwortdeconf/pixmaps/fedora.pngbin0 -> 698 bytes
-rw-r--r--knetwortdeconf/pixmaps/freebsd.pngbin0 -> 1106 bytes
-rw-r--r--knetwortdeconf/pixmaps/gentoo.pngbin0 -> 1116 bytes
-rw-r--r--knetwortdeconf/pixmaps/hi22-action-network_connected_lan_knc.pngbin0 -> 850 bytes
-rw-r--r--knetwortdeconf/pixmaps/hi22-action-network_disconnected_lan.pngbin0 -> 746 bytes
-rw-r--r--knetwortdeconf/pixmaps/hi22-action-network_disconnected_wlan.pngbin0 -> 473 bytes
-rw-r--r--knetwortdeconf/pixmaps/hi22-action-network_traffic_wlan.pngbin0 -> 1153 bytes
-rw-r--r--knetwortdeconf/pixmaps/kubuntu.pngbin0 -> 765 bytes
-rw-r--r--knetwortdeconf/pixmaps/mandriva.pngbin0 -> 853 bytes
-rw-r--r--knetwortdeconf/pixmaps/openna.pngbin0 -> 743 bytes
-rw-r--r--knetwortdeconf/pixmaps/pld.pngbin0 -> 682 bytes
-rw-r--r--knetwortdeconf/pixmaps/redhat.pngbin0 -> 443 bytes
-rw-r--r--knetwortdeconf/pixmaps/rpath.pngbin0 -> 1170 bytes
-rw-r--r--knetwortdeconf/pixmaps/slackware.pngbin0 -> 1062 bytes
-rw-r--r--knetwortdeconf/pixmaps/suse.pngbin0 -> 793 bytes
-rw-r--r--knetwortdeconf/pixmaps/turbolinux.pngbin0 -> 749 bytes
-rw-r--r--knetwortdeconf/pixmaps/vine.pngbin0 -> 944 bytes
-rw-r--r--knetwortdeconf/pixmaps/yoper.pngbin0 -> 1159 bytes
-rwxr-xr-xknetwortdeconf/update_backends.sh42
112 files changed, 30462 insertions, 0 deletions
diff --git a/knetwortdeconf/AUTHORS b/knetwortdeconf/AUTHORS
new file mode 100644
index 0000000..1fbb263
--- /dev/null
+++ b/knetwortdeconf/AUTHORS
@@ -0,0 +1 @@
+Juan Luis Baptiste
diff --git a/knetwortdeconf/COPYING b/knetwortdeconf/COPYING
new file mode 100644
index 0000000..c13faf0
--- /dev/null
+++ b/knetwortdeconf/COPYING
@@ -0,0 +1,340 @@
+ 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 Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 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 Library General
+Public License instead of this License.
diff --git a/knetwortdeconf/ChangeLog b/knetwortdeconf/ChangeLog
new file mode 100644
index 0000000..47af0c1
--- /dev/null
+++ b/knetwortdeconf/ChangeLog
@@ -0,0 +1,54 @@
+* Mon Feb 21 2005 0.6.1:
+- Ugraded network backend to GST 1.1.4
+- Support for two new platforms: Specifix and Vine Linux, being now 15 the platforms supported.
+- Parcial wireless support: Autodetection of wireless network interfaces.
+- New dialog for managing static hosts.
+- Many User Interface enhaments.
+- Lots of bug fixes
+- Lots of code cleanups
+- Updated spanish, french, german, polish and norewian translations.
+
+* Fri Aug 06 2004 0.6:
+- Ported to run as a KControl Module.
+- Major UI redesign.
+- Added support for BlackPanther OS, Conectiva Linux, Gentoo Linux, FreeBSD and Slackware Linux. Credits for Conectiva linux support goes to Helio Chissini de Castro from Conectiva.
+- Brazillian Portuguese translation by Gustavo Pichorim Boiko from Conectiva.
+- Updated german, hungarian and spanish translations.
+_ Updated english, german and spanish documentation.
+- Fixed some minor bugs.
+- Updated GST to 0.34.
+
+* Tue Feb 10 2004 0.5:
+- Added german and hungarian translations.
+- Final release.
+
+* Tue Jan 13 2004 0.5beta2:
+- Bug fixes.
+- Updated gst to 0.30.
+- Some GUI fixes.
+- Added Euskara translation and updated spanish and french ones.
+
+* Wed Oct 22 2003 0.5beta1:
+- Integrated KNetworkConf with Gnome System Tools network backend.
+ http://www.gnome.org/projects/gst/
+- Autodetection of running platform.
+- Added support for /etc/hosts file .
+- Added a enable/disable interfaces button in the main dialog.
+- Bug fixes.
+
+* Wed Oct 1 2003 0.4.2:
+- Bug fixes.
+- Added french translation, courtesy of Forian Fernandez <florian.fernandez2@wanadoo.fr>.
+
+* Sun Apr 6 2003 0.4.1:
+- Made widgets resizeable.
+- Started work for a shell script-driven distro abstraction layer.
+- Fixed crash when running KnetworkConf in a unsupported Linux distro.
+- Made all buttons of variable length (needed for other languages).
+- Added spanish translation. Thanks to Pedro Jurado Maqueda <pjmelenas@biwemail.com>
+ for this.
+- Updated rpm packages for Mandrake 9.1.
+- Bug fixes.
+
+* Fri Feb 14 2003 0.4:
+- Initial release.
diff --git a/knetwortdeconf/Doxyfile b/knetwortdeconf/Doxyfile
new file mode 100644
index 0000000..bd68031
--- /dev/null
+++ b/knetwortdeconf/Doxyfile
@@ -0,0 +1,232 @@
+# Doxyfile 1.3.2-Gideon
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = knetwortdeconf
+PROJECT_NUMBER =
+OUTPUT_DIRECTORY =
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+SHORT_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 8
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ALIASES =
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+SHOW_USED_FILES = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = /home/juancho/cvs_proyectos/knetwortdeconf_0.4.9
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.idl \
+ *.odl \
+ *.cs \
+ *.C \
+ *.H \
+ *.tlh \
+ *.diff \
+ *.patch \
+ *.moc \
+ *.xpm
+RECURSIVE = yes
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = yes
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
+CGI_NAME = search.cgi
+CGI_URL =
+DOC_URL =
+DOC_ABSPATH =
+BIN_ABSPATH = /usr/local/bin/
+EXT_DOC_PATHS =
diff --git a/knetwortdeconf/INSTALL b/knetwortdeconf/INSTALL
new file mode 100644
index 0000000..02a4a07
--- /dev/null
+++ b/knetwortdeconf/INSTALL
@@ -0,0 +1,167 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes a while. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 4. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/knetwortdeconf/LEAME b/knetwortdeconf/LEAME
new file mode 100644
index 0000000..89cf46a
--- /dev/null
+++ b/knetwortdeconf/LEAME
@@ -0,0 +1,83 @@
+KNetworkConf 0.6.1 - Un módulo para el Centro de Control de KDE
+para configurar las propiedades de red.
+Juan Luis Baptiste M. <juan.baptiste@kdemail.net>
+Colombia 2003 - 2005
+http://www.merlinux.org/knetwortdeconf/
+
+------------------------------------------------------------
+
+
+1. Introducción
+KNetworkConf es un módulo para el Centro de Control de KDE
+(http://www.kde.org) que sirve para configurar las propiedades
+de red en una máquina GNU/Linux. Desarrollé esta aplicación debido
+a que no había encontrado alguna que sirviera para configurar las propiedades
+de red y que fuera parte de KDE, ya que considero que una aplicación como esta
+es muy importante en cualquier escritorio serio como lo es KDE.
+
+Características de KNetworkConf:
+
+* Configurar las interfaces de red instaladas (no se pueden agregar nuevas
+por ahora) en modos básico y avanzado (ej. no configurar la dirección de
+difusión y máscara de red).
+* Autodetección de interfaces de red inalámbricas.
+* Configurar la puerta de enlace y la interfáz de red por defecto.
+* Configurar el nombre de dominio y de la máquina.
+* Agregar/remover servidores de Dominio (/etc/resolv.conf).
+* Agregar/remover hosts conocidos (/etc/hosts).
+
+KNetworkConf actualmente funciona en 15 plataformas distintas:
+
+* BlackPanther OS
+* Conectiva Linux
+* Debian Linux
+* Fedora Linux
+* FreeBSD
+* Gentoo Linux
+* Mandriva Linux
+* OpenNA Linux
+* Polish Linux Distribution
+* Red Hat Linux
+* Slackware Linux
+* Specifix Linux
+* TurboLinux
+* Vine Linux
+
+Esto es posible gracias a Gnome System Tools (http://www.gnome.org/projects/gst/index.html).
+GST son un conjunto de herramientas de configuración para Gnome. Estas
+herramientas están divididas en frontends y backends.
+
+KNetworkConf usa el backend de red de Gnome System Tools (GST)
+(http://www.gnome.org/projects/gst/) para averiguar los valores de la red en
+las diferente plataformas. Los backends están hechos en perl y se comunican
+con los frontends a través de XML.
+
+NOTA: No es necesario tener instalado GNOME o GST. El backend de red viene
+incluído con KNetworkConf.
+
+2. Requerimientos
+* Una distribución compatible con Red Hat.
+* KDE 3.1.x
+* Qt 3.1.x
+* Perl
+* libxml
+* autoconf > 2.5x/automake > 1.6
+
+3. Instalación
+Para instrucciones de instalación por favor lea el archivo INSTALL,
+pero un arranque rápido puede hacer:
+
+./configure
+make
+su root
+make istall
+
+Usuarios de Mandriva deben agregarle la opcion --prefix=/usr al
+script configure para instalar los archivos en el directorio correcto
+y correr el comando update-menus después de make install.
+
+4. Contacto
+Para reportar errores, o si tiene comentarios o sugerencias acerca
+de KNetworkConf, por favor escriba a las listas de correo del proyecto:
+knetwortdeconf-devel@lists.sourceforge.net o knetwortdeconf-users@lists.sourceforge.net.
+
diff --git a/knetwortdeconf/Makefile.am b/knetwortdeconf/Makefile.am
new file mode 100644
index 0000000..93aadb2
--- /dev/null
+++ b/knetwortdeconf/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = knetwortdeconf backends pixmaps \ No newline at end of file
diff --git a/knetwortdeconf/README b/knetwortdeconf/README
new file mode 100644
index 0000000..edf3377
--- /dev/null
+++ b/knetwortdeconf/README
@@ -0,0 +1,74 @@
+KNetworkConf 0.6.1 - A KDE control Center Module to confiure Network settings.
+Juan Luis Baptiste M. <juan.baptiste@kdemail.net>
+Colombia, 2003 - 2005
+http://www.merlinux.org/knetwortdeconf/
+
+------------------------------------------------------------
+
+
+1. Introduction
+KNetworkConf is a TDE Control Center module to configure the Network
+settings in a Linux machine. I developed it because I couldn't find any
+application to do this from within KDE, and I think this is a "must have"
+app for a serious Desktop Enviroment like KDE.
+
+KNetworkConf features:
+
+* Configure installed network devices (you can't add new ones for now)
+in basic and advanced mode (ie. don't auto configure broadcast and
+netmask values).
+* Autodetection of wireless interfaces.
+* Configure the default gateway and gateway device.
+* Configure host and domain names.
+* Add/remove DNS servers (/etc/resolv.conf).
+* Add/Remove known Hosts (/etc/hosts).
+
+KNetworkConf works now in 15 different platforms:
+
+* BlackPanther OS
+* Conectiva Linux
+* Debian Linux
+* Fedora Linux
+* FreeBSD
+* Gentoo Linux
+* Mandriva Linux
+* OpenNA Linux
+* Polish Linux Distribution
+* Red Hat Linux
+* Slackware Linux
+* Specifix Linux
+* TurboLinux
+* Vine Linux
+
+KNetworkConf uses the Gnome System Tools (gst)
+(http://www.gnome.org/projects/gst/) network backend to find out the network
+values in a platform-independient manner. This backends are a bunch of perl
+scripts that use XML files to communicate with different frontends.
+
+NOTE:You don't need to have GNOME nor GST installed AT ALL to run
+KNetworkConf. The network backend comes included.
+
+2. Requirements
+* KDE 3.1.x
+* Qt 3.1.x
+* Perl
+* libxml
+* autoconf > 2.5x/automake > 1.6
+
+3. Installation
+For installation instructions, please see the INSTALL file, but for
+a quick start you can do:
+
+./configure
+make
+su root
+make istall
+
+Mandriva users must add --prefix=/usr to the configure script to
+install the files in the correct path and run update-menus after make install.
+
+4. Contact
+To report bugs or if you have any comments or sugestions about KNetworkConf,
+please write to the mailing lists knetwortdeconf-devel@lists.sourceforge.net or
+knetwortdeconf-users@lists.sourceforge.net.
+
diff --git a/knetwortdeconf/TODO b/knetwortdeconf/TODO
new file mode 100644
index 0000000..8a4708c
--- /dev/null
+++ b/knetwortdeconf/TODO
@@ -0,0 +1,5 @@
+* Translation to other languajes.
+* Add/Remove network devices.
+* Autodetection of new network devices.
+* Configure routes to other hosts and networks.
+* IPv6 support.
diff --git a/knetwortdeconf/backends/AUTHORS b/knetwortdeconf/backends/AUTHORS
new file mode 100644
index 0000000..b0195bc
--- /dev/null
+++ b/knetwortdeconf/backends/AUTHORS
@@ -0,0 +1,5 @@
+Arturo Espinosa <arturo@ximian.com>
+Hans Petter Jansson <hpj@ximian.com>
+Tambet Ingo <tambet@ximian.com>
+Carlos Garnacho Parro <carlosg@gnome.org>
+
diff --git a/knetwortdeconf/backends/Makefile.am b/knetwortdeconf/backends/Makefile.am
new file mode 100644
index 0000000..7fc54ec
--- /dev/null
+++ b/knetwortdeconf/backends/Makefile.am
@@ -0,0 +1,29 @@
+backends = \
+ network-conf
+
+perl_libs = \
+ debug.pl \
+ file.pl \
+ general.pl \
+ network.pl \
+ parse.pl \
+ platform.pl \
+ process.pl \
+ replace.pl \
+ report.pl \
+ service.pl \
+ service-list.pl \
+ util.pl \
+ xml.pl
+
+scripts_SCRIPTS = $(backends) $(perl_libs)
+
+EXTRA_DIST = \
+ system-tools-backends.pc.in \
+ AUTHORS
+
+CLEANFILES = $(backends) $(perl_libs) system-tools-backends.pc
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = system-tools-backends.pc
+
diff --git a/knetwortdeconf/backends/NEWS b/knetwortdeconf/backends/NEWS
new file mode 100644
index 0000000..3ff2bd4
--- /dev/null
+++ b/knetwortdeconf/backends/NEWS
@@ -0,0 +1,325 @@
+System Tools Backends Version 1.4.2, 2006-01-02
+-----------------------------------------------
+
+The System Tools Backends version 1.4.1 "Radical cut" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Changes since last release
+==========================
+
+ Network
+ =======
+ - Added support for Ubuntu 5.10 and 6.04, Yoper 2.2, ArkLinux, FC4 and latest Mandrake/Mandriva (Juan Luis Baptiste)
+
+ Services
+ ========
+ - Added support for ArchLinux (Arjan Timmerman)
+
+ Time
+ ====
+ - Added support for ArchLinux (Arjan Timmerman)
+
+
+Downloading
+===========
+You can get it from :
+http://system-tools-backends.freedesktop.org/downloads/1.4/
+
+
+System Tools Backends Version 1.4.1, 2005-11-27
+-----------------------------------------------
+
+The System Tools Backends version 1.4.1 "Burning sky" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Changes since last release
+==========================
+
+ Network
+ =======
+ - Fixed network configuration in Gentoo (Christian Meyer, Florian Schricker, garnacho)
+ - Fixed WEP key detection in Slackware (garnacho)
+
+ Common
+ ======
+ - Added support for Slackware 10.2.0 (Scott J. Harmon)
+ - Changed Specifix Linux to rPath Linux (Ken VanDine)
+
+Downloading
+===========
+You can get it from :
+http://system-tools-backends.freedesktop.org/downloads/1.4/
+
+
+System Tools Backends Version 1.4.0, 2005-08-23
+-----------------------------------------------
+
+The System Tools Backends version 1.4.0 "Already there" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Downloading
+===========
+You can get it from :
+http://system-tools-backends.freedesktop.org/downloads/1.4/
+
+
+System Tools Backends Version 1.3.92, 2005-08-23
+-----------------------------------------------
+
+The System Tools Backends version 1.3.92 "Almost there" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Changes since last release
+==========================
+
+ Network
+ =======
+ - enable gateway saving under Slackware and Zenwalk (Jean-Philippe Guillemin)
+
+Downloading
+===========
+You can get it from :
+http://system-tools-backends.freedesktop.org/downloads/1.3/
+
+System Tools Backends Version 1.3.2, 2005-08-08
+-----------------------------------------------
+
+The System Tools Backends version 1.3.2 "It's not a rehearsal" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Changes since last release
+==========================
+
+ Services
+ ========
+ - Added more roles for known services (garnacho)
+
+ Users
+ =====
+ - Strings improvements in groups descriptions (Corey Burger, Guillaume Desmottes)
+
+Downloading
+===========
+You can get it from :
+http://system-tools-backends.freedesktop.org/downloads/1.3/
+
+System Tools Backends Version 1.3.1, 2005-07-05
+-----------------------------------------------
+
+The System Tools Backends version 1.3.1 "Make me laugh" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Changes since last release
+==========================
+
+ Network
+ =======
+ - do not detect irlan[0-9] interfaces as an[0-9] (garnacho)
+ - other misc fixes (garnacho)
+
+Downloading
+===========
+You can get it from :
+http://system-tools-backends.freedesktop.org/downloads/1.3/
+
+System Tools Backends Version 1.3.0, 2005-07-05
+-----------------------------------------------
+
+The System Tools Backends version 1.3.0 "Learning to hate autotools" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Changes since last release
+==========================
+
+ General
+ =======
+ - Added support for Slackware 10.1.0 (Scott J. Harmon)
+ - Added support for VidaLinux 1.2 (Christian Meyer)
+
+ Network
+ =======
+ - wireless handling improvements in Debian (me)
+ - recognize tun ifaces as dialup ones (me)
+ - fixed handling of dhclient v3 (me)
+ - fixed FreeBSD network support (Joe Marcus Clarke)
+ - fixed handling of dhcpcd (Christian Meyer)
+ - Added support for WEP key type (me)
+ - Added support for KUbuntu (Juan Luis Baptiste)
+
+ Time
+ ====
+ - update /etc/timezone in Debian systems
+
+ Services
+ ========
+ - Separate priorities for init types which support them (me)
+ - Add roles to services and runlevels (me)
+
+ Translations
+ ============
+ - el (Nikos Charonitakis)
+ - en_CA (Adam Weinberger)
+ - hu (Szabolcs Varga)
+ - id (Ahmad Riza H Nst)
+ - ne (Jyotsna, Pawan chitrakr)
+ - rw (Steve Murphy)
+ - xh (Adi Attar)
+ - zh_TW (GNOME HK Team)
+
+Downloading
+===========
+You can get it from :
+http://system-tools-backends.freedesktop.org/downloads/1.3/
+
+System Tools Backends Version 1.2.0, 2005-03-07
+-----------------------------------------------
+
+The System Tools Backends version 1.2.0 "Eleee mi niñooo!!" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+Changes since last release
+==========================
+
+ Network
+ =======
+ - Don't activate any interface after having changed if it was disabled (Garnacho)
+
+ Translations
+ ============
+ - hi (Rajesh Ranjan)
+ - hu (Szabolcs Varga)
+ - ja (Takeshi AIHANA)
+ - ro (MiÅŸu Moldovan)
+ - sr, sr@Latn (Danilo Å egan)
+ - vi (Abel Cheung)
+ - zh_TW (GNOME HK Team)
+
+Downloading
+===========
+You can get it from :
+ftp://ftp.gnome.org/pub/GNOME/sources/system-tools-backends/1.2/
+
+System Tools Backends Version 1.1.92, 2005-03-01
+------------------------------------------------
+
+The GNOME System Tools version 1.1.92 "Tararí que te ví" have been released.
+
+The System Tools Backends are a set of cross-platform scripts for Linux and other Unix systems. The backends provide an standard XML interface for modifying the configuration regarless of the distribution that's being used.
+
+Right now the System Tools Backends fully support various distros/OS such as: Redhat, Mandriva, SuSE, Fedora, Debian (and derivations like Ubuntu, Linex, Guadalinex...), Gentoo, Slackware, FreeBSD, OpenNA, PLD, Vine and Specifix.
+
+
+Changes since last release
+==========================
+
+ General
+ =======
+ - Added support for Fedora Core 3 (Garnacho)
+ - i18n fixes (Garnacho)
+
+ Network
+ =======
+ - Added directive for changing default gateway on the fly (Garnacho)
+ - Add support for dhcpcd (Garnacho)
+ - Fixed PPP calling (Michael Vogt, Garnacho)
+
+ Shares
+ ======
+ - Avoid print$ shares (Garnacho)
+
+ Translations
+ ============
+ - bg (Alexander Shopov)
+ - ca (Josep Puigdemont i Casamajó)
+ - el (Kostas Papadimas)
+ - fi (Ilkka Tuohela)
+ - fr (Christophe Merlet)
+ - gu (Ankit Patel)
+ - it (Francesco Marletta)
+ - ko (Young-Ho Cha)
+ - lt (Žygimantas BeruÄka)
+ - nb (Kjartan Maraas)
+ - nl (Tino Meinen)
+ - pl (GNOME PL Team)
+ - pt (Duarte Loreto)
+ - pt_BR (Raphael Higino)
+ - th (Theppitak Karoonboonyanan)
+ - uk (Maxim Dziumanenko)
+
+Downloading
+===========
+You can get it from :
+ftp://ftp.gnome.org/pub/GNOME/sources/system-tools-backends/1.1/
+
+
+System Tools Backends Version 1.1.91, 2005-02-08
+------------------------------------------------
+
+The GNOME System Tools version 1.1.91 "Ad infinitum" have been released.
+
+The GNOME System Tools are a set of cross-platform configuration utilities for Linux and other Unix systems. The frontends knows nothing about the underlying system and provide the same user interface across the different types of systems. Internally they use the system-tools-backends package.
+
+Changes since last release
+==========================
+
+ General
+ =======
+ - Separate it from the GNOME System Tools frontends (Jeff Waugh, garnacho)
+
+ Network
+ =======
+ - Fixed hosts file parsing when there's more than one line per IP address (garnacho)
+ - Only add an empty PPP interface if it wasn't added before (garnacho)
+ - Use dhclient more reliably (garnacho)
+
+ Time
+ ====
+ - Update the correct server status in Debian (garnacho)
+
+ Users
+ =====
+ - Detect whether to use md5 or not (garnacho)
+ - Made a group description more user friendly (Ole Laursen)
+
+ Translations
+ ============
+ - cs (Miloslav Trmac)
+ - da (Ole Laursen)
+ - de (Frank Arnold)
+ - en_CA (Adam Weinberger)
+ - en_GB (David Lodge)
+ - es (Francisco Javier F. Serrador)
+ - lt (Ã…Å“ygimantas BeruÄÂka)
+ - pt (Duarte Loreto)
+ - pt_BR (Raphael Higino)
+ - sq (Elian Myftiu)
+ - sv (Christian Rose)
+
+Downloading
+===========
+You can get it from :
+ftp://ftp.gnome.org/pub/GNOME/sources/system-tools-backends/1.1/
diff --git a/knetwortdeconf/backends/README b/knetwortdeconf/backends/README
new file mode 100644
index 0000000..0618fe1
--- /dev/null
+++ b/knetwortdeconf/backends/README
@@ -0,0 +1,9 @@
+to extract the configuracion
+============================
+
+backend --get
+
+to restore the configuration from XML
+=====================================
+
+backend --set < file.xml
diff --git a/knetwortdeconf/backends/README.NEW_PLATFORMS b/knetwortdeconf/backends/README.NEW_PLATFORMS
new file mode 100644
index 0000000..dc2d857
--- /dev/null
+++ b/knetwortdeconf/backends/README.NEW_PLATFORMS
@@ -0,0 +1,5 @@
+If you patch the backends, PLEASE also make a patch with your changes and send it to the author at juan.baptiste@kdemail.net so your changes can be merged with the system-tools-backend project at freedesktop.org .
+
+Thanks.
+Juan Luis Baptiste
+
diff --git a/knetwortdeconf/backends/configure.in.in b/knetwortdeconf/backends/configure.in.in
new file mode 100644
index 0000000..1d867c1
--- /dev/null
+++ b/knetwortdeconf/backends/configure.in.in
@@ -0,0 +1,15 @@
+dnl ==============================================================
+dnl Set SCRIPTS_DIR, FILES_DIR & LOCALE_DIR
+dnl ==============================================================
+KDE_EXPAND_MAKEVAR(KDE_DATADIR, kde_datadir)
+scriptsdir="$KDE_DATADIR/knetwortdeconf/backends"
+
+AC_SUBST(scriptsdir)
+
+dnl ==============================================================
+dnl END: Set SCRIPTS_DIR, FILES_DIR & LOCALE_DIR
+dnl ==============================================================
+
+dnl Keep the comment on the line below, it works that way.
+dnl AC_OUTPUT(knetwortdeconf/backends/system-tools-backends.pc knetwortdeconf/backends/network-conf knetwortdeconf/backends/debug.pl knetwortdeconf/backends/file.pl knetwortdeconf/backends/general.pl knetwortdeconf/backends/network.pl knetwortdeconf/backends/parse.pl knetwortdeconf/backends/platform.pl knetwortdeconf/backends/process.pl knetwortdeconf/backends/replace.pl knetwortdeconf/backends/report.pl knetwortdeconf/backends/service-list.pl knetwortdeconf/backends/service.pl knetwortdeconf/backends/util.pl knetwortdeconf/backends/xml.pl)
+echo "Backend configured."
diff --git a/knetwortdeconf/backends/debug.pl.in b/knetwortdeconf/backends/debug.pl.in
new file mode 100644
index 0000000..0512308
--- /dev/null
+++ b/knetwortdeconf/backends/debug.pl.in
@@ -0,0 +1,222 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Functions for hacker debug.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+use File::Path;
+use File::Copy;
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/general.pl$DOTIN";
+require "$SCRIPTSDIR/file.pl$DOTIN";
+
+
+%gst_debug_fd_hash = ();
+
+
+sub gst_debug_open_output_file
+{
+ local *FILE;
+ my $debug_path = &gst_file_get_debug_path () . "/$gst_name/1/$_[0]";
+
+ if (!exists $gst_debug_fd_hash{$debug_path})
+ {
+ &gst_debug_rotate_try ();
+ open (FILE, ">>$debug_path");
+ $gst_debug_fd_hash{$debug_path} = *FILE;
+ }
+
+ return $gst_debug_fd_hash{$debug_path};
+}
+
+sub gst_debug_close_all
+{
+ my ($file, @files);
+
+ @files = keys %gst_debug_fd_hash;
+ foreach $file (@files)
+ {
+ &gst_file_close ($gst_debug_fd_hash{$file});
+ delete $gst_debug_fd_hash{$file};
+ }
+}
+
+sub gst_debug_print_string_to_file
+{
+ my $debug_file;
+
+ $debug_file = &gst_debug_open_output_file ($_[0]);
+ print $debug_file $_[1];
+}
+
+sub gst_debug_print_log_to_file
+{
+ my ($file, $doc) = @_;
+ my (@buff, $line, $fd);
+
+ $fd = &gst_debug_open_output_file ($file);
+
+ @buff = split ("\n", $doc);
+ foreach $line (@buff)
+ {
+ print $fd "$line\n";
+ }
+}
+
+
+sub gst_debug_print_string
+{
+ if ($gst_debug) { print STDERR $_[0]; }
+ &gst_debug_print_string_to_file ("debug", $_[0]);
+}
+
+
+sub gst_debug_print_line
+{
+ &gst_debug_print_string ($_[0] . "\n");
+}
+
+
+sub gst_debug_print_indent
+{
+ my $indent = $_[0];
+ my $indent_string = "";
+
+ $indent_string = " " x $indent;
+ &gst_debug_print_string ($indent_string);
+}
+
+
+sub gst_debug_print_indented_string
+{
+ my ($indent, @string) = @_;
+
+ &gst_debug_print_indent ($indent);
+ &gst_debug_print_string (@string);
+}
+
+
+sub gst_debug_print_indented_line
+{
+ my $indent = shift @_;
+ my @line = @_;
+
+ &gst_debug_print_indent ($indent);
+ &gst_debug_print_line (@line);
+}
+
+
+sub gst_debug_print_struct
+{
+ foreach $i (@_)
+ {
+ &gst_debug_print_struct_r (0, 0, $i);
+ }
+}
+
+
+sub gst_debug_print_struct_r
+{
+ my ($indent) = $_[0];
+ my $is_hash_value = $_[1];
+ my $a = $_[2];
+ my $type;
+ my @keys;
+ my $elem;
+ my $i;
+
+ $type = ref $a;
+
+ if (!$is_hash_value) { &gst_debug_print_indent ($indent); }
+
+ if ($type eq "SCALAR")
+ {
+ &gst_debug_print_line ($$a);
+ }
+ elsif ($type eq "ARRAY")
+ {
+ &gst_debug_print_line ("[ARRAY]");
+
+ for ($i = 0; $i <= $#$a; $i++)
+ {
+ &gst_debug_print_struct_r ($indent + 1, 0, $$a[$i]);
+ }
+ }
+ elsif ($type eq "HASH")
+ {
+ @keys = sort keys (%$a);
+
+ &gst_debug_print_line ("[HASH]");
+
+ foreach $i (@keys)
+ {
+ &gst_debug_print_indented_string ($indent + !$is_hash_value, $i . " -> ");
+ &gst_debug_print_struct_r ($indent + !$is_hash_value + 1, 1, $$a{$i});
+ }
+ }
+ else
+ {
+ &gst_debug_print_line ($a);
+ }
+}
+
+
+$gst_debug_dir_rotation_was_made = 0;
+
+sub gst_debug_rotate_try
+{
+
+ my $debug_file = $_[0];
+ my $debug_tool_dir = &gst_file_get_debug_path () . "/$gst_name";
+
+ # If this is the first debug created by this tool on this invocation,
+ # rotate the debug directories and create a new, empty one.
+
+ if (!$gst_debug_dir_rotation_was_made)
+ {
+ my $i;
+
+ $gst_debug_dir_rotation_was_made = 1;
+
+ if (-e "$debug_tool_dir/9")
+ {
+ &gst_file_rmtree ("$debug_tool_dir/9", 0, 1);
+ }
+
+ for ($i = 8; $i; $i--)
+ {
+ if (-e "$debug_tool_dir/$i")
+ {
+ move ("$debug_tool_dir/$i", "$debug_tool_dir/" . ($i + 1));
+ }
+ }
+
+ &gst_file_create_path ("$debug_tool_dir/1");
+ }
+}
+
+1;
diff --git a/knetwortdeconf/backends/file.pl.in b/knetwortdeconf/backends/file.pl.in
new file mode 100644
index 0000000..ac73301
--- /dev/null
+++ b/knetwortdeconf/backends/file.pl.in
@@ -0,0 +1,934 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Functions for file manipulation. Find, open, read, write, backup, etc.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+# Arturo Espinosa <arturo@ximian.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+use File::Path;
+use File::Copy;
+use File::Temp;
+use Carp;
+
+$SCRIPTSDIR = "@scriptsdir@";
+$FILESDIR = "@filesdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $FILESDIR = "files";
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/general.pl$DOTIN";
+require "$SCRIPTSDIR/report.pl$DOTIN";
+
+
+$GST_FILE_READ = 1;
+$GST_FILE_WRITE = 2;
+
+
+# --- File operations --- #
+
+
+sub gst_file_get_base_path
+{
+ my $path = "/var/cache/setup-tool-backends";
+ chmod (0755, $path);
+ return $path;
+}
+
+
+sub gst_file_get_tmp_path
+{
+ return (&gst_file_get_base_path () . "/tmp");
+}
+
+
+sub gst_file_get_backup_path
+{
+ return (&gst_file_get_base_path () . "/backup");
+}
+
+
+sub gst_file_get_debug_path
+{
+ return (&gst_file_get_base_path (). "/debug");
+}
+
+
+sub gst_file_get_data_path
+{
+ my $path = &gst_file_get_base_path (). "/data";
+ chmod (0755, $path);
+ return $path;
+}
+
+
+# Give a command, and it will put in C locale, some sane PATH values and find
+# the program to run in the path. Redirects stderr to null.
+sub get_cmd_path
+{
+ my ($cmd) = @_;
+ my ($tool_name, @argline, $command, $tool_path);
+
+ ($tool_name, @argline) = split("[ \t]+", $cmd);
+
+ $tool_path = &gst_file_locate_tool ($tool_name);
+ return -1 if ($tool_path eq "");
+
+
+ $command = "$tool_path @argline";
+ $command =~ s/\"/\\\"/g;
+
+ return $command;
+}
+
+sub gst_file_get_cmd_path
+{
+ my ($cmd) = @_;
+
+ my $command = &get_cmd_path ($cmd);
+ return ("LC_ALL=C PATH=\$PATH:/sbin:/usr/sbin $command 2> /dev/null");
+}
+
+# necessary for some programs that output info through stderr
+sub gst_file_get_cmd_path_with_stderr
+{
+ my ($cmd) = @_;
+
+ my $command = &get_cmd_path ($cmd);
+ return ("LC_ALL=C PATH=\$PATH:/sbin:/usr/sbin $command 2>&1");
+}
+
+
+sub gst_file_create_path
+{
+ my ($path, $perms) = @_;
+ $prems = $perms || 0770;
+ my @pelem;
+
+ $path =~ tr/\///s;
+ @pelem = split(/\//, $path); # 'a/b/c/d/' -> 'a', 'b', 'c', 'd', ''
+
+ for ($path = ""; @pelem; shift @pelem)
+ {
+ $path = "$path$pelem[0]";
+ mkdir($path, $perms);
+ $path = "$path/";
+ }
+
+ &gst_report_enter ();
+ &gst_report ("file_create_path", $_[0]);
+ &gst_report_leave ();
+}
+
+
+sub gst_file_create_path_for_file
+{
+ my ($path, $perms) = @_;
+ $prems = $perms || 0770;
+ my @pelem;
+
+ $path =~ tr/\///s;
+ @pelem = split(/\//, $path); # 'a/b/c/d/' -> 'a', 'b', 'c', 'd', ''
+
+ for ($path = ""; @pelem; shift @pelem)
+ {
+ if ($pelem[1] ne "")
+ {
+ $path = "$path$pelem[0]";
+ mkdir($path, $perms);
+ $path = "$path/";
+ }
+ }
+
+ &gst_report_enter ();
+ &gst_report ("file_create_path", $_[0]);
+ &gst_report_leave ();
+}
+
+
+$gst_file_backup_dir_rotation_was_made = 0;
+
+# If this is the first backup created by this tool on this invocation,
+# rotate the backup directories and create a new, empty one.
+sub gst_file_backup_rotate_dirs
+{
+ my $backup_tool_dir = $_[0];
+
+ &gst_report_enter ();
+
+ if (!$gst_file_backup_dir_rotation_was_made)
+ {
+ my $i;
+
+ $gst_file_backup_dir_rotation_was_made = 1;
+ if (-e "$backup_tool_dir/9")
+ {
+ if (-s "$backup_tool_dir/9")
+ {
+ unlink ("$backup_tool_dir/9");
+ }
+ else
+ {
+ &gst_file_rmtree ("$backup_tool_dir/9");
+ }
+ }
+
+ for ($i = 8; $i; $i--)
+ {
+ if (stat ("$backup_tool_dir/$i"))
+ {
+ move ("$backup_tool_dir/$i", "$backup_tool_dir/" . ($i+1));
+ }
+ }
+
+ if (!stat ("$backup_tool_dir/First"))
+ {
+ &gst_file_create_path ("$backup_tool_dir/First");
+ &gst_file_run ("ln -s First $backup_tool_dir/1");
+ }
+ else
+ {
+ &gst_file_create_path_for_file ("$backup_tool_dir/1/");
+ }
+
+ &gst_report ("file_backup_rotate", $backup_tool_dir);
+ }
+
+ &gst_report_enter ();
+}
+
+sub gst_file_backup
+{
+ my $backup_file = $_[0];
+ my $backup_tool_dir;
+
+ &gst_report_enter ();
+
+ $backup_tool_dir = &gst_file_get_backup_path () . "/$gst_name/";
+
+ &gst_file_backup_rotate_dirs ($backup_tool_dir);
+
+ # If the file hasn't already been backed up on this invocation, copy the
+ # file to the backup directory.
+
+ if (!stat ("$backup_tool_dir/1/$backup_file"))
+ {
+ &gst_file_create_path_for_file ("$backup_tool_dir/1/$backup_file");
+ copy ($backup_file, "$backup_tool_dir/1/$backup_file");
+ &gst_report ("file_backup_success", $backup_tool_dir);
+ }
+
+ &gst_report_leave ();
+}
+
+# Return 1/0 depending on file existance.
+sub gst_file_exists
+{
+ my ($file) = @_;
+
+ return (-f "$gst_prefix/$file")? 1: 0;
+}
+
+sub gst_file_open_read_from_names
+{
+ local *FILE;
+ my $fname = "";
+
+ &gst_report_enter ();
+
+ foreach $name (@_)
+ {
+ if (open (FILE, "$gst_prefix/$name"))
+ {
+ $fname = $name;
+ last;
+ }
+ }
+
+ (my $fullname = "$gst_prefix/$fname") =~ tr/\//\//s; # '//' -> '/'
+
+ if ($fname eq "")
+ {
+ &gst_report ("file_open_read_failed", "@_");
+ return undef;
+ }
+
+ &gst_report ("file_open_read_success", $fullname);
+ &gst_report_leave ();
+
+ return *FILE;
+}
+
+
+sub gst_file_open_write_from_names
+{
+ local *FILE;
+ my $name;
+ my $fullname;
+
+ &gst_report_enter ();
+
+ # Find out where it lives.
+
+ foreach $elem (@_) { if (stat($elem) ne "") { $name = $elem; last; } }
+
+ if ($name eq "")
+ {
+ $name = $_[0];
+ (my $fullname = "$gst_prefix/$name") =~ tr/\//\//s;
+ &gst_report ("file_open_write_create", "@_", $fullname);
+ }
+ else
+ {
+ (my $fullname = "$gst_prefix/$name") =~ tr/\//\//s;
+ &gst_report ("file_open_write_success", $fullname);
+ }
+
+ ($name = "$gst_prefix/$name") =~ tr/\//\//s; # '//' -> '/'
+ &gst_file_create_path_for_file ($name);
+
+ # Make a backup if the file already exists - if the user specified a prefix,
+ # it might not.
+
+ if (stat ($name))
+ {
+ &gst_file_backup ($name);
+ }
+
+ &gst_report_leave ();
+
+ # Truncate and return filehandle.
+
+ if (!open (FILE, ">$name"))
+ {
+ &gst_report ("file_open_write_failed", $name);
+ return undef;
+ }
+
+ return *FILE;
+}
+
+sub gst_file_open_filter_write_from_names
+{
+ local *INFILE;
+ local *OUTFILE;
+ my ($filename, $name, $elem);
+
+ &gst_report_enter ();
+
+ # Find out where it lives.
+
+ foreach $coin (@_)
+ {
+ if (-e $coin) { $name = $coin; last; }
+ }
+
+ if (! -e $name)
+ {
+ # If we couldn't locate the file, and have no prefix, give up.
+
+ # If we have a prefix, but couldn't locate the file relative to '/',
+ # take the first name in the array and let that be created in $prefix.
+
+ if ($prefix eq "")
+ {
+ &gst_report ("file_open_filter_failed", "@_");
+ return(0, 0);
+ }
+ else
+ {
+ $name = $_[0];
+ (my $fullname = "$gst_prefix/$name") =~ tr/\//\//s;
+ &gst_report ("file_open_filter_create", "@_", $fullname);
+ }
+ }
+ else
+ {
+ (my $fullname = "$gst_prefix/$name") =~ tr/\//\//s;
+ &gst_report ("file_open_filter_success", $name, $fullname);
+ }
+
+ ($filename) = $name =~ /.*\/(.+)$/;
+ ($name = "$gst_prefix/$name") =~ tr/\//\//s; # '//' -> '/'
+ &gst_file_create_path_for_file ($name);
+
+ # Make a backup if the file already exists - if the user specified a prefix,
+ # it might not.
+
+ if (-e $name)
+ {
+ &gst_file_backup ($name);
+ }
+
+ # Return filehandles. Make a copy to use as filter input. It might be
+ # invalid (no source file), in which case the caller should just write to
+ # OUTFILE without bothering with INFILE filtering.
+
+ my $tmp_path = &gst_file_get_tmp_path ();
+
+ &gst_file_create_path ("$tmp_path");
+ unlink ("$tmp_path/$gst_name-$filename");
+ copy ($name, "$tmp_path/$gst_name-$filename");
+
+ open (INFILE, "$tmp_path/$gst_name-$filename");
+
+ if (!open (OUTFILE, ">$name"))
+ {
+ &gst_report ("file_open_filter_failed", $name);
+ return;
+ }
+
+ &gst_report_leave ();
+
+ return (*INFILE, *OUTFILE);
+}
+
+
+sub gst_file_open_write_compressed
+{
+ local *FILE;
+ my ($name, $fullname, $gzip);
+
+ $gzip = &gst_file_locate_tool ("gzip");
+ return undef if (!$gzip);
+
+ &gst_report_enter ();
+
+ # Find out where it lives.
+
+ foreach $elem (@_) { if (stat($elem) ne "") { $name = $elem; last; } }
+
+ if ($name eq "")
+ {
+ $name = $_[0];
+ (my $fullname = "$gst_prefix/$name") =~ tr/\//\//s;
+ &gst_report ("file_open_write_create", "@_", $fullname);
+ }
+ else
+ {
+ (my $fullname = "$gst_prefix/$name") =~ tr/\//\//s;
+ &gst_report ("file_open_write_success", $fullname);
+ }
+
+ ($name = "$gst_prefix/$name") =~ tr/\//\//s; # '//' -> '/'
+ &gst_file_create_path_for_file ($name);
+
+ # Make a backup if the file already exists - if the user specified a prefix,
+ # it might not.
+
+ if (stat ($name))
+ {
+ &gst_file_backup ($name);
+ }
+
+ &gst_report_leave ();
+
+ # Truncate and return filehandle.
+
+ if (!open (FILE, "| $gzip -c > $name"))
+ {
+ &gst_report ("file_open_write_failed", $name);
+ return;
+ }
+
+ return *FILE;
+}
+
+
+sub gst_file_run_pipe
+{
+ my ($cmd, $mode_mask, $stderr) = @_;
+ my ($command);
+ local *PIPE;
+
+ $mode_mask = $GST_FILE_READ if $mode_mask eq undef;
+
+ &gst_report_enter ();
+
+ if ($stderr)
+ {
+ $command = &gst_file_get_cmd_path_with_stderr ($cmd);
+ }
+ else
+ {
+ $command = &gst_file_get_cmd_path ($cmd);
+ }
+
+ if ($command == -1)
+ {
+ &gst_report ("file_run_pipe_failed", $command);
+ &gst_report_leave ();
+ return undef;
+ }
+
+ $command .= " |" if $mode_mask & $GST_FILE_READ;
+ $command = "| $command > /dev/null" if $mode_mask & $GST_FILE_WRITE;
+
+ open PIPE, $command;
+ &gst_report ("file_run_pipe_success", $command);
+ &gst_report_leave ();
+ return *PIPE;
+}
+
+
+sub gst_file_run_pipe_read
+{
+ my ($cmd) = @_;
+
+ return &gst_file_run_pipe ($cmd, $GST_FILE_READ);
+}
+
+sub gst_file_run_pipe_read_with_stderr
+{
+ my ($cmd) = @_;
+
+ return &gst_file_run_pipe ($cmd, $GST_FILE_READ, 1);
+}
+
+sub gst_file_run_pipe_write
+{
+ my ($cmd) = @_;
+
+ return &gst_file_run_pipe ($cmd, $GST_FILE_WRITE);
+}
+
+
+sub gst_file_run_backtick
+{
+ my ($cmd, $stderr) = @_;
+ my ($fd, $res);
+
+ if ($stderr)
+ {
+ $fd = &gst_file_run_pipe_read_with_stderr ($cmd);
+ }
+ else
+ {
+ $fd = &gst_file_run_pipe_read ($cmd);
+ }
+
+ $res = join ('', <$fd>);
+ &gst_file_close ($fd);
+
+ return $res;
+}
+
+
+sub gst_file_close
+{
+ my ($fd) = @_;
+
+ close $fd if (ref \$fd eq "GLOB");
+}
+
+
+sub gst_file_remove
+{
+ my ($name) = @_;
+
+ &gst_report_enter ();
+ &gst_report ("file_remove", $name);
+
+ if (stat ($name))
+ {
+ &gst_file_backup ($name);
+ }
+
+ unlink $name;
+ &gst_report_leave ();
+}
+
+sub gst_file_rmtree
+{
+ my($roots, $verbose, $safe) = @_;
+ my(@files);
+ my($count) = 0;
+ $verbose ||= 0;
+ $safe ||= 0;
+
+ if ( defined($roots) && length($roots) ) {
+ $roots = [$roots] unless ref $roots;
+ }
+ else {
+ carp "No root path(s) specified\n";
+ return 0;
+ }
+
+ my($root);
+ foreach $root (@{$roots}) {
+ $root =~ s#/\z##;
+ (undef, undef, my $rp) = lstat $root or next;
+ $rp &= 07777; # don't forget setuid, setgid, sticky bits
+
+ if ( -d $root ) { # $root used to be _, which is a bug.
+ # this is why we are replicating this function.
+
+ # notabene: 0777 is for making readable in the first place,
+ # it's also intended to change it to writable in case we have
+ # to recurse in which case we are better than rm -rf for
+ # subtrees with strange permissions
+ chmod(0777, ($Is_VMS ? VMS::Filespec::fileify($root) : $root))
+ or carp "Can't make directory $root read+writeable: $!"
+ unless $safe;
+
+ local *DIR;
+ if (opendir DIR, $root) {
+ @files = readdir DIR;
+ closedir DIR;
+ }
+ else {
+ carp "Can't read $root: $!";
+ @files = ();
+ }
+
+ # Deleting large numbers of files from VMS Files-11 filesystems
+ # is faster if done in reverse ASCIIbetical order
+ @files = reverse @files if $Is_VMS;
+ ($root = VMS::Filespec::unixify($root)) =~ s#\.dir\z## if $Is_VMS;
+ @files = map("$root/$_", grep $_!~/^\.{1,2}\z/s,@files);
+ $count += &gst_file_rmtree(\@files,$verbose,$safe);
+ if ($safe &&
+ ($Is_VMS ? !&VMS::Filespec::candelete($root) : !-w $root)) {
+ print "skipped $root\n" if $verbose;
+ next;
+ }
+ chmod 0777, $root
+ or carp "Can't make directory $root writeable: $!"
+ if $force_writeable;
+ print "rmdir $root\n" if $verbose;
+ if (rmdir $root) {
+ ++$count;
+ }
+ else {
+ carp "Can't remove directory $root: $!";
+ chmod($rp, ($Is_VMS ? VMS::Filespec::fileify($root) : $root))
+ or carp("and can't restore permissions to "
+ . sprintf("0%o",$rp) . "\n");
+ }
+ }
+ else {
+ if ($safe &&
+ ($Is_VMS ? !&VMS::Filespec::candelete($root)
+ : !(-l $root || -w $root)))
+ {
+ print "skipped $root\n" if $verbose;
+ next;
+ }
+ chmod 0666, $root
+ or carp "Can't make file $root writeable: $!"
+ if $force_writeable;
+ print "unlink $root\n" if $verbose;
+ # delete all versions under VMS
+ for (;;) {
+ unless (unlink $root) {
+ carp "Can't unlink file $root: $!";
+ if ($force_writeable) {
+ chmod $rp, $root
+ or carp("and can't restore permissions to "
+ . sprintf("0%o",$rp) . "\n");
+ }
+ last;
+ }
+ ++$count;
+ last unless $Is_VMS && lstat $root;
+ }
+ }
+ }
+
+ $count;
+}
+
+# --- Buffer operations --- #
+
+
+# Open $file and put it into @buffer, for in-line editting.
+# \@buffer on success, undef on error.
+
+sub gst_file_buffer_load
+{
+ my ($file) = @_;
+ my @buffer;
+ my $fd;
+
+ &gst_report_enter ();
+ &gst_report ("file_buffer_load", $file);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ return [] unless $fd;
+
+ @buffer = (<$fd>);
+
+ &gst_report_leave ();
+
+ return \@buffer;
+}
+
+# Same with an already open fd.
+sub gst_file_buffer_load_fd
+{
+ my ($fd) = @_;
+ my (@buffer);
+
+ &gst_report_enter ();
+ &gst_report ("file_buffer_load", $file);
+
+ @buffer = (<$fd>);
+
+ &gst_report_leave ();
+
+ return \@buffer;
+}
+
+# Take a $buffer and save it in $file. -1 is error, 0 success.
+
+sub gst_file_buffer_save
+{
+ my ($buffer, $file) = @_;
+ my ($fd, $i);
+
+ &gst_report_enter ();
+ &gst_report ("file_buffer_save", $file);
+
+ foreach $i (@$buffer)
+ {
+ &gst_debug_print_string ("|" . $i);
+ }
+
+ $fd = &gst_file_open_write_from_names ($file);
+ return -1 if !$fd;
+
+ if (@$buffer < 1)
+ {
+ # We want to write single line.
+ # Print only if $buffer is NOT a reference (it'll print ARRAY(0x412493) for example).
+ print $fd $buffer if (!ref ($buffer));
+ }
+
+ else
+ {
+ # Let's print array
+
+ foreach $i (@$buffer)
+ {
+ print $fd $i;
+ }
+ }
+
+ &gst_file_close ($fd);
+
+ &gst_report_leave ();
+
+ return 0;
+}
+
+
+# Erase all empty string elements from the $buffer.
+
+sub gst_file_buffer_clean
+{
+ my $buffer = $_[0];
+ my $i;
+
+ for ($i = 0; $i <= $#$buffer; $i++)
+ {
+ splice (@$buffer, $i, 1) if $$buffer[$i] eq "";
+ }
+}
+
+
+sub gst_file_buffer_join_lines
+{
+ my $buffer = $_[0];
+ my $i;
+
+ for ($i = 0; $i <= $#$buffer; $i++)
+ {
+ while ($$buffer[$i] =~ /\\$/)
+ {
+ chomp $$buffer[$i];
+ chop $$buffer[$i];
+ $$buffer[$i] .= $$buffer[$i + 1];
+ splice (@$buffer, $i + 1, 1);
+ }
+ }
+}
+
+
+# --- Command-line utilities --- #
+
+
+# &gst_file_run (<command line>)
+#
+# Assumes the first word on the command line is the command-line utility
+# to run, and tries to locate it, replacing it with its full path. The path
+# is cached in a hash, to avoid searching for it repeatedly. Output
+# redirection is appended, to make the utility perfectly silent. The
+# preprocessed command line is run, and its exit value is returned.
+#
+# Example: "mkswap /dev/hda3" -> 'PATH=$PATH:/sbin:/usr/sbin /sbin/mkswap /dev/hda3 2>/dev/null >/dev/null'.
+
+sub gst_file_run
+{
+ my ($cmd, $background) = @_;
+ my ($command, $tool_name, $tool_path, @argline);
+
+ &gst_report_enter ();
+
+ $command = &gst_file_get_cmd_path ($cmd);
+ return -1 if $command == -1;
+ $command .= " > /dev/null";
+ $command .= " &" if $background;
+
+ &gst_report ("file_run", $command);
+ &gst_report_leave ();
+
+ # As documented in perlfunc, divide by 256.
+ return (system ($command) / 256);
+}
+
+sub gst_file_run_bg
+{
+ my ($cmd) = @_;
+
+ return &gst_file_run ($cmd, 1);
+}
+
+# &gst_file_locate_tool
+#
+# Tries to locate a command-line utility from a set of built-in paths
+# and a set of user paths (found in the environment). The path (or a negative
+# entry) is cached in a hash, to avoid searching for it repeatedly.
+
+@gst_builtin_paths = ( "/sbin", "/usr/sbin", "/usr/local/sbin",
+ "/bin", "/usr/bin", "/usr/local/bin" );
+
+%gst_tool_paths = ();
+
+sub gst_file_locate_tool
+{
+ my ($tool) = @_;
+ my $found = "";
+ my @user_paths;
+
+ # We don't search absolute paths. Arturo.
+ if ($tool =~ /^\//)
+ {
+ if (! (-x $tool))
+ {
+ &gst_report ("file_locate_tool_failed", $tool);
+ return "";
+ }
+
+ return $tool;
+ }
+
+ &gst_report_enter ();
+
+ $found = $gst_tool_paths{$tool};
+ if ($found eq "0")
+ {
+ # Negative cache hit. At this point, the failure has already been reported
+ # once.
+ return "";
+ }
+
+ if ($found eq "")
+ {
+ # Nothing found in cache. Look for real.
+
+ # Extract user paths to try.
+
+ @user_paths = ($ENV{PATH} =~ /([^:]+):/mg);
+
+ # Try user paths.
+
+ foreach $path (@user_paths)
+ {
+ if (-x "$path/$tool" || -u "$path/$tool") { $found = "$path/$tool"; last; }
+ }
+
+ if (!$found)
+ {
+ # Try builtin paths.
+ foreach $path (@gst_builtin_paths)
+ {
+ if (-x "$path/$tool" || -u "$path/$tool") { $found = "$path/$tool"; last; }
+ }
+ }
+
+ # Report success/failure and update cache.
+
+ if ($found)
+ {
+ $gst_tool_paths{$tool} = $found;
+ &gst_report ("file_locate_tool_success", $tool);
+ }
+ else
+ {
+ $gst_tool_paths{$tool} = "0";
+ &gst_report ("file_locate_tool_failed", $tool);
+ }
+ }
+
+ &gst_report_leave ();
+
+ return ($found);
+}
+
+sub gst_file_tool_installed
+{
+ my ($tool) = @_;
+
+ $tool = &gst_file_locate_tool ($tool);
+ return 0 if $tool eq "";
+ return 1;
+}
+
+sub gst_file_copy
+{
+ my ($orig, $dest) = @_;
+
+ return if (!gst_file_exists ($orig));
+ copy ("$gst_prefix/$orig", "$gst_prefix/$dest");
+}
+
+sub gst_file_get_temp_name
+{
+ my ($prefix) = @_;
+
+ return mktemp ($prefix);
+}
+
+sub gst_file_copy_from_stock
+{
+ my ($orig, $dest) = @_;
+
+ if (!copy ("$FILESDIR/$orig", $dest))
+ {
+ &gst_report ("file_copy_failed", "$FILESDIR/$orig", $dest);
+ return -1;
+ }
+
+ return 0;
+}
+
+1;
diff --git a/knetwortdeconf/backends/general.pl.in b/knetwortdeconf/backends/general.pl.in
new file mode 100644
index 0000000..4657487
--- /dev/null
+++ b/knetwortdeconf/backends/general.pl.in
@@ -0,0 +1,644 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Common stuff for the ximian-setup-tools backends.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/report.pl$DOTIN";
+require "$SCRIPTSDIR/platform.pl$DOTIN";
+require "$SCRIPTSDIR/xml.pl$DOTIN";
+
+eval "use Locale::gettext";
+$eval_gettext = $@;
+eval "use POSIX";
+$eval_posix = $@;
+eval "use Encode";
+$eval_encode = $@;
+
+$has_i18n = (($eval_gettext eq "") && ($eval_posix eq "") && ($eval_encode eq ""));
+
+if ($has_i18n)
+{
+ # set up i18n stuff
+ &setlocale (LC_MESSAGES, "");
+ &bindtextdomain ("@GETTEXT_PACKAGE@", "@localedir@");
+
+ # Big stupid hack, but it's the best I can do until
+ # distros switch to perl's gettext 1.04...
+ eval "&bind_textdomain_codeset (\"@GETTEXT_PACKAGE@\", \"UTF-8\")";
+ &textdomain ("@GETTEXT_PACKAGE@");
+
+ eval "sub _ { return gettext (shift); }";
+}
+else
+{
+ # fake the gettext calls
+ eval "sub _ { return shift; }";
+}
+
+# --- Operation modifying variables --- #
+
+
+# Variables are set to their default value, which may be overridden by user. Note
+# that a $prefix of "" will cause the configurator to use '/' as the base path,
+# and disables creation of directories and writing of previously non-existent
+# files.
+
+# We should get rid of all these globals.
+
+$gst_name = ""; # Short name of tool.
+# $gst_version = ""; # Version of tool - [major.minor.revision]. Deprecated: now in hash
+# structure generated by &gst_init.
+# $gst_operation = ""; # Major operation user wants to perform - [get | set | filter]. Same as gst_version.
+
+$gst_prefix = "";
+$gst_do_verbose = 0;
+$gst_do_report = 0;
+
+$gst_debug = 0;
+$gst_do_immediate = 1;
+
+
+# Location management stuff
+$gst_location = "";
+$gst_no_archive = 0;
+
+sub gst_print_usage_synopsis
+{
+ my ($tool) = @_;
+ my ($ops_syn, $i);
+ my @ops = qw (get set filter);
+
+ foreach $i (@ops)
+ {
+ $ops_syn .= "--$i | " if exists $ {$$tool{"directives"}}{$i};
+ }
+
+ print STDERR "Usage: $$tool{name}-conf <${ops_syn}--interface | --directive | --help | --version>\n";
+
+ print STDERR " " x length $$tool{"name"};
+ print STDERR " [--disable-immediate] [--prefix <location>]\n";
+
+ print STDERR " " x length $$tool{"name"};
+ print STDERR " [--progress] [--report] [--verbose]\n\n";
+}
+
+sub gst_print_usage_generic
+{
+ my ($tool) = @_;
+ my (%usage, $i);
+ my @ops = qw (get set filter);
+
+ my $usage_generic_head =<< "end_of_usage_generic;";
+ Major operations (specify one of these):
+
+end_of_usage_generic;
+
+ my $usage_generic_tail =<< "end_of_usage_generic;";
+ -i --interface Shows the available backend directives for interactive mode,
+ in XML format.
+
+ Interactive mode is set when no -g, -s or -f arguments are
+ given.
+
+ -d --directive <directive> Takes a \'name::arg1::arg2...::argN\' directive
+ value as comming from standard input in interactive mode.
+
+ -h --help Prints this page to standard error.
+
+ --version Prints version information to standard output.
+
+ Modifiers (specify any combination of these):
+
+ --platform <name-ver> Overrides the detection of your platform\'s
+ name and version, e.g. redhat-6.2. Use with care. See the
+ documentation for a full list of supported platforms.
+
+ --disable-immediate With --set, prevents the configurator from
+ running any commands that make immediate changes to
+ the system configuration. Use with --prefix to make a
+ dry run that won\'t affect your configuration.
+
+ With --get, suppresses running of non-vital external
+ programs that might take a long time to finish.
+
+ -p --prefix <location> Specifies a directory prefix where the
+ configuration is looked for or stored. When storing
+ (with --set), directories and files may be created.
+
+ --progress Prints machine-readable progress information to standard
+ output, before any XML, consisting of three-digit
+ percentages always starting with \'0\'.
+
+ --report Prints machine-readable diagnostic messages to standard
+ output, before any XML. Each message has a unique
+ three-digit ID. The report ends in a blank line.
+
+ -v --verbose Prints human-readable diagnostic messages to standard
+ error.
+end_of_usage_generic;
+
+ $usage{"get"} =<< "end_of_usage_generic;";
+ -g --get Prints the current configuration to standard output, as
+ a standalone XML document. The configuration is read from
+ the host\'s system config files.
+
+end_of_usage_generic;
+ $usage{"set"} =<< "end_of_usage_generic;";
+ -s --set Updates the current configuration from a standalone XML
+ document read from standard input. The format is the same
+ as for the document generated with --get.
+
+end_of_usage_generic;
+ $usage{"filter"} =<< "end_of_usage_generic;";
+ -f --filter Reads XML configuration from standard input, parses it,
+ and writes the configurator\'s impression of it back to
+ standard output. Good for debugging and parsing tests.
+
+end_of_usage_generic;
+
+ print STDERR $usage_generic_head;
+
+ foreach $i (@ops)
+ {
+ print STDERR $usage{$i} if exists $ {$$tool{"directives"}}{$i};
+ }
+
+ print STDERR $usage_generic_tail;
+}
+
+# if $exit_code is provided (ne undef), exit with that code at the end.
+sub gst_print_usage
+{
+ my ($tool, $exit_code) = @_;
+
+ &gst_print_usage_synopsis ($tool);
+ print STDERR $$tool{"description"} . "\n";
+ &gst_print_usage_generic ($tool);
+
+ exit $exit_code if $exit_code ne undef;
+}
+
+sub gst_print_version
+{
+ my ($tool, $exit_code) = @_;
+
+ print "$$tool{name} $$tool{version}\n";
+
+ exit $exit_code if $exit_code ne undef;
+}
+
+# --- Initialization and finalization --- #
+
+
+sub gst_set_operation
+{
+ my ($tool, $operation) = @_;
+
+ if ($tool{"operation"} ne "")
+ {
+ print STDERR "Error: You may specify only one major operation.\n\n";
+ &gst_print_usage ($tool, 1);
+ exit (1);
+ }
+
+ $$tool{"operation"} = $operation;
+}
+
+sub gst_set_with_param
+{
+ my ($tool, $arg_name, $value) = @_;
+
+ if ($$tool{$arg_name} ne "")
+ {
+ print STDERR "Error: You may specify --$arg_name only once.\n\n";
+ &gst_print_usage ($tool, 1);
+ }
+
+ if ($value eq "")
+ {
+ print STDERR "Error: You must specify an argument to the --$arg_name option.\n\n";
+ &gst_print_usage ($tool, 1);
+ }
+
+ $$tool{$arg_name} = $value;
+}
+
+sub gst_set_op_directive
+{
+ my ($tool, $directive) = @_;
+
+ &gst_set_with_param ($tool, "directive", $directive);
+ &gst_set_operation ($tool, "directive");
+}
+
+sub gst_set_prefix
+{
+ my ($tool, $prefix) = @_;
+
+ &gst_set_with_param ($tool, "prefix", $prefix);
+ $gst_prefix = $prefix;
+}
+
+sub gst_set_dist
+{
+ my ($tool, $dist) = @_;
+
+ &gst_set_with_param ($tool, "platform", $dist);
+ $gst_dist = $dist;
+}
+
+sub gst_set_location
+{
+ my ($tool, $location) = @_;
+
+ &gst_set_with_param ($tool, "location", $location);
+ $gst_location = $location;
+}
+
+sub gst_merge_std_directives
+{
+ my ($tool) = @_;
+ my ($directives, $i);
+ my %std_directives =
+ (
+# platforms directive to do later.
+ "platforms" => [ \&gst_platform_list, [],
+ "Print XML showing platforms supported by backend." ],
+ "platform_set" => [ \&gst_platform_set, ["platform"],
+ "Force the selected platform. platform arg must be one of the listed in the" .
+ "reports." ],
+ "interface" => [ \&gst_interface_directive, [],
+ "Print XML showing backend capabilities." ],
+ "end" => [ \&gst_end_directive, [],
+ "Finish gracefuly and exit with success." ]
+ );
+
+ $directives = $$tool{"directives"};
+ # Standard directives may be overriden.
+ foreach $i (keys %std_directives)
+ {
+ $$directives{$i} = $std_directives{$i} if !exists $$directives{$i};
+ }
+}
+
+sub gst_is_tool
+{
+ my ($tool) = @_;
+
+ if ((ref $tool eq "HASH") &&
+ (exists $$tool{"is_tool"}) &&
+ ($$tool{"is_tool"} == 1))
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+sub gst_init
+{
+ my ($name, $version, $description, $directives, @args) = @_;
+ my (%tool, $arg);
+
+ # print a CR for synchronysm with the frontend
+ print "\n";
+
+ # Set the output autoflush.
+ $old_fh = select (STDOUT); $| = 1; select ($old_fh);
+ $old_fh = select (STDERR); $| = 1; select ($old_fh);
+
+ $tool{"is_tool"} = 1;
+
+ # Set backend descriptors.
+
+ $tool{"name"} = $gst_name = $name;
+ $tool{"version"} = $version;
+ $tool{"description"} = $description;
+ $tool{"directives"} = $directives;
+
+ &gst_merge_std_directives (\%tool);
+
+ # Parse arguments.
+
+ while ($arg = shift (@args))
+ {
+ if ($arg eq "--get" || $arg eq "-g") { &gst_set_operation (\%tool, "get"); }
+ elsif ($arg eq "--set" || $arg eq "-s") { &gst_set_operation (\%tool, "set"); }
+ elsif ($arg eq "--filter" || $arg eq "-f") { &gst_set_operation (\%tool, "filter"); }
+ elsif ($arg eq "--directive" || $arg eq "-d") { &gst_set_op_directive (\%tool, shift @args); }
+ elsif ($arg eq "--interface" || $arg eq "-i") { &gst_interface_print (\%tool, 0); }
+ elsif ($arg eq "--help" || $arg eq "-h") { &gst_print_usage (\%tool, 0); }
+ elsif ($arg eq "--version") { &gst_print_version (\%tool, 0); }
+ elsif ($arg eq "--prefix" || $arg eq "-p") { &gst_set_prefix (\%tool, shift @args); }
+ elsif ($arg eq "--platform") { &gst_set_dist (\%tool, shift @args); }
+ elsif ($arg eq "--progress") { $tool{"progress"} = $gst_progress = 1; }
+ elsif ($arg eq "--location") { &gst_set_location (\%tool, shift @args); }
+ elsif ($arg eq "--no-archive") { $tool{"no_archive"} = $gst_no_archive = 1; }
+ elsif ($arg eq "--debug") { $tool{"debug"} = $gst_debug = 1; }
+ elsif ($arg eq "--verbose" || $arg eq "-v")
+ {
+ $tool{"do_verbose"} = $gst_do_verbose = 1;
+ &gst_report_set_threshold (99);
+ }
+ elsif ($arg eq "--report")
+ {
+ $tool{"do_report"} = $gst_do_report = 1;
+ &gst_report_set_threshold (99);
+ }
+ else
+ {
+ print STDERR "Error: Unrecognized option '$arg'.\n\n";
+ &gst_print_usage (\%tool, 1);
+ }
+ }
+
+ # See if debug requested in env.
+
+ $tool{"debug"} = $gst_debug = 1 if ($ENV{"SET_ME_UP_HARDER"});
+
+ # Set up subsystems.
+
+ &gst_platform_get_system (\%tool);
+ &gst_platform_guess (\%tool) if !$tool{"platform"};
+ &gst_report_begin ();
+
+ return \%tool;
+}
+
+sub gst_terminate
+{
+ &gst_report_set_threshold (-1);
+ &gst_debug_close_all ();
+ exit (0);
+}
+
+sub gst_end_directive
+{
+ my ($tool) = @_;
+
+ &gst_report_end ();
+ &gst_xml_print_request_end ();
+ &gst_terminate ();
+}
+
+
+sub gst_interface_print_comment
+{
+ my ($name, $directive) = @_;
+ my %std_comments =
+ ("get" =>
+ "Prints the current configuration to standard output, as " .
+ "a standalone XML document. The configuration is read from " .
+ "the host\'s system config files.",
+
+ "set" =>
+ "Updates the current configuration from a standalone XML " .
+ "document read from standard input. The format is the same " .
+ "as for the document generated with --get.",
+
+ "filter" =>
+ "Reads XML configuration from standard input, parses it, " .
+ "and writes the configurator\'s impression of it back to " .
+ "standard output. Good for debugging and parsing tests."
+ );
+
+ $comment = $$directive[2];
+ $comment = $std_comments{$name} if (exists $std_comments{$name});
+
+ if ($comment)
+ {
+ &gst_xml_print_line ("<comment>");
+ &gst_xml_print_line ($comment);
+ &gst_xml_print_line ("</comment>");
+ }
+}
+
+# if $exit_code is provided (ne undef), exit with that code at the end.
+sub gst_interface_print
+{
+ my ($tool, $exit_code) = @_;
+ my ($directives, $key);
+
+ $directives = $$tool{"directives"};
+
+ &gst_xml_print_begin ("interface");
+ foreach $key (sort keys %$directives)
+ {
+ my $comment = $ {$$directives{$key}}[2];
+ my @args = @{ $ {$$directives{$key}}[1]};
+ my $arg;
+
+ &gst_xml_container_enter ("directive");
+ &gst_xml_print_line ("<name>$key</name>");
+ &gst_interface_print_comment ($key, $$directives{$key});
+
+ while ($arg = shift (@args))
+ {
+ if ($arg =~ /\*$/)
+ {
+ my $tmp = $arg;
+
+ &gst_report ("directive_invalid", $key) if ($#args != -1);
+ chop $tmp;
+ &gst_xml_print_line ("<var-arguments>$tmp</var-arguments>");
+ }
+ else
+ {
+ &gst_xml_print_line ("<argument>$arg</argument>");
+ }
+ }
+
+ &gst_xml_container_leave ();
+ }
+ &gst_xml_print_end ("interface");
+
+ exit $exit_code if $exit_code ne undef;
+}
+
+
+sub gst_interface_directive
+{
+ my ($tool) = @_;
+
+ &gst_report_end ();
+ &gst_interface_print ($tool);
+}
+
+
+sub gst_directive_fail
+{
+ my (@report_args) = @_;
+
+ &gst_report (@report_args);
+ &gst_report_end ();
+ &gst_xml_print_request_end ();
+ &gst_debug_close_all ();
+}
+
+# This sepparates a line in args by the directive line format,
+# doing the necessary escape sequence manipulations.
+sub gst_directive_parse_line
+{
+ my ($line) = @_;
+ my ($arg, @args);
+
+ chomp $line;
+ $line =~ s/\\\\/___escape\\___/g;
+ $line =~ s/\\::/___escape2:___/g;
+ @args = split ("::", $line);
+
+ foreach $arg (@args)
+ {
+ $arg =~ s/___escape2:___/::/g;
+ $arg =~ s/___escape\\___/\\/g;
+ }
+
+ return @args;
+}
+
+# Normal use for the direcives hash in the backends is:
+#
+# "name" => [ \&sub, [ "arg1", "arg2", "arg3",... "argN" ], "comment" ]
+#
+# name name of the directive that will be used in interactive mode.
+# sub is the function that runs the directive.
+# arg1...argN show the number of arguments that the function may use. The
+# name of the argument is used for documentation purposes for
+# the interfaces XML (dumped by the "interfaces" directive).
+# An argument ending with * means that 0 or more arguments
+# may be given.
+# comment documents the directive in a brief way, for the interface XML.
+#
+# Example:
+#
+# "install_font" => [ \&gst_font_install, [ "directory", "file", "morefiles*" ], "Installs fonts." ]
+#
+# This means that when an interactive mode directive is given, such as:
+#
+# install_font::/usr/share/fonts::/tmp/myfile::/tmp/myfile2
+#
+# the function gst_font_install will be called, with the tool structure, /usr/share/fonts,
+# /tmp/myfile and /tmp/myfile2 as arguments. Directives with 1 or 0 arguments
+# would be rejected, as we are requiring 2, and optionaly allowing more.
+# Check enable_iface in network-conf.in for an example of a directive handler.
+#
+# The generated interface XML piece for this entry would be:
+#
+# <directive>
+# <name>gst_font_install</name>
+# <comment>
+# Installs fonts.
+# </comment>
+# <argument>directory</argument>
+# <argument>file</argument>
+# <var-arguments>morefiles</var-arguments>
+# </directive>
+
+
+sub gst_directive_run
+{
+ my ($tool, $line) = @_;
+ my ($key, @args, $directives, $proc, $reqargs, $i);
+
+ ($key, @args) = &gst_directive_parse_line ($line);
+ $directives = $$tool{"directives"};
+
+ &gst_report_begin ();
+
+ if (!exists $$directives{$key})
+ {
+ &gst_directive_fail ("directive_unsup", $key);
+ return;
+ }
+
+ $reqargs = [];
+ foreach $i (@{$ {$$directives{$key}}[1]})
+ {
+ push @$reqargs, $i if not ($i =~ /\*$/);
+ }
+
+ if (scalar @args < scalar @$reqargs)
+ {
+ &gst_directive_fail ("directive_lowargs", $key, scalar (@$reqargs), join (',', $key, @args));
+ return;
+ }
+
+ $reqargs = $ {$$directives{$key}}[1];
+ if ((scalar @args != scalar @$reqargs) &&
+ !($$reqargs[$#$reqargs] =~ /\*$/))
+ {
+ &gst_directive_fail ("directive_badargs", $key, scalar (@$reqargs), join (',', $key, @args));
+ return;
+ }
+
+ &gst_report ("directive_run", $key, join (',', @args));
+
+ $proc = $ {$$directives{$key}}[0];
+ &$proc ($tool, @args);
+
+ &gst_xml_print_request_end ();
+ &gst_debug_close_all ();
+}
+
+
+sub gst_run
+{
+ my ($tool) = @_;
+ my ($line);
+
+ if ($$tool{"operation"} ne "directive")
+ {
+ my @stdops = qw (get set filter);
+ my ($op);
+
+ foreach $op (@stdops)
+ {
+ if ($$tool{"operation"} eq $op)
+ {
+ $$tool{"operation"} = "directive";
+ $$tool{"directive"} = $op;
+ }
+ }
+ }
+
+ &gst_report_end ();
+
+ if ($$tool{"directive"})
+ {
+ &gst_directive_run ($tool, $$tool{"directive"});
+ &gst_terminate ();
+ }
+
+ while ($line = <STDIN>)
+ {
+ &gst_directive_run ($tool, $line);
+ }
+}
+
+1;
diff --git a/knetwortdeconf/backends/guess_system.sh b/knetwortdeconf/backends/guess_system.sh
new file mode 100755
index 0000000..9b7bfa9
--- /dev/null
+++ b/knetwortdeconf/backends/guess_system.sh
@@ -0,0 +1,1121 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+# Free Software Foundation, Inc.
+#
+# This file 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Please send patches to <autoconf-patches@gnu.org>.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# Use $HOST_CC if defined. $CC may point to a cross-compiler
+if test x"$CC_FOR_BUILD" = x; then
+ if test x"$HOST_CC" != x; then
+ CC_FOR_BUILD="$HOST_CC"
+ else
+ if test x"$CC" != x; then
+ CC_FOR_BUILD="$CC"
+ else
+ CC_FOR_BUILD=cc
+ fi
+ fi
+fi
+
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .globl main
+ .ent main
+main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ arm32:NetBSD:*:*)
+ echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:NetBSD:*:*)
+ echo powerpc-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ sed 's/^ //' << EOF >$dummy.c
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ rm -f $dummy.c $dummy
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-unknown-openbsd
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ if test -x /usr/bin/objformat; then
+ if test "elf" = "`/usr/bin/objformat`"; then
+ echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+ exit 0
+ fi
+ fi
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_help_string=`cd /; ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ *ia64)
+ echo "${UNAME_MACHINE}-unknown-linux"
+ exit 0
+ ;;
+ i?86linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0
+ ;;
+ i?86coff)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0
+ ;;
+ sparclinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ armlinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ elf32arm*)
+ echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ exit 0
+ ;;
+ armelf_linux*)
+ echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ exit 0
+ ;;
+ m68klinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ elf32ppc)
+ # Determine Lib Version
+ cat >$dummy.c <<EOF
+#include <features.h>
+#if defined(__GLIBC__)
+extern char __libc_version[];
+extern char __libc_release[];
+#endif
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#if defined(__GLIBC__)
+ printf("%s %s\n", __libc_version, __libc_release);
+#else
+ printf("unkown\n");
+#endif
+ return 0;
+}
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy | grep 1\.99 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.c $dummy
+ echo powerpc-unknown-linux-gnu${LIBC}
+ exit 0
+ ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ sed 's/^ //' <<EOF >$dummy.s
+ .globl main
+ .ent main
+ main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+
+ objdump --private-headers $dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >$dummy.c <<EOF
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i?86:*:5:7*)
+ # Fixed at (any) Pentium or better
+ UNAME_MACHINE=i586
+ if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
+ echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ pc:*:*:*)
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-qnx-qnx${UNAME_VERSION}
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/knetwortdeconf/backends/mkinstalldirs b/knetwortdeconf/backends/mkinstalldirs
new file mode 100755
index 0000000..d2d5f21
--- /dev/null
+++ b/knetwortdeconf/backends/mkinstalldirs
@@ -0,0 +1,111 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage" 1>&2
+ exit 0
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
+done
+
+for file
+do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+ 0) exit 0 ;;
+esac
+
+case $dirmode in
+ '')
+ if mkdir -p -- . 2>/dev/null; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ fi
+ ;;
+esac
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=""
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# End:
+# mkinstalldirs ends here
diff --git a/knetwortdeconf/backends/network-conf.in b/knetwortdeconf/backends/network-conf.in
new file mode 100755
index 0000000..6dba52f
--- /dev/null
+++ b/knetwortdeconf/backends/network-conf.in
@@ -0,0 +1,641 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Network configurator. Designed to be architecture and distribution independent.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+# Michael Vogt <mvo@debian.org> (Debian Support)
+# Arturo Espinosa <arturo@ximian.com>
+# Grzegorz Golawski <grzegol@pld-linux.org> (PLD Support)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+# Best viewed with 100 columns of width.
+
+# Configuration files affected:
+#
+# /etc/resolv.conf
+# /etc/host.conf
+# /etc/hosts
+# /etc/sysconfig/network
+# /etc/rc.config
+# /etc/smb.conf
+
+# Running programs affected:
+#
+# smbd
+# nmbd
+# ifconfig: check current interfaces and activate/deactivate.
+
+BEGIN {
+ $SCRIPTSDIR = "@scriptsdir@";
+ if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+ {
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+ }
+
+ require "$SCRIPTSDIR/general.pl$DOTIN";
+ require "$SCRIPTSDIR/platform.pl$DOTIN";
+ require "$SCRIPTSDIR/util.pl$DOTIN";
+ require "$SCRIPTSDIR/file.pl$DOTIN";
+ require "$SCRIPTSDIR/xml.pl$DOTIN";
+ require "$SCRIPTSDIR/network.pl$DOTIN";
+}
+
+# --- Tool information --- #
+
+$name = "network";
+$version = "@VERSION@";
+@platforms = ("redhat-5.2", "redhat-6.0", "redhat-6.1", "redhat-6.2", "redhat-7.0", "redhat-7.1",
+ "redhat-7.2", "redhat-8.0", "redhat-9",
+ "rhel-5", "rhel-6",
+ "openna-1.0",
+ "mandrake-7.1", "mandrake-7.2", "mandrake-9.0", "mandrake-9.1", "mandrake-9.2",
+ "mandrake-10.0", "mandrake-10.1","mandrake-10.2", "mandriva-2006.0",
+ "mandriva-2006.1", "mandriva-2007.0", "mandriva-2007.1",
+ "yoper-2.2",
+ "blackpanther-4.0",
+ "debian-2.2", "debian-3.0", "debian-3.1", "debian-4.0", "debian-5.0", "debian-testing",
+ "ubuntu-5.04", "ubuntu-5.10", "ubuntu-6.06", "ubuntu-6.10", "ubuntu-7.04", "ubuntu-7.10", "ubuntu-8.04", "ubuntu-8.10", "ubuntu-9.04", "ubuntu-9.10", "ubuntu-10.04", "ubuntu-10.10",
+ "suse-7.0", "suse-9.0", "suse-9.1",
+ "turbolinux-7.0", "fedora-1", "fedora-2", "fedora-3", "fedora-4", "fedora-5", "rpath", "fedora-15", "fedora-16", "fedora-17",
+ "pld-1.0", "pld-1.1", "pld-1.99",
+ "conectiva-9", "conectiva-10",
+ "vine-3.0", "vine-3.1",
+ "ark",
+ "slackware-9.1.0", "slackware-10.0.0", "slackware-10.1.0", "slackware-10.2.0",
+ "slackware-11.0.0", "slackware-12.0.0", "slackware-12.1.0", "slackware-12.2.0", "slackware-13.0.0", "slackware-13.1.0", "slackware-13.37.0", "slackware-14.0.0",
+ "gentoo", "vlos-1.2", "freebsd-5", "freebsd-6");
+
+$description =<<"end_of_description;";
+ Configures all network parameters and interfaces.
+end_of_description;
+
+$progress_max = 10;
+
+$profile_file = "profiles.xml";
+
+
+# --- XML parsing ---
+
+# Scan XML from standard input to an internal tree.
+sub xml_parse
+{
+ my ($tree, %hash, $elem);
+ # Scan XML to tree.
+
+ $tree = &gst_xml_scan ();
+
+ # Walk the tree recursively and extract configuration parameters.
+ # This is the top level - find and enter the "network" tag.
+
+ while ($elem = shift @$tree)
+ {
+ if ($elem eq "network") { &xml_parse_network (shift @$tree, \%hash); }
+ else { &gst_report ("xml_unexp_tag", $elem); shift @$tree; }
+ }
+
+ return(\%hash);
+}
+
+# <network>...</network>
+
+sub push_unique
+{
+ my ($arr, $val) = @_;
+ my $i;
+
+ foreach $i (@$arr)
+ {
+ return if $i eq $val;
+ }
+
+ push @$arr, $val;
+}
+
+sub xml_parse_network
+{
+ my ($tree, $hash) = @_;
+ my ($elem);
+ my (@searchdomain, @nameserver, @order, %statichost, %interface, %dialing);
+
+ shift @$tree; # Skip attributes.
+
+ while ($elem = shift @$tree)
+ {
+ if ($elem eq "auto") { $$hash{"auto"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "hostname") { $$hash{"hostname"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "gateway") { $$hash{"gateway"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "gatewaydev") { $$hash{"gatewaydev"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "domain") { $$hash{"domain"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "workgroup") { $$hash{"workgroup"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "smbdesc") { $$hash{"smbdesc"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "name") { $$hash{"name"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "description") { $$hash{"description"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "winsserver") { $$hash{"winsserver"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "winsuse") { $$hash{"winsuse"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "smbuse") { $$hash{"smbuse"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "hostmatch") { $$hash{"hostmatch"} = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "nameserver") { &push_unique (\@nameserver, &gst_xml_get_pcdata (shift @$tree)); }
+ elsif ($elem eq "searchdomain") { &push_unique (\@searchdomain, &gst_xml_get_pcdata (shift @$tree)); }
+ elsif ($elem eq "order") { push (@order, &gst_xml_get_pcdata (shift @$tree)); }
+ elsif ($elem eq "statichost") { &xml_parse_statichost (shift @$tree, \%statichost); }
+ elsif ($elem eq "interface") { &gst_network_xml_parse_interface (shift @$tree, \%interface); }
+ elsif ($elem eq "dialing") { &xml_parse_dialing (shift @$tree, \%dialing); }
+ elsif ($elem eq "dialinstalled") { shift @$tree; }
+ elsif ($elem eq "smbinstalled") { shift @$tree; }
+ elsif ($elem eq "smartdhcpcd") { shift @$tree; }
+ elsif ($elem eq "gwdevunsup") { shift @$tree; }
+ elsif ($elem eq "wireless_device") { shift @$tree; }
+ elsif ($elem eq "profiledb") { &xml_parse_profiledb (shift @$tree, $hash); }
+ else { &gst_report ("xml_unexp_tag", $elem); shift @$tree; }
+ }
+
+ $$hash{"order"} = \@order unless $#order < 0;
+ $$hash{"searchdomain"} = \@searchdomain unless $#searchdomain < 0;
+ $$hash{"nameserver"} = \@nameserver unless $#nameserver < 0;
+ $$hash{"statichost"} = \%statichost unless scalar keys %statichost == 0;
+ $$hash{"interface"} = \%interface unless scalar keys %interface == 0;
+ $$hash{"dialing"} = \%dialing unless scalar keys %dialing == 0;
+}
+
+# <network><statichost>...</statichost></network>
+sub xml_parse_statichost
+{
+ my ($tree, $statichost) = @_;
+ my ($ip, @alias, $elem);
+
+ shift @$tree;
+
+ while ($elem = shift @$tree)
+ {
+ if ($elem eq "ip") { $ip = &gst_xml_get_pcdata (shift @$tree); }
+ elsif ($elem eq "alias") { push(@alias, &gst_xml_get_pcdata (shift @$tree)); }
+ else { &gst_report ("xml_unexp_tag", $elem); shift @$tree; }
+ }
+
+ # common regexp for IPv4 and IPv6
+ if ($ip =~ /([0-9a-fA-F\.:])+/)
+ {
+ $$statichost{$ip} = \@alias;
+ }
+}
+
+sub xml_parse_dialing
+{
+ my ($tree, $dialing) = @_;
+ my (%hash, $name, $elem);
+
+ shift @$tree;
+
+ while ($elem = shift @$tree)
+ {
+ $hash{$elem} = &gst_xml_get_pcdata (shift @$tree);
+ }
+
+ $name = $hash{"name"};
+ $$dialing{$name} = \%hash;
+}
+
+# couple of functions for fixing profiles format
+sub fix_profile_modem_iface
+{
+ my ($configuration, $section, $dialing) = @_;
+ my ($s, $key, %h);
+
+ foreach $s (keys %$dialing)
+ {
+ if ($s eq $section)
+ {
+ $h = $$dialing{$s};
+
+ foreach $key (keys %$h)
+ {
+ $$configuration{$key} = $$h{$key};
+ }
+ }
+ }
+}
+
+sub fix_profile_interface_format
+{
+ my ($interface, $dialing) = @_;
+ my (%configuration, $key, $section);
+
+ return if (exists $$interface{"configuration"});
+
+ foreach $key (keys %$interface)
+ {
+ if ($key !~ /^(dev|enabled|hwaddr)$/)
+ {
+ if ($key eq 'wvsection')
+ {
+ &fix_profile_modem_iface (\%configuration, $$interface{$key}, $dialing);
+ $configuration{"section"} = $$interface{$key};
+ }
+ else
+ {
+ $dest_key = $key;
+ $configuration{$key} = $$interface{$key};
+ }
+
+ delete $$interface{$key};
+ }
+ }
+
+ $$interface{"type"} = &gst_network_get_interface_type ($$interface{"dev"});
+
+ if (%configuration)
+ {
+ $$interface{"configuration"} = \%configuration;
+ }
+}
+
+sub fix_profile_format
+{
+ my ($hash) = @_;
+ my ($interfaces, $dialing, $iface);
+
+ $interfaces = $$hash{"interface"};
+ $dialing = $$hash{"dialing"};
+
+ foreach $iface (keys %$interfaces)
+ {
+ &fix_profile_interface_format ($$interfaces{$iface}, $dialing);
+ }
+}
+
+sub xml_parse_profile
+{
+ my ($tree, $hash) = @_;
+ my (%profile);
+
+ &xml_parse_network ($tree, \%profile);
+
+ # We've got to translate the old profiles format
+ &fix_profile_format (\%profile);
+
+ push @{$hash->{"profiledb"}{"profile"}}, \%profile;
+}
+
+sub xml_parse_profiledb
+{
+ my ($tree, $hash) = @_;
+
+ shift @$tree; # Skip attributes.
+
+ while (@$tree)
+ {
+ if ($$tree[0] eq "profile") { &xml_parse_profile ($$tree[1], $hash); }
+ else
+ {
+ &gst_report ("xml_unexp_tag", $$tree[0]);
+ }
+
+ shift @$tree;
+ shift @$tree;
+ }
+}
+
+# --- XML printing --- #
+
+sub xml_print_configuration
+{
+ my ($h) = @_;
+ my @scalar_keys =
+ qw(auto hostname gateway gatewaydev gwdevunsup domain
+ hostmatch workgroup smbdesc winsserver winsuse smbuse
+ smartdhcpcd smbinstalled dialinstalled name);
+ my @array_keys =
+ qw(nameserver searchdomain order);
+
+ # Hostname, domain, search domains, nameservers.
+
+ &gst_xml_print_scalars ($h, @scalar_keys);
+ &gst_xml_print_arrays ($h, @array_keys);
+ &network_xml_print_statichost ($h);
+
+ &xml_print_interfaces ($$h{"interface"});
+}
+
+sub xml_print_profiledb
+{
+ my ($h) = @_;
+
+ &gst_xml_print_vspace ();
+
+ &gst_xml_print_line ("<profiledb>\n");
+ &gst_xml_enter ();
+ foreach $i (@{$$h{"profiledb"}{"profile"}})
+ {
+ gst_xml_print_line ("<profile>\n");
+ gst_xml_enter ();
+
+ &xml_print_configuration ($i);
+
+ gst_xml_leave ();
+ gst_xml_print_line ("</profile>\n");
+ }
+ gst_xml_leave ();
+ gst_xml_print_line ("</profiledb>\n");
+}
+
+sub xml_print_interfaces
+{
+ my ($h) = @_;
+ my ($dev, $type);
+
+ foreach $dev (keys %$h)
+ {
+ if ($$h{$dev}{"type"})
+ {
+ $type = $$h{$dev}{"type"};
+ delete $$h{$dev}{"type"};
+ }
+ else
+ {
+ $type = &gst_network_get_interface_type ($dev);
+ }
+
+ &gst_xml_print_vspace ();
+ &gst_xml_print_line ("<interface type='$type'>");
+ &gst_xml_enter ();
+ &gst_xml_print_hash ($$h{$dev});
+
+ &gst_xml_leave ();
+ &gst_xml_print_line ("</interface>");
+ }
+}
+
+sub xml_print
+{
+ my ($h) = @_;
+
+ &gst_xml_print_begin ();
+
+ &xml_print_configuration ($h);
+ &xml_print_profiledb ($h);
+
+ &gst_xml_print_end ();
+}
+
+
+# Reading profiles
+sub read_profiledb
+{
+ my ($hash) = @_;
+ my ($path);
+ my ($tree);
+
+ $path = gst_file_get_data_path () . "/" . $main::tool->{"name"} . "/";
+ chmod (0755, $path);
+ chmod (0644, $path . $profile_file);
+
+ $tree = &gst_xml_scan ($path . $profile_file, $tool);
+ if ($tree && scalar @$tree)
+ {
+ if ($$tree[0] eq 'profiledb')
+ {
+ xml_parse_profiledb ($$tree[1], $hash);
+ }
+ else
+ {
+ gst_report ('xml_unexp_tag', $$tree[0]);
+ }
+ }
+}
+
+# Writing profiles
+sub write_profiledb
+{
+ my ($hash) = @_;
+ my $profiledb = $hash->{'profiledb'};
+ my $path = &gst_file_get_data_path () . "/" . $main::tool->{'name'} . "/";
+ chmod (0755, $path);
+
+ if ($profiledb) {
+ # Write our profiles.
+ my $fh = &gst_file_open_write_from_names ($path . $profile_file);
+ if ($fh)
+ {
+ local *STDOUT = $fh;
+ &xml_print_profiledb ($hash);
+ close ($fh);
+
+ delete $hash->{'profiledb'};
+ }
+ }
+ else
+ {
+ gst_file_remove ($path . $profile_file);
+ }
+
+ chmod (0644, $path . $profile_file);
+}
+
+
+# Top-level actions.
+sub get
+{
+ my $hash;
+
+ # network interface stuff
+ $hash = &gst_network_conf_get ();
+ &read_profiledb (\%$hash);
+ &gst_network_ensure_loopback ($hash);
+
+ &gst_report_end ();
+ &xml_print ($hash);
+}
+
+
+sub set
+{
+ my $hash;
+
+ $hash = &xml_parse ();
+ &write_profiledb ($hash);
+ &gst_network_conf_set ($hash);
+ &gst_report_end ();
+}
+
+sub set_profile
+{
+ my ($tool, $profile_name) = @_;
+ my ($hash, $profiles, $profile);
+
+ &read_profiledb (\%$hash);
+ $profiles = $$hash{"profiledb"}{"profile"};
+
+ foreach $profile (@$profiles)
+ {
+ if ($$profile{"name"} eq $profile_name)
+ {
+ &gst_network_conf_set ($profile);
+ }
+ }
+
+ &gst_report_end ();
+}
+
+sub save_profiles
+{
+ my $hash;
+
+ $hash = &xml_parse ();
+ &write_profiledb ($hash);
+ &gst_report_end ();
+}
+
+
+# --- Filter config: XML in, XML out --- #
+
+
+sub filter
+{
+ my $hash;
+
+ $hash = &xml_parse ();
+ &gst_report_end ();
+ &xml_print ($hash);
+}
+
+sub enable_iface
+{
+ my ($tool, $iface, $enabled) = @_;
+ my (%dist_attrib, $iface_set);
+ my %hash = ("configuration" => {"file" => $iface});
+
+ %dist_attrib = &gst_network_get_interface_replace_table ();
+ $iface_set = $dist_attrib{"iface_set"};
+ &$iface_set (\%hash, undef, $enabled, 1);
+
+ # small hack for ensuring that the interface is really down
+ # when messing ifup/ifdown/ifconfig calls
+ if ($enabled == 0)
+ {
+ gst_file_run ("ifconfig $iface down");
+ &drop_dhcp_connection ($iface);
+ &drop_pppd_connection ($iface);
+ }
+
+ # Don't forget to do gst_end when the reports are over!
+ &gst_report_end ();
+ # XML output would come here, but this directive returns no XML.
+}
+
+sub enable_iface_with_config
+{
+ my ($tool) = @_;
+ my ($tree, $hash, $ret, $str);
+
+ # Scan XML to tree.
+ $tree = &gst_xml_scan ();
+
+ if (shift @$tree eq "interface")
+ {
+ $hash = &gst_network_xml_parse_interface (shift @$tree);
+ }
+
+ $ret = &gst_network_enable_iface_with_config ($hash);
+ &gst_report_end ();
+
+ &gst_xml_print_begin ("enable-iface");
+ &gst_xml_print_pcdata ("success", ($ret == 0) ? "1" : "0");
+ &gst_xml_print_end ("enable-iface");
+}
+
+sub list_ifaces
+{
+ my ($tool) = @_;
+ my ($ifaces, $iface, @arr);
+
+ $ifaces = &gst_network_interfaces_get_info ();
+
+ foreach $iface (keys %$ifaces)
+ {
+ push @arr, $$ifaces{$iface};
+ }
+
+ &gst_report_end ();
+ &gst_xml_print_begin ("network-ifaces");
+ &gst_xml_print_structure (\@arr, "interface");
+ &gst_xml_print_end ("network-ifaces");
+}
+
+sub detect_modem
+{
+ my ($tool) = @_;
+ my ($device);
+
+ $device = &gst_network_autodetect_modem ();
+ &gst_report_end ();
+
+ &gst_xml_print_begin ("network-modem-device");
+ &gst_xml_print_pcdata ("device", $device) if ($device ne undef);
+ &gst_xml_print_end ("network-modem-device");
+}
+
+sub detect_essids
+{
+ my ($tool, $iface) = @_;
+ my (@essids);
+
+ $essids = &gst_network_detect_essids ($iface);
+ &gst_report_end ();
+
+ &gst_xml_print_begin ("essids");
+ &gst_xml_print_structure ($essids, "network");
+ &gst_xml_print_end ("essids");
+}
+
+sub set_gateway
+{
+ my ($tool, $iface, $address) = @_;
+
+ &gst_network_route_set_default_gw ($iface, $address);
+ &gst_report_end ();
+}
+
+# --- Main --- #
+
+# get, set and filter are special cases that don't need more parameters than a ref to their function.
+# Read general.pl.in:gst_run_directive to know about the format of this hash.
+
+$directives = {
+ "get" => [ \&get, [], "" ],
+ "set" => [ \&set, [], "" ],
+ "filter" => [ \&filter, [], "" ],
+ "list_ifaces" => [ \&list_ifaces, [],
+ "List interfaces and active/inactive status." ],
+ "save_profiles" => [ \&save_profiles, [], "Save the profiles list" ],
+ "set_profile" => [ \&set_profile, [ "profile_name" ],
+ "Set a profile as the default configuration" ],
+ "enable_iface" => [ \&enable_iface, [ "interface", "enabled" ],
+ "Immediatly enable or disable a given interface. " .
+ "interface is the file tag value, enabled is 1 or 0." ],
+ "enable_iface_with_config" => [ \&enable_iface_with_config, [],
+ "Enable an interface with a given configuration" ],
+ "detect_modem" => [ \&detect_modem, [], "Detects the modem device." ],
+ "detect_essids" => [ \&detect_essids, [ "interface" ], "Detects active wireless networks" ],
+ "set_gateway" => [ \&set_gateway, [ "interface", "address" ], "Sets the default gateway" ]
+};
+
+$tool = &gst_init ($name, $version, $description, $directives, @ARGV);
+&gst_platform_ensure_supported ($tool, @platforms);
+&gst_run ($tool);
diff --git a/knetwortdeconf/backends/network.pl.in b/knetwortdeconf/backends/network.pl.in
new file mode 100644
index 0000000..91270bb
--- /dev/null
+++ b/knetwortdeconf/backends/network.pl.in
@@ -0,0 +1,6731 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Common network stuff for the ximian-setup-tools backends.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+# Arturo Espinosa <arturo@ximian.com>
+# Michael Vogt <mvo@debian.org> - Debian 2.[2|3] support.
+# David Lee Ludwig <davidl@wpi.edu> - Debian 2.[2|3] support.
+# Grzegorz Golawski <grzegol@pld-linux.org> - PLD support
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+use Socket;
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/general.pl$DOTIN";
+require "$SCRIPTSDIR/file.pl$DOTIN";
+require "$SCRIPTSDIR/parse.pl$DOTIN";
+require "$SCRIPTSDIR/replace.pl$DOTIN";
+require "$SCRIPTSDIR/service.pl$DOTIN";
+require "$SCRIPTSDIR/util.pl$DOTIN";
+require "$SCRIPTSDIR/xml.pl$DOTIN";
+require "$SCRIPTSDIR/process.pl$DOTIN";
+
+
+# Shared XML printing function
+sub network_xml_print_statichost
+{
+ my ($h) = $_[0];
+ my ($statichost, $i, $j, $val);
+
+ &gst_xml_print_vspace ();
+ foreach $i (keys %{$$h{"statichost"}})
+ {
+ $statichost = $ {$$h{"statichost"}}{$i};
+ &gst_xml_container_enter ("statichost");
+ $val = &gst_xml_quote ($i);
+ &gst_xml_print_pcdata ("ip", $val);
+ foreach $j (@$statichost)
+ {
+ $val = &gst_xml_quote ($j);
+ &gst_xml_print_pcdata ("alias", $val);
+ }
+ &gst_xml_container_leave ("statichost");
+ }
+}
+
+sub gst_network_get_linux_wireless_ifaces
+{
+ my ($fd, $line);
+ my (@ifaces, $command);
+
+ $command = &gst_file_get_cmd_path ("iwconfig");
+ open $fd, "$command |";
+ return @ifaces if $fd eq undef;
+
+ while (<$fd>)
+ {
+ if (/^([a-zA-Z0-9]+)[\t ].*$/)
+ {
+ push @ifaces, $1;
+ }
+ }
+
+ &gst_file_close ($fd);
+
+ &gst_report_leave ();
+ return \@ifaces;
+}
+
+sub gst_network_get_freebsd_wireless_ifaces
+{
+ my ($fd, $line, $iface);
+ my (@ifaces, $command);
+
+ $command = &gst_file_get_cmd_path ("iwconfig");
+ open $fd, "$command |";
+ return @ifaces if $fd eq undef;
+
+ while (<$fd>)
+ {
+ if (/^([a-zA-Z]+[0-9]+):/)
+ {
+ $iface = $1;
+ }
+
+ if (/media:.*wireless.*/i)
+ {
+ push @ifaces, $iface;
+ }
+ }
+
+ &gst_file_close ($fd);
+ &gst_report_leave ();
+
+ return \@ifaces;
+}
+
+# Returns an array with the wireless devices found
+sub gst_network_get_wireless_ifaces
+{
+ my ($plat) = $$tool{"system"};
+
+ return &gst_network_get_linux_wireless_ifaces if ($plat eq "Linux");
+ return &gst_network_get_freebsd_wireless_ifaces if ($plat eq "FreeBSD");
+}
+
+# set of functions for enabling an interface
+sub gst_network_config_wireless
+{
+ my ($hash, $dev, $command_iwconfig, $command_ifconfig) = @_;
+ my ($essid, $key, $command);
+
+ $essid = $$hash{"configuration"}{"essid"};
+ $key = $$hash{"configuration"}{"key"};
+ $key_type = $$hash{"configuration"}{"key_type"};
+
+ if ($essid)
+ {
+ $command = $command_iwconfig if ($$tool{"system"} eq "Linux");
+ $command = $command_ifconfig if ($$tool{"system"} eq "FreeBSD");
+
+ $command .= " $dev";
+ $command .= " essid '$essid'" if ($essid);
+
+ if ($key)
+ {
+ $key = &gst_network_get_full_key ($key, $key_type);
+ $command .= " key '$key'";
+ }
+ else
+ {
+ $command .= " key off";
+ }
+
+ &gst_file_run ($command);
+ }
+}
+
+sub gst_network_enable_iface
+{
+ my ($hash, $dev, $command_ifconfig) = @_;
+ my ($address, $netmask, $bootproto, $remote_address);
+
+ $address = $$hash{"configuration"}{"address"};
+ $netmask = $$hash{"configuration"}{"netmask"};
+ $bootproto = $$hash{"configuration"}{"bootproto"};
+ $remote_address = $$hash{"configuration"}{"remote_address"};
+
+ if ($bootproto eq "dhcp")
+ {
+ if (&gst_file_locate_tool ("dhclient3"))
+ {
+ $command = "dhclient3 -pf /var/run/dhclient.$dev.pid $dev";
+ }
+ elsif (&gst_file_locate_tool ("dhclient"))
+ {
+ $command = "dhclient -pf /var/run/dhclient.$dev.pid -e $dev";
+ }
+ else
+ {
+ $command = "dhcpcd -n $dev";
+ }
+ }
+ else
+ {
+ $command = $command_ifconfig;
+ $command .= " $dev";
+ $command .= " $address" if ($address);
+ $command .= " netmask $netmask" if ($netmask);
+ $command .= " dstaddr $remote_address" if ($remote_address);
+ $command .= " up";
+ }
+
+ return &gst_file_run ($command);
+}
+
+sub gst_network_get_chat_file
+{
+ my ($hash) = @_;
+ my ($volume, $phone_number, $external_line, $dial_command);
+ my ($dial, $tmp_file, $filename, $arr);
+
+ $volume = $$hash{"configuration"}{"volume"};
+ $phone_number = $$hash{"configuration"}{"phone_number"};
+ $external_line = $$hash{"configuration"}{"external_line"};
+ $dial_command = $$hash{"configuration"}{"dial_command"};
+
+ $filename = gst_file_get_temp_name ("network-admin-chat-script-XXXXXXXXX");
+ $tmp_file = "/tmp/$filename";
+
+ $dial = $dial_command;
+ $dial .= $external_line . "W" if ($external_line);
+ $dial .= $phone_number;
+
+ &gst_network_create_pppscript ($tmp_file);
+ chmod (0600, $tmp_file);
+ &gst_replace_chat ($tmp_file, "atd[tp][0-9wW]+", $dial);
+ &gst_network_set_modem_volume ($tmp_file, $volume);
+
+
+ return $tmp_file;
+}
+
+sub gst_network_enable_modem
+{
+ my ($hash, $dev, $command_pppd, $command_chat) = @_;
+ my ($config, $chat_file, $command, $ret);
+
+ $config = $$hash{"configuration"};
+ $chat_file = &gst_network_get_chat_file ($hash);
+
+ $command = $command_pppd;
+ $command .= " " . $$config{"serial_port"};
+ $command .= " debug" if ($$config{"debug"});
+ $command .= ($$config{"noauth"}) ? " noauth" : " auth";
+ $command .= ($$config{"persist"}) ? " persist" : " nopersist";
+ $command .= ($$config{"serial_hwctl"}) ? " crtscts" : " nocrtscts";
+ $command .= ($$config{"set_default_gw"}) ? " defaultroute" : " nodefaultroute";
+ $command .= " usepeerdns" if ($$config{"update_dns"});
+ $command .= " user " . $$config{"login"};
+ $command .= " connect \'$command_chat -v -f $chat_file\'";
+
+ $ret = &gst_file_run ($command);
+
+ return $ret;
+}
+
+sub gst_network_enable_isdn
+{
+ my ($hash, $dev, $command_pppd) = @_;
+ my ($config, $command);
+
+ $config = $$hash{"configuration"};
+
+ $command = $command_pppd;
+ $command .= " debug" if ($$config{"debug"});
+ $command .= ($$config{"noauth"}) ? " noauth" : " auth";
+ $command .= ($$config{"persist"}) ? " persist" : " nopersist";
+ $command .= ($$config{"serial_hwctl"}) ? " crtscts" : " nocrtscts";
+ $command .= ($$config{"set_default_gw"}) ? " defaultroute" : " nodefaultroute";
+ $command .= " usepeerdns" if ($$config{"update_dns"});
+ $command .= " sync plugin userpass.so ipcp-accept-local ipcp-accept-remote";
+ $command .= " plugin capiplugin.so";
+ $command .= " /dev/null";
+ $command .= " user " . $$config{"login"};
+ $command .= " number " . $$config{"phone_number"};
+
+ return &gst_file_run ($command);
+}
+
+sub drop_dhcp_connection
+{
+ my ($dev) = @_;
+ &gst_process_kill_by_pidfile ("dhclient.$dev.pid");
+ &gst_process_kill_by_pidfile ("/etc/dhcpc/dhcpcd-$dev.pid");
+}
+
+sub drop_pppd_connection
+{
+ my ($dev) = @_;
+ &gst_process_kill_by_pidfile ("$dev.pid");
+}
+
+sub gst_network_enable_iface_with_config
+{
+ my ($hash) = @_;
+ my ($command_ifconfig, $command_iwconfig);
+ my ($command_pppd, $command_chat);
+ my ($dev, $command, $ret);
+
+ $command_ifconfig = "ifconfig";
+ $command_iwconfig = "iwconfig";
+ $command_pppd = "pppd";
+ $command_chat = gst_file_locate_tool ("chat");
+
+ $dev = $$hash{"dev"};
+
+ $command = "$command_ifconfig $dev down";
+ $ret = &gst_file_run ($command);
+
+ &drop_dhcp_connection ($dev);
+ &drop_pppd_connection ($dev);
+
+ if (exists ($$hash{"configuration"}))
+ {
+ if (exists ($$hash{"configuration"}{"phone_number"}))
+ {
+ $login = $$hash{"configuration"}{"login"};
+ $pw = $$hash{"configuration"}{"password"};
+
+ &gst_network_set_pap_passwd ("/etc/ppp/pap-secrets", $login, $pw);
+ &gst_network_set_pap_passwd ("/etc/ppp/chap-secrets", $login, $pw);
+
+ if (&gst_network_check_pppd_plugin ("capiplugin"))
+ {
+ $ret = &gst_network_enable_isdn ($hash, $dev, $command_pppd);
+ }
+ else
+ {
+ $ret = &gst_network_enable_modem ($hash, $dev, $command_pppd, $command_chat);
+ }
+ }
+ else
+ {
+ # if it's a wireless interface, put first the essid
+ &gst_network_config_wireless ($hash, $dev, $command_iwconfig, $command_ifconfig);
+ $ret = &gst_network_enable_iface ($hash, $dev, $command_ifconfig);
+ }
+ }
+
+ return $ret;
+}
+
+# Tries to detect modem in a closed list of devices
+sub gst_network_autodetect_modem
+{
+ my (@arr);
+
+ if ($$tool{"system"} eq "Linux")
+ {
+ @arr = ("/dev/modem", "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3");
+
+ $pid = `pidof pppd 2>/dev/null`;
+
+ if ($pid =~ /\d/) {
+ return;
+ }
+ }
+ elsif ($$tool{"system"} eq "FreeBSD")
+ {
+ @arr = ("/dev/modem", "/dev/cuaa0", "/dev/cuaa1", "/dev/cuaa2", "/dev/cuaa3");
+ }
+
+ foreach $tty (@arr) {
+ $temp = `pppd lcp-max-configure 1 nodetach noauth nocrtscts $tty connect \"chat -t1 \'\' AT OK\" 2>/dev/null`;
+
+ if ($temp =~ /established/) {
+ return $tty;
+ }
+ }
+}
+
+# Parse <interface>...</interface>. Put here so it can be shared with internetsharing.
+sub gst_network_xml_parse_interface_config
+{
+ my ($tree) = @_;
+ my (%config);
+
+ shift @$tree;
+
+ while ($elem = shift @$tree)
+ {
+ $config{$elem} = &gst_xml_get_pcdata (shift @$tree);
+ }
+
+ return \%config;
+}
+
+sub gst_network_xml_parse_interface
+{
+ my ($tree, $interface) = @_;
+ my (%hash, $aux, $dev, $elem);
+
+ shift @$tree;
+
+ while ($elem = shift @$tree)
+ {
+ if ($elem eq "configuration")
+ {
+ $aux = &gst_network_xml_parse_interface_config (shift @$tree);
+ $hash{$elem} = $aux if ($aux ne undef);
+ }
+ else
+ {
+ $hash{$elem} = &gst_xml_get_pcdata (shift @$tree);
+ }
+ }
+
+ if (($hash{"configuration"} ne undef) &&
+ ($hash{"configuration"}{"file"} ne undef))
+ {
+ $dev = $hash{"configuration"}{"file"};
+ }
+ else
+ {
+ $dev = &gst_network_get_file (\%hash);
+ $hash{"configuration"}{"file"} = $dev if ($hash{"configuration"} ne undef);
+ }
+
+ $$interface{$dev} = \%hash;
+ return \%hash;
+}
+
+# Expects something like "132.248.10.2" and returns 4 bytes.
+sub gst_network_ipv4_str2vec
+{
+ my ($str) = @_;
+
+ return pack ('C4', split ('\.', $str));
+}
+
+# Converse
+sub gst_network_ipv4_vec2str
+{
+ my ($vec) = @_;
+
+ return join ('.', unpack ('C4', $vec));
+}
+
+# Gets the subnet, in bitmap.
+sub gst_network_ipv4_calc_subnet_vec
+{
+ my ($addr, $mask) = @_;
+ my ($addrvec, $maskvec);
+
+ $addrvec = &gst_network_ipv4_str2vec ($addr);
+ $maskvec = &gst_network_ipv4_str2vec ($mask);
+
+ return $addrvec & $maskvec;
+}
+
+# What you're looking for.
+sub gst_network_ipv4_calc_subnet
+{
+ my ($addr, $mask) = @_;
+
+ return &gst_network_ipv4_vec2str (&gst_network_ipv4_calc_subnet_vec);
+}
+
+# The broadcast, bitmap.
+sub gst_network_ipv4_calc_bcast_vec
+{
+ my ($addr, $mask) = @_;
+
+ $addrvec = &gst_network_ipv4_str2vec ($addr);
+ $maskvec = &gst_network_ipv4_str2vec ($mask);
+
+ return $addrvec | ~$maskvec;
+}
+
+# And this returning the quad-dot notation.
+sub gst_network_ipv4_calc_bcast
+{
+ my ($addr, $mask) = @_;
+
+ return &gst_network_ipv4_vec2str (&gst_network_ipv4_calc_bcast_vec);
+}
+
+
+# Selects a ping command, which must ping just twice, with
+# one second interval, returning numeric IPs to the given
+# broadcast address.
+sub gst_network_get_broadcast_ping_cmd
+{
+ my ($bcast) = @_;
+ my ($tool_ping);
+
+ my %cmd_map =
+ (
+ "debian-2.2" => "ping -c 2 -i 1 -n $bcast",
+ "redhat-6.2" => "ping -c 2 -i 1 -n -b $bcast"
+ );
+ my %dist_map =
+ (
+ "redhat-6.0" => "redhat-6.2",
+ "redhat-6.1" => "redhat-6.2",
+ "redhat-6.2" => "redhat-6.2",
+ "redhat-7.0" => "redhat-6.2",
+ "redhat-7.1" => "redhat-6.2",
+ "redhat-7.2" => "redhat-6.2",
+ "redhat-8.0" => "redhat-6.2",
+ "redhat-9" => "redhat-6.2",
+ "rhel-5" => "redhat-6.2",
+ "rhel-6" => "redhat-6.2",
+ "openna-1.0" => "redhat-6.2",
+ "debian-2.2" => "debian-2.2",
+ "debian-3.0" => "debian-2.2",
+ "debian-3.1" => "debian-2.2",
+ "debian-4.0" => "debian-2.2",
+ "debian-5.0" => "debian-2.2",
+ "debian-testing" => "debian-2.2",
+ "ubuntu-5.04" => "debian-2.2",
+ "ubuntu-5.10" => "debian-2.2",
+ "ubuntu-6.06" => "debian-2.2",
+ "ubuntu-6.10" => "debian-2.2",
+ "ubuntu-7.04" => "debian-2.2",
+ "ubuntu-7.10" => "debian-2.2",
+ "ubuntu-8.04" => "debian-2.2",
+ "ubuntu-8.10" => "debian-2.2",
+ "ubuntu-9.04" => "debian-2.2",
+ "ubuntu-9.10" => "debian-2.2",
+ "ubuntu-10.10" => "debian-2.2",
+ "ubuntu-10.10" => "debian-2.2",
+ "mandrake-7.1" => "debian-2.2",
+ "mandrake-7.2" => "debian-2.2",
+ "mandrake-9.0" => "debian-2.2",
+ "mandrake-9.1" => "debian-2.2",
+ "mandrake-9.2" => "debian-2.2",
+ "mandrake-10.0" => "debian-2.2",
+ "mandrake-10.1" => "redhat-6.2",
+ "mandrake-10.2" => "redhat-6.2",
+ "mandriva-2006.0" => "redhat-6.2",
+ "mandriva-2006.1" => "redhat-6.2",
+ "mandriva-2007.0" => "redhat-6.2",
+ "mandriva-2007.1" => "redhat-6.2",
+ "yoper-2.2" => "redhat-6.2",
+ "blackpanther-4.0" => "debian-2.2",
+ "suse-7.0" => "debian-2.2",
+ "suse-9.0" => "redhat-6.2",
+ "suse-9.1" => "redhat-6.2",
+ "pld-1.0" => "redhat-6.2",
+ "pld-1.1" => "redhat-6.2",
+ "pld-1.99" => "redhat-6.2",
+ "conectiva-9" => "debian-2.2",
+ "conectiva-10" => "debian-2.2",
+ "fedora-1" => "redhat-6.2",
+ "fedora-2" => "redhat-6.2",
+ "fedora-3" => "redhat-6.2",
+ "fedora-4" => "redhat-6.2",
+ "fedora-5" => "redhat-6.2",
+ "fedora-15" => "redhat-6.2",
+ "fedora-16" => "redhat-6.2",
+ "fedora-17" => "redhat-6.2",
+ "rpath" => "redhat-6.2",
+ "vine-3.0" => "redhat-6.2",
+ "vine-3.1" => "redhat-6.2",
+ "ark" => "redhat-6.2",
+ "slackware-9.1.0" => "redhat-6.2",
+ "slackware-10.0.0" => "redhat-6.2",
+ "slackware-10.1.0" => "redhat-6.2",
+ "slackware-10.2.0" => "redhat-6.2",
+ "slackware-11.0.0" => "redhat-6.2",
+ "slackware-12.0.0" => "redhat-6.2",
+ "slackware-12.1.0" => "redhat-6.2",
+ "slackware-12.2.0" => "redhat-6.2",
+ "slackware-13.0.0" => "redhat-6.2",
+ "slackware-13.1.0" => "redhat-6.2",
+ "slackware-13.37.0" => "redhat-6.2",
+ "slackware-14.0.0" => "redhat-6.2",
+ "gentoo" => "debian-2.2",
+ "vlos-1.2" => "debian-2.2",
+ "freebsd-5" => "debian-2.2",
+ "freebsd-6" => "debian-2.2",
+ );
+
+ return $cmd_map{$dist_map{$gst_dist}};
+}
+
+
+# Run ping, taking what looks like the replying host addresses, return
+# colon-sepparated (:) string. To be used with gst_process_fork.
+sub gst_network_ping_broadcast_call
+{
+ my ($bcast) = @_;
+ my ($cmd, %hosts, $fd);
+
+ $cmd = &gst_network_get_broadcast_ping_cmd ($bcast);
+ $fd = &gst_file_run_pipe_read ($cmd);
+ return undef if $fd eq undef;
+ while (<$fd>)
+ {
+ if (/([0-9.]+):?[ \t]+icmp_seq/)
+ {
+ # If it already exists, it is the second count, and we can return then.
+ last if exists $hosts{$1};
+ $hosts{$1} = 1 ;
+ }
+ }
+ &gst_file_close ($fd);
+
+ return join (':', keys (%hosts));
+}
+
+
+# Return an array of IPs of the hosts in all the adjacent local networks.
+sub gst_network_find_hosts
+{
+ my ($iface, $ifaces, $dev, $hosts_str, @hosts, $proc, @procs);
+
+ $ifaces = &gst_network_interfaces_get_info ();
+
+ foreach $dev (keys %$ifaces)
+ {
+ $iface = $$ifaces{$dev};
+ if ($$iface{"active"} && exists $$iface{"bcast"})
+ {
+ push @procs, &gst_process_fork (\&gst_network_ping_broadcast_call, $$iface{"bcast"});
+ }
+ }
+
+ &gst_process_list_check_ready (3, \@procs);
+
+ foreach $proc (@procs)
+ {
+ if ($$proc{"ready"})
+ {
+ sysread ($$proc{"fd"}, $hosts_str, 4096);
+ push @hosts, split (':', $hosts_str);
+ }
+ }
+
+ return @hosts;
+}
+
+
+# like, &gst_network_lookup_address_block ("132.248.10.2") returns 'dns2.unam.mx'
+# but watch it: it will block until libc timeouts or a result is found. If
+# nothing found, returns the address.
+sub gst_network_lookup_address_block
+{
+ my ($addr) = @_;
+ my $name;
+
+ $name = (gethostbyaddr (&gst_network_ipv4_str2vec ($addr), AF_INET))[0];
+ return $addr if length ($name) == 0;
+ return $name;
+}
+
+
+# To be called from gst_process_fork by the child.
+sub gst_network_address_lookup_call
+{
+ my ($addr) = @_;
+
+ return &gst_network_lookup_address_block ($addr);
+}
+
+
+# Fork a lookup process for every passed address, return ref to
+# array with info on every proc.
+sub gst_network_lookup_address_start
+{
+ my (@addrs) = @_;
+ my ($addr, $proc, @procs);
+
+ # Fork a lookup for every address.
+ foreach $addr (@addrs)
+ {
+ $proc = &gst_process_fork (\&gst_network_address_lookup_call, $addr);
+ $$proc{"addr"} = $addr;
+ push @procs, $proc;
+ }
+
+ return \@procs;
+}
+
+# Take a ref to a list of forked lookup processes,
+# and collect the information from those ready.
+sub gst_network_lookup_address_collect
+{
+ my ($procs) = @_;
+ my ($name, @names, $proc);
+
+ # For every process, if the "ready" flag is on, read info.
+ # Else, populate with the given address. Then kill child and wait for it to die.
+ foreach $proc (@$procs)
+ {
+ if ($$proc{"ready"})
+ {
+ sysread ($$proc{"fd"}, $name, 4096);
+ push @names, $name;
+ }
+ else
+ {
+ push @names, $$proc{"addr"};
+ }
+ &gst_process_kill ($proc);
+ }
+
+ return @names;
+}
+
+
+# like, &gst_network_lookup_address (10, "132.248.10.2", "132.248.29.8") returns
+# 'dns2.unam.mx', 'sphinx.nuclecu.unam.mx' after 10 seconds, in the worst case.
+# If any of the given addresses is not resolved before timeout, the address will
+# be returned as its name. Timeout of 0 or undef blocks.
+# Timeout may be a decimal (0.5, half a second). You can split this process in
+# two, so you can collect the information at the last moment, giving more time for
+# the lookups to take place. Use the two functions above for this, as shown here.
+sub gst_network_lookup_address
+{
+ my ($timeout, @addrs) = @_;
+ my $procs;
+
+ $procs = &gst_network_lookup_address_start (@addrs);
+ &gst_process_list_check_ready ($timeout, $procs);
+ return &gst_network_lookup_address_collect ($procs);
+}
+
+
+# This code is not under the portable table style because it is supposed to
+# depend on wvdial.
+sub gst_network_dialing_get
+{
+ my %vars =
+ (
+ "Inherits" => "inherits",
+ "Modem" => "device",
+ "Baud" => "speed",
+ "Init1" => "init1",
+ "Init2" => "init2",
+ "Phone" => "phone",
+ "Username" => "login",
+ "Password" => "password",
+ "Dial Command" => "dialcmd",
+ "SetVolume" => "volume",
+ "Stupid mode" => "stupid",
+ "Auto Reconnect" => "persist",
+ "Force Address" => "address",
+ "Auto DNS" => "update_dns",
+ "Check Def Route" => "set_default_gw",
+ "GST Device" => "gst_dev",
+ "Dial Command" => "dial_command"
+ );
+ my %title2type =
+ (
+ "Dialer (.*)" => "dialer",
+ "Modem(.*)" => "modem"
+ );
+
+ my ($file) = @_;
+ my (%ret, @sections);
+ my ($i, $j, $name, $val);
+
+ &gst_report_enter ();
+ &gst_report ("network_dialing_get");
+
+ @sections = &gst_parse_ini_sections ($file);
+ foreach $i (@sections)
+ {
+ my %hash;
+
+ $hash{"type"} = "unknown";
+ foreach $j (keys %title2type)
+ {
+ if ($i =~ /$j/)
+ {
+ $hash{"name"} = $1;
+ $hash{"type"} = $title2type{$j};
+ }
+ }
+
+ $ret{$hash{"name"}} = \%hash;
+
+ foreach $j (keys %vars)
+ {
+ $val = &gst_parse_ini ($file, $i, $j);
+ $hash{$vars{$j}} = $val if ($val ne undef);
+ }
+
+ # we add the volume label, it's not a line in the wvdial config,
+ # it's a hayes command in the init2 string, it can be ATM0 or ATL[1-3]
+ if ($hash{"init2"} =~ /M0/)
+ {
+ $hash{"volume"} = 0;
+ }
+ elsif ($hash{"init2"} =~ /L[1-3]/)
+ {
+ $hash{"init2"} =~ /.*L([1-3]).*/;
+ $volume = ($1);
+ $hash{"volume"} = $volume;
+ }
+ else
+ {
+ $hash{"volume"} = 3;
+ }
+
+ # add the external line access number
+ if ($hash{"phone"} =~ /(^.*)[wW]/)
+ {
+ $hash{"external_line"} = $1;
+ $hash{"phone"} =~ s/^.*[wW]//;
+ }
+ }
+
+ &gst_report_leave ();
+ return \%ret;
+}
+
+# returns interface type depending on it's interface name
+# types_cache is a global var for caching interface types
+sub gst_network_get_interface_type
+{
+ my ($dev) = @_;
+ my (@wireless_ifaces, $wi, $type);
+
+ return $types_cache{$dev} if (exists $types_cache{$dev});
+
+ #check whether interface is wireless
+ $wireless_ifaces = &gst_network_get_wireless_ifaces ();
+ foreach $wi (@$wireless_ifaces)
+ {
+ if ($dev eq $wi)
+ {
+ $types_cache{$dev} = "wireless";
+ return $types_cache{$dev};
+ }
+ }
+
+ if ($dev =~ /^(ppp|tun)/)
+ {
+ # check whether the proper plugin exists
+ if (&gst_network_check_pppd_plugin ("capiplugin"))
+ {
+ $types_cache{$dev} = "isdn";
+ }
+ else
+ {
+ $types_cache{$dev} = "modem";
+ }
+ }
+ elsif ($dev =~ /^(eth|dc|ed|bfe|em|fxp|bge|de|xl|ixgb|txp|vx|lge|nge|pcn|re|rl|sf|sis|sk|ste|ti|tl|tx|vge|vr|wb|cs|ex|ep|fe|ie|lnc|sn|xe|le|an|awi|wi|ndis|wlaue|axe|cue|kue|rue|fwe|nve)[0-9]/)
+ {
+ $types_cache{$dev} = "ethernet";
+ }
+ elsif ($dev =~ /^irlan[0-9]/)
+ {
+ $types_cache{$dev} = "irlan";
+ }
+ elsif ($dev =~ /^plip[0-9]/)
+ {
+ $types_cache{$dev} = "plip";
+ }
+ elsif ($dev =~ /^lo[0-9]?/)
+ {
+ $types_cache{$dev} = "loopback";
+ }
+
+ return $types_cache{$dev};
+}
+
+sub gst_network_freebsd_interfaces_get_info
+{
+ my ($dev, %ifaces, $fd);
+
+ &gst_report_enter ();
+ &gst_report ("network_iface_active_get");
+
+ $fd = &gst_file_run_pipe_read ("ifconfig");
+ return {} if $fd eq undef;
+
+ while (<$fd>)
+ {
+ chomp;
+ if (/^([^ \t:]+):.*(<.*>)/)
+ {
+ $dev = $1;
+ $ifaces{$dev}{"dev"} = $dev;
+ $ifaces{$dev}{"enabled"} = 1 if ($2 =~ /[<,]UP[,>]/);
+ }
+
+ s/^[ \t]+//;
+ if ($dev)
+ {
+ $ifaces{$dev}{"hwaddr"} = $1 if /ether[ \t]+([^ \t]+)/i;
+ $ifaces{$dev}{"addr"} = $1 if /inet[ \t]+([^ \t]+)/i;
+ $ifaces{$dev}{"mask"} = $1 if /netmask[ \t]+([^ \t]+)/i;
+ $ifaces{$dev}{"bcast"} = $1 if /broadcast[ \t]+([^ \t]+)/i;
+ }
+ }
+
+ &gst_file_close ($fd);
+ &gst_report_leave ();
+ return \%ifaces;
+}
+
+sub gst_network_linux_interfaces_get_info
+{
+ my ($dev, %ifaces, $fd);
+
+ &gst_report_enter ();
+ &gst_report ("network_iface_active_get");
+
+ $fd = &gst_file_run_pipe_read ("ifconfig -a");
+ return {} if $fd eq undef;
+
+ while (<$fd>)
+ {
+ chomp;
+ if (/^([^ \t:]+)/)
+ {
+ $dev = $1;
+ $ifaces{$dev}{"enabled"} = 0;
+ $ifaces{$dev}{"dev"} = $dev;
+ }
+
+ s/^[ \t]+//;
+ if ($dev)
+ {
+ $ifaces{$dev}{"hwaddr"} = $1 if /HWaddr[ \t]+([^ \t]+)/i;
+ $ifaces{$dev}{"addr"} = $1 if /addr:([^ \t]+)/i;
+ $ifaces{$dev}{"mask"} = $1 if /mask:([^ \t]+)/i;
+ $ifaces{$dev}{"bcast"} = $1 if /bcast:([^ \t]+)/i;
+ $ifaces{$dev}{"enabled"} = 1 if /^UP[ \t]/i;
+ }
+ }
+
+ &gst_file_close ($fd);
+ &gst_report_leave ();
+ return \%ifaces;
+}
+
+sub gst_network_interfaces_get_info
+{
+ my (%ifaces);
+
+ $ifaces = &gst_network_linux_interfaces_get_info if ($$tool{"system"} eq "Linux");
+ $ifaces = &gst_network_freebsd_interfaces_get_info if ($$tool{"system"} eq "FreeBSD");
+
+ foreach $dev (keys %$ifaces)
+ {
+ #$$ifaces{$dev}{"enabled"} = 0 if $$ifaces{$dev}{"addr"} eq undef;
+ $$ifaces{$dev}{"type"} = &gst_network_get_interface_type ($dev);
+
+ #delete unknown ifaces
+ if ($$ifaces{$dev}{"type"} eq undef)
+ {
+ delete $$ifaces{$dev};
+ }
+ }
+
+ return $ifaces;
+}
+
+sub gst_network_active_interfaces_get
+{
+ my $fd;
+ my @ret = ();
+
+ &gst_report_enter ();
+ &gst_report ("network_iface_active_get");
+
+ $fd = &gst_file_run_pipe_read ("ifconfig");
+ return undef if $fd eq undef;
+
+ while (<$fd>)
+ {
+ chomp;
+ s/:? .*//;
+ next if /^$/;
+ push @ret, $_;
+ }
+
+ &gst_file_close ($fd);
+
+ &gst_report_leave ();
+ return @ret;
+}
+
+sub gst_network_freebsd5_active_interfaces_get
+{
+ my ($fd, @ret);
+
+ &gst_report_enter ();
+ &gst_report ("network_iface_active_get");
+
+ $fd = &gst_file_run_pipe_read ("ifconfig");
+ return undef if ($fd eq undef);
+
+ while (<$fd>)
+ {
+ chomp;
+ if (/^([\w\d]*):.*[<,]UP[,>]/)
+ {
+ push @ret, $1;
+ }
+ }
+
+ &gst_file_close ($fd);
+ &gst_report_leave ();
+
+ return @ret;
+}
+
+sub gst_network_suse70_active_interfaces_get
+{
+ my (@devs, $dev, @ret, $num);
+
+ @devs = &gst_network_active_interfaces_get ();
+
+ foreach $dev (@devs)
+ {
+ if ($dev ne "lo")
+ {
+ $num = &gst_network_suse70_parse_iface_num ("$gst_prefix/etc/rc.config", $dev);
+ push @ret, $num if $num != -1;
+ }
+ }
+
+ return @ret;
+}
+
+sub gst_network_interface_active
+{
+ my ($search_iface, $proc) = @_;
+ my @ifaces;
+
+ &gst_report_enter ();
+ &gst_report ("network_iface_is_active", $search_iface);
+
+ @ifaces = &$proc ();
+ while ($ifaces[0] ne "")
+ {
+ return 1 if (shift (@ifaces) eq $search_iface);
+ }
+
+ &gst_report_leave ();
+ return 0;
+}
+
+sub gst_network_interface_ensure_broadcast_and_network
+{
+ my ($iface) = @_;
+
+ if (exists $$iface{"netmask"} &&
+ exists $$iface{"address"})
+ {
+ if (! exists $$iface{"broadcast"})
+ {
+ $$iface{"broadcast"} = &gst_network_ipv4_calc_bcast ($$iface{"address"}, $$iface{"netmask"});
+ }
+
+ if (! exists $$iface{"network"})
+ {
+ $$iface{"network"} = &gst_network_ipv4_calc_subnet ($$iface{"address"}, $$iface{"netmask"});
+ }
+ }
+}
+
+sub gst_network_sysconfig_dir_ifaces_get_existing
+{
+ my ($dir) = @_;
+ my (@ret, $i, $name);
+ local *IFACE_DIR;
+
+ if (opendir IFACE_DIR, "$gst_prefix/$dir")
+ {
+ foreach $i (readdir (IFACE_DIR))
+ {
+ push @ret, $1 if ($i =~ /^ifcfg-(.+)$/);
+ }
+
+ closedir (IFACE_DIR);
+ }
+
+ return \@ret;
+}
+
+sub gst_network_sysconfig_rh62_ifaces_get_existing
+{
+ return @{&gst_network_sysconfig_dir_ifaces_get_existing ("/etc/sysconfig/network-scripts")};
+}
+
+sub gst_network_sysconfig_rh72_ifaces_get_existing
+{
+ my ($ret);
+
+ # This syncs /etc/sysconfig/network-scripts and /etc/sysconfig/networking
+ &gst_file_run ("redhat-config-network-cmd");
+
+ $ret = &gst_network_sysconfig_dir_ifaces_get_existing
+ ("/etc/sysconfig/networking/profiles/default");
+
+ &gst_arr_merge ($ret,
+ &gst_network_sysconfig_dir_ifaces_get_existing
+ ("/etc/sysconfig/networking/devices"));
+
+ return @$ret;
+}
+
+sub gst_network_debian_ifaces_get_existing
+{
+ my (@ret, @stanzas, $stanza);
+
+ @stanzas = &gst_parse_interfaces_stanzas ("$gst_prefix/etc/network/interfaces", "iface");
+
+ foreach $stanza (@stanzas)
+ {
+ if ($$stanza[1] eq "inet")
+ {
+ push @ret, $$stanza[0];
+ }
+ }
+
+ return @ret;
+}
+
+sub gst_network_suse70_ifaces_get_existing
+{
+ my $file = "$gst_prefix/etc/rc.config";
+ my ($i, $dev, @ret, $fd);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ return @ret if !$fd;
+
+ while ($i = <$fd>)
+ {
+ if ($i =~ /^[ \t]*NETDEV_([0-9]+)=/)
+ {
+ push @ret, $1 if &gst_parse_sh ($file, "NETDEV_$1") ne "";
+ }
+ }
+
+ &gst_file_close ($fd);
+ return @ret;
+}
+
+sub gst_network_suse90_ifaces_get_existing
+{
+ return @{&gst_network_sysconfig_dir_ifaces_get_existing ("/etc/sysconfig/network")};
+}
+
+sub gst_network_sysconfig_pld10_ifaces_get_existing
+{
+ return @{&gst_network_sysconfig_dir_ifaces_get_existing ("/etc/sysconfig/interfaces")};
+}
+
+sub gst_network_slackware91_ifaces_get_existing
+{
+ my $file = "/etc/rc.d/rc.inet1.conf";
+ my $pppscript = "/etc/ppp/pppscript";
+ my ($fd, $i, @ret);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ return @ret if !$fd;
+
+ while ($i = <$fd>)
+ {
+ if ($i =~ /^[ \t]*(IPADDR|USE_DHCP)\[([0-9]+)\][ \t]*=[ \t]*"(.*)"/)
+ {
+ push @ret, "eth$2" if ($3 ne "");
+ }
+ }
+
+ &gst_file_close ($fd);
+
+ if (&gst_file_exists ($pppscript))
+ {
+ push @ret, "ppp0";
+ }
+
+ return @ret;
+}
+
+sub gst_network_gentoo_ifaces_get_existing
+{
+ my $file = "/etc/conf.d/net";
+ my ($fd, $i, @ret, $ppp);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ return @ret if !$fd;
+
+ while ($i = <$fd>)
+ {
+ if ($i =~ /^config_([a-zA-Z0-9]*)[ \t]*=/)
+ {
+ push @ret, $1;
+ }
+ }
+
+ #now the PPP ifaces
+ foreach $ppp (</etc/conf.d/net.*>)
+ {
+ $ppp =~ s#^/etc/conf.d/net\.##;
+ push @ret, $ppp if ($ppp =~ /^ppp[0-9]$/);
+ }
+
+ return @ret;
+}
+
+sub gst_network_freebsd_ifaces_get_existing
+{
+ my $file = "/etc/rc.conf";
+ my ($fd, $i, @ret);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ return @ret if !$fd;
+
+ while ($i = <$fd>)
+ {
+ if ($i =~ /^ifconfig_(.*)[ \t]*=/)
+ {
+ push @ret, $1;
+ }
+ }
+
+ return @ret;
+}
+
+sub gst_network_suse70_parse_iface_num
+{
+ my ($file, $dev) = @_;
+ my ($i, $ret);
+
+ foreach $i (&gst_network_suse70_ifaces_get_existing ())
+ {
+ $ret = &gst_parse_sh ($file, "NETDEV_$i");
+ return $i if $ret eq $dev;
+ }
+
+ &gst_debug_print_string ("\n\nWarning: gst_network_suse70_parse_iface_num: num for $dev not found.\n\n");
+ return -1;
+}
+
+sub gst_network_suse70_parse_iface_auto
+{
+ my ($file, $iface, $key) = @_;
+ my ($val, $i);
+
+ $val = &gst_parse_sh_split ($file, $key, "[ \t]+");
+
+ foreach $i (@$val)
+ {
+ return 1 if $i eq "_$iface";
+ }
+
+ return 0;
+}
+
+sub gst_network_suse70_replace_iface_auto
+{
+ my ($file, $iface, $key, $value) = @_;
+ my ($val, $i, $found, @ret);
+
+ $val = &gst_parse_sh_split ($file, $key, "[ \t]+");
+
+ foreach $i (@$val)
+ {
+ $found = 1 if $i eq "_$iface";
+ push @ret, $i unless ($i eq "_$iface" && !$value);
+ }
+
+ return 0 if ($found == $value);
+ push @ret, "_$iface" if (!$found && $value);
+
+ return &gst_replace_sh ($file, $key, join (" ", @ret));
+}
+
+sub gst_network_suse70_parse_iface_sh
+{
+ my ($file, $iface, $key) = @_;
+ my ($val, $num);
+
+ return &gst_parse_sh ($file, "${key}_$iface");
+}
+
+sub gst_network_suse70_replace_iface_sh
+{
+ my ($file, $iface, $key, $value) = @_;
+ my ($val, $num);
+
+ return &gst_replace_sh ($file, "${key}_$iface", $value);
+}
+
+sub gst_network_suse70_get_ifconfig_arg
+{
+ my ($file, $iface, $key) = @_;
+ my ($val);
+
+ $val = &gst_network_suse70_parse_iface_sh ($file, $iface, "IFCONFIG");
+ $val =~ /[ \t]+$key[ \t]+([^ \t]+)/;
+ return $1;
+}
+
+sub gst_network_suse70_set_ifconfig_arg
+{
+ my ($file, $iface, $key, $value) = @_;
+ my ($val);
+
+ $val = &gst_network_suse70_parse_iface_sh ($file, $iface, "IFCONFIG");
+
+ return 0 if $val =~ /^dhcpclient$/ || $val =~ /^bootp$/;
+
+ if (! ($val =~ s/([ \t]+$key[ \t]+)[^ \t]+/$1$value/))
+ {
+ $val =~ s/[ \t]+up$//;
+ $val .= " " if $val =~ /[^ \t]$/;
+ $val .= "$key $value up";
+ }
+
+ return &gst_network_suse70_replace_iface_sh ($file, $iface, "IFCONFIG", $val);
+}
+
+sub gst_network_suse70_set_ifconfig_ip
+{
+ my ($file, $iface, $value) = @_;
+
+ $val = &gst_network_suse70_parse_iface_sh ($file, $iface, "IFCONFIG");
+
+ return 0 if $val =~ /^dhcpclient$/ || $val =~ /^bootp$/;
+
+ if (! ($val =~ s/^[0-9\.]+([ \t])/$value$1/))
+ {
+ $val = "$value $val";
+ $val =~ s/[ \t]+/ /;
+ }
+
+ return &gst_network_suse70_replace_iface_sh ($file, $iface, "IFCONFIG", $val);
+}
+
+sub gst_network_get_new_dialing_dev
+{
+ my ($dial_hash, $type) = @_;
+ my ($dial, $dev, $maxdev);
+
+ $maxdev = -1;
+ foreach $dial (keys %$dial_hash)
+ {
+ $dev = $ {$$dial_hash{$dial}}{"gst_dev"};
+ if ($dev ne "")
+ {
+ if ($dev =~ s/^$type//)
+ {
+ $maxdev = $dev if $dev > $maxdev;
+ }
+ }
+ }
+
+ $maxdev ++;
+ return "$type$maxdev";
+}
+
+sub gst_network_dial2iface
+{
+ my ($dial_hash, $name) = @_;
+ my ($dial, %iface, $i);
+
+ my %map = ("address" => "address",
+ "update_dns" => "update_dns",
+ "login" => "login",
+ "password" => "password",
+ "serial_port" => "device",
+ "serial_speed" => "speed",
+ "set_default_gw" => "set_default_gw",
+ "persist" => "persist",
+ "phone_number" => "phone",
+ "dev" => "gst_dev"
+ );
+
+ $dial = $$dial_hash{$name};
+ if ($$dial{"gst_dev"} eq "")
+ {
+ $$dial{"gst_dev"} = "ppp0";
+ # = &gst_network_get_new_dialing_dev ($dial_hash, "ppp");
+ }
+ else
+ {
+ $iface{"enabled"} = &gst_network_interface_active ($$dial{"gst_dev"},
+ \&gst_network_active_interfaces_get)? 1: 0;
+ }
+
+ foreach $i (keys %map)
+ {
+ $iface{$i} = $$dial{$map{$i}} if exists $$dial{$map{$i}};
+ }
+
+ $iface{"file"} = $iface{"name"} = $iface{"section"} = $name;
+ $iface{"update_dns"} = 1 if ($iface{"update_dns"} eq "");
+ $iface{"set_default_gw"} = 1 if ($iface{"set_default_gw"} eq "");
+
+ return \%iface;
+}
+
+sub gst_network_iface2dial
+{
+ my ($dial_hash, $iface) = @_;
+ my ($dial, $i);
+
+ my %map = ("address" => "address",
+ "update_dns" => "update_dns",
+ "device" => "serial_port",
+ "speed" => "serial_speed",
+ "set_default_gw" => "set_default_gw",
+ "persist" => "persist",
+ "gst_dev" => "dev"
+ );
+
+ $dial = $$dial_hash{$$iface{"name"}};
+
+ foreach $i (keys %map)
+ {
+ $$dial{$i} = $$iface{$map{$i}} if exists $$iface{$map{$i}};
+ }
+
+ $$dial{"type"} = "dialer";
+}
+
+sub gst_network_suse70_get_ppp
+{
+ my ($dial, $iface) = @_;
+ my ($d);
+
+ foreach $d (keys %$dial)
+ {
+ $$iface{$d} = &gst_network_dial2iface ($dial, $d);
+ }
+
+ return $iface;
+}
+
+sub gst_network_suse70_set_ppp
+{
+ my ($wvfile, $dial, $iface) = @_;
+ my ($d, $i, @ppp_devs, $section);
+
+ foreach $d (keys %$iface)
+ {
+ $i = $$iface{$d};
+ if ($$i{"dev"} =~ /^ppp/)
+ {
+ my ($tmp, $wv, $name);
+
+ push @ppp_devs, $i;
+
+ # This takes care of connection name changes.
+ $wv = $$i{"section"};
+ $name = $$i{"name"};
+
+ if ($wv ne $name)
+ {
+ $tmp = $$dial{$wv};
+ delete $$dial{$wv};
+ $$tmp{"name"} = $name;
+ $$dial{$name} = $tmp;
+ }
+
+ # Then merges interface with dialing.
+ &gst_network_iface2dial ($dial, $i);
+ }
+ }
+
+ # Delete any wvdial sections that are no longer present as ifaces.
+ OUTER: foreach $d (keys %$dial)
+ {
+ foreach $i (@ppp_devs)
+ {
+ next OUTER if $$i{"name"} eq $ {$$dial{$d}}{"name"};
+ }
+
+ # Don't delete the defaults: that's not very polite.
+ delete $$dial{$d} unless $ {$$dial{$d}}{"name"} eq "Defaults";
+ }
+
+ return 0;
+}
+
+sub gst_network_suse70_ppp_iface_activate
+{
+ my ($name, $enabled);
+ my ($wvdial_dod, $tool_ifconfig, @paths);
+
+ @paths = &gst_service_sysv_get_paths ();
+ $wvdial_dod = $paths[1] . "/wvdial.dod";
+ $tool_ifconfig = &gst_file_locate_tool ("ifconfig");
+
+ if ($enabled)
+ {
+ &gst_debug_print_string ("\n\nifup ppp iface $name\n\n");
+ return -1 if &gst_file_run_bg ("$wvdial_dod start \"$name\"");
+ }
+ else
+ {
+ # Hmm... you'd better not have more than one ppp connection active:
+ # this is the only SuSE way of doing it.
+ &gst_debug_print_string ("\n\nifdown ppp iface $name\n\n");
+ return -1 if &gst_file_run ("$wvdial_dod stop");
+ }
+
+ return 0;
+}
+
+sub gst_network_suse70_activate_ppp
+{
+ my ($iface) = @_;
+ my ($d, $i);
+
+ foreach $d (keys %$iface)
+ {
+ $i = $$iface{$d};
+ if ($$i{"dev"} =~ /^ppp/ && (! $$i{"enabled"}))
+ {
+ &gst_network_suse70_ppp_iface_activate ($$i{"name"}, 0);
+ # deleted, so interfaces_set doesn't handle them.
+ delete $$iface{$d};
+ }
+ }
+
+ foreach $d (keys %$iface)
+ {
+ $i = $$iface{$d};
+ if ($$i{"dev"} =~ /^ppp/ && $$i{"enabled"})
+ {
+ &gst_network_suse70_ppp_iface_activate ($$i{"name"}, 1);
+ delete $$iface{$d};
+ }
+ }
+
+ return 0;
+}
+
+sub gst_network_slackware91_create_pppgo
+{
+ my ($pppgo) = "/usr/sbin/ppp-go";
+ my ($contents, $pppd, $chat);
+ local *FILE;
+
+ if (!&gst_file_exists ($pppgo))
+ {
+ $pppd = &gst_file_locate_tool ("pppd");
+ $chat = &gst_file_locate_tool ("chat");
+
+ # create a simple ppp-go from scratch
+ # this script is based on the one that's created by pppsetup
+ $contents = "killall -INT pppd 2>/dev/null \n";
+ $contents .= "rm -f /var/lock/LCK* /var/run/ppp*.pid \n";
+ $contents .= "( $pppd connect \"$chat -v -f /etc/ppp/pppscript\") || exit 1 \n";
+ $contents .= "exit 0 \n";
+
+ &gst_file_buffer_save ($contents, $pppgo);
+ chmod 0777, "$gst_prefix/$pppgo";
+ }
+}
+
+sub gst_network_get_modem_volume
+{
+ my ($file) = @_;
+ my ($volume);
+
+ $volume = &gst_parse_chat ($file, "AT.*(M0|L[1-3])");
+
+ return 3 if ($volume eq undef);
+
+ $volume =~ s/^[ml]//i;
+ return $volume;
+}
+
+sub gst_network_set_modem_volume_string
+{
+ my ($file, $key, $volume) = @_;
+ my ($vol);
+
+ if ($volume == 0) { $vol = "ATM0" }
+ elsif ($volume == 1) { $vol = "ATL1" }
+ elsif ($volume == 2) { $vol = "ATL2" }
+ else { $vol = "ATL3" }
+
+ return &gst_replace_sh ($file, $key, $vol);
+}
+
+sub gst_network_set_modem_volume
+{
+ my ($file, $volume) = @_;
+ my $line;
+
+ $line = &gst_parse_chat ($file, "AT([^DZ][a-z0-9&]+)");
+ $line =~ s/(M0|L[1-3])//g;
+
+ if ($volume == 0) { $line .= "M0"; }
+ elsif ($volume == 1) { $line .= "L1"; }
+ elsif ($volume == 2) { $line .= "L2"; }
+ else { $line .= "L3"; }
+
+ return &gst_replace_chat ($file, "AT([^DZ][a-z0-9&]+)", $line);
+}
+
+sub gst_network_create_pppscript
+{
+ my ($pppscript) = @_;
+ my ($contents);
+
+ if (!&gst_file_exists ($pppscript))
+ {
+ # create a template file from scratch
+ $contents = 'TIMEOUT 60' . "\n";
+ $contents .= 'ABORT ERROR' . "\n";
+ $contents .= 'ABORT BUSY' . "\n";
+ $contents .= 'ABORT VOICE' . "\n";
+ $contents .= 'ABORT "NO CARRIER"' . "\n";
+ $contents .= 'ABORT "NO DIALTONE"' . "\n";
+ $contents .= 'ABORT "NO DIAL TONE"' . "\n";
+ $contents .= 'ABORT "NO ANSWER"' . "\n";
+ $contents .= '"" "ATZ"' . "\n";
+ $contents .= '"" "AT&FH0"' . "\n";
+ $contents .= 'OK-AT-OK "ATDT000000000"' . "\n";
+ $contents .= 'TIMEOUT 75' . "\n";
+ $contents .= 'CONNECT' . "\n";
+
+ &gst_file_buffer_save ($contents, $pppscript);
+ }
+}
+
+sub gst_network_create_isdn_options
+{
+ my ($file) = @_;
+
+ if (!&gst_file_exists ($file))
+ {
+ &gst_file_copy_from_stock ("general_isdn_ppp_options", $file);
+ }
+}
+
+sub gst_network_check_pppd_plugin
+{
+ my ($plugin) = @_;
+ my ($version, $output);
+
+ $version = &gst_file_run_backtick ("pppd --version", 1);
+ $version =~ s/.*version[ \t]+//;
+ chomp $version;
+
+ return 0 if !version;
+ return &gst_file_exists ("/usr/lib/pppd/$version/$plugin.so");
+}
+
+sub gst_network_gentoo_parse_gateway
+{
+ my ($file, $iface) = @_;
+ my ($str);
+
+ $str = &gst_parse_confd_net ($file, "routes_$iface");
+
+ if ($str =~ /default[ \t]+(via|gw)[ \t]+([0-9\.\:]*)/)
+ {
+ return $2;
+ }
+}
+
+sub gst_network_interfaces_get
+{
+ my (%dist_attrib, %config_hash, %hash, %fn);
+ my (@config_ifaces, $iface, $dev);
+ my ($dist, $value, $file, $proc);
+ my ($i, $j);
+ my ($modem_settings);
+
+ $hash = &gst_network_interfaces_get_info ();
+ %dist_attrib = &gst_network_get_interface_parse_table ();
+ %fn = %{$dist_attrib{"fn"}};
+ $proc = $dist_attrib{"ifaces_get"};
+ @ifaces = &$proc ();
+
+ # clear unneeded hash elements
+ foreach $i (keys %$hash)
+ {
+ delete $$hash{$i}{"addr"};
+ delete $$hash{$i}{"bcast"};
+ delete $$hash{$i}{"mask"};
+ }
+
+ foreach $i (@ifaces)
+ {
+ foreach $j (keys (%fn))
+ {
+ $ {$dist_attrib{"fn"}}{$j} = &gst_parse_expand ($fn{$j}, "iface", $i);
+ }
+
+ $iface = &gst_parse_from_table ($dist_attrib{"fn"},
+ $dist_attrib{"table"});
+ &gst_network_interface_ensure_broadcast_and_network ($iface);
+ $$iface{"file"} = $i if ($$iface{"file"} eq undef);
+
+ $dev = $$iface{"dev"};
+ delete $$iface{"dev"};
+
+ if (exists $$hash{$dev})
+ {
+ $$hash{$dev}{"configuration"} = $iface;
+ }
+ elsif (($dev eq "ppp0") || ($dev eq "tun0"))
+ {
+ $modem_settings = $iface;
+ }
+ }
+
+ # only show PPP and ISDN devices if pppd exists
+ # and they aren't configured yet
+ $dev = "ppp0" if ($$tool{"system"} eq "Linux");
+ $dev = "tun0" if ($$tool{"system"} eq "FreeBSD");
+
+ if (!exists $$hash{$dev} && &gst_file_locate_tool ("pppd"))
+ {
+ $$hash{$dev}{"dev"} = $dev;
+ $$hash{$dev}{"enabled"} = 0;
+ $$hash{$dev}{"type"} = &gst_network_get_interface_type ($dev);
+ $$hash{$dev}{"configuration"} = $modem_settings if ($modem_settings);
+ }
+
+ return \%$hash;
+}
+
+sub gst_network_conf_get
+{
+ my %dist_attrib;
+ my $hash;
+
+ %dist_attrib = &gst_network_get_parse_table ();
+
+ $hash = &gst_parse_from_table ($dist_attrib{"fn"},
+ $dist_attrib{"table"});
+ return $hash;
+}
+
+sub gst_network_rh_get_smb_desc
+{
+ my ($file, $section, $var, $hostname) = @_;
+ my $val;
+
+ $val = &gst_parse_ini ($file, $section, $var);
+ if (($val =~ /^Samba Server/) && ($hostname ne undef))
+ {
+ return $hostname;
+ }
+
+ return $val;
+}
+
+sub gst_network_rh62_get_file
+{
+ my ($iface) = @_;
+ my ($pre, $i, $dev);
+
+ $dev = $$iface{"dev"};
+ $pre = "$gst_prefix/etc/sysconfig/network-scripts/ifcfg-";
+
+ return $dev if ! -e "$pre$dev";
+
+ $dev =~ s/[0-9]*$//;
+
+ $i = 0;
+ $i ++ while (-e "$pre$dev$i");
+
+ return "$dev$i";
+}
+
+sub gst_network_rh72_get_file
+{
+ my ($iface) = @_;
+ my ($pre, $i, $dev);
+
+ $dev = $$iface{"dev"};
+ $pre = "$gst_prefix/etc/sysconfig/networking/devices/ifcfg-";
+
+ return $dev if ! -e "$pre$dev";
+
+ $i = 0;
+ $i ++ while (-e "$pre$dev.$i");
+
+ return "$dev.$i";
+}
+
+sub gst_network_deb22_get_file
+{
+ my ($iface) = @_;
+
+ return $$iface{"dev"};
+}
+
+sub gst_network_suse70_get_file
+{
+ my ($i, $file);
+
+ $file = "$gst_prefix/etc/rc.config";
+
+ $i = 0;
+ $i ++ while (&gst_parse_sh ($file, "NETDEV_$i") ne "");
+
+ return $i;
+}
+
+sub gst_network_pld10_get_file
+{
+ my ($iface) = @_;
+ my ($pre, $i, $dev);
+
+ $dev = $$iface{"dev"};
+ $pre = "$gst_prefix/etc/sysconfig/interfaces/ifcfg-";
+
+ return $dev if ! -e "$pre$dev";
+
+ $dev =~ s/[0-9]*$//;
+
+ $i = 0;
+ $i ++ while (-e "$pre$dev$i");
+
+ return "$dev$i";
+}
+
+sub gst_network_get_file
+{
+ my ($iface) = @_;
+ my $proc;
+
+ my %dist_map =
+ (
+ "redhat-6.0" => \&gst_network_rh62_get_file,
+ "redhat-6.1" => \&gst_network_rh62_get_file,
+ "redhat-6.2" => \&gst_network_rh62_get_file,
+ "redhat-7.0" => \&gst_network_rh62_get_file,
+ "redhat-7.1" => \&gst_network_rh62_get_file,
+ "redhat-7.2" => \&gst_network_rh72_get_file,
+ "redhat-8.0" => \&gst_network_rh72_get_file,
+ "redhat-9" => \&gst_network_rh72_get_file,
+ "rhel-5" => \&gst_network_rh72_get_file,
+ "rhel-6" => \&gst_network_rh72_get_file,
+ "openna-1.0" => \&gst_network_rh62_get_file,
+ "mandrake-7.2" => \&gst_network_rh62_get_file,
+ "mandrake-7.1" => \&gst_network_rh62_get_file,
+ "mandrake-9.0" => \&gst_network_rh62_get_file,
+ "mandrake-9.1" => \&gst_network_rh62_get_file,
+ "mandrake-9.2" => \&gst_network_rh62_get_file,
+ "mandrake-10.0" => \&gst_network_rh62_get_file,
+ "mandrake-10.1" => \&gst_network_rh62_get_file,
+ "mandrake-10.2" => \&gst_network_rh62_get_file,
+ "mandriva-2006.0" => \&gst_network_rh62_get_file,
+ "mandriva-2006.1" => \&gst_network_rh62_get_file,
+ "mandriva-2007.0" => \&gst_network_rh62_get_file,
+ "mandriva-2007.1" => \&gst_network_rh62_get_file,
+ "yoper-2.2" => \&gst_network_rh62_get_file,
+ "blackpanther-4.0" => \&gst_network_rh62_get_file,
+ "conectiva-9" => \&gst_network_rh62_get_file,
+ "conectiva-10" => \&gst_network_rh62_get_file,
+ "debian-2.2" => \&gst_network_deb22_get_file,
+ "debian-3.0" => \&gst_network_deb22_get_file,
+ "debian-3.1" => \&gst_network_deb22_get_file,
+ "debian-4.0" => \&gst_network_deb22_get_file,
+ "debian-5.0" => \&gst_network_deb22_get_file,
+ "debian-testing" => \&gst_network_deb22_get_file,
+ "ubuntu-5.04" => \&gst_network_deb22_get_file,
+ "ubuntu-5.10" => \&gst_network_deb22_get_file,
+ "ubuntu-6.06" => \&gst_network_deb22_get_file,
+ "ubuntu-6.10" => \&gst_network_deb22_get_file,
+ "ubuntu-7.04" => \&gst_network_deb22_get_file,
+ "ubuntu-7.10" => \&gst_network_deb22_get_file,
+ "ubuntu-8.04" => \&gst_network_deb22_get_file,
+ "ubuntu-8.10" => \&gst_network_deb22_get_file,
+ "ubuntu-9.04" => \&gst_network_deb22_get_file,
+ "ubuntu-9.10" => \&gst_network_deb22_get_file,
+ "ubuntu-10.04" => \&gst_network_deb22_get_file,
+ "ubuntu-10.10" => \&gst_network_deb22_get_file,
+ "suse-7.0" => \&gst_network_suse70_get_file,
+ "suse-9.0" => \&gst_network_deb22_get_file,
+ "suse-9.1" => \&gst_network_deb22_get_file,
+ "turbolinux-7.0" => \&gst_network_rh62_get_file,
+ "pld-1.0" => \&gst_network_pld10_get_file,
+ "pld-1.1" => \&gst_network_pld10_get_file,
+ "pld-1.99" => \&gst_network_pld10_get_file,
+ "fedora-1" => \&gst_network_rh72_get_file,
+ "fedora-2" => \&gst_network_rh72_get_file,
+ "fedora-3" => \&gst_network_rh72_get_file,
+ "fedora-4" => \&gst_network_rh72_get_file,
+ "fedora-5" => \&gst_network_rh72_get_file,
+ "fedora-15" => \&gst_network_rh72_get_file,
+ "fedora-16" => \&gst_network_rh72_get_file,
+ "fedora-17" => \&gst_network_rh72_get_file,
+ "rpath" => \&gst_network_rh72_get_file,
+ "vine-3.0" => \&gst_network_rh62_get_file,
+ "vine-3.1" => \&gst_network_rh62_get_file,
+ "ark" => \&gst_network_rh62_get_file,
+ "slackware-9.1.0" => \&gst_network_deb22_get_file,
+ "slackware-10.0.0" => \&gst_network_deb22_get_file,
+ "slackware-10.1.0" => \&gst_network_deb22_get_file,
+ "slackware-10.2.0" => \&gst_network_deb22_get_file,
+ "slackware-11.0.0" => \&gst_network_deb22_get_file,
+ "slackware-12.0.0" => \&gst_network_deb22_get_file,
+ "slackware-12.1.0" => \&gst_network_deb22_get_file,
+ "slackware-12.2.0" => \&gst_network_deb22_get_file,
+ "slackware-13.0.0" => \&gst_network_deb22_get_file,
+ "slackware-13.1.0" => \&gst_network_deb22_get_file,
+ "slackware-13.37.0" => \&gst_network_deb22_get_file,
+ "slackware-14.0.0" => \&gst_network_deb22_get_file,
+ "gentoo" => \&gst_network_deb22_get_file,
+ "freebsd-5" => \&gst_network_deb22_get_file,
+ "freebsd-6" => \&gst_network_deb22_get_file,
+ );
+
+ $proc = $dist_map{$gst_dist};
+
+ return &$proc ($iface) if $proc;
+
+ # FIXME: should make us bail.
+ &gst_debug_print_string ("\n\nWarning: No network_get_file proc for dist $gst_dist.\n\n");
+ return undef;
+}
+
+sub gst_network_get_gateway_data
+{
+ my ($fd, $gateway, $dev);
+
+ $fd = &gst_file_run_pipe_read ("route -n");
+ while (<$fd>)
+ {
+ if (/^0\.0\.0\.0[\t ]+([^\t ]+).*[ \t]([a-zA-Z0-9]*)/)
+ {
+ $gateway = $1;
+ $dev = $2;
+ last;
+ }
+ }
+
+ &gst_file_close ($fd);
+ return ($gateway, $dev);
+}
+
+sub gst_network_get_default_gatewaydev
+{
+ my ($gateway, $dev) = &gst_network_get_gateway_data ();
+
+ return $dev;
+}
+
+sub gst_network_get_default_gateway
+{
+ my ($gateway, $dev) = &gst_network_get_gateway_data ();
+
+ return $gateway;
+}
+
+sub gst_network_route_set_default_gw
+{
+ my ($gatewaydev, $gateway) = @_;
+ my ($tool_route, $curr_gateway, $curr_gatewaydev, $fd);
+
+ # Just in case. This means that no static gateway is needed.
+ return if $gateway eq "";
+
+ $fd = &gst_file_run_pipe_read ("route -n");
+ while (<$fd>)
+ {
+ if (/^0\.0\.0\.0[ \t]+([0-9.]+) /)
+ {
+ $curr_gateway = $1;
+ if ($gatewaydev ne "")
+ {
+ /([a-z0-9]+)$/;
+ $curr_gatewaydev = $1;
+ }
+
+ last;
+ }
+ }
+ &gst_file_close ($fd);
+
+ if (($curr_gateway ne $gateway) ||
+ ($curr_gatewaydev ne $gatewaydev))
+ {
+ &gst_file_run ("route del default gw $curr_gateway");
+ &gst_file_run ("route add default gw $gateway $gatewaydev");
+ }
+}
+
+sub gst_network_run_hostname
+{
+ my ($hostname) = @_;
+
+ &gst_report_enter ();
+ &gst_report ("network_hostname_set", $hostname);
+ &gst_file_run ("hostname $hostname");
+ &gst_report_leave ();
+}
+
+sub gst_network_dialing_get_section_name
+{
+ my ($dial) = @_;
+
+ my %type2title =
+ (
+ "dialer" => "Dialer ",
+ "modem" => "Modem ",
+ "unknown" => ""
+ );
+
+ return $type2title{$$dial{"type"}} . $$dial{"name"};
+}
+
+sub gst_network_dialing_set
+{
+ my ($file, $old_hash, $values_hash) = @_;
+ my %vars =
+ (
+ "inherits" => "Inherits",
+ "device" => "Modem",
+ "speed" => "Baud",
+ "init1" => "Init1",
+ "init2" => "Init2",
+ "phone" => "Phone",
+ "login" => "Username",
+ "password" => "Password",
+ "dialcmd" => "Dial Command",
+ "setvol" => "SetVolume",
+ "stupid" => "Stupid mode",
+ "persist" => "Auto Reconnect",
+ "address" => "Force Address",
+ "update_dns" => "Auto DNS",
+ "set_default_gw" => "Check Def Route",
+ "gst_dev" => "GST Device",
+ "dial_command" => "Dial Command"
+ );
+
+ my (%hash, $section);
+ my $ret;
+ my ($i, $j);
+
+ &gst_report_enter ();
+ &gst_report ("network_dialing_set");
+ &gst_file_run ("wvdialconf $gst_prefix/$file") if (!-e "$gst_prefix/$file");
+
+ # Remove those that are in old, but not in values.
+ $old_hash = $$old_hash{"dialing"};
+ OUTER: foreach $i (keys %$old_hash)
+ {
+ foreach $j (keys %$values_hash)
+ {
+ next OUTER if ($j eq $i) && ($ {$$values_hash{$j}}{"type"} eq $ {$$old_hash{$i}}{"type"});
+ }
+
+ $section = gst_network_dialing_get_section_name ($$old_hash{$i});
+ $ret = -1 if &gst_replace_remove_ini_section ($file, $section);
+ }
+
+ # Now save the current stuff.
+ foreach $i (keys %$values_hash)
+ {
+ %hash = %{$$values_hash{$i}};
+
+ $section = gst_network_dialing_get_section_name (\%hash);
+ delete $hash{"type"};
+ delete $hash{"name"};
+
+ # if init1 doesnt exist add one with ATZ
+ if (!$hash{"init1"})
+ {
+ $hash{"init1"} = "ATZ";
+ }
+
+ # add the volume settings to init2
+ if ($hash{"init2"} !~ /^(AT)/)
+ {
+ $hash{"init2"} = "AT";
+ }
+ $hash {"init2"} =~ s/L[1-3]//;
+ $hash {"init2"} =~ s/M[0-2]//;
+ if ($hash{"volume"} == 0)
+ {
+ $hash{"init2"} .= "M0";
+ }
+ else
+ {
+ $volume = $hash{"volume"};
+ $hash {"init2"} .= "L$volume";
+ }
+ delete $hash {"volume"};
+
+ # join again the "external_line" and "phone" tags
+ if ($hash{"external_line"} ne undef)
+ {
+ $hash{"phone"} = $hash{"external_line"} . "W" . $hash{"phone"};
+ delete $hash{"external_line"};
+ }
+
+ foreach $j (keys %hash)
+ {
+ $ret = -1 if &gst_replace_ini ($file, $section, $vars{$j}, $hash{$j});
+ }
+ }
+
+ &gst_report_leave ();
+
+ chmod (0600, $file) if !$ret;
+
+ return $ret;
+}
+
+# This works for all systems that have ifup/ifdown scripts.
+sub gst_network_rh62_interface_activate_by_dev
+{
+ my ($dev, $enabled) = @_;
+
+ &gst_report_enter ();
+
+ if ($enabled)
+ {
+ &gst_report ("network_iface_activate", $dev);
+ return -1 if &gst_file_run ("ifup $dev");
+ }
+ else
+ {
+ &gst_report ("network_iface_deactivate", $dev);
+ return -1 if &gst_file_run ("ifdown $dev");
+ }
+
+ &gst_report_leave ();
+
+ return 0;
+}
+
+sub gst_network_rh62_interface_activate
+{
+ my ($hash, $old_hash, $enabled, $force) = @_;
+ my $dev;
+
+ if ($force || &gst_network_interface_changed ($hash, $old_hash))
+ {
+ if (exists $$hash{"configuration"}{"file"})
+ {
+ $dev = $$hash{"configuration"}{"file"};
+ }
+ else
+ {
+ $dev = $$hash{"dev"};
+ }
+
+ &gst_network_rh62_interface_activate_by_dev ($dev, $enabled);
+ }
+}
+
+sub gst_network_suse9_interface_activate
+{
+ my ($hash, $old_hash, $enabled, $force) = @_;
+ my ($iface, $dev);
+
+ if ($force || &gst_network_interface_changed ($hash, $old_hash))
+ {
+ if (exists $$hash{"configuration"}{"file"})
+ {
+ $iface = $$hash{"configuration"}{"file"};
+ $dev = &gst_network_suse9_get_dev_name ($iface);
+ }
+ else
+ {
+ $dev = $$hash{"dev"};
+ }
+
+ &gst_network_rh62_interface_activate_by_dev ($dev, $enabled);
+ }
+}
+
+sub gst_network_suse70_interface_activate_by_dev
+{
+ my ($dev, $enabled) = @_;
+ my ($network, @paths);
+
+ @paths = &gst_service_sysv_get_paths ();
+ $network = $paths[1] . "/network";
+
+ &gst_report_enter ();
+
+ if ($enabled)
+ {
+ &gst_report ("network_iface_deactivate", $hash{"dev"});
+ return -1 if &gst_file_run_bg ("$network start $dev");
+ }
+ else
+ {
+ &gst_report ("network_iface_activate", $hash{"dev"});
+ return -1 if &gst_file_run ("$network stop $dev");
+ }
+
+ &gst_report_leave ();
+
+ return 0;
+}
+
+sub gst_network_suse70_interface_activate
+{
+ my ($hash, $old_hash, $enabled, $force) = @_;
+
+ if ($force || &gst_network_interface_changed ($hash, $old_hash))
+ {
+ &gst_network_rh62_interface_activate_by_dev ($$hash{"dev"}, $enabled);
+ }
+}
+
+sub gst_network_slackware91_interface_activate_by_dev
+{
+ my ($dev, $enabled) = @_;
+ my ($address, $netmask, $gateway);
+ my ($file) = "/etc/rc.d/rc.inet1.conf";
+ my ($ret) = 0;
+
+ &gst_report_enter ();
+
+ if ($enabled)
+ {
+ &gst_report ("network_iface_activate", $dev);
+
+ if ($dev =~ /^ppp/)
+ {
+ $ret = &gst_file_run ("ppp-go");
+ }
+ else
+ {
+ if (&gst_parse_rcinet1conf_bool ($file, $dev, USE_DHCP))
+ {
+ # Use DHCP
+ $ret = &gst_file_run ("dhclient $dev");
+ }
+ else
+ {
+ $address = &gst_parse_rcinet1conf ($file, $dev, "IPADDR");
+ $netmask = &gst_parse_rcinet1conf ($file, $dev, "NETMASK");
+ $gateway = &gst_network_get_gateway ($file, "GATEWAY", $address, $netmask);
+
+ $ret = &gst_file_run ("ifconfig $dev $address netmask $netmask up");
+
+ # Add the gateway if necessary
+ if ($gateway ne undef)
+ {
+ &gst_file_run ("route add default gw $gateway");
+ }
+ }
+ }
+ }
+ else
+ {
+ &gst_report ("network_iface_deactivate", $dev);
+
+ $ret = &gst_file_run ("ifconfig $dev down") if ($dev =~ /^eth/);
+ $ret = &gst_file_run ("ppp-off") if ($dev =~ /^ppp/);
+ }
+
+ &gst_report_leave ();
+ return -1 if ($ret != 0);
+ return 0;
+}
+
+sub gst_network_slackware91_interface_activate
+{
+ my ($hash, $old_hash, $enabled, $force) = @_;
+ my $dev = $$hash{"configuration"}{"file"};
+
+ if ($force || &gst_network_interface_changed ($hash, $old_hash))
+ {
+ &gst_network_slackware91_interface_activate_by_dev ($dev, $enabled);
+ }
+}
+
+sub gst_network_gentoo_interface_activate_by_dev
+{
+ my ($dev, $enabled) = @_;
+ my $file = "/etc/init.d/net.$dev";
+ my $action = ($enabled == 1)? "start" : "stop";
+
+ return &gst_file_run ("$file $action");
+}
+
+sub gst_network_gentoo_interface_activate
+{
+ my ($hash, $old_hash, $enabled, $force) = @_;
+ my $dev = $$hash{"configuration"}{"file"};
+
+ if ($force || &gst_network_interface_changed ($hash, $old_hash))
+ {
+ &gst_network_gentoo_interface_activate_by_dev ($dev, $enabled);
+ }
+}
+
+sub gst_network_freebsd_interface_activate_by_dev
+{
+ my ($hash, $enabled) = @_;
+ my ($dev) = $$hash{"configuration"}{"file"};
+ my ($startif) = "/etc/start_if.$dev";
+ my ($file) = "/etc/rc.conf";
+ my ($command, $dhcp_flags, $defaultroute, $fd);
+
+ if ($enabled)
+ {
+ # Run the /etc/start_if.$dev commands
+ $fd = &gst_file_open_read_from_names ($startif);
+
+ while (<$fd>)
+ {
+ `$_`;
+ }
+
+ &gst_file_close ($fd);
+ $command = &gst_parse_sh ($file, "ifconfig_$dev");
+
+ # Bring up the interface
+ if ($command =~ /DHCP/i)
+ {
+ $dhcp_flags = &gst_parse_sh ($file, "dhcp_flags");
+ &gst_file_run ("dhclient $dhcp_flags $dev");
+ }
+ else
+ {
+ &gst_file_run ("ifconfig $dev $command");
+ }
+
+ # Add the default route
+ $default_route = &gst_parse_sh ($file, "defaultrouter");
+ &gst_file_run ("route add default $default_route") if ($default_route !~ /^no$/i);
+ }
+ else
+ {
+ &gst_file_run ("ifconfig $dev down");
+ }
+}
+
+sub gst_network_freebsd_interface_activate
+{
+ my ($hash, $old_hash, $enabled, $force) =@_;
+
+ if ($force || &gst_network_interface_changed ($hash, $old_hash))
+ {
+ &gst_network_freebsd_interface_activate_by_dev ($hash, $enabled);
+ }
+}
+
+sub gst_network_remove_pap_entry
+{
+ my ($file, $login) = @_;
+ my ($i, $buff);
+
+ &gst_report_enter ();
+ &gst_report ("network_remove_pap", $file, $login);
+
+ $buff = &gst_file_buffer_load ($file);
+
+ foreach $i (@$buff)
+ {
+ $i = "" if ($i =~ /^[ \t]*$login[ \t]/);
+ }
+
+ &gst_file_buffer_clean ($buff);
+ &gst_report_leave ();
+ return &gst_file_buffer_save ($buff, $file);
+}
+
+sub gst_network_rh62_interface_delete
+{
+ my ($old_hash) = @_;
+ my $dev = $$old_hash{"configuration"}{"file"};
+ my $file = "$gst_prefix/etc/sysconfig/network-scripts/ifcfg-$dev";
+ my $login;
+
+ &gst_network_rh62_interface_activate_by_dev ($dev, 0);
+
+ $login = $old_hash{"configuration"}{"login"};
+ if ($login ne "")
+ {
+ &gst_network_remove_pap_entry ("/etc/ppp/pap-secrets", $login);
+ &gst_network_remove_pap_entry ("/etc/ppp/chap-secrets", $login);
+ }
+
+ &gst_file_remove ($file);
+}
+
+sub gst_network_rh72_interface_delete
+{
+ my ($old_hash) = @_;
+ my ($dev, $login);
+
+ $filedev = $$old_hash{"configuration"}{"file"};
+ $dev = $$old_hash{"dev"};
+ $login = $$old_hash{"configuration"}{"login"};
+
+ &gst_network_rh62_interface_activate_by_dev ($filedev, 0);
+
+ if ($login ne "")
+ {
+ &gst_network_remove_pap_entry ("/etc/ppp/pap-secrets", $login);
+ &gst_network_remove_pap_entry ("/etc/ppp/chap-secrets", $login);
+ }
+
+ &gst_file_remove ("$gst_prefix/etc/sysconfig/networking/devices/ifcfg-$filedev");
+ &gst_file_remove ("$gst_prefix/etc/sysconfig/networking/profiles/default/ifcfg-$filedev");
+ &gst_file_remove ("$gst_prefix/etc/sysconfig/network-scripts/ifcfg-$dev");
+
+ &gst_file_run ("redhat-config-network-cmd");
+}
+
+sub gst_network_deb22_interface_delete
+{
+ my ($old_hash) = @_;
+ my $dev = $$old_hash{"dev"};
+
+ &gst_network_rh62_interface_activate_by_dev ($dev, 0);
+ &gst_replace_interfaces_iface_stanza_delete ("$gst_prefix/etc/network/interfaces", $dev);
+
+ $login = $old_hash{"configuration"}{"login"};
+ if ($login ne "")
+ {
+ &gst_network_remove_pap_entry ("/etc/ppp/pap-secrets", $login);
+ &gst_network_remove_pap_entry ("/etc/ppp/chap-secrets", $login);
+ }
+}
+
+sub gst_network_suse70_interface_delete
+{
+ my ($old_hash) = @_;
+ my $dev = $$old_hash{"configuration"}{"file"};
+ my $file = "$gst_prefix/etc/rc.config";
+ my $login;
+
+ &gst_network_suse70_interface_activate_by_dev ($$old_hash{"dev"}, 0);
+
+# Commented until I know what to do with ppp connections.
+# $login = $old_hash{"login"};
+# if ($login ne "")
+# {
+# &gst_network_remove_pap_entry ("/etc/ppp/pap-secrets", $login);
+# &gst_network_remove_pap_entry ("/etc/ppp/chap-secrets", $login);
+# }
+
+ &gst_replace_sh ($file, "IPADDR_$dev", "");
+ &gst_replace_sh ($file, "NETDEV_$dev", "");
+ &gst_replace_sh ($file, "IFCONFIG_$dev", "");
+}
+
+sub gst_network_suse90_interface_delete
+{
+ my ($old_hash) = @_;
+ my $file = $$old_hash{"configuration"}{"file"};
+ my $provider = &gst_parse_sh ("$gst_prefix/etc/sysconfig/network/ifcfg-$file", PROVIDER);
+ my $dev = &gst_network_suse9_get_dev_name ($file);
+
+ &gst_network_rh62_interface_activate_by_dev ($dev, 0);
+
+ &gst_file_remove ("$gst_prefix/etc/sysconfig/network/ifroute-$file");
+ &gst_file_remove ("$gst_prefix/etc/sysconfig/network/ifcfg-$file");
+ &gst_file_remove ("$gst_prefix/etc/sysconfig/network/providers/$provider");
+}
+
+sub gst_network_pld10_interface_delete
+{
+ my ($old_hash) = @_;
+ my $dev = $$old_hash{"configuration"}{"file"};
+ my $file = "$gst_prefix/etc/sysconfig/interfaces/ifcfg-$dev";
+ my $login;
+
+ &gst_network_rh62_interface_activate_by_dev ($dev, 0);
+
+ $login = $old_hash{"configuration"}{"login"};
+ if ($login ne "")
+ {
+ &gst_network_remove_pap_entry ("/etc/ppp/pap-secrets", $login);
+ &gst_network_remove_pap_entry ("/etc/ppp/chap-secrets", $login);
+ }
+
+ &gst_file_remove ($file);
+}
+
+sub gst_network_slackware91_interface_delete
+{
+ my ($old_hash) = @_;
+ my $rcinetconf = "$gst_prefix/etc/rc.d/rc.inet1.conf";
+ my $rcinet = "$gst_prefix/etc/rc.d/rc.inet1";
+ my $pppscript = "$gst_prefix/etc/ppp/pppscript";
+ my $dev = $$old_hash {"dev"};
+
+ # remove ifup/ppp-go at startup if existing
+ &gst_network_slackware91_set_auto ($rcinet, $dev);
+
+ if ($dev =~ /^eth/)
+ {
+ # empty the values
+ &gst_replace_rcinet1conf ($rcinetconf, $dev, "IPADDR", "");
+ &gst_replace_rcinet1conf ($rcinetconf, $dev, "NETMASK", "");
+ &gst_replace_rcinet1conf ($rcinetconf, $dev, "USE_DHCP", "");
+ &gst_replace_rcinet1conf ($rcinetconf, $dev, "DHCP_HOSTNAME", "");
+ }
+ elsif ($dev =~ /^ppp/)
+ {
+ &gst_file_remove ($pppscript);
+ }
+}
+
+sub gst_network_gentoo_interface_delete
+{
+ my ($old_hash) = @_;
+ my ($dev) = $$old_hash {"dev"};
+ my ($gateway) = $$old_hash {"configuration"}{"gateway"};
+ my ($initfile) = "$gst_prefix/etc/init.d/net.$dev";
+ my ($netconf);
+
+ # bring down the interface and remove from init
+ &gst_service_gentoo_set_status ($initfile, 1, 0);
+
+ if ($dev =~ /^ppp/)
+ {
+ $netconf = "/etc/conf.d/net.$dev";
+ gst_file_remove ($netconf);
+ }
+ else
+ {
+ $netconf = "/etc/conf.d/net";
+ &gst_replace_sh ($netconf, "config_$dev", "");
+ }
+}
+
+sub gst_network_freebsd_interface_delete
+{
+ my ($old_hash) = @_;
+ my ($dev) = $$old_hash{"dev"};
+ my ($startif) = "/etc/start_if.$dev";
+ my ($file) = "/etc/rc.conf";
+ my ($pppconf) = "/etc/ppp/ppp.conf";
+ my ($buff, $line_no, $end_line_no, $i);
+
+ &gst_file_run ("ifconfig $dev down");
+
+ if ($dev =~ /^tun[0-9]+/)
+ {
+ # Delete the ppp.conf section
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+
+ $buff = &gst_file_buffer_load ($pppconf);
+
+ $line_no = &gst_parse_pppconf_find_stanza ($buff, $section);
+ $end_line_no = &gst_parse_pppconf_find_next_stanza ($buff, $line_no + 1);
+ $end_line_no = scalar @$buff + 1 if ($end_line_no == -1);
+ $end_line_no--;
+
+ for ($i = $line_no; $i <= $end_line_no; $i++)
+ {
+ delete $$buff[$i];
+ }
+
+ &gst_file_buffer_clean ($buff);
+ &gst_file_buffer_save ($buff, $pppconf);
+ }
+
+ &gst_replace_sh ($file, "ifconfig_$dev", "");
+ &gst_file_remove ($startif);
+}
+
+sub gst_network_interface_changed
+{
+ my ($iface, $iface_old) = @_;
+
+ delete $$iface{"type"};
+ delete $$iface_old{"type"};
+ return !&gst_util_struct_eq ($iface, $iface_old);
+}
+
+# silly function for leveling the configuration hash
+# with the interface hash
+sub level_interface_hash
+{
+ my ($hash) = @_;
+ my (%config, $i);
+
+ $config = $$hash{"configuration"};
+
+ foreach $i (keys %$config)
+ {
+ $$hash{$i} = $$config{$i};
+ }
+}
+
+sub gst_network_interface_set
+{
+ my ($dev, $values_hash, $old_hash) = @_;
+ my (%dist_attrib, %fn);
+ my ($proc, $i, $res);
+
+ &gst_report_enter ();
+ &gst_report ("network_iface_set", $dev);
+ %dist_attrib = &gst_network_get_interface_replace_table ();
+ $proc = $dist_attrib{"iface_set"};
+ %fn = %{$dist_attrib{"fn"}};
+
+ level_interface_hash (\%$values_hash);
+ level_interface_hash (\%$old_hash);
+
+ foreach $i (keys (%fn))
+ {
+ $ {$dist_attrib{"fn"}}{$i} = &gst_parse_expand ($fn{$i}, "iface", $dev);
+ }
+
+ $res = &gst_replace_from_table ($dist_attrib{"fn"}, $dist_attrib{"table"},
+ $values_hash, $old_hash);
+
+ # if success saving the settings for the interface, set up immediatly.
+ &$proc ($values_hash, $old_hash, $$values_hash{"enabled"}, 0) if !$res;
+
+ &gst_report_leave ();
+
+ return $res;
+}
+
+sub gst_network_interfaces_set
+{
+ my ($old_hash, $values_hash) = @_;
+ my (%dist_attrib, @ifaces, %fn);
+ my ($value, $proc);
+ my ($i, $j);
+ my ($tmp, $res);
+ my ($delete_proc, $set_proc);
+ my ($was_active);
+
+ &gst_report_enter ();
+ &gst_report ("network_ifaces_set");
+
+ %dist_attrib = &gst_network_get_interface_replace_table ();
+ $old_hash = $$old_hash{"interface"};
+
+ $delete_proc = $dist_attrib{"iface_delete"};
+ $set_proc = $dist_attrib{"iface_set"};
+
+ foreach $i (keys %$values_hash)
+ {
+ # delete it if it's no longer configured or boot protocol is dhcp,
+ # so that network-manager see the card again
+ if ((exists $$old_hash{$i}{"configuration"} &&
+ not exists $$values_hash{$i}{"configuration"}) ||
+ (exists $$values_hash{$i}{"configuration"} &&
+ $$values_hash{$i}{"configuration"}{"bootproto"} eq "dhcp")
+ )
+ {
+ &$set_proc ($$values_hash{$i}, $$old_hash{$i}, 0, 1);
+ &$delete_proc ($$old_hash{$i});
+ }
+ elsif (exists $$values_hash{$i}{"configuration"})
+ {
+ if (&gst_network_interface_changed ($$values_hash{$i}, $$old_hash{$i}))
+ {
+ $was_active = $$values_hash{$i}{"enabled"};
+
+ &$set_proc ($$values_hash{$i}, $$old_hash{$i}, 0, 1);
+ $tmp = &gst_network_interface_set ($i, $$values_hash{$i}, $$old_hash{$i});
+ $res = $tmp if !$res;
+
+ if ($was_active == 1)
+ {
+ &$set_proc ($$values_hash{$i}, $$old_hash{$i}, 1, 1);
+ }
+ }
+ }
+ }
+
+ &gst_report_leave ();
+ return $res;
+}
+
+sub gst_network_conf_set
+{
+ my $values_hash = $_[0];
+ my $old_hash;
+ my %dist_attrib;
+
+ $old_hash = &gst_network_conf_get ();
+
+ &gst_network_ensure_loopback ($values_hash, $old_hash);
+
+ %dist_attrib = &gst_network_get_replace_table ();
+ $res = &gst_replace_from_table ($dist_attrib{"fn"}, $dist_attrib{"table"},
+ $values_hash, $old_hash);
+ return $res;
+}
+
+sub gst_network_get_pap_passwd
+{
+ my ($file, $login) = @_;
+ my (@arr, $passwd);
+
+ $login = '"?' . $login . '"?';
+ &gst_report_enter ();
+ &gst_report ("network_get_pap_passwd", $login, $file);
+ $arr = &gst_parse_split_first_array ($file, $login, "[ \t]+", "[ \t]+");
+
+ $passwd = $$arr[1];
+ &gst_report_leave ();
+
+ $passwd =~ s/^\"([^\"]*)\"$/$1/;
+
+ return $passwd;
+}
+
+sub gst_network_set_pap_passwd
+{
+ my ($file, $login, $passwd) = @_;
+ my ($line);
+
+ $login = '"' . $login . '"';
+ $passwd = '"'. $passwd . '"';
+ $line = "* $passwd";
+
+ return &gst_replace_split ($file, $login, "[ \t]+", $line);
+}
+
+# These functions do not honour the file nor call directives.
+sub gst_network_get_ppp_options_re
+{
+ my ($file, $re) = @_;
+ my ($fd, @res);
+
+ &gst_report_enter ();
+ &gst_report ("network_get_ppp_option", &gst_replace_regexp_to_separator ($re), $file);
+ $fd = &gst_file_open_read_from_names ("$file");
+ &gst_report_leave ();
+ return undef if !$fd;
+
+ while (($_ = &gst_parse_chomp_line_hash_comment ($fd)) != -1)
+ {
+ $_ = $$_;
+
+ if (/$re/)
+ {
+ return $1;
+ }
+ }
+
+ return undef;
+}
+
+sub gst_network_set_ppp_options_re
+{
+ my ($file, $re, $value) = @_;
+ my ($buff, $line, $replaced, $ret);
+ my ($pre_space, $post_comment);
+
+ &gst_report_enter ();
+ &gst_report ("network_set_ppp_option", &gst_replace_regexp_to_separator ($re), $file);
+
+ $buff = &gst_file_buffer_load ($file);
+
+ foreach $line (@$buff)
+ {
+ $pre_space = $post_comment = "";
+ chomp $line;
+ $pre_space = $1 if $line =~ s/^([ \t]+)//;
+ $post_comment = $1 if $line =~ s/([ \t]*\#.*)//;
+
+ if ($line =~ /$re/)
+ {
+ $line = "$value\n";
+ $replaced = 1;
+ last;
+ }
+
+ $line = $pre_space . $line . $post_comment . "\n";
+ }
+
+ push @$buff, "$value\n" if !$replaced;
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+sub gst_network_set_ppp_options_connect
+{
+ my ($file, $value) = @_;
+ my $ret;
+
+ &gst_report_enter ();
+ &gst_report ("network_set_ppp_connect", $file);
+ $ret = &gst_network_set_ppp_options_re ($file, "^connect", "connect \"/usr/sbin/chat -v -f $value\"");
+ &gst_report_leave ();
+ return $ret;
+}
+
+sub gst_network_get_ppp_options_unsup
+{
+ my ($file) = @_;
+ my ($fd, $line, $res, $re);
+ my @known_options = ("usepeerdns", "mtu", "mru", "user", "/dev/[^ \t]+", "[0-9]+",
+ "defaultroute", "debug", "persist", "escape", "crtscts", "connect",
+ "remotename", "hide-password", "noauth", "noipdefault", "ipparam", "name \".*\"");
+
+ $res = "";
+ &gst_report_enter ();
+ &gst_report ("network_get_ppp_unsup", $file);
+ $fd = &gst_file_open_read_from_names ("$file");
+ &gst_report_leave ();
+ return undef if !$fd;
+
+ GET_LINE: while (($line = &gst_parse_chomp_line_hash_comment ($fd)) != -1)
+ {
+ $_ = $$line;
+ next if /^[ \t]*$/;
+
+ foreach $re (@known_options)
+ {
+ next GET_LINE if /^$re/;
+ }
+
+ $res .= "$_ ";
+ }
+
+ chop $res;
+
+ return $res;
+}
+
+sub gst_network_set_ppp_options_unsup
+{
+ my ($file, $value) = @_;
+ my ($buff, $line, $re, $ret);
+ my ($pre_space, $post_comment);
+ my @known_options = ("usepeerdns", "mtu", "mru", "user", "/dev/[^ \t]+", "[0-9]+",
+ "defaultroute", "debug", "persist", "escape", "crtscts", "connect",
+ "remotename", "hide-password", "noauth", "noipdefault", "ipparam", "name \".*\"");
+
+ # The options in the last row are those that are on by default in pppd and we don't handle,
+ # so we ignore them, as they are set implicitly if not specified.
+
+ &gst_report_enter ();
+ &gst_report ("network_set_ppp_unsup", $file);
+ $buff = &gst_file_buffer_load ($file);
+
+ GET_LINE: foreach $line (@$buff)
+ {
+ $pre_space = $post_comment = "";
+ $pre_space = $1 if $line =~ s/^([ \t]+)//;
+ $post_comment = $1 if $line =~ s/([ \t]*\#.*)//;
+
+ foreach $re (@known_options)
+ {
+ next GET_LINE if $line =~ /^$re/;
+ }
+ $line = $pre_space . $post_comment . "\n";
+ $line = "" if $line =~ /^[ \t]*$/;
+ }
+
+ $value =~ s/[ \t]+([^0-9])/\n$1/g;
+ push @$buff, $value . "\n";
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+sub gst_network_rh62_parse_bootproto
+{
+ my ($file, $key) = @_;
+ my %rh62_to_proto_name =
+ (
+ "bootp" => "bootp",
+ "dhcp" => "dhcp",
+ "none" => "none"
+ );
+ my $ret;
+
+ $ret = &gst_parse_sh ($file, $key);
+
+ if (!exists $rh62_to_proto_name{$ret})
+ {
+ &gst_report ("network_bootproto_unsup", $file, $ret);
+ $ret = "none";
+ }
+ return $rh62_to_proto_name{$ret};
+}
+
+sub gst_network_rh62_replace_bootproto
+{
+ my ($file, $key, $value) = @_;
+ my %proto_name_to_rh62 =
+ (
+ "bootp" => "bootp",
+ "dhcp" => "dhcp",
+ "none" => "none"
+ );
+
+ return &gst_replace_sh ($file, $key, $proto_name_to_rh62{$value});
+}
+
+sub gst_network_deb22_parse_bootproto
+{
+ my ($file, $iface) = @_;
+ my (@stanzas, $stanza, $method, $bootproto);
+ my %debian_to_proto_name =
+ (
+ "bootp" => "bootp",
+ "dhcp" => "dhcp",
+ "loopback" => "none",
+ "ppp" => "none",
+ "static" => "none"
+ );
+
+ &gst_report_enter ();
+ @stanzas = &gst_parse_interfaces_stanzas ($file, "iface");
+
+ foreach $stanza (@stanzas)
+ {
+ if (($$stanza[0] eq $iface) && ($$stanza[1] eq "inet"))
+ {
+ $method = $$stanza[2];
+ last;
+ }
+ }
+
+ if (exists $debian_to_proto_name {$method})
+ {
+ $bootproto = $debian_to_proto_name {$method};
+ }
+ else
+ {
+ $bootproto = "none";
+ &gst_report ("network_bootproto_unsup", $method, $iface);
+ }
+
+ &gst_report_leave ();
+ return $bootproto;
+}
+
+sub gst_network_deb22_replace_bootproto
+{
+ my ($file, $iface, $value) = @_;
+ my (@stanzas, $stanza, $method, $bootproto);
+ my %proto_name_to_debian =
+ (
+ "bootp" => "bootp",
+ "dhcp" => "dhcp",
+ "loopback" => "loopback",
+ "ppp" => "ppp",
+ "none" => "static"
+ );
+
+ my %dev_to_method =
+ (
+ "lo" => "loopback",
+ "ppp" => "ppp",
+ "ippp" => "ppp"
+ );
+
+ foreach $i (keys %dev_to_method)
+ {
+ $value = $dev_to_method{$i} if $iface =~ /^$i/;
+ }
+
+ return &gst_replace_interfaces_stanza_value ($file, $iface, 2, $proto_name_to_debian{$value});
+}
+
+sub gst_network_slackware91_parse_bootproto
+{
+ my ($file, $iface) = @_;
+
+ if (&gst_parse_rcinet1conf_bool ($file, $iface, USE_DHCP))
+ {
+ return "dhcp"
+ }
+ else
+ {
+ return "none";
+ }
+}
+
+sub gst_network_slackware91_replace_bootproto
+{
+ my ($file, $iface, $value) = @_;
+
+ if ($value eq "dhcp")
+ {
+ &gst_replace_rcinet1conf ($file, $iface, USE_DHCP, "yes");
+ }
+ else
+ {
+ &gst_replace_rcinet1conf ($file, $iface, USE_DHCP);
+ }
+}
+
+sub gst_network_suse70_parse_bootproto
+{
+ my ($file, $iface) = @_;
+ my ($ret);
+ my %suse70_to_proto_name =
+ (
+ "bootp" => "bootp",
+ "dhcpclient" => "dhcp"
+ );
+
+ $ret = &gst_network_suse70_parse_iface_sh ($file, $iface, "IFCONFIG");
+ if (!exists $suse70_to_proto_name {$ret})
+ {
+ &gst_report ("network_bootproto_unsup", $iface, $ret);
+ return "none";
+ }
+
+ return $suse70_to_proto_name {$ret};
+}
+
+sub gst_network_suse70_replace_bootproto
+{
+ my ($file, $iface, $value) = @_;
+ my ($ret, $val);
+ my %proto_name_to_suse70 =
+ (
+ "bootp" => "bootp",
+ "dhcp" => "dhcpclient",
+ "none" => ""
+ );
+
+ $val = $proto_name_to_suse70{$value};
+ return &gst_network_suse70_replace_iface_sh ($file, $iface, "IFCONFIG", $val);
+}
+
+sub gst_network_pld10_parse_bootproto
+{
+ my ($file, $key) = @_;
+ my %pld10_to_proto_name =
+ (
+ "bootp" => "bootp",
+ "dhcp" => "dhcp",
+ "pump" => "pump",
+ "none" => "none"
+ );
+ my $ret;
+
+ $ret = &gst_parse_sh ($file, $key);
+
+ if (!exists $pld10_to_proto_name{$ret})
+ {
+ &gst_report ("network_bootproto_unsup", $file, $ret);
+ $ret = "none";
+ }
+ return $pld10_to_proto_name{$ret};
+}
+
+sub gst_network_pld10_replace_bootproto
+{
+ my ($file, $key, $value) = @_;
+ my %proto_name_to_pld10 =
+ (
+ "bootp" => "bootp",
+ "dhcp" => "dhcp",
+ "pump" => "pump",
+ "none" => "none"
+ );
+
+ return &gst_replace_sh ($file, $key, $proto_name_to_pld10{$value});
+}
+
+sub gst_network_parse_bootproto
+{
+ my ($file, $key) = @_;
+
+ return "dhcp" if (&gst_parse_sh ($file, $key) =~ /dhcp/i);
+ return "bootp" if (&gst_parse_sh ($file, $key) =~ /bootp/i);
+ return "none";
+}
+
+sub gst_network_suse90_replace_bootproto
+{
+ my ($file, $key, $value) = @_;
+ my %proto_name_to_suse90 =
+ (
+ "dhcp" => "dhcp",
+ "bootp" => "bootp",
+ "static" => "none",
+ );
+
+ return &gst_replace_sh ($file, $key, $proto_name_to_suse90{$value});
+}
+
+sub gst_network_gentoo_parse_bootproto
+{
+ my ($file, $dev) = @_;
+
+ return "dhcp" if (&gst_parse_confd_net ($file, "config_$dev") =~ /dhcp/i);
+ return "none";
+}
+
+sub gst_network_gentoo_replace_bootproto
+{
+ my ($file, $dev, $value) = @_;
+
+ return if ($dev =~ /^ppp/);
+
+ return &gst_replace_confd_net ($file, "config_$dev", "dhcp") if ($value ne "none");
+
+ # replace with a fake IP address, I know it's a hack
+ return &gst_replace_confd_net ($file, "config_$dev", "0.0.0.0");
+}
+
+sub gst_network_freebsd5_replace_bootproto
+{
+ my ($file, $dev, $value) = @_;
+
+ return &gst_replace_sh ($file, "ifconfig_$dev", "dhcp") if ($value ne "none");
+ return &gst_replace_sh ($file, "ifconfig_$dev", "");
+}
+
+sub gst_network_pump_iface_supported
+{
+ my ($iface) = @_;
+ my ($dev);
+ my @devs = qw(eth wlan plip irlan);
+
+ foreach $dev (@devs)
+ {
+ return 1 if $iface =~ /^$dev/;
+ }
+
+ return 0;
+}
+
+sub gst_network_parse_pppconf
+{
+ my ($pppconf, $startif, $iface, $key) = @_;
+ my ($section);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ return undef if ($section eq undef);
+
+ return &gst_parse_pppconf ($pppconf, $section, $key);
+ }
+}
+
+sub gst_network_parse_pppconf_bool
+{
+ my ($pppconf, $startif, $iface, $key) = @_;
+ my ($section);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ return undef if ($section eq undef);
+
+ return &gst_parse_pppconf_bool ($pppconf, $section, $key);
+ }
+}
+
+sub gst_network_parse_pppconf_re
+{
+ my ($pppconf, $startif, $iface, $key, $re) = @_;
+ my ($section);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ return undef if ($section eq undef);
+
+ return &gst_parse_pppconf_re ($pppconf, $section, $key, $re);
+ }
+}
+
+sub gst_network_replace_pppconf
+{
+ my ($pppconf, $startif, $iface, $key, $val) = @_;
+ my ($section);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ &gst_replace_pppconf ($pppconf, $section, $key, $val);
+ }
+}
+
+sub gst_network_replace_pppconf_bool
+{
+ my ($pppconf, $startif, $iface, $key, $val) = @_;
+ my ($section);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ &gst_replace_pppconf_bool ($pppconf, $section, $key, $val);
+ }
+}
+
+sub gst_network_replace_pppconf_route
+{
+ my ($pppconf, $startif, $iface, $key, $val) = @_;
+ my ($section);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ &gst_replace_pppconf_common ($pppconf, $section, $key,
+ ($val == 1)? "add default HISADDR" : undef);
+ }
+}
+
+sub gst_network_replace_pppconf_dial_command
+{
+ my ($pppconf, $startif, $iface, $val) = @_;
+ my ($section, $dial);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ $dial = &gst_parse_pppconf ($pppconf, $section, "dial");
+ $dial =~ s/ATD[TP]/$val/;
+
+ &gst_replace_pppconf ($pppconf, $section, "dial", $dial);
+ }
+}
+
+sub gst_network_replace_pppconf_volume
+{
+ my ($pppconf, $startif, $iface, $val) = @_;
+ my ($section, $dial, $vol, $pre, $post);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ $dial = &gst_parse_pppconf ($pppconf, $section, "dial");
+
+ if ($dial =~ /(.*AT[^ \t]*)([ML][0-3])(.* OK .*)/i)
+ {
+ $pre = $1;
+ $post = $3;
+ }
+ elsif ($dial =~ /(.*AT[^ \t]*)( OK .*)/i)
+ {
+ $pre = $1;
+ $post = $2;
+ }
+
+ if ($val == 0)
+ {
+ $vol = "M0";
+ }
+ else
+ {
+ $vol = "L$val";
+ }
+
+ $dial = $pre . $vol . $post;
+ &gst_replace_pppconf ($pppconf, $section, "dial", $dial);
+ }
+}
+
+sub gst_network_get_freebsd5_ppp_persist
+{
+ my ($startif, $iface) = @_;
+ my ($val);
+
+ if ($iface =~ /^tun[0-9]+/)
+ {
+ $val = &gst_parse_startif ($startif, "ppp[ \t]+\-(auto|ddial)[ \t]+");
+
+ return 1 if ($val eq "ddial");
+ return 0;
+ }
+
+ return undef;
+}
+
+sub gst_network_pump_get_nodns
+{
+ my ($file, $iface, $bootproto) = @_;
+
+ return undef if (!&gst_network_pump_iface_supported ($iface));
+
+ return &gst_parse_pump_get_iface_kw_not ($file, $iface, "nodns");
+}
+
+sub gst_network_pump_set_nodns
+{
+ my ($file, $iface, $bootproto, $value) = @_;
+
+ return 0 if $bootproto ne "dhcp";
+ return 0 if (!&gst_network_pump_iface_supported ($iface));
+
+ return &gst_replace_pump_iface_kw_not ($file, $iface, "nodns", $value);
+}
+
+sub gst_network_debian_parse_remote_address
+{
+ my ($file, $iface) = @_;
+ my ($str, @tuples, $tuple, @res);
+
+ &gst_report_enter ();
+ &gst_report ("network_get_remote", $iface);
+
+ @tuples = &gst_parse_interfaces_option_tuple ($file, $iface, "up", 1);
+
+ &gst_report_leave ();
+
+ foreach $tuple (@tuples)
+ {
+ @res = $$tuple[1] =~ /[ \t]+pointopoint[ \t]+([^ \t]+)/;
+ return $res[0] if $res[0];
+ }
+
+ return undef;
+}
+
+sub gst_network_debian_replace_remote_address
+{
+ my ($file, $iface, $value) = @_;
+ my ($ifconfig, $ret);
+
+ &gst_report_enter ();
+ &gst_report ("network_set_remote", $iface);
+
+ $ifconfig = &gst_file_locate_tool ("ifconfig");
+
+ $ret = &gst_replace_interfaces_option_str ($file, $iface, "up", "$ifconfig $iface pointopoint $value");
+ &gst_report_leave ();
+ return $ret;
+}
+
+sub gst_network_debian_woody_get_auto_by_stanza
+{
+ my ($file, $iface) = @_;
+ my (@stanzas, $stanza, $i);
+
+ @stanzas = &gst_parse_interfaces_stanzas ($file, "auto");
+
+ foreach $stanza (@stanzas)
+ {
+ foreach $i (@$stanza)
+ {
+ return $stanza if $i eq $iface;
+ }
+ }
+
+ return undef;
+}
+
+sub gst_network_debian_woody_get_auto
+{
+ my ($file, $iface) = @_;
+
+ return (&gst_network_debian_woody_get_auto_by_stanza ($file, $iface) ne undef)? 1 : 0;
+}
+
+sub gst_network_debian_woody_set_auto
+{
+ my ($file, $iface, $value) = @_;
+ my ($buff, $line_no, $found);
+
+ $buff = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buff);
+ $line_no = 0;
+
+ while (($found = &gst_replace_interfaces_get_next_stanza ($buff, \$line_no, "auto")) != -1)
+ {
+ if ($value)
+ {
+ if ($$buff[$line_no] =~ /[ \t]$iface([\# \t\n])/)
+ {
+ return &gst_file_buffer_save ($buff, $file);
+ }
+ }
+ else
+ {
+ # I'm including the hash here, although the man page says it's not supported.
+ last if $$buff[$line_no] =~ s/[ \t]$iface([\# \t\n])/$1/;
+ }
+
+ $line_no ++;
+ }
+
+ if ($found == -1)
+ {
+ if ($value)
+ {
+ &gst_replace_interfaces_auto_stanza_create ($buff, $iface);
+ }
+ }
+ else
+ {
+ if ($value)
+ {
+ chomp $$buff[$line_no];
+ $$buff[$line_no] .= " $iface\n";
+ }
+ $$buff[$line_no] =~ s/auto[ \t]*$//;
+ }
+
+ return &gst_file_buffer_save ($buff, $file);
+}
+
+# looks for eth_up $eth_iface_number
+sub gst_network_slackware91_get_auto
+{
+ my ($file, $rclocal, $iface) = @_;
+ my ($search) = 0;
+ my ($buff);
+
+ if ($iface =~ /^eth/)
+ {
+ $buff = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buff);
+
+ $iface =~ s/eth//;
+
+ foreach $i (@$buff)
+ {
+ if ($i =~ /^[ \t]*'start'\)/)
+ {
+ $search = 1;
+ }
+ elsif (($i =~ /^[ \t]*;;/) && ($search == 1))
+ {
+ return 0;
+ }
+ elsif (($i =~ /^[ \t]*eth_up (\S+)/) && ($search == 1))
+ {
+ return 1 if ($1 == $iface);
+ }
+ }
+
+ return 0;
+ }
+ elsif ($iface =~ /^ppp/)
+ {
+ return &gst_parse_kw ($rclocal, "ppp-go");
+ }
+}
+
+# adds or deletes eth_up $eth_iface_number
+sub gst_network_slackware91_set_auto
+{
+ my ($file, $rclocal, $iface, $active) = @_;
+ my ($search) = 0;
+ my ($nline) = 0;
+ my ($buff, $sline);
+
+ if ($iface =~ /^eth/)
+ {
+ $buff = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buff);
+
+ $iface =~ s/eth//;
+
+ foreach $i (@$buff)
+ {
+ if ($i =~ /^[ \t]*('start'\)|\*\))/)
+ {
+ # if the line is 'start') or *), begin the search
+ $search = 1;
+ }
+ elsif (($i =~ /^[ \t]*gateway_up/) && ($search == 1))
+ {
+ # save the line in which we're going to save the eth_up stuff
+ $sline = $nline;
+ }
+ elsif (($i =~ /^[ \t]*(;;|esac)/) && ($search == 1))
+ {
+ # we've arrived to the end of the case, if we wanted to
+ # add the iface, now it's the moment
+ $$buff[$sline] = "\teth_up $iface\n" . $$buff[$sline] if ($active == 1);
+ $search = 0;
+ }
+ elsif (($i =~ /^[ \t]*eth_up (\S+)/) && ($search == 1))
+ {
+ if ($1 == $iface)
+ {
+ delete $$buff[$nline] if ($active == 0);
+ $search = 0;
+ }
+ }
+
+ $nline++;
+ }
+
+ return &gst_file_buffer_save ($buff, $file);
+ }
+ elsif ($iface =~ /^ppp/)
+ {
+ return &gst_replace_kw ($rclocal, "ppp-go", $active);
+ }
+}
+
+# finds out if a interface is active at boot time
+sub gst_network_freebsd5_get_auto
+{
+ my ($file, $defaults_file, $iface) = @_;
+ my ($val);
+
+ $val = &gst_parse_sh ($file, "network_interfaces");
+ $val = &gst_parse_sh ($defaults_file, "network_interfaces") if ($val eq undef);
+
+ return 1 if ($val eq "auto");
+ return 1 if ($val =~ /$iface/);
+ return 0;
+}
+
+sub gst_network_freebsd5_set_auto
+{
+ my ($file, $iface, $active) = @_;
+ my ($val);
+
+ $val = &gst_parse_sh ($file, "network_interfaces");
+ $val = &gst_file_run_backtick ("ifconfig -l") if ($val =~ /auto/);
+ $val .= " ";
+
+ if ($active && ($val !~ /$iface /))
+ {
+ $val .= $iface;
+ }
+ elsif (!$active && ($val =~ /$iface /))
+ {
+ $val =~ s/$iface //;
+ }
+
+ # Trim the string
+ $val =~ s/^[ \t]*//;
+ $val =~ s/[ \t]*$//;
+
+ &gst_replace_sh ($file, "network_interfaces", $val);
+}
+
+sub gst_network_suse90_get_auto
+{
+ my ($file, $key) = @_;
+ my ($ret);
+
+ $ret = &gst_parse_sh ($file, $key);
+
+ return 1 if ($ret =~ /^onboot$/i);
+ return 0;
+}
+
+sub gst_network_suse90_set_auto
+{
+ my ($file, $key, $enabled) = @_;
+ my ($ret);
+
+ if($enabled)
+ {
+ return &gst_replace_sh($file, $key, "onboot");
+ }
+ else
+ {
+ return &gst_replace_sh($file, $key, "manual");
+ }
+}
+
+# Return IP address or netmask, depending on $what
+sub gst_network_pld10_get_ipaddr
+{
+ my ($file, $key, $what) = @_;
+ my ($ipaddr, $netmask, $ret, $i);
+ my @netmask_prefixes = (0, 128, 192, 224, 240, 248, 252, 254, 255);
+
+ $ipaddr = &gst_parse_sh($file, $key);
+ return undef if $ipaddr eq "";
+
+ if($ipaddr =~ /([^\/]*)\/([[:digit:]]*)/)
+ {
+ $netmask = $2;
+ return undef if $netmask eq "";
+
+ if($what eq "address")
+ {
+ return $1;
+ }
+
+ for($i = 0; $i < int($netmask/8); $i++)
+ {
+ $ret .= "255.";
+ }
+
+ $ret .= "$netmask_prefixes[$b%8]." if $netmask < 32;
+
+ for($i = int($netmask/8) + 1; $i < 4; $i++)
+ {
+ $ret .= "0.";
+ }
+
+ chop($ret);
+ return $ret;
+ }
+ return undef;
+}
+
+# Writes IP address or netmask, depending in $what, to $file
+sub gst_network_pld10_set_ipaddr
+{
+ my ($file, $key, $what, $value) = @_;
+ my %prefixes =
+ (
+ "0" => 0,
+ "128" => 1,
+ "192" => 2,
+ "224" => 3,
+ "240" => 4,
+ "248" => 5,
+ "252" => 6,
+ "254" => 7,
+ "255" => 8
+ );
+ my ($ipaddr, $netmask);
+
+ $ipaddr = &gst_parse_sh($file, $key);
+ return undef if $ipaddr eq "";
+
+ if($what eq "address")
+ {
+ $ipaddr =~ s/.*\//$value\//;
+ }
+ else
+ {
+ if($value =~ /([[:digit:]]*).([[:digit:]]*).([[:digit:]]*).([[:digit:]]*)/)
+ {
+ $netmask = $prefixes{$1} + $prefixes{$2} + $prefixes{$3} + $prefixes{$4};
+ $ipaddr =~ s/\/[[:digit:]]*/\/$netmask/;
+ }
+ }
+
+ return &gst_replace_sh($file, $key, $ipaddr);
+}
+
+# FIXME: this function isn't IPv6-aware
+# it checks if a IP address is in the same network than another
+sub gst_network_is_ip_in_same_network
+{
+ my ($address1, $address2, $netmask) = @_;
+ my (@add1, @add2, @mask);
+ my ($i);
+
+ return 0 if (($address1 eq undef) ||
+ ($address2 eq undef) ||
+ ($netmask eq undef));
+
+ @add1 = split (/\./, $address1);
+ @add2 = split (/\./, $address2);
+ @mask = split (/\./, $netmask);
+
+ for ($i = 0; $i < 4; $i++)
+ {
+ $add1[$i] += 0;
+ $add2[$i] += 0;
+ $mask[$i] += 0;
+
+ return 0 if (($add1[$i] & $mask[$i]) != ($add2[$i] & $mask[$i]));
+ }
+
+ return 1;
+}
+
+# function that gets a gateway device from the gateway address
+sub gst_network_get_gateway_dev_from_address
+{
+ my ($interface, $gateway) = @_;
+ my ($address, $netmask, $key);
+
+ foreach $key (keys %$interface)
+ {
+ $address = $$interface{$key}{"address"};
+ $netmask = $$interface{$key}{"netmask"};
+
+ return $$interface{$key}{"dev"} if (&gst_network_is_ip_in_same_network ($address, $gateway, $netmask));
+ }
+
+ return undef;
+}
+
+sub gst_network_get_plip_gateway
+{
+ my ($file, $key, $remote_address) = @_;
+ my ($gateway);
+
+ $gateway = &gst_parse_sh ($file, $key);
+
+ return $gateway if ($gateway eq $remote_address);
+}
+
+sub gst_network_get_gateway
+{
+ my ($file, $key, $address, $netmask) = @_;
+ my ($gateway);
+
+ return undef if ($address eq undef);
+
+ $gateway = &gst_parse_sh ($file, $key);
+
+ return $gateway if &gst_network_is_ip_in_same_network ($address, $gateway, $netmask);
+ return undef;
+}
+
+sub gst_network_suse90_get_gateway
+{
+ my ($file, $address, $netmask) = @_;
+ my ($gateway) = &gst_parse_split_first_array_pos ($file, "default", 0, "[ \t]+", "[ \t]+");
+
+ return $gateway if &gst_network_is_ip_in_same_network ($address, $gateway, $netmask);
+ return undef;
+}
+
+sub gst_network_suse90_get_plip_gateway
+{
+ my ($file, $remote_address) = @_;
+ my ($gateway) = &gst_parse_split_first_array_pos ($file, "default", 0, "[ \t]+", "[ \t]+");
+
+ return $gateway if ($gateway eq $remote_address);
+ return undef;
+}
+
+sub gst_network_suse90_replace_gateway
+{
+ my ($file, $dev, $address, $netmask, $value) = @_;
+
+
+ return &gst_replace_split ($file, "default", "[ \t]+", "$value \- $dev") if &gst_network_is_ip_in_same_network ($address, $value, $netmask);
+# return &gst_replace_split ($file, "default", "[ \t]+", "$value \- $dev") ;
+ return undef;
+
+}
+
+
+# runs a function if the interface is of type $type
+sub gst_network_check_type
+{
+ my ($iface) = shift @_;
+ my ($type) = shift @_;
+ my ($func) = shift @_;
+ my ($t);
+
+ $t = &gst_network_get_interface_type ($iface);
+
+ if ($t =~ "^$type")
+ {
+ &$func (@_);
+ }
+}
+
+# creates files neccesary for gentoo ifaces
+sub gst_network_gentoo_create_files
+{
+ my ($dev) = @_;
+ my ($init) = "/etc/init.d/net.$dev";
+ my ($conf) = "/etc/conf.d/net.$dev";
+ my ($backup) = "/etc/conf.d/net.ppp0.gstbackup";
+
+ if ($dev =~ /ppp/)
+ {
+ &gst_file_copy ("/etc/init.d/net.ppp0", $init) if (!&gst_file_exists ($init));
+
+ # backup the ppp config file
+ &gst_file_copy ("/etc/conf.d/net.ppp0", $backup) if (!&gst_file_exists ($backup));
+ &gst_file_copy ($backup, $conf) if (!&gst_file_exists ($conf));
+ }
+ else
+ {
+ &gst_file_copy ("/etc/init.d/net.eth0", $init) if (!&gst_file_exists ($init));
+ }
+
+ chmod 0755, "$gst_prefix/$init";
+}
+
+# we need this function because essid can be multiword, and thus it can't be in rc.conf
+sub gst_network_freebsd5_replace_essid
+{
+ my ($file, $startif, $iface, $essid) = @_;
+
+ if ($essid =~ /[ \t]/)
+ {
+ # It's multiword
+ &gst_file_buffer_save ("ifconfig $iface ssid \"$essid\"", $startif);
+ &gst_replace_sh_re ($file, "ifconfig_$iface", "ssid[ \t]+([^ \t]*)", "");
+ }
+ else
+ {
+ &gst_replace_sh_re ($file, "ifconfig_$iface", "ssid[ \t]+([^ \t]*)", " ssid $essid");
+ }
+}
+
+sub gst_network_freebsd_create_ppp_startif
+{
+ my ($startif, $iface, $dev, $persist) = @_;
+ my ($section);
+
+ if ($dev =~ /^tun[0-9]+/)
+ {
+ $section = &gst_parse_startif ($startif, "ppp[ \t]+\-[^ \t]+[ \t]+([^ \t]+)");
+ $section = $dev if ($section eq undef);
+
+ return &gst_file_buffer_save ("ppp -ddial $section", $startif) if ($persist eq 1);
+ return &gst_file_buffer_save ("ppp -auto $section", $startif);
+ }
+}
+
+# Functions for parsing provider file in suse 9.X
+sub gst_network_suse90_parse_provider_file_func
+{
+ my ($provider, $key, $func) = @_;
+ my ($path) = "/etc/sysconfig/network/providers/";
+
+ return &$func ("$path/$provider", $key);
+}
+
+sub gst_network_suse90_parse_provider_file
+{
+ my ($provider, $key) = @_;
+ return &gst_network_suse90_parse_provider_file_func ($provider, $key, \&gst_parse_sh);
+}
+
+sub gst_network_suse90_parse_provider_file_bool
+{
+ my ($provider, $key) = @_;
+ return &gst_network_suse90_parse_provider_file_func ($provider, $key, \&gst_parse_sh_bool);
+}
+
+# Functions for replacing in provider file in SuSE 9.X
+sub gst_network_suse90_replace_provider_file_func
+{
+ my ($provider, $key, $value, $func) = @_;
+ my ($path) = "/etc/sysconfig/network/providers/";
+
+ return &$func ("$path/$provider", $key, $value);
+}
+
+sub gst_network_suse90_replace_provider_file
+{
+ my ($provider, $key, $value) = @_;
+ #make sure the function is called only by modem
+ if ($provider =~ /ppp/)
+ {
+ return &gst_network_suse90_replace_provider_file_func ($provider, $key, $value, \&gst_replace_sh);
+ }
+}
+
+sub gst_network_suse90_replace_provider_file_bool
+{
+ my ($provider, $key, $value) = @_;
+ #make sure the function is called only by modem
+ if ($provider =~ /ppp/)
+ {
+ return &gst_network_suse90_replace_provider_file_func ($provider, $key, $value, \&gst_replace_sh_bool);
+ }
+}
+
+sub gst_network_suse9_get_dev_name
+{
+ my ($iface) = @_;
+ my ($ifaces, $dev, $hwaddr, $d);
+ my ($dev);
+
+ $dev = &gst_parse_sh ("/var/run/sysconfig/if-$iface", "interface");
+
+ if ($dev eq undef)
+ {
+ $fd = &gst_file_run_backtick ("getcfg-interface $iface");
+ }
+
+ if ($dev eq undef)
+ {
+ # Those are the last cases, we make rough guesses
+ if ($iface =~ /-pcmcia-/)
+ {
+ # it's something like wlan-pcmcia-0
+ $dev =~ s/-pcmcia-//;
+ }
+ elsif ($iface =~ /-id-([a-fA-F0-9\:]*)/)
+ {
+ # it's something like eth-id-xx:xx:xx:xx:xx:xx, which is the NIC MAC
+ $hwaddr = $1;
+ $ifaces = &gst_network_interfaces_get_info ();
+
+ foreach $d (keys %$ifaces)
+ {
+ if ($hwaddr eq $$ifaces{$d}{"hwaddr"})
+ {
+ $dev = $d;
+ last;
+ }
+ }
+ }
+ }
+
+ if ($dev eq undef)
+ {
+ # We give up, take $iface as $dev
+ $dev = $iface;
+ }
+
+ return $dev;
+}
+
+sub gst_network_detect_essids
+{
+ my ($iface) = @_;
+ my ($fd, @arr, $encrypted);
+
+ # some wireless cards need to be up before scanning
+ &gst_file_run ("ifconfig $iface up");
+ $fd = &gst_file_run_pipe_read ("iwlist $iface scanning");
+ return undef if (!$fd);
+
+ while (<$fd>)
+ {
+ if (/^[ \t]*Encryption key:([^ \t\n]+)/)
+ {
+ $encrypted = ($1 eq "off") ? 0 : 1;
+ }
+ elsif (/^[ \t]*ESSID\:"(.+)"/)
+ {
+ push @arr, {"essid" => $1,
+ "encrypted" => $encrypted };
+ }
+ }
+
+ return \@arr;
+}
+
+sub gst_network_get_wep_key_type
+{
+ my ($func) = shift @_;
+ my ($val);
+
+ $val = &$func (@_);
+
+ return undef if (!$val);
+ return "ascii" if ($val =~ /^s\:/);
+ return "hexadecimal";
+}
+
+sub gst_network_get_wep_key
+{
+ my ($func) = shift @_;
+ my ($val);
+
+ $val = &$func (@_);
+ $val =~ s/^s\://;
+
+ return $val;
+}
+
+sub gst_network_get_full_key
+{
+ my ($key, $key_type) = @_;
+
+ if ($key_type eq "ascii")
+ {
+ $key = "s:" . $key;
+ }
+
+ return $key;
+}
+
+sub gst_network_set_wep_key_type
+{
+ my ($key, $key_type, $func);
+
+ # seems kind of hackish, but we want to use distro
+ # specific saving functions, so we need to leave
+ # the args as variable as possible
+ $func = shift @_;
+ $key_type = pop @_;
+ $key = pop @_;
+
+ push @_, &gst_network_get_full_key ($key, $key_type);
+ &$func (@_);
+}
+
+# Set dist_map for your distro to "" if you don't want
+# loopback ensuring. See suse-7.0 entry for example.
+sub gst_network_ensure_loopback_interface
+{
+ my ($interface) = @_;
+ my $dev;
+ my %dist_map =
+ (
+ "redhat-5.2" => "lo",
+ "redhat-6.0" => "lo",
+ "redhat-6.1" => "lo",
+ "redhat-6.2" => "lo",
+ "redhat-7.0" => "lo",
+ "redhat-7.1" => "lo",
+ "redhat-7.2" => "lo",
+ "redhat-8.0" => "lo",
+ "redhat-9" => "",
+ "rhel-5" => "",
+ "rhel-6" => "",
+ "openna-1.0" => "lo",
+ "mandrake-7.1" => "lo",
+ "mandrake-7.2" => "lo",
+ "mandrake-9.0" => "lo",
+ "mandrake-9.1" => "lo",
+ "mandrake-9.2" => "lo",
+ "mandrake-10.0" => "lo",
+ "mandrake-10.1" => "lo",
+ "mandrake-10.2" => "lo",
+ "mandriva-2006.0" => "lo",
+ "mandriva-2006.1" => "lo",
+ "mandriva-2007.0" => "lo",
+ "mandriva-2007.1" => "lo",
+ "yoper-2.2" => "lo",
+ "blackpanther-4.0" => "lo",
+ "conectiva-9" => "lo",
+ "conectiva-10" => "lo",
+ "debian-2.2" => "lo",
+ "debian-3.0" => "lo",
+ "debian-3.1" => "lo",
+ "debian-4.0" => "lo",
+ "debian-5.0" => "lo",
+ "debian-testing" => "lo",
+ "ubuntu-5.04" => "lo",
+ "ubuntu-5.10" => "lo",
+ "ubuntu-6.06" => "lo",
+ "ubuntu-6.10" => "lo",
+ "ubuntu-7.04" => "lo",
+ "ubuntu-7.10" => "lo",
+ "ubuntu-8.04" => "lo",
+ "ubuntu-8.10" => "lo",
+ "ubuntu-9.04" => "lo",
+ "ubuntu-9.10" => "lo",
+ "ubuntu-10.04" => "lo",
+ "ubuntu-10.10" => "lo",
+ "suse-7.0" => "",
+ "suse-9.0" => "",
+ "suse-9.1" => "",
+ "turbolinux-7.0" => "lo",
+ "pld-1.0" => "lo",
+ "pld-1.1" => "lo",
+ "pld-1.99" => "lo",
+ "fedora-1" => "",
+ "fedora-2" => "",
+ "fedora-3" => "",
+ "fedora-4" => "",
+ "fedora-5" => "",
+ "fedora-15" => "",
+ "fedora-16" => "",
+ "fedora-17" => "",
+ "rpath" => "",
+ "vine-3.0" => "lo",
+ "vine-3.1" => "lo",
+ "ark" => "lo",
+ "slackware-9.1.0" => "",
+ "slackware-10.0.0" => "",
+ "slackware-10.1.0" => "",
+ "slackware-10.2.0" => "",
+ "slackware-11.0.0" => "",
+ "slackware-12.0.0" => "",
+ "slackware-12.1.0" => "",
+ "slackware-12.2.0" => "",
+ "slackware-13.0.0" => "",
+ "slackware-13.1.0" => "",
+ "slackware-13.37.0" => "",
+ "slackware-14.0.0" => "",
+ "gentoo" => "",
+ "vlos-1.2" => "",
+ "freebsd-5" => "",
+ "freebsd-6" => "",
+ );
+
+ $dev = $dist_map {$gst_dist};
+
+ return if $dev eq "";
+
+ if (!exists $$interface{$dev})
+ {
+ my %iface = (
+ "auto" => 1,
+ "user" => 0,
+ "dev" => "lo",
+ "address" => "127.0.0.1",
+ "netmask" => "255.0.0.0",
+ "broadcast" => "127.255.255.255",
+ "network" => "127.0.0.0",
+ "bootproto" => "none",
+ "enabled" => 1,
+ "update_dns" => 0
+ );
+
+ $$interface{$dev} = \%iface;
+ &gst_network_interface_set ($dev, \%iface);
+ }
+ elsif (! $ {$$interface{$dev}}{"enabled"})
+ {
+ $ {$$interface{$dev}}{"enabled"} = 1;
+ &gst_network_interface_set ($dev, $$interface{$dev});
+ }
+}
+
+sub gst_network_statichost_add_alias
+{
+ my ($localhost, $alias) = @_;
+ my $i;
+
+ foreach $i (@$localhost)
+ {
+ return if ($i eq $alias);
+ }
+
+ push @$localhost, $alias;
+}
+
+sub gst_network_statichost_remove_alias
+{
+ my ($localhost, $alias) = @_;
+ my $i;
+
+ for ($i = 0; $i < @$localhost; $i++) {
+ if ($$localhost[$i] eq $alias)
+ {
+ delete $$localhost[$i];
+ return;
+ }
+ }
+}
+
+sub gst_network_ensure_loopback_statichost
+{
+ my ($statichost, $hostname, $old_hostname, $lo_ip) = @_;
+ my $i;
+
+ if (exists $$statichost{$lo_ip})
+ {
+ my $localhost = $$statichost{$lo_ip};
+ &gst_network_statichost_remove_alias ($localhost, $old_hostname) if ($old_hostname);
+ &gst_network_statichost_remove_alias ($localhost, $hostname);
+ }
+ else
+ {
+ $$statichost{$lo_ip} = [ ("localhost") ];
+ }
+}
+
+sub get_network_get_lo_ip
+{
+ my ($statichost) = @_;
+
+# Ugly workarround, it is considered you have one lo only, which is wrong, so let's
+# force the first to be 127.0.0.1 and let the script work for other ones as if they were
+# classic hosts entries... At least sudo won't break...
+# foreach $i (keys %$statichost)
+# {
+# return $i if ($i =~ /^127\./);
+# }
+
+ return "127.0.0.1";
+}
+
+sub gst_network_ensure_loopback
+{
+ my $values_hash = $_[0];
+ my $old_values_hash = $_[1];
+ my $interface = $$values_hash{"interface"};
+ my $hostname = $$values_hash{"hostname"};
+ my $statichost = $$values_hash{"statichost"};
+ my $lo_ip = &get_network_get_lo_ip ($statichost);
+
+ # needed for replacing hostname safely
+ my $old_hostname = $$old_values_hash{"hostname"};
+
+ &gst_report_enter ();
+ &gst_report ("network_ensure_lo");
+
+ &gst_network_ensure_loopback_statichost ($statichost, $hostname, $old_hostname, $lo_ip);
+ &gst_network_ensure_loopback_interface ($interface, $lo_ip);
+
+ &gst_report_leave ();
+}
+
+sub gst_network_get_parse_table
+{
+ my %dist_map =
+ (
+ "redhat-5.2" => "redhat-6.2",
+ "redhat-6.0" => "redhat-6.2",
+ "redhat-6.1" => "redhat-6.2",
+ "redhat-6.2" => "redhat-6.2",
+ "redhat-7.0" => "redhat-7.0",
+ "redhat-7.1" => "redhat-7.0",
+ "redhat-7.2" => "redhat-7.2",
+ "redhat-8.0" => "redhat-7.2",
+ "redhat-9" => "redhat-7.2",
+ "rhel-5" => "redhat-7.2",
+ "rhel-6" => "redhat-7.2",
+ "openna-1.0" => "redhat-6.2",
+ "mandrake-7.1" => "redhat-6.2",
+ "mandrake-7.2" => "redhat-6.2",
+ "mandrake-9.0" => "redhat-7.0",
+ "mandrake-9.1" => "redhat-7.0",
+ "mandrake-9.2" => "redhat-7.0",
+ "mandrake-10.0" => "redhat-7.0",
+ "mandrake-10.1" => "redhat-7.0",
+ "mandrake-10.2" => "redhat-7.0",
+ "mandriva-2006.0" => "redhat-7.0",
+ "mandriva-2006.1" => "redhat-7.0",
+ "mandriva-2007.0" => "redhat-7.0",
+ "mandriva-2007.1" => "redhat-7.0",
+ "yoper-2.2" => "redhat-7.0",
+ "blackpanther-4.0" => "redhat-7.0",
+ "conectiva-9" => "redhat-7.0",
+ "conectiva-10" => "redhat-7.0",
+ "debian-2.2" => "debian-2.2",
+ "debian-3.0" => "debian-2.2",
+ "debian-3.1" => "debian-2.2",
+ "debian-4.0" => "debian-2.2",
+ "debian-5.0" => "debian-2.2",
+ "debian-testing" => "debian-2.2",
+ "ubuntu-5.04" => "debian-2.2",
+ "ubuntu-5.10" => "debian-2.2",
+ "ubuntu-6.06" => "debian-2.2",
+ "ubuntu-6.10" => "debian-2.2",
+ "ubuntu-7.04" => "debian-2.2",
+ "ubuntu-7.10" => "debian-2.2",
+ "ubuntu-8.04" => "debian-2.2",
+ "ubuntu-8.10" => "debian-2.2",
+ "ubuntu-9.04" => "debian-2.2",
+ "ubuntu-9.10" => "debian-2.2",
+ "ubuntu-10.04" => "debian-2.2",
+ "ubuntu-10.10" => "debian-2.2",
+ "suse-7.0" => "suse-7.0",
+ "suse-9.0" => "suse-9.0",
+ "suse-9.1" => "suse-9.0",
+ "turbolinux-7.0" => "redhat-7.0",
+ "pld-1.0" => "pld-1.0",
+ "pld-1.1" => "pld-1.0",
+ "pld-1.99" => "pld-1.0",
+ "fedora-1" => "redhat-7.2",
+ "fedora-2" => "redhat-7.2",
+ "fedora-3" => "redhat-7.2",
+ "fedora-4" => "redhat-7.2",
+ "fedora-5" => "redhat-7.2",
+ "fedora-15" => "redhat-7.2",
+ "fedora-16" => "redhat-7.2",
+ "fedora-17" => "redhat-7.2",
+ "rpath" => "redhat-7.2",
+ "vine-3.0" => "redhat-7.0",
+ "vine-3.1" => "redhat-7.0",
+ "ark" => "redhat-7.0",
+ "slackware-9.1.0" => "slackware-9.1.0",
+ "slackware-10.0.0" => "slackware-9.1.0",
+ "slackware-10.1.0" => "slackware-9.1.0",
+ "slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
+ "slackware-13.0.0" => "slackware-9.1.0",
+ "slackware-13.1.0" => "slackware-9.1.0",
+ "slackware-13.37.0" => "slackware-9.1.0",
+ "slackware-14.0.0" => "slackware-9.1.0",
+ "gentoo" => "gentoo",
+ "vlos-1.2" => "gentoo",
+ "freebsd-5" => "freebsd-5",
+ "freebsd-6" => "freebsd-5",
+ );
+
+ my %dist_tables =
+ (
+ "redhat-6.2" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => "/etc/sysconfig/network",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "gateway", \&gst_parse_sh, SYSCONFIG_NW, GATEWAY ],
+ [ "gatewaydev", \&gst_parse_sh, SYSCONFIG_NW, GATEWAYDEV ],
+ [ "userifacectl", \&gst_parse_trivial, 1 ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ],
+ [ "smbinstalled", \&gst_service_sysv_installed, "smb" ],
+ [ "smartdhcpcd", \&gst_file_tool_installed, "pump" ],
+ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ],
+ [ "interface", \&gst_network_interfaces_get ]
+ ]
+ },
+
+ "redhat-7.0" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => "/etc/sysconfig/network",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/samba/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "gateway", \&gst_parse_sh, SYSCONFIG_NW, GATEWAY ],
+ [ "gatewaydev", \&gst_parse_sh, SYSCONFIG_NW, GATEWAYDEV ],
+ [ "userifacectl", \&gst_parse_trivial, 1 ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ],
+ [ "smbinstalled", \&gst_service_sysv_installed, "smb" ],
+ [ "smartdhcpcd", \&gst_file_tool_installed, "pump" ],
+ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ],
+ [ "interface", \&gst_network_interfaces_get ]
+ ]
+ },
+
+ "redhat-7.2" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => ["/etc/sysconfig/networking/profiles/default/network",
+ "/etc/sysconfig/networking/network",
+ "/etc/sysconfig/network"],
+ RESOLV_CONF => ["/etc/sysconfig/networking/profiles/default/resolv.conf",
+ "/etc/resolv.conf"],
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => ["/etc/sysconfig/networking/profiles/default/hosts",
+ "/etc/hosts"],
+ SMB_CONF => "/etc/samba/smb.conf",
+ WVDIAL => "/etc/wvdial.conf",
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "gateway", \&gst_parse_sh, SYSCONFIG_NW, GATEWAY ],
+ [ "gatewaydev", \&gst_parse_sh, SYSCONFIG_NW, GATEWAYDEV ],
+ [ "userifacectl", \&gst_parse_trivial, 1 ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ],
+ [ "smbinstalled", \&gst_service_sysv_installed, "smb" ],
+ [ "smartdhcpcd", \&gst_file_tool_installed, "pump" ],
+ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ],
+ [ "interface", \&gst_network_interfaces_get ]
+ ]
+ },
+
+ "debian-2.2" =>
+ {
+ fn =>
+ {
+ OPTIONS => "/etc/network/options",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ HOSTNAME => "/etc/hostname",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_line_first, HOSTNAME ],
+ [ "gateway", \&gst_network_get_default_gateway ],
+ [ "gatewaydev", \&gst_network_get_default_gatewaydev ],
+# [ "gwdevunsup", \&gst_parse_trivial, 1 ],
+# [ "userifacectl", \&gst_parse_trivial, 0 ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_parse_split_all_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "smartdhcpcd", \&gst_file_tool_installed, "pump" ],
+ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ],
+ [ "interface", \&gst_network_interfaces_get ]
+ ]
+ },
+
+ "suse-7.0" =>
+ {
+ fn =>
+ {
+ RC_CONFIG => "/etc/rc.config",
+ ROUTE_CONF => "/etc/route.conf",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_sh_get_hostname, RC_CONFIG, FQHOSTNAME ],
+ [ "gateway", \&gst_parse_split_first_str, ROUTE_CONF, "default", "[ \t]+" ],
+ [ "gateway", \&gst_parse_split_first_str, ROUTE_CONF, "0.0.0.0", "[ \t]+" ],
+ [ "gwdevunsup", \&gst_parse_trivial, 1 ],
+ [ "userifacectl", \&gst_parse_trivial, 0 ],
+ [ "domain", \&gst_parse_sh_get_domain, RC_CONFIG, FQHOSTNAME ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+# This was to take the values from SuSEConfig, but a better solution is to get
+# the configuration from /etc/resolv.conf and then replace in rc.config, so those
+# files stay in sync.
+# [ "nameserver", \&gst_parse_sh_split, RC_CONFIG, NAMESERVER, "[ \t]+" ],
+# [ "searchdomain", \&gst_parse_sh_split, RC_CONFIG, SEARCHLIST, "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_parse_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ],
+ [ "smbinstalled", \&gst_service_sysv_installed, "smb" ],
+ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ],
+ [ "interface_tmp", \&gst_network_interfaces_get ],
+ [ "interface", \&gst_network_suse70_get_ppp, "%dialing%", "%interface_tmp%" ],
+ ]
+ },
+
+ "suse-9.0" =>
+ {
+ fn =>
+ {
+ ROUTE_CONF => "/etc/sysconfig/network/routes",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ HOSTNAME => "/etc/HOSTNAME",
+ SMB_CONF => "/etc/samba/smb.conf",
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_fq_hostname, HOSTNAME ],
+ [ "domain", \&gst_parse_fq_domain, HOSTNAME ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_get_status, "smb" ],
+ [ "smbinstalled", \&gst_service_installed, "smb" ],
+ [ "dialinstalled", \&gst_parse_trivial, 1 ],
+ [ "interface", \&gst_network_interfaces_get ],
+ [ "gateway", \&gst_parse_split_first_array_pos, ROUTE_CONF, "default", 0, "[ \t]+", "[ \t]+" ],
+ [ "gatewaydev", \&gst_network_get_gateway_dev_from_address, "%interface%", "%gateway%" ],
+ ]
+ },
+
+ "pld-1.0" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => "/etc/sysconfig/network",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/smb/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "gateway", \&gst_parse_sh, SYSCONFIG_NW, GATEWAY ],
+ [ "gatewaydev", \&gst_parse_sh, SYSCONFIG_NW, GATEWAYDEV ],
+ [ "userifacectl", \&gst_parse_trivial, 1 ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ],
+ [ "smbinstalled", \&gst_service_sysv_installed, "smb" ],
+ [ "smartdhcpcd", \&gst_file_tool_installed, "pump" ],
+ [ "dialinstalled", \&gst_file_tool_installed, "wvdial" ],
+ [ "interface", \&gst_network_interfaces_get ]
+ ]
+ },
+
+ "slackware-9.1.0" =>
+ {
+ fn =>
+ {
+ RC_INET_CONF => "/etc/rc.d/rc.inet1.conf",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ HOSTNAME => "/etc/HOSTNAME",
+ SMB_CONF => "/etc/samba/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_fq_hostname, HOSTNAME ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "order", \&gst_parse_split_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_parse_split_first_bool, HOST_CONF, "multi", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_get_status_any, "smbd", "nmbd" ],
+ [ "smbinstalled", \&gst_service_installed, "/etc/rc.d/rc.samba" ],
+ [ "dialinstalled", \&gst_parse_trivial, 1 ],
+ [ "interface", \&gst_network_interfaces_get ],
+ [ "gateway", \&gst_parse_sh, RC_INET_CONF, GATEWAY ],
+ [ "gatewaydev", \&gst_network_get_gateway_dev_from_address, "%interface%", "%gateway%" ],
+ ]
+ },
+
+ "gentoo" =>
+ {
+ fn =>
+ {
+ HOSTNAME => "/etc/conf.d/hostname",
+ DOMAINNAME => "/etc/conf.d/domainname",
+ NET => "/etc/conf.d/net",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/samba/smb.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_sh, HOSTNAME, "HOSTNAME" ],
+ [ "domain", \&gst_parse_sh, DOMAINNAME, "DNSDOMAIN" ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_gentoo_get_status, "samba" ],
+ [ "smbinstalled", \&gst_service_installed, "samba" ],
+ [ "dialinstalled", \&gst_parse_trivial, 1 ],
+ [ "gateway", \&gst_network_get_default_gateway ],
+ [ "gatewaydev", \&gst_network_get_default_gatewaydev ],
+ [ "interface", \&gst_network_interfaces_get ],
+ ]
+ },
+
+ "freebsd-5" =>
+ {
+ fn =>
+ {
+ RC_CONF => "/etc/rc.conf",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/usr/local/etc/smb.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_parse_sh_re, RC_CONF, hostname, "^([^\.]*)\." ],
+ [ "domain", \&gst_parse_split_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_parse_split_all_unique_hash_comment, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_parse_split_first_array_unique, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "statichost", \&gst_parse_split_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_parse_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_network_rh_get_smb_desc, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_parse_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_parse_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "dialinstalled", \&gst_parse_trivial, 1 ],
+ [ "smbinstalled", \&gst_service_installed, "samba" ],
+ [ "smbuse", \&gst_service_rcng_get_status, "smbd" ],
+ [ "interface", \&gst_network_interfaces_get ],
+ [ "gateway", \&gst_parse_sh, RC_CONF, defaultrouter ],
+ [ "gatewaydev", \&gst_network_get_gateway_dev_from_address, "%interface%", "%gateway%" ],
+ ]
+ },
+ );
+
+ my $dist = $dist_map{$gst_dist};
+ return %{$dist_tables{$dist}} if $dist;
+
+ &gst_report ("platform_no_table", $gst_dist);
+ return undef;
+}
+
+sub gst_network_get_interface_parse_table
+{
+ my %dist_map =
+ (
+ "redhat-5.2" => "redhat-6.2",
+ "redhat-6.0" => "redhat-6.2",
+ "redhat-6.1" => "redhat-6.2",
+ "redhat-6.2" => "redhat-6.2",
+ "redhat-7.0" => "redhat-6.2",
+ "redhat-7.1" => "redhat-6.2",
+ "redhat-7.2" => "redhat-7.2",
+ "redhat-8.0" => "redhat-8.0",
+ "redhat-9" => "redhat-8.0",
+ "rhel-5" => "redhat-8.0",
+ "rhel-6" => "redhat-8.0",
+ "openna-1.0" => "redhat-6.2",
+ "mandrake-7.1" => "redhat-6.2",
+ "mandrake-7.2" => "redhat-6.2",
+ "mandrake-9.0" => "mandrake-9.0",
+ "mandrake-9.1" => "mandrake-9.0",
+ "mandrake-9.2" => "mandrake-9.0",
+ "mandrake-10.0" => "mandrake-9.0",
+ "mandrake-10.1" => "mandrake-9.0",
+ "mandrake-10.2" => "mandrake-9.0",
+ "mandriva-2006.0" => "mandrake-9.0",
+ "mandriva-2006.1" => "mandrake-9.0",
+ "mandriva-2007.0" => "mandrake-9.0",
+ "mandriva-2007.1" => "mandrake-9.0",
+ "yoper-2.2" => "redhat-6.2",
+ "blackpanther-4.0" => "mandrake-9.0",
+ "conectiva-9" => "conectiva-9",
+ "conectiva-10" => "conectiva-9",
+ "debian-2.2" => "debian-2.2",
+ "debian-3.0" => "debian-3.0",
+ "debian-3.1" => "debian-3.0",
+ "debian-4.0" => "debian-3.0",
+ "debian-5.0" => "debian-3.0",
+ "debian-testing" => "debian-3.0",
+ "ubuntu-5.04" => "debian-3.0",
+ "ubuntu-5.10" => "debian-3.0",
+ "ubuntu-6.06" => "debian-3.0",
+ "ubuntu-6.10" => "debian-3.0",
+ "ubuntu-7.04" => "debian-3.0",
+ "ubuntu-7.10" => "debian-3.0",
+ "ubuntu-8.04" => "debian-3.0",
+ "ubuntu-8.10" => "debian-3.0",
+ "ubuntu-9.04" => "debian-3.0",
+ "ubuntu-9.10" => "debian-3.0",
+ "ubuntu-10.04" => "debian-3.0",
+ "ubuntu-10.10" => "debian-3.0",
+ "suse-7.0" => "suse-7.0",
+ "suse-9.0" => "suse-9.0",
+ "suse-9.1" => "suse-9.0",
+ "turbolinux-7.0" => "redhat-6.2",
+ "pld-1.0" => "pld-1.0",
+ "pld-1.1" => "pld-1.0",
+ "pld-1.99" => "pld-1.0",
+ "fedora-1" => "redhat-7.2",
+ "fedora-2" => "redhat-7.2",
+ "fedora-3" => "redhat-7.2",
+ "fedora-4" => "redhat-7.2",
+ "fedora-5" => "redhat-7.2",
+ "fedora-15" => "redhat-7.2",
+ "fedora-16" => "redhat-7.2",
+ "fedora-17" => "redhat-7.2",
+ "rpath" => "redhat-7.2",
+ "vine-3.0" => "vine-3.0",
+ "vine-3.1" => "vine-3.0",
+ "ark" => "vine-3.0",
+ "slackware-9.1.0" => "slackware-9.1.0",
+ "slackware-10.0.0" => "slackware-9.1.0",
+ "slackware-10.1.0" => "slackware-9.1.0",
+ "slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
+ "slackware-13.0.0" => "slackware-9.1.0",
+ "slackware-13.1.0" => "slackware-9.1.0",
+ "slackware-13.37.0" => "slackware-9.1.0",
+ "slackware-14.0.0" => "slackware-9.1.0",
+ "gentoo" => "gentoo",
+ "vlos-1.2" => "gentoo",
+ "freebsd-5" => "freebsd-5",
+ "freebsd-6" => "freebsd-5",
+ );
+
+ my %dist_tables =
+ (
+ "redhat-6.2" =>
+ {
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_parse_sh_bool, IFCFG, ONBOOT ],
+# [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+ [ "dev", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_parse_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_parse_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_parse_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_parse_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMIP ],
+# [ "update_dns", \&gst_network_pump_get_nodns, PUMP, "%dev%", "%bootproto%" ],
+# [ "dns1", \&gst_parse_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_parse_sh, IFCFG, DNS2 ],
+# [ "ppp_options", \&gst_parse_sh, IFCFG, PPPOPTIONS ],
+ [ "section", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, WVDIALSECT ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PEERDNS ]],
+ [ "mtu", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MTU ]],
+ [ "mru", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MRU ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, PAPNAME ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MODEMPORT ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, LINESPEED ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, DEFROUTE ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PERSIST ]],
+ [ "serial_escapechars", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, ESCAPECHARS ]],
+ [ "serial_hwctl", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, HARDFLOWCTL ]],
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ]],
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+# [ "enabled", \&gst_network_interface_active, IFACE,
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ ]
+ },
+
+ "redhat-7.2" =>
+ {
+ ifaces_get => \&gst_network_sysconfig_rh72_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => ["/etc/sysconfig/networking/profiles/default/ifcfg-#iface#",
+ "/etc/sysconfig/networking/devices/ifcfg-#iface#",
+ "/etc/sysconfig/network-scripts/ifcfg-#iface#"],
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_parse_sh_bool, IFCFG, ONBOOT ],
+# [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+# [ "name", \&gst_parse_sh, IFCFG, NAME ],
+# [ "name", \&gst_parse_trivial, IFACE ],
+ [ "dev", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_parse_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_parse_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_parse_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_parse_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_parse_sh, IFCFG, ESSID ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_sh, IFCFG, KEY ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_sh, IFCFG, KEY ]],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMIP ],
+# [ "update_dns", \&gst_network_pump_get_nodns, PUMP, "%dev%", "%bootproto%" ],
+# [ "dns1", \&gst_parse_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_parse_sh, IFCFG, DNS2 ],
+ [ "section", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, WVDIALSECT ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PEERDNS ]],
+ [ "mtu", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MTU ]],
+ [ "mru", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MRU ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, PAPNAME ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MODEMPORT ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, LINESPEED ]],
+# [ "ppp_options", \&gst_parse_sh, IFCFG, PPPOPTIONS ],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, DEFROUTE ]],
+# [ "debug", \&gst_parse_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PERSIST ]],
+ [ "serial_escapechars", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, ESCAPECHARS ]],
+ [ "serial_hwctl", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, HARDFLOWCTL ]],
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ]],
+# [ "enabled", \&gst_network_interface_active, "%dev%",
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_network_interface_active, IFACE,
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "redhat-8.0" =>
+ {
+ ifaces_get => \&gst_network_sysconfig_rh72_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => ["/etc/sysconfig/networking/profiles/default/ifcfg-#iface#",
+ "/etc/sysconfig/networking/devices/ifcfg-#iface#",
+ "/etc/sysconfig/network-scripts/ifcfg-#iface#"],
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_parse_sh_bool, IFCFG, ONBOOT ],
+# [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+# [ "name", \&gst_parse_sh, IFCFG, NAME ],
+# [ "name", \&gst_parse_trivial, IFACE ],
+ [ "dev", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_parse_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_parse_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_parse_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_parse_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_parse_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMIP ],
+# [ "update_dns", \&gst_network_pump_get_nodns, PUMP, "%dev%", "%bootproto%" ],
+# [ "dns1", \&gst_parse_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_parse_sh, IFCFG, DNS2 ],
+ [ "section", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, WVDIALSECT ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PEERDNS ]],
+ [ "mtu", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MTU ]],
+ [ "mru", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MRU ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, PAPNAME ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MODEMPORT ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, LINESPEED ]],
+# [ "ppp_options", \&gst_parse_sh, IFCFG, PPPOPTIONS ],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, DEFROUTE ]],
+# [ "debug", \&gst_parse_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PERSIST ]],
+ [ "serial_escapechars", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, ESCAPECHARS ]],
+ [ "serial_hwctl", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, HARDFLOWCTL ]],
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ]],
+# [ "enabled", \&gst_network_interface_active, "%dev%",
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_network_interface_active, IFACE,
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "vine-3.0" =>
+ {
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_parse_sh_bool, IFCFG, ONBOOT ],
+# [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+# [ "name", \&gst_parse_sh, IFCFG, NAME ],
+ [ "dev", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_parse_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_parse_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_parse_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_parse_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_parse_sh, IFCFG, ESSID ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_sh, IFCFG, KEY ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_sh, IFCFG, KEY ]],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMIP ],
+# [ "update_dns", \&gst_network_pump_get_nodns, PUMP, "%dev%", "%bootproto%" ],
+# [ "dns1", \&gst_parse_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_parse_sh, IFCFG, DNS2 ],
+ [ "section", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, WVDIALSECT ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PEERDNS ]],
+ [ "mtu", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MTU ]],
+ [ "mru", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MRU ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, PAPNAME ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MODEMPORT ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, LINESPEED ]],
+# [ "ppp_options", \&gst_parse_sh, IFCFG, PPPOPTIONS ],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, DEFROUTE ]],
+# [ "debug", \&gst_parse_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PERSIST ]],
+ [ "serial_escapechars", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, ESCAPECHARS ]],
+ [ "serial_hwctl", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, HARDFLOWCTL ]],
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ]],
+# [ "enabled", \&gst_network_interface_active, IFACE, \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "mandrake-9.0" =>
+ {
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_parse_sh_bool, IFCFG, ONBOOT ],
+# [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+# [ "name", \&gst_parse_sh, IFCFG, NAME ],
+ [ "dev", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_parse_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_parse_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_parse_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_parse_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_parse_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMIP ],
+# [ "update_dns", \&gst_network_pump_get_nodns, PUMP, "%dev%", "%bootproto%" ],
+# [ "dns1", \&gst_parse_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_parse_sh, IFCFG, DNS2 ],
+ [ "section", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, WVDIALSECT ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PEERDNS ]],
+ [ "mtu", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MTU ]],
+ [ "mru", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MRU ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, PAPNAME ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MODEMPORT ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, LINESPEED ]],
+# [ "ppp_options", \&gst_parse_sh, IFCFG, PPPOPTIONS ],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, DEFROUTE ]],
+# [ "debug", \&gst_parse_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PERSIST ]],
+ [ "serial_escapechars", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, ESCAPECHARS ]],
+ [ "serial_hwctl", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, HARDFLOWCTL ]],
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ]],
+# [ "enabled", \&gst_network_interface_active, IFACE,
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "conectiva-9" =>
+ {
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_parse_sh_bool, IFCFG, ONBOOT ],
+# [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+# [ "name", \&gst_parse_sh, IFCFG, NAME ],
+ [ "dev", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_parse_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_parse_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_parse_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_parse_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_parse_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMIP ],
+# [ "update_dns", \&gst_network_pump_get_nodns, PUMP, "%dev%", "%bootproto%" ],
+# [ "dns1", \&gst_parse_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_parse_sh, IFCFG, DNS2 ],
+ [ "section", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, WVDIALSECT ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PEERDNS ]],
+ [ "mtu", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MTU ]],
+ [ "mru", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MRU ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, PAPNAME ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, MODEMPORT ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, LINESPEED ]],
+ [ "ppp_options", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh, IFCFG, PPPOPTIONS ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, DEFROUTE ]],
+# [ "debug", \&gst_parse_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, PERSIST ]],
+ [ "serial_escapechars", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, ESCAPECHARS ]],
+ [ "serial_hwctl", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_sh_bool, IFCFG, HARDFLOWCTL ]],
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ]],
+# [ "enabled", \&gst_network_interface_active, IFACE,
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_parse_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "debian-2.2" =>
+ {
+ ifaces_get => \&gst_network_debian_ifaces_get_existing,
+ fn =>
+ {
+ INTERFACES => "/etc/network/interfaces",
+ IFACE => "#iface#",
+ CHAT => "/etc/chatscripts/%section%",
+ PPP_OPTIONS => "/etc/ppp/peers/%section%",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+# [ "user", \&gst_parse_trivial, 0 ], # not supported.
+ [ "dev", \&gst_parse_trivial, IFACE ],
+ [ "bootproto", \&gst_network_deb22_parse_bootproto, [INTERFACES, IFACE]],
+ [ "auto", \&gst_parse_interfaces_option_kw_not, [INTERFACES, IFACE], "noauto" ],
+# [ "name", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "name" ],
+ [ "address", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "address" ],
+ [ "netmask", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "netmask" ],
+ [ "broadcast", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "broadcast" ],
+ [ "network", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "network" ],
+ [ "gateway", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "gateway" ],
+ [ "essid", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "wireless[_-]essid" ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_interfaces_option_str, INTERFACES, IFACE, "wireless[_-]key1?" ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_interfaces_option_str, INTERFACES, IFACE, "wireless[_-]key1?" ]],
+ [ "remote_address", \&gst_network_debian_parse_remote_address, [INTERFACES, IFACE]],
+ [ "section", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "provider" ],
+ [ "update_dns", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "usepeerdns" ]],
+ [ "noauth", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "noauth" ]],
+ [ "mtu", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]],
+ [ "mru", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]],
+ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]],
+ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]],
+ [ "login", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^login \"?([^\"]*)\"?" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "ppp_options", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_unsup, PPP_OPTIONS ]],
+ [ "set_default_gw", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "defaultroute" ]],
+ [ "debug", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "debug" ]],
+ [ "persist", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "persist" ]],
+ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]],
+ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "crtscts" ]],
+ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd[^0-9]([0-9*#]*)[wW]" ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd.*[ptwW]([0-9, -]+)" ]],
+ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "(atd[tp])[0-9, -w]+" ]],
+ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_modem_volume, CHAT ]],
+# [ "enabled", \&gst_network_interface_active, IFACE,
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ ]
+ },
+
+ # Basicly the same as debian-2.2, but the "auto" option changes.
+ "debian-3.0" =>
+ {
+ ifaces_get => \&gst_network_debian_ifaces_get_existing,
+ fn =>
+ {
+ INTERFACES => "/etc/network/interfaces",
+ IFACE => "#iface#",
+ CHAT => "/etc/chatscripts/%section%",
+ PPP_OPTIONS => "/etc/ppp/peers/%section%",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ },
+ table =>
+ [
+# [ "user", \&gst_parse_trivial, 0 ], # not supported.
+ [ "dev", \&gst_parse_trivial, IFACE ],
+ [ "bootproto", \&gst_network_deb22_parse_bootproto, [INTERFACES, IFACE]],
+ [ "auto", \&gst_network_debian_woody_get_auto, [INTERFACES, IFACE]],
+# [ "name", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "name" ],
+ [ "address", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "address" ],
+ [ "netmask", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "netmask" ],
+ [ "broadcast", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "broadcast" ],
+ [ "network", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "network" ],
+ [ "gateway", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "gateway" ],
+ [ "essid", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "wireless[_-]essid" ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_interfaces_option_str, INTERFACES, IFACE, "wireless[_-]key1?" ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_interfaces_option_str, INTERFACES, IFACE, "wireless[_-]key1?" ]],
+ [ "remote_address", \&gst_network_debian_parse_remote_address, [INTERFACES, IFACE]],
+ [ "section", \&gst_parse_interfaces_option_str, [INTERFACES, IFACE], "provider" ],
+ [ "update_dns", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "usepeerdns" ]],
+ [ "noauth", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "noauth" ]],
+ [ "mtu", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_split_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]],
+ [ "mru", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_split_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]],
+ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]],
+ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]],
+ [ "login", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^user \"?([^\"]*)\"?" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "ppp_options", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_unsup, PPP_OPTIONS ]],
+ [ "set_default_gw", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "defaultroute" ]],
+ [ "debug", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "debug" ]],
+ [ "persist", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_parse_kw, PPP_OPTIONS, "persist" ]],
+ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]],
+ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "crtscts" ]],
+ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd[^0-9]([0-9*#]*)[wW]" ]],
+ [ "external_line", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^number[ \t]+(.+)[wW]" ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^number.*[wW \t](.*)" ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd.*[ptwW]([0-9, -]+)" ]],
+ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "(atd[tp])[0-9, -w]+" ]],
+ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_modem_volume, CHAT ]],
+# [ "enabled", \&gst_network_interface_active, IFACE,
+# \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ ]
+ },
+
+ "suse-7.0" =>
+ {
+ ifaces_get => \&gst_network_suse70_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/rc.config",
+ IFACE => "#iface#"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_suse70_parse_bootproto, [IFCFG, IFACE] ],
+ [ "auto", \&gst_network_suse70_parse_iface_auto, [IFCFG, IFACE], NETCONFIG ],
+ [ "user", \&gst_parse_trivial, 0 ], # not supported.
+ [ "name", \&gst_network_suse70_parse_iface_sh, [IFCFG, IFACE], GST_IFACE_NAME ],
+ [ "dev", \&gst_network_suse70_parse_iface_sh, [IFCFG, IFACE], NETDEV ],
+ [ "address", \&gst_network_suse70_parse_iface_sh, [IFCFG, IFACE], IPADDR ],
+ [ "netmask", \&gst_network_suse70_get_ifconfig_arg, [IFCFG, IFACE], netmask ],
+ [ "broadcast", \&gst_network_suse70_get_ifconfig_arg, [IFCFG, IFACE], broadcast ],
+# [ "network", \&gst_parse_trivial, 0 ], # not supported.
+# [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ], # not supported
+ [ "remote_address", \&gst_network_suse70_get_ifconfig_arg, [IFCFG, IFACE], pointopoint ],
+ [ "enabled", \&gst_network_interface_active, IFACE,
+ \&gst_network_suse70_active_interfaces_get ],
+ [ "enabled", \&gst_parse_trivial, 0 ]
+ ]
+ },
+
+ "suse-9.0" =>
+ {
+ ifaces_get => \&gst_network_suse90_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network/ifcfg-#iface#",
+ ROUTE_CONF => "/etc/sysconfig/network/routes",
+ IFACE => "#iface#"
+ },
+ table =>
+ [
+ [ "dev", \&gst_network_suse9_get_dev_name, IFACE ],
+# [ "enabled", \&gst_network_interface_active, "%dev%", \&gst_network_active_interfaces_get ],
+ [ "auto", \&gst_network_suse90_get_auto, IFCFG, STARTMODE ],
+ [ "bootproto", \&gst_network_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "address", \&gst_parse_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_parse_sh, IFCFG, NETMASK ],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMOTE_IPADDR ],
+ [ "essid", \&gst_parse_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_sh, IFCFG, WIRELESS_KEY ]],
+ [ "gateway", \&gst_network_suse90_get_gateway, ROUTE_CONF, "%address%", "%netmask%" ],
+ [ "gateway", \&gst_network_suse90_get_plip_gateway, ROUTE_CONF, "%remote_address%" ],
+ # Modem stuff goes here
+ [ "serial_port", \&gst_parse_sh, IFCFG, MODEM_DEVICE ],
+ [ "serial_speed", \&gst_parse_sh, IFCFG, SPEED ],
+ [ "mtu", \&gst_parse_sh, IFCFG, MTU ],
+ [ "mru", \&gst_parse_sh, IFCFG, MRU ],
+# [ "ppp_options", \&gst_parse_sh, IFCFG, PPPD_OPTIONS ],
+ [ "dial_command", \&gst_parse_sh, IFCFG, DIALCOMMAND ],
+ [ "external_line", \&gst_parse_sh, IFCFG, DIALPREFIX ],
+ [ "section", \&gst_parse_sh, IFCFG, PROVIDER ],
+ [ "volume", \&gst_parse_sh_re, IFCFG, INIT8, "AT.*[ml]([0-3])" ],
+ [ "login", \&gst_network_suse90_parse_provider_file, "%section%", USERNAME ],
+ [ "password", \&gst_network_suse90_parse_provider_file, "%section%", PASSWORD ],
+ [ "phone_number", \&gst_network_suse90_parse_provider_file, "%section%", PHONE ],
+ [ "dns1", \&gst_network_suse90_parse_provider_file, "%section%", DNS1 ],
+ [ "dns2", \&gst_network_suse90_parse_provider_file, "%section%", DNS2 ],
+ [ "update_dns", \&gst_network_suse90_parse_provider_file_bool, "%section%", MODIFYDNS ],
+ [ "persist", \&gst_network_suse90_parse_provider_file_bool, "%section%", PERSIST ],
+ [ "stupid", \&gst_network_suse90_parse_provider_file_bool, "%section%", STUPIDMODE ],
+ [ "set_default_gw", \&gst_network_suse90_parse_provider_file_bool, "%section%", DEFAULTROUTE ],
+ ]
+ },
+
+ "pld-1.0" =>
+ {
+ ifaces_get => \&gst_network_sysconfig_pld10_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/interfaces/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/interfaces/data/chat-#iface#",
+ IFACE => "#iface#",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_pld10_parse_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_parse_sh_bool, IFCFG, ONBOOT ],
+# [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+# [ "name", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "dev", \&gst_parse_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_network_pld10_get_ipaddr, IFCFG, IPADDR, "address" ],
+ [ "netmask", \&gst_network_pld10_get_ipaddr, IFCFG, IPADDR, "netmask" ],
+# [ "broadcast", \&gst_parse_sh, IFCFG, BROADCAST ],
+# [ "network", \&gst_parse_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ],
+ [ "remote_address", \&gst_parse_sh, IFCFG, REMIP ],
+# [ "update_dns", \&gst_network_pump_get_nodns, PUMP, "%dev%", "%bootproto%" ],
+# [ "dns1", \&gst_parse_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_parse_sh, IFCFG, DNS2 ],
+ [ "update_dns", \&gst_parse_sh_bool, IFCFG, PEERDNS ],
+ [ "mtu", \&gst_parse_sh, IFCFG, MTU ],
+ [ "mru", \&gst_parse_sh, IFCFG, MRU ],
+ [ "login", \&gst_parse_sh, IFCFG, PAPNAME ],
+ [ "password", \&gst_network_get_pap_passwd, PAP, "%login%" ],
+ [ "password", \&gst_network_get_pap_passwd, CHAP, "%login%" ],
+ [ "serial_port", \&gst_parse_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_parse_sh, IFCFG, LINESPEED ],
+# [ "ppp_options", \&gst_parse_sh, IFCFG, PPPOPTIONS ],
+# [ "section", \&gst_parse_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_parse_sh_bool, IFCFG, DEFROUTE ],
+# [ "debug", \&gst_parse_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_parse_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_parse_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_parse_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_parse_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+# [ "enabled", \&gst_network_interface_active, IFACE, \&gst_network_active_interfaces_get ],
+# [ "enabled", \&gst_parse_trivial, 0 ]
+ ]
+ },
+ "slackware-9.1.0" =>
+ {
+ ifaces_get => \&gst_network_slackware91_ifaces_get_existing,
+ fn =>
+ {
+ RC_INET_CONF => "/etc/rc.d/rc.inet1.conf",
+ RC_INET => "/etc/rc.d/rc.inet1",
+ RC_LOCAL => "/etc/rc.d/rc.local",
+ IFACE => "#iface#",
+ WIRELESS => "/etc/pcmcia/wireless.opts",
+ PPP_OPTIONS => "/etc/ppp/options",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ CHAT => "/etc/ppp/pppscript",
+ },
+ table =>
+ [
+ [ "user", \&gst_parse_trivial, 0 ], # not supported.
+ [ "dev", \&gst_parse_trivial, IFACE ],
+ [ "address", \&gst_parse_rcinet1conf, [RC_INET_CONF, IFACE], IPADDR ],
+ [ "netmask", \&gst_parse_rcinet1conf, [RC_INET_CONF, IFACE], NETMASK ],
+ [ "gateway", \&gst_network_get_gateway, RC_INET_CONF, GATEWAY, "%address%", "%netmask%" ],
+ [ "auto", \&gst_network_slackware91_get_auto, [RC_INET, RC_LOCAL, IFACE]],
+ [ "bootproto", \&gst_network_slackware91_parse_bootproto, [RC_INET_CONF, IFACE]],
+ [ "essid", \&gst_parse_wireless_opts, [ WIRELESS, IFACE ], \&gst_network_get_wireless_ifaces, ESSID ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_wireless_opts, WIRELESS, IFACE, \&gst_network_get_wireless_ifaces, KEY ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_wireless_opts, WIRELESS, IFACE, \&gst_network_get_wireless_ifaces, KEY ]],
+ [ "enabled", \&gst_network_interface_active, IFACE, \&gst_network_active_interfaces_get ],
+ # Modem stuff
+ [ "update_dns", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "usepeerdns" ]],
+ [ "noauth", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "noauth" ]],
+ [ "mtu", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]],
+ [ "mru", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]],
+ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]],
+ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]],
+ [ "login", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_re, PPP_OPTIONS, "^name \"?([^\"]*)\"?" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_pap_passwd, CHAP, "%login%" ]],
+ [ "ppp_options", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_ppp_options_unsup, PPP_OPTIONS ]],
+ [ "set_default_gw", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "defaultroute" ]],
+ [ "debug", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "debug" ]],
+ [ "persist", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "persist" ]],
+ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_split_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]],
+ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_kw, PPP_OPTIONS, "crtscts" ]],
+ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd[^0-9]*([0-9*#]*)[wW]" ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "atd.*[ptw]([0-9, -]+)" ]],
+ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_parse_chat, CHAT, "(atd[tp])[0-9, -w]+" ]],
+ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_get_modem_volume, CHAT ]],
+ ]
+ },
+
+ "gentoo" =>
+ {
+ ifaces_get => \&gst_network_gentoo_ifaces_get_existing,
+ fn =>
+ {
+ NET => "/etc/conf.d/net",
+ PPPNET => "/etc/conf.d/net.#iface#",
+ INIT => "net.#iface#",
+ IFACE => "#iface#",
+ WIRELESS => "/etc/conf.d/wireless",
+ },
+ table =>
+ [
+ [ "auto", \&gst_service_gentoo_get_service_status, INIT, "default" ],
+ [ "user", \&gst_parse_trivial, 0 ], # not supported.
+ [ "dev", \&gst_parse_trivial, IFACE ],
+ [ "address", \&gst_parse_confd_net_re, NET, "config_%dev%", "^[ \t]*([0-9\.]+)" ],
+ [ "netmask", \&gst_parse_confd_net_re, NET, "config_%dev%", "netmask[ \t]+([0-9\.]*)" ],
+ [ "remote_address", \&gst_parse_confd_net_re, NET, "config_%dev%", "dest_address[ \t]+([0-9\.]*)" ],
+# [ "gateway", \&gst_parse_sh_re, NET, "gateway", "%dev%/([0-9\.\:]*)" ],
+ [ "gateway", \&gst_network_gentoo_parse_gateway, [ NET, IFACE ]],
+ [ "enabled", \&gst_network_interface_active, IFACE, \&gst_network_active_interfaces_get ],
+ [ "bootproto", \&gst_network_gentoo_parse_bootproto, [ NET, IFACE ]],
+ [ "essid", \&gst_parse_sh, WIRELESS, "essid_%dev%" ],
+ [ "key_type", \&gst_network_get_wep_key_type, [ \&gst_parse_sh, WIRELESS, "key_%essid%" ]],
+ [ "key", \&gst_network_get_wep_key, [ \&gst_parse_sh, WIRELESS, "key_%essid%" ]],
+ # modem stuff
+ [ "update_dns", \&gst_parse_sh_bool, PPPNET, PEERDNS ],
+ [ "mtu", \&gst_parse_sh, PPPNET, MTU ],
+ [ "mru", \&gst_parse_sh, PPPNET, MRU ],
+ [ "serial_port", \&gst_parse_sh, PPPNET, MODEMPORT ],
+ [ "serial_speed", \&gst_parse_sh, PPPNET, LINESPEED ],
+ [ "login", \&gst_parse_sh, PPPNET, USERNAME ],
+ [ "password", \&gst_parse_sh, PPPNET, PASSWORD ],
+ [ "ppp_options", \&gst_parse_sh, PPPNET, PPPOPTIONS ],
+ [ "set_default_gw", \&gst_parse_sh_bool, PPPNET, DEFROUTE ],
+ [ "debug", \&gst_parse_sh_bool, PPPNET, DEBUG ],
+ [ "persist", \&gst_parse_sh_bool, PPPNET, PERSIST ],
+ [ "serial_escapechars", \&gst_parse_sh_bool, PPPNET, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_parse_sh_bool, PPPNET, HARDFLOWCTL ],
+ [ "external_line", \&gst_parse_sh_re, PPPNET, NUMBER, "^([0-9*#]*)wW" ],
+ [ "phone_number", \&gst_parse_sh_re, PPPNET, NUMBER, "w?([0-9]*)\$" ],
+ [ "volume", \&gst_parse_sh_re, PPPNET, INITSTRING, "^at.*[ml]([0-3])" ],
+ ]
+ },
+
+ "freebsd-5" =>
+ {
+ ifaces_get => \&gst_network_freebsd_ifaces_get_existing,
+ fn =>
+ {
+ RC_CONF => "/etc/rc.conf",
+ RC_CONF_DEFAULT => "/etc/defaults/rc.conf",
+ STARTIF => "/etc/start_if.#iface#",
+ PPPCONF => "/etc/ppp/ppp.conf",
+ IFACE => "#iface#",
+ },
+ table =>
+ [
+ [ "auto", \&gst_network_freebsd5_get_auto, [RC_CONF, RC_CONF_DEFAULT, IFACE ]],
+ [ "user", \&gst_parse_trivial, 0 ], # not supported.
+ [ "dev", \&gst_parse_trivial, IFACE ],
+ # we need to double check these values both in the start_if and in the rc.conf files, in this order
+ [ "address", \&gst_parse_startif, STARTIF, "inet[ \t]+([0-9\.]+)" ],
+ [ "address", \&gst_parse_sh_re, RC_CONF, "ifconfig_%dev%", "inet[ \t]+([0-9\.]+)" ],
+ [ "netmask", \&gst_parse_startif, STARTIF, "netmask[ \t]+([0-9\.]+)" ],
+ [ "netmask", \&gst_parse_sh_re, RC_CONF, "ifconfig_%dev%", "netmask[ \t]+([0-9\.]+)" ],
+ [ "remote_address", \&gst_parse_startif, STARTIF, "dest_address[ \t]+([0-9\.]+)" ],
+ [ "remote_address", \&gst_parse_sh_re, RC_CONF, "ifconfig_%dev%", "dest_address[ \t]+([0-9\.]+)" ],
+ [ "essid", \&gst_parse_startif, STARTIF, "ssid[ \t]+(\".*\"|[^\"][^ ]+)" ],
+ [ "essid", \&gst_parse_sh_re, RC_CONF, "ifconfig_%dev%", "ssid[ \t]+([^ ]*)" ],
+ # this is for plip interfaces
+ [ "gateway", \&gst_network_get_plip_gateway, RC_CONF, "defaultrouter", "%remote_address%" ],
+ [ "gateway", \&gst_network_get_gateway, RC_CONF, "defaultrouter", "%address%", "%netmask%" ],
+ [ "enabled", \&gst_network_interface_active, IFACE, \&gst_network_freebsd5_active_interfaces_get ],
+ [ "bootproto", \&gst_network_parse_bootproto, RC_CONF, "ifconfig_%dev%" ],
+ # Modem stuff
+ [ "serial_port", \&gst_network_parse_pppconf, [ PPPCONF, STARTIF, IFACE ], "device" ],
+ [ "serial_speed", \&gst_network_parse_pppconf, [ PPPCONF, STARTIF, IFACE ], "speed" ],
+ [ "mtu", \&gst_network_parse_pppconf, [ PPPCONF, STARTIF, IFACE ], "mtu" ],
+ [ "mru", \&gst_network_parse_pppconf, [ PPPCONF, STARTIF, IFACE ], "mru" ],
+ [ "login", \&gst_network_parse_pppconf, [ PPPCONF, STARTIF, IFACE ], "authname" ],
+ [ "password", \&gst_network_parse_pppconf, [ PPPCONF, STARTIF, IFACE ], "authkey" ],
+ [ "update_dns", \&gst_network_parse_pppconf_bool, [ PPPCONF, STARTIF, IFACE ], "dns" ],
+ [ "set_default_gw", \&gst_network_parse_pppconf_bool, [ PPPCONF, STARTIF, IFACE ], "default HISADDR" ],
+ [ "external_line", \&gst_network_parse_pppconf_re, [ PPPCONF, STARTIF, IFACE ], "phone", "[ \t]+([0-9]+)[wW]" ],
+ [ "phone_number", \&gst_network_parse_pppconf_re, [ PPPCONF, STARTIF, IFACE ], "phone", "[wW]?([0-9]+)[ \t]*\$" ],
+ [ "dial_command", \&gst_network_parse_pppconf_re, [ PPPCONF, STARTIF, IFACE ], "dial", "(ATD[TP])" ],
+ [ "volume", \&gst_network_parse_pppconf_re, [ PPPCONF, STARTIF, IFACE ], "dial", "AT.*[ml]([0-3]) OK " ],
+ [ "persist", \&gst_network_get_freebsd5_ppp_persist, [ STARTIF, IFACE ]],
+ ]
+ },
+ );
+
+ my $dist = $dist_map{$gst_dist};
+ return %{$dist_tables{$dist}} if $dist;
+
+ &gst_report ("platform_no_table", $gst_dist);
+ return undef;
+}
+
+sub gst_network_get_replace_table
+{
+ my %dist_map =
+ (
+ "redhat-5.2" => "redhat-5.2",
+ "redhat-6.0" => "redhat-6.2",
+ "redhat-6.1" => "redhat-6.2",
+ "redhat-6.2" => "redhat-6.2",
+ "redhat-7.0" => "redhat-7.0",
+ "redhat-7.1" => "redhat-7.0",
+ "redhat-7.2" => "redhat-7.2",
+ "redhat-8.0" => "redhat-7.2",
+ "redhat-9" => "redhat-7.2",
+ "rhel-5" => "redhat-7.2",
+ "rhel-6" => "redhat-7.2",
+ "mandrake-7.1" => "redhat-6.2",
+ "mandrake-7.2" => "redhat-6.2",
+ "mandrake-9.0" => "redhat-7.0",
+ "mandrake-9.1" => "redhat-7.0",
+ "mandrake-9.2" => "redhat-7.0",
+ "mandrake-10.0" => "redhat-7.0",
+ "mandrake-10.1" => "redhat-7.0",
+ "mandrake-10.2" => "redhat-7.0",
+ "mandriva-2006.0" => "redhat-7.0",
+ "mandriva-2006.1" => "redhat-7.0",
+ "mandriva-2007.0" => "redhat-7.0",
+ "mandriva-2007.1" => "redhat-7.0",
+ "yoper-2.2" => "redhat-7.0",
+ "blackpanther-4.0" => "redhat-7.0",
+ "conectiva-9" => "redhat-7.0",
+ "conectiva-10" => "redhat-7.0",
+ "debian-2.2" => "debian-2.2",
+ "debian-3.0" => "debian-2.2",
+ "debian-3.1" => "debian-2.2",
+ "debian-4.0" => "debian-2.2",
+ "debian-5.0" => "debian-2.2",
+ "debian-testing" => "debian-2.2",
+ "ubuntu-5.04" => "debian-2.2",
+ "ubuntu-5.10" => "debian-2.2",
+ "ubuntu-6.06" => "debian-2.2",
+ "ubuntu-6.10" => "debian-2.2",
+ "ubuntu-7.04" => "debian-2.2",
+ "ubuntu-7.10" => "debian-2.2",
+ "ubuntu-8.04" => "debian-2.2",
+ "ubuntu-8.10" => "debian-2.2",
+ "ubuntu-9.04" => "debian-2.2",
+ "ubuntu-9.10" => "debian-2.2",
+ "ubuntu-10.04" => "debian-2.2",
+ "ubuntu-10.10" => "debian-2.2",
+ "suse-7.0" => "suse-7.0",
+ "suse-9.0" => "suse-9.0",
+ "suse-9.1" => "suse-9.0",
+ "turbolinux-7.0" => "redhat-7.0",
+ "pld-1.0" => "pld-1.0",
+ "pld-1.1" => "pld-1.0",
+ "pld-1.99" => "pld-1.0",
+ "fedora-1" => "redhat-7.2",
+ "fedora-2" => "redhat-7.2",
+ "fedora-3" => "redhat-7.2",
+ "fedora-4" => "redhat-7.2",
+ "fedora-5" => "redhat-7.2",
+ "fedora-15" => "redhat-7.2",
+ "fedora-16" => "redhat-7.2",
+ "fedora-17" => "redhat-7.2",
+ "rpath" => "redhat-7.2",
+ "vine-3.0" => "redhat-7.0",
+ "vine-3.1" => "redhat-7.0",
+ "ark" => "redhat-7.0",
+ "slackware-9.1.0" => "slackware-9.1.0",
+ "slackware-10.0.0" => "slackware-9.1.0",
+ "slackware-10.1.0" => "slackware-9.1.0",
+ "slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
+ "slackware-13.0.0" => "slackware-9.1.0",
+ "slackware-13.1.0" => "slackware-9.1.0",
+ "slackware-13.37.0" => "slackware-9.1.0",
+ "slackware-14.0.0" => "slackware-9.1.0",
+ "gentoo" => "gentoo",
+ "vlos-1.2" => "gentoo",
+ "freebsd-5" => "freebsd-5",
+ "freebsd-6" => "freebsd-5",
+ );
+
+ my %dist_tables =
+ (
+ "redhat-6.2" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => "/etc/sysconfig/network",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "auto", \&gst_replace_sh_bool, SYSCONFIG_NW, NETWORKING ],
+ [ "hostname", \&gst_replace_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "gateway", \&gst_replace_sh, SYSCONFIG_NW, GATEWAY],
+ [ "gatewaydev", \&gst_replace_sh, SYSCONFIG_NW, GATEWAYDEV],
+ [ "domain", \&gst_replace_sh, SYSCONFIG_NW, DOMAIN],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_set_status, 91, "smb", "%smbuse%" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ],
+ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ]
+ ]
+ },
+
+ "redhat-7.0" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => "/etc/sysconfig/network",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/samba/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "auto", \&gst_replace_sh_bool, SYSCONFIG_NW, NETWORKING ],
+ [ "hostname", \&gst_replace_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "gateway", \&gst_replace_sh, SYSCONFIG_NW, GATEWAY],
+ [ "gatewaydev", \&gst_replace_sh, SYSCONFIG_NW, GATEWAYDEV],
+ [ "domain", \&gst_replace_sh, SYSCONFIG_NW, DOMAIN],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_set_status, 91, "smb", "%smbuse%" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ],
+ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ]
+ ]
+ },
+
+ "redhat-7.2" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => ["/etc/sysconfig/networking/profiles/default/network",
+ "/etc/sysconfig/networking/network",
+ "/etc/sysconfig/network"],
+ RESOLV_CONF => ["/etc/sysconfig/networking/profiles/default/resolv.conf",
+ "/etc/resolv.conf"],
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => ["/etc/sysconfig/networking/profiles/default/hosts",
+ "/etc/hosts"],
+ SMB_CONF => "/etc/samba/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "auto", \&gst_replace_sh_bool, SYSCONFIG_NW, NETWORKING ],
+ [ "hostname", \&gst_replace_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "gateway", \&gst_replace_sh, SYSCONFIG_NW, GATEWAY],
+ [ "gatewaydev", \&gst_replace_sh, SYSCONFIG_NW, GATEWAYDEV],
+ [ "domain", \&gst_replace_sh, SYSCONFIG_NW, DOMAIN],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_set_status, 91, "smb", "%smbuse%" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ],
+ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ]
+ ]
+ },
+
+ "debian-2.2" =>
+ {
+ fn =>
+ {
+ OPTIONS => "/etc/network/options",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ HOSTNAME => "/etc/hostname",
+ SMB_CONF => "/etc/samba/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_replace_line_first, HOSTNAME ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_set_status, 91, "samba" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ]
+ ]
+ },
+
+ "suse-7.0" =>
+ {
+ fn =>
+ {
+ RC_CONFIG => "/etc/rc.config",
+ ROUTE_CONF => "/etc/route.conf",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/smb.conf",
+ WVDIAL => "/etc/wvdial.conf",
+ SUSECONFIG => "SuSEconfig"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_replace_sh_set_hostname, RC_CONFIG, FQHOSTNAME ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "gateway", \&gst_replace_join_first_str, ROUTE_CONF, "default", "[ \t]+" ],
+ [ "gateway", \&gst_replace_join_first_str, ROUTE_CONF, "0.0.0.0", "[ \t]+" ],
+ [ "domain", \&gst_replace_sh_set_domain, RC_CONFIG, FQHOSTNAME ],
+ [ "nameserver", \&gst_replace_sh_join, RC_CONFIG, NAMESERVER, "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_sh_join, RC_CONFIG, SEARCHLIST, "[ \t]+" ],
+# Remove /etc/resolv.conf so SuSEconfig sets the new values.
+ [ "searchdomain", \&gst_file_remove, RESOLV_CONF ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_set_status, 20, "smb", "%smbuse%" ],
+ [ "interface", \&gst_network_suse70_set_ppp, [WVDIAL, "%dialing%"] ],
+# We're calling this sepparated cuz we are going to call wvdial to activate.
+ [ "interface", \&gst_network_suse70_activate_ppp ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ],
+ [ "_always_", \&gst_file_run, SUSECONFIG ],
+ ]
+ },
+
+ "suse-9.0" =>
+ {
+ fn =>
+ {
+ ROUTE_CONF => "/etc/sysconfig/network/routes",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ HOSTNAME => "/etc/HOSTNAME",
+ SMB_CONF => "/etc/samba/smb.conf",
+ },
+ table =>
+ [
+ [ "hostname", \&gst_replace_fq_hostname, HOSTNAME, "%hostname%", "%domain%" ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_suse_set_status, "smb" ],
+ [ "gateway", \&gst_replace_join_first_str, ROUTE_CONF, "default", "[ \t]+", "%gateway% - -" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ],
+ ]
+ },
+
+ "pld-1.0" =>
+ {
+ fn =>
+ {
+ SYSCONFIG_NW => "/etc/sysconfig/network",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/smb/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "auto", \&gst_replace_sh_bool, SYSCONFIG_NW, NETWORKING ],
+ [ "hostname", \&gst_replace_sh, SYSCONFIG_NW, HOSTNAME ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "gateway", \&gst_replace_sh, SYSCONFIG_NW, GATEWAY],
+ [ "gatewaydev", \&gst_replace_sh, SYSCONFIG_NW, GATEWAYDEV],
+# [ "domain", \&gst_replace_sh, SYSCONFIG_NW, DOMAIN],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_sysv_set_status, 91, "smb", "%smbuse%" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ],
+ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ]
+ ]
+ },
+ "slackware-9.1.0" =>
+ {
+ fn =>
+ {
+ RC_INET_CONF => "/etc/rc.d/rc.inet1.conf",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOST_CONF => "/etc/host.conf",
+ HOSTS => "/etc/hosts",
+ HOSTNAME => "/etc/HOSTNAME",
+ SMB_CONF => "/etc/samba/smb.conf",
+ WVDIAL => "/etc/wvdial.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_replace_fq_hostname, HOSTNAME, "%hostname%", "%domain%" ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "gateway", \&gst_replace_rcinet1conf_global, RC_INET_CONF, GATEWAY ],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "order", \&gst_replace_join_first_array, HOST_CONF, "order", "[ \t]+", ",[ \t]*" ],
+ [ "hostmatch", \&gst_replace_join_first_bool, HOST_CONF, "multi", "[ \t]+", "on", "off" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_bsd_set_status, "/etc/rc.d/rc.samba" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ],
+ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ]
+ ]
+ },
+
+ "gentoo" =>
+ {
+ fn =>
+ {
+ HOSTNAME => "/etc/conf.d/hostname",
+ DOMAINNAME => "/etc/conf.d/domainname",
+ NET => "/etc/conf.d/net",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/etc/samba/smb.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_replace_sh, HOSTNAME, "HOSTNAME" ],
+ [ "hostname", \&gst_network_run_hostname ],
+ [ "gateway", \&gst_network_route_set_default_gw, "%gatewaydev%" ],
+ [ "domain", \&gst_replace_sh, DOMAINNAME, "DNSDOMAIN" ],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_gentoo_set_status, "samba", 1 ],
+ # first set the gateway to something like "eth0", then add the IP address like "eth0/1.1.1.1"
+# [ "gatewaydev", \&gst_replace_sh, NET, gateway ],
+# [ "gateway", \&gst_replace_sh_re, NET, gateway, "\/[0-9\.]*\$", "/%gateway%" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ]
+ ]
+ },
+
+ "freebsd-5" =>
+ {
+ fn =>
+ {
+ RC_CONF => "/etc/rc.conf",
+ RESOLV_CONF => "/etc/resolv.conf",
+ HOSTS => "/etc/hosts",
+ SMB_CONF => "/usr/local/etc/smb.conf"
+ },
+ table =>
+ [
+ [ "hostname", \&gst_replace_sh, RC_CONF, "hostname", "%hostname%.%domain%" ],
+ [ "hostname", \&gst_network_run_hostname, "%hostname%.%domain%" ],
+ [ "domain", \&gst_replace_join_first_str, RESOLV_CONF, "domain", "[ \t]+" ],
+ [ "nameserver", \&gst_replace_join_all, RESOLV_CONF, "nameserver", "[ \t]+" ],
+ [ "searchdomain", \&gst_replace_join_first_array, RESOLV_CONF, "search", "[ \t]+", "[ \t]+" ],
+ [ "statichost", \&gst_replace_join_hash, HOSTS, "[ \t]+", "[ \t]+" ],
+ [ "workgroup", \&gst_replace_ini, SMB_CONF, "global", "workgroup" ],
+ [ "smbdesc", \&gst_replace_ini, SMB_CONF, "global", "server string", "%hostname%" ],
+ [ "winsserver", \&gst_replace_ini, SMB_CONF, "global", "wins server" ],
+ [ "winsuse", \&gst_replace_ini_bool, SMB_CONF, "global", "wins support" ],
+ [ "smbuse", \&gst_service_rcng_set_status, "samba" ],
+ [ "gateway", \&gst_replace_sh, RC_CONF, "defaultrouter" ],
+ [ "interface", \&gst_network_interfaces_set, OLD_HASH ]
+ ]
+ }
+ );
+
+ my $dist = $dist_map{$gst_dist};
+ return %{$dist_tables{$dist}} if $dist;
+
+ &gst_report ("platform_no_table", $gst_dist);
+ return undef;
+}
+
+sub gst_network_get_interface_replace_table
+{
+ my %dist_map =
+ (
+ "redhat-5.2" => "redhat-5.2",
+ "redhat-6.0" => "redhat-6.2",
+ "redhat-6.1" => "redhat-6.2",
+ "redhat-6.2" => "redhat-6.2",
+ "redhat-7.0" => "redhat-6.2",
+ "redhat-7.1" => "redhat-6.2",
+ "redhat-7.2" => "redhat-7.2",
+ "redhat-8.0" => "redhat-8.0",
+ "redhat-9" => "redhat-8.0",
+ "rhel-5" => "redhat-8.0",
+ "rhel-6" => "redhat-8.0",
+ "mandrake-7.1" => "redhat-6.2",
+ "mandrake-7.2" => "redhat-6.2",
+ "mandrake-9.0" => "mandrake-9.0",
+ "mandrake-9.1" => "mandrake-9.0",
+ "mandrake-9.2" => "mandrake-9.0",
+ "mandrake-10.0" => "mandrake-9.0",
+ "mandrake-10.1" => "mandrake-9.0",
+ "mandrake-10.2" => "mandrake-9.0",
+ "mandriva-2006.0" => "mandrake-9.0",
+ "mandriva-2006.1" => "mandrake-9.0",
+ "mandriva-2007.0" => "mandrake-9.0",
+ "mandriva-2007.1" => "mandrake-9.0",
+ "yoper-2.2" => "redhat-6.2",
+ "blackpanther-4.0" => "mandrake-9.0",
+ "conectiva-9" => "conectiva-9",
+ "conectiva-10" => "conectiva-9",
+ "debian-2.2" => "debian-2.2",
+ "debian-3.0" => "debian-3.0",
+ "debian-3.1" => "debian-3.0",
+ "debian-4.0" => "debian-3.0",
+ "debian-5.0" => "debian-3.0",
+ "debian-testing" => "debian-3.0",
+ "ubuntu-5.04" => "debian-3.0",
+ "ubuntu-5.10" => "debian-3.0",
+ "ubuntu-6.06" => "debian-3.0",
+ "ubuntu-6.10" => "debian-3.0",
+ "ubuntu-7.04" => "debian-3.0",
+ "ubuntu-7.10" => "debian-3.0",
+ "ubuntu-8.04" => "debian-3.0",
+ "ubuntu-8.10" => "debian-3.0",
+ "ubuntu-9.04" => "debian-3.0",
+ "ubuntu-9.10" => "debian-3.0",
+ "ubuntu-10.04" => "debian-3.0",
+ "ubuntu-10.10" => "debian-3.0",
+ "suse-7.0" => "suse-7.0",
+ "suse-9.0" => "suse-9.0",
+ "suse-9.1" => "suse-9.0",
+ "turbolinux-7.0" => "redhat-6.2",
+ "pld-1.0" => "pld-1.0",
+ "pld-1.1" => "pld-1.0",
+ "pld-1.99" => "pld-1.0",
+ "fedora-1" => "redhat-7.2",
+ "fedora-2" => "redhat-7.2",
+ "fedora-3" => "redhat-7.2",
+ "fedora-4" => "redhat-7.2",
+ "fedora-5" => "redhat-7.2",
+ "fedora-15" => "redhat-7.2",
+ "fedora-16" => "redhat-7.2",
+ "fedora-17" => "redhat-7.2",
+ "rpath" => "redhat-7.2",
+ "vine-3.0" => "vine-3.0",
+ "vine-3.1" => "vine-3.0",
+ "ark" => "vine-3.0",
+ "slackware-9.1.0" => "slackware-9.1.0",
+ "slackware-10.0.0" => "slackware-9.1.0",
+ "slackware-10.1.0" => "slackware-9.1.0",
+ "slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
+ "slackware-13.0.0" => "slackware-9.1.0",
+ "slackware-13.1.0" => "slackware-9.1.0",
+ "slackware-13.37.0" => "slackware-9.1.0",
+ "slackware-14.0.0" => "slackware-9.1.0",
+ "gentoo" => "gentoo",
+ "vlos-1.2" => "gentoo",
+ "freebsd-5" => "freebsd-5",
+ "freebsd-6" => "freebsd-5",
+ );
+
+ my %dist_tables =
+ (
+ "redhat-6.2" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate,
+ iface_delete => \&gst_network_rh62_interface_delete,
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ WVDIAL => "/etc/wvdial.conf",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_replace_sh_bool, IFCFG, ONBOOT ],
+ [ "user", \&gst_replace_sh_bool, IFCFG, USERCTL ],
+ [ "dev", \&gst_replace_sh, IFCFG, NAME ],
+ [ "dev", \&gst_replace_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_replace_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_replace_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_replace_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_replace_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_replace_sh, IFCFG, GATEWAY ],
+ [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_sh_bool, IFCFG, PEERDNS ],
+ [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+ [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMIP ],
+ [ "login", \&gst_replace_sh, IFCFG, PAPNAME ],
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, LINESPEED ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPOPTIONS ],
+ [ "section", \&gst_replace_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_replace_sh_bool, IFCFG, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "redhat-7.2" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate,
+ iface_delete => \&gst_network_rh72_interface_delete,
+ ifaces_get => \&gst_network_sysconfig_rh72_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => ["/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ "/etc/sysconfig/networking/profiles/default/ifcfg-#iface#",
+ "/etc/sysconfig/networking/devices/ifcfg-#iface#"],
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ WVDIAL => "/etc/wvdial.conf",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_replace_sh_bool, IFCFG, ONBOOT ],
+ [ "user", \&gst_replace_sh_bool, IFCFG, USERCTL ],
+ [ "name", \&gst_replace_sh, IFCFG, NAME ],
+ [ "dev", \&gst_replace_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_replace_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_replace_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_replace_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_replace_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_replace_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_replace_sh, IFCFG, ESSID ],
+ [ "key", \&gst_replace_sh, IFCFG, KEY ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_sh, IFCFG, KEY, "%key%" ]],
+ [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_sh_bool, IFCFG, PEERDNS ],
+ [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+ [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMIP ],
+ [ "login", \&gst_replace_sh, IFCFG, PAPNAME ],
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, LINESPEED ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPOPTIONS ],
+ [ "section", \&gst_replace_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_replace_sh_bool, IFCFG, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "redhat-8.0" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate,
+ iface_delete => \&gst_network_rh72_interface_delete,
+ ifaces_get => \&gst_network_sysconfig_rh72_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => ["/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ "/etc/sysconfig/networking/profiles/default/ifcfg-#iface#",
+ "/etc/sysconfig/networking/devices/ifcfg-#iface#"],
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ WVDIAL => "/etc/wvdial.conf",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_replace_sh_bool, IFCFG, ONBOOT ],
+ [ "user", \&gst_replace_sh_bool, IFCFG, USERCTL ],
+ [ "name", \&gst_replace_sh, IFCFG, NAME ],
+ [ "dev", \&gst_replace_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_replace_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_replace_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_replace_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_replace_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_replace_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_replace_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key", \&gst_replace_sh, IFCFG, WIRELESS_KEY ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_sh, IFCFG, WIRELESS_KEY, "%key%" ]],
+ [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_sh_bool, IFCFG, PEERDNS ],
+ [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+ [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMIP ],
+ [ "login", \&gst_replace_sh, IFCFG, PAPNAME ],
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, LINESPEED ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPOPTIONS ],
+ [ "section", \&gst_replace_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_replace_sh_bool, IFCFG, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "vine-3.0" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate,
+ iface_delete => \&gst_network_rh62_interface_delete,
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ WVDIAL => "/etc/wvdial.conf",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_replace_sh_bool, IFCFG, ONBOOT ],
+ [ "user", \&gst_replace_sh_bool, IFCFG, USERCTL ],
+ [ "name", \&gst_replace_sh, IFCFG, NAME ],
+ [ "dev", \&gst_replace_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_replace_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_replace_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_replace_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_replace_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_replace_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_replace_sh, IFCFG, ESSID ],
+ [ "key", \&gst_replace_sh, IFCFG, KEY ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_sh, IFCFG, KEY, "%key%" ]],
+ [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_sh_bool, IFCFG, PEERDNS ],
+ [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+ [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMIP ],
+ [ "login", \&gst_replace_sh, IFCFG, PAPNAME ],
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, LINESPEED ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPOPTIONS ],
+ [ "section", \&gst_replace_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_replace_sh_bool, IFCFG, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "mandrake-9.0" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate,
+ iface_delete => \&gst_network_rh62_interface_delete,
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ WVDIAL => "/etc/wvdial.conf",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_replace_sh_bool, IFCFG, ONBOOT ],
+ [ "user", \&gst_replace_sh_bool, IFCFG, USERCTL ],
+ [ "name", \&gst_replace_sh, IFCFG, NAME ],
+ [ "dev", \&gst_replace_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_replace_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_replace_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_replace_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_replace_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_replace_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_replace_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key", \&gst_replace_sh, IFCFG, WIRELESS_KEY ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_sh, IFCFG, WIRELESS_KEY, "%key%" ]],
+ [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_sh_bool, IFCFG, PEERDNS ],
+ [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+ [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMIP ],
+ [ "login", \&gst_replace_sh, IFCFG, PAPNAME ],
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, LINESPEED ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPOPTIONS ],
+ [ "section", \&gst_replace_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_replace_sh_bool, IFCFG, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "conectiva-9" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate,
+ iface_delete => \&gst_network_rh62_interface_delete,
+ ifaces_get => \&gst_network_sysconfig_rh62_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network-scripts/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/network-scripts/chat-#iface#",
+ IFACE => "#iface#",
+ WVDIAL => "/etc/wvdial.conf",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_rh62_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_replace_sh_bool, IFCFG, ONBOOT ],
+ [ "user", \&gst_replace_sh_bool, IFCFG, USERCTL ],
+ [ "name", \&gst_replace_sh, IFCFG, NAME ],
+ [ "dev", \&gst_replace_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_replace_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_replace_sh, IFCFG, NETMASK ],
+ [ "broadcast", \&gst_replace_sh, IFCFG, BROADCAST ],
+ [ "network", \&gst_replace_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_replace_sh, IFCFG, GATEWAY ],
+ [ "essid", \&gst_replace_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key", \&gst_replace_sh, IFCFG, WIRELESS_KEY ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_sh, IFCFG, WIRELESS_KEY, "%key%" ]],
+ [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_sh_bool, IFCFG, PEERDNS ],
+ [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+ [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMIP ],
+ [ "login", \&gst_replace_sh, IFCFG, PAPNAME ],
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, LINESPEED ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPOPTIONS ],
+ [ "section", \&gst_replace_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_replace_sh_bool, IFCFG, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+ # wvdial settings
+ [ "phone_number", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Phone" ]],
+ [ "update_dns", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto DNS" ]],
+ [ "login", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Username" ]],
+ [ "password", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Password" ]],
+ [ "serial_port", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Modem" ]],
+ [ "serial_speed", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Baud" ]],
+ [ "set_default_gw", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Check Def Route" ]],
+ [ "persist", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Auto Reconnect" ]],
+ [ "dial_command", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Command" ]],
+ [ "external_line", \&gst_network_check_type, ["%dev%", "modem", \&gst_replace_ini, WVDIAL, "Dialer %section%", "Dial Prefix" ]],
+ ]
+ },
+
+ "debian-2.2" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate, # They use the same ifup/ifdown cmds.
+ iface_delete => \&gst_network_deb22_interface_delete,
+ ifaces_get => \&gst_network_debian_ifaces_get_existing,
+ fn =>
+ {
+ INTERFACES => "/etc/network/interfaces",
+ IFACE => "#iface#",
+ CHAT => "/etc/chatscripts/%section%",
+ PPP_OPTIONS => "/etc/ppp/peers/%section%",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+# not sup [ "user", \&gst_parse_sh_bool, IFCFG, USERCTL ],
+ [ "_always_", \&gst_network_deb22_replace_bootproto, [INTERFACES, IFACE]],
+ [ "bootproto", \&gst_network_deb22_replace_bootproto, [INTERFACES, IFACE]],
+ [ "auto", \&gst_replace_interfaces_option_kw_not, [INTERFACES, IFACE], "noauto" ],
+ [ "name", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "name" ],
+ [ "address", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "address" ],
+ [ "netmask", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "netmask" ],
+ [ "broadcast", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "broadcast" ],
+ [ "network", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "network" ],
+ [ "gateway", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "gateway" ],
+ [ "section", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "provider" ],
+ [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_kw, PPP_OPTIONS, "usepeerdns" ],
+# not sup [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+# not sup [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "noauth", \&gst_replace_kw, PPP_OPTIONS, "noauth" ],
+ [ "mtu", \&gst_replace_join_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ],
+ [ "mru", \&gst_replace_join_first_str, PPP_OPTIONS, "mru", "[ \t]+" ],
+ [ "remote_address", \&gst_network_debian_replace_remote_address, [INTERFACES, IFACE]],
+ [ "login", \&gst_replace_join_first_str, PPP_OPTIONS, "user", "[ \t]+" ],
+ [ "serial_port", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ],
+ [ "serial_speed", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ],
+ [ "section", \&gst_network_set_ppp_options_connect, PPP_OPTIONS ],
+ [ "ppp_options", \&gst_network_set_ppp_options_unsup, PPP_OPTIONS ],
+ [ "set_default_gw", \&gst_replace_kw, PPP_OPTIONS, "defaultroute" ],
+ [ "debug", \&gst_replace_kw, PPP_OPTIONS, "debug" ],
+ [ "persist", \&gst_replace_kw, PPP_OPTIONS, "persist" ],
+ [ "serial_escapechars", \&gst_replace_join_first_str, PPP_OPTIONS, "escape", "[ \t]+" ],
+ [ "serial_hwctl", \&gst_replace_kw, PPP_OPTIONS, "crtscts" ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ],
+ ]
+ },
+
+ # Basicly the same as debian-2.2, but the "auto" option changes.
+ "debian-3.0" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate, # They use the same ifup/ifdown cmds.
+ iface_delete => \&gst_network_deb22_interface_delete,
+ ifaces_get => \&gst_network_debian_ifaces_get_existing,
+ fn =>
+ {
+ INTERFACES => "/etc/network/interfaces",
+ IFACE => "#iface#",
+ CHAT => "/etc/chatscripts/%section%",
+ PPP_OPTIONS => "/etc/ppp/peers/%section%",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ },
+ table =>
+ [
+ [ "_always_", \&gst_network_deb22_replace_bootproto, [INTERFACES, IFACE]],
+ [ "bootproto", \&gst_network_deb22_replace_bootproto, [INTERFACES, IFACE]],
+ [ "auto", \&gst_network_debian_woody_set_auto, [INTERFACES, IFACE]],
+ [ "address", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "address" ],
+ [ "netmask", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "netmask" ],
+ [ "gateway", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "gateway" ],
+ [ "essid", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "wireless-essid" ],
+ [ "key", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "wireless-key" ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_interfaces_option_str, INTERFACES, IFACE, "wireless-key", "%key%" ]],
+ # ugly hack for deleting undesired options (due to syntax duality)
+ [ "essid", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "wireless_essid", "" ],
+ [ "key", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "wireless_key", "" ],
+ [ "key", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "wireless_key1", "" ],
+ # End of hack
+ [ "section", \&gst_replace_interfaces_option_str, [INTERFACES, IFACE], "provider" ],
+ [ "remote_address", \&gst_network_debian_replace_remote_address, [INTERFACES, IFACE]],
+ # Modem stuff
+ [ "section", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_connect, PPP_OPTIONS ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_network_create_pppscript, CHAT ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_create_isdn_options, PPP_OPTIONS ]],
+ [ "update_dns", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "usepeerdns" ]],
+ [ "noauth", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "noauth" ]],
+ [ "set_default_gw", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "defaultroute" ]],
+ [ "debug", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "debug" ]],
+ [ "persist", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_kw, PPP_OPTIONS, "persist" ]],
+ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "crtscts" ]],
+ [ "mtu", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_join_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]],
+ [ "mru", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_replace_join_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]],
+ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]],
+ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]],
+ [ "login", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^user (.*)", "user \"%login%\"" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "(modem|isdn)", \&gst_network_set_pap_passwd, CHAP, "%login%" ]],
+ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_join_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]],
+ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "(atd[tp])[0-9w, -]+" ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w]+)" ]],
+ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w, -]+)", "%external_line%W%phone_number%" ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^number (.*)", "number %phone_number%" ]],
+ [ "external_line", \&gst_network_check_type, [IFACE, "isdn", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^number (.*)", "number %external_line%W%phone_number%" ]],
+ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_modem_volume, CHAT ]],
+ ]
+ },
+
+ "suse-7.0" =>
+ {
+ iface_set => \&gst_network_suse70_interface_activate,
+ iface_delete => \&gst_network_suse70_interface_delete,
+ ifaces_get => \&gst_network_suse70_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/rc.config",
+ IFACE => "#iface#",
+ PPP_OPTIONS => "/etc/ppp/options"
+ },
+ table =>
+ [
+# bootproto has to go second for suse, as it uses the same value for bootproto and params.
+ [ "bootproto", \&gst_network_suse70_replace_bootproto, [IFCFG, IFACE] ],
+ [ "auto", \&gst_network_suse70_replace_iface_auto, [IFCFG, IFACE], NETCONFIG ],
+ [ "dev", \&gst_network_suse70_replace_iface_sh, [IFCFG, IFACE], NETDEV ],
+# not sup [ "user", \&gst_parse_trivial, 0 ], # not supported.
+ [ "name", \&gst_network_suse70_replace_iface_sh, [IFCFG, IFACE], GST_IFACE_NAME ],
+ [ "address", \&gst_network_suse70_replace_iface_sh, [IFCFG, IFACE], IPADDR ],
+ [ "address", \&gst_network_suse70_set_ifconfig_ip, [IFCFG, IFACE] ],
+ [ "netmask", \&gst_network_suse70_set_ifconfig_arg, [IFCFG, IFACE], netmask ],
+ [ "broadcast", \&gst_network_suse70_set_ifconfig_arg, [IFCFG, IFACE], broadcast ],
+# [ "network", \&gst_parse_trivial, 0 ], # not supported.
+# [ "gateway", \&gst_parse_sh, IFCFG, GATEWAY ], # not supported
+ [ "remote_address", \&gst_network_suse70_set_ifconfig_arg, [IFCFG, IFACE], pointopoint ],
+ [ "update_dns", \&gst_replace_kw, PPP_OPTIONS, "usepeerdns" ]
+ ]
+ },
+
+ "suse-9.0" =>
+ {
+ iface_set => \&gst_network_suse9_interface_activate,
+ iface_delete => \&gst_network_suse90_interface_delete,
+ ifaces_get => \&gst_network_suse90_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/network/ifcfg-#iface#",
+ ROUTE_CONF => "/etc/sysconfig/network/routes",
+ IFACE => "#iface#",
+ PPP_OPTIONS => "/etc/ppp/options"
+ },
+ table =>
+ [
+ [ "auto", \&gst_network_suse90_set_auto, IFCFG, STARTMODE ],
+ [ "bootproto", \&gst_network_suse90_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "address", \&gst_replace_sh, IFCFG, IPADDR ],
+ [ "netmask", \&gst_replace_sh, IFCFG, NETMASK ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMOTE_IPADDR ],
+ [ "essid", \&gst_replace_sh, IFCFG, WIRELESS_ESSID ],
+ [ "key", \&gst_replace_sh, IFCFG, WIRELESS_KEY ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_sh, IFCFG, WIRELESS_KEY, "%key%" ]],
+ # Modem stuff goes here
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEM_DEVICE ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, SPEED ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPD_OPTIONS ],
+ [ "dial_command", \&gst_replace_sh, IFCFG, DIALCOMMAND ],
+ [ "external_line", \&gst_replace_sh, IFCFG, DIALPREFIX ],
+ [ "provider", \&gst_replace_sh, IFCFG, PROVIDER ],
+ [ "volume", \&gst_network_check_type, [ IFACE, "modem", \&gst_network_set_modem_volume_string, IFCFG, INIT8 ]],
+ [ "login", \&gst_network_suse90_replace_provider_file, "%provider%", USERNAME ],
+ [ "password", \&gst_network_suse90_replace_provider_file, "%provider%", PASSWORD ],
+ [ "phone_number", \&gst_network_suse90_replace_provider_file, "%provider%", PHONE ],
+ [ "dns1", \&gst_network_suse90_replace_provider_file, "%provider%", DNS1 ],
+ [ "dns2", \&gst_network_suse90_replace_provider_file, "%provider%", DNS2 ],
+ [ "update_dns", \&gst_network_suse90_replace_provider_file_bool, "%provider%", MODIFYDNS ],
+ [ "stupid", \&gst_network_suse90_replace_provider_file_bool, "%provider%", STUPIDMODE ],
+ [ "persist", \&gst_network_suse90_replace_provider_file_bool, "%provider%", PERSIST ],
+ [ "set_default_gw", \&gst_network_suse90_replace_provider_file_bool, "%provider%", DEFAULTROUTE ],
+ ]
+ },
+
+ "pld-1.0" =>
+ {
+ iface_set => \&gst_network_rh62_interface_activate,
+ iface_delete => \&gst_network_pld10_interface_delete,
+ ifaces_get => \&gst_network_sysconfig_pld10_ifaces_get_existing,
+ fn =>
+ {
+ IFCFG => "/etc/sysconfig/interfaces/ifcfg-#iface#",
+ CHAT => "/etc/sysconfig/interfaces/data/chat-#iface#",
+ IFACE => "#iface#",
+ WVDIAL => "/etc/wvdial.conf",
+ PUMP => "/etc/pump.conf"
+ },
+ table =>
+ [
+ [ "bootproto", \&gst_network_pld10_replace_bootproto, IFCFG, BOOTPROTO ],
+ [ "auto", \&gst_replace_sh_bool, IFCFG, ONBOOT ],
+ [ "user", \&gst_replace_sh_bool, IFCFG, USERCTL ],
+# [ "name", \&gst_replace_sh, IFCFG, NAME ],
+ [ "dev", \&gst_replace_sh, IFCFG, DEVICE ],
+ [ "address", \&gst_network_pld10_set_ipaddr, IFCFG, IPADDR, "address" ],
+ [ "netmask", \&gst_network_pld10_set_ipaddr, IFCFG, IPADDR, "netmask" ],
+# [ "broadcast", \&gst_replace_sh, IFCFG, BROADCAST ],
+# [ "network", \&gst_replace_sh, IFCFG, NETWORK ],
+ [ "gateway", \&gst_replace_sh, IFCFG, GATEWAY ],
+# [ "update_dns", \&gst_network_pump_set_nodns, PUMP, "%dev%", "%bootproto%" ],
+ [ "update_dns", \&gst_replace_sh_bool, IFCFG, PEERDNS ],
+# [ "dns1", \&gst_replace_sh, IFCFG, DNS1 ],
+# [ "dns2", \&gst_replace_sh, IFCFG, DNS2 ],
+ [ "mtu", \&gst_replace_sh, IFCFG, MTU ],
+ [ "mru", \&gst_replace_sh, IFCFG, MRU ],
+ [ "remote_address", \&gst_replace_sh, IFCFG, REMIP ],
+ [ "login", \&gst_replace_sh, IFCFG, PAPNAME ],
+ [ "serial_port", \&gst_replace_sh, IFCFG, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, IFCFG, LINESPEED ],
+ [ "ppp_options", \&gst_replace_sh, IFCFG, PPPOPTIONS ],
+# [ "section", \&gst_replace_sh, IFCFG, WVDIALSECT ],
+ [ "set_default_gw", \&gst_replace_sh_bool, IFCFG, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, IFCFG, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, IFCFG, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, IFCFG, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, IFCFG, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_chat, CHAT, "^atd[^0-9]*([0-9, -]+)" ]
+ ]
+ },
+
+ "slackware-9.1.0" =>
+ {
+ iface_set => \&gst_network_slackware91_interface_activate,
+ iface_delete => \&gst_network_slackware91_interface_delete,
+ ifaces_get => \&gst_network_slackware91_ifaces_get_existing,
+ fn =>
+ {
+ RC_INET_CONF => "/etc/rc.d/rc.inet1.conf",
+ RC_INET => "/etc/rc.d/rc.inet1",
+ RC_LOCAL => "/etc/rc.d/rc.local",
+ IFACE => "#iface#",
+ WIRELESS => "/etc/pcmcia/wireless.opts",
+ PPP_OPTIONS => "/etc/ppp/options",
+ PAP => "/etc/ppp/pap-secrets",
+ CHAP => "/etc/ppp/chap-secrets",
+ CHAT => "/etc/ppp/pppscript",
+ },
+ table =>
+ [
+ [ "address", \&gst_replace_rcinet1conf, [ RC_INET_CONF, IFACE ], IPADDR ],
+ [ "netmask", \&gst_replace_rcinet1conf, [ RC_INET_CONF, IFACE ], NETMASK ],
+ [ "gateway", \&gst_replace_rcinet1conf_global, RC_INET_CONF, GATEWAY ],
+ [ "bootproto", \&gst_network_slackware91_replace_bootproto, [ RC_INET_CONF, IFACE ] ],
+ [ "auto", \&gst_network_slackware91_set_auto, [ RC_INET, RC_LOCAL, IFACE ] ],
+ [ "essid", \&gst_replace_wireless_opts, [ WIRELESS, IFACE ], \&gst_network_get_wireless_ifaces, ESSID ],
+ [ "key", \&gst_replace_wireless_opts, [ WIRELESS, IFACE ], \&gst_network_get_wireless_ifaces, KEY ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_wireless_opts, [ WIRELESS, IFACE ], \&gst_network_get_wireless_ifaces, KEY, "%key%" ]],
+ # Modem stuff
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_network_create_pppscript, CHAT ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_network_slackware91_create_pppgo ]],
+ [ "update_dns", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "usepeerdns" ]],
+ [ "noauth", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "noauth" ]],
+ [ "set_default_gw", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "defaultroute" ]],
+ [ "debug", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "debug" ]],
+ [ "persist", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "persist" ]],
+ [ "serial_hwctl", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_kw, PPP_OPTIONS, "crtscts" ]],
+ [ "mtu", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_join_first_str, PPP_OPTIONS, "mtu", "[ \t]+" ]],
+ [ "mru", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_join_first_str, PPP_OPTIONS, "mru", "[ \t]+" ]],
+ [ "serial_port", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^(/dev/[^ \t]+)" ]],
+ [ "serial_speed", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^([0-9]+)" ]],
+ [ "login", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_re, PPP_OPTIONS, "^name \"(.*)\"", "name \"%login%\"" ]],
+ [ "ppp_options", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_ppp_options_unsup, PPP_OPTIONS ]],
+ [ "serial_escapechars", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_join_first_str, PPP_OPTIONS, "escape", "[ \t]+" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_pap_passwd, PAP, "%login%" ]],
+ [ "password", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_pap_passwd, CHAP, "%login%" ]],
+ [ "dial_command", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "(atd[tp])[0-9w, -]+" ]],
+ [ "phone_number", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w]+)" ]],
+ [ "external_line", \&gst_network_check_type, [IFACE, "modem", \&gst_replace_chat, CHAT, "atd[tp]([0-9w, -]+)", "%external_line%W%phone_number%" ]],
+ [ "volume", \&gst_network_check_type, [IFACE, "modem", \&gst_network_set_modem_volume, CHAT ]],
+ ]
+ },
+
+ "gentoo" =>
+ {
+ iface_set => \&gst_network_gentoo_interface_activate,
+ iface_delete => \&gst_network_gentoo_interface_delete,
+ ifaces_get => \&gst_network_gentoo_ifaces_get_existing,
+ fn =>
+ {
+ NET => "/etc/conf.d/net",
+ PPPNET => "/etc/conf.d/net.#iface#",
+ INIT => "net.#iface#",
+ IFACE => "#iface#",
+ WIRELESS => "/etc/conf.d/wireless",
+ },
+ table =>
+ [
+ [ "dev", \&gst_network_gentoo_create_files ],
+ [ "auto", \&gst_service_gentoo_set_status, INIT , 0 ],
+ [ "bootproto", \&gst_network_gentoo_replace_bootproto, [ NET, IFACE ]],
+ [ "address", \&gst_replace_confd_net_re, NET, "config_%dev%", "^[ \t]*([0-9\.]+)" ],
+ [ "address", \&gst_replace_confd_net_re, NET, "config_%dev%", "^[ \t]*([0-9\.]+)" ],
+ [ "netmask", \&gst_replace_confd_net_re, NET, "config_%dev%", "[ \t]+netmask[ \t]+[0-9\.]*", " netmask %netmask%"],
+ [ "broadcast", \&gst_replace_confd_net_re, NET, "config_%dev%", "[ \t]+broadcast[ \t]+[0-9\.]*", " broadcast %broadcast%" ],
+ [ "remote_address", \&gst_replace_confd_net_re, NET, "config_%dev%", "[ \t]+dest_address[ \t]+[0-9\.]*", " dest_address %remote_address%" ],
+ [ "gateway", \&gst_replace_confd_net_re, NET, "routes_%dev%", "[ \t]*default[ \t]+(via|gw)[ \t]+[0-9\.\:]*", "default via %gateway%" ],
+ [ "essid", \&gst_replace_sh, WIRELESS, "essid_%dev%" ],
+ [ "key", \&gst_replace_sh, WIRELESS, "key_%essid%" ],
+ [ "key_type", \&gst_network_set_wep_key_type, [ \&gst_replace_sh, WIRELESS, "key_%essid%", "%key%" ]],
+ # modem stuff
+ [ "dev", \&gst_network_check_type, [ IFACE, "modem", \&gst_replace_sh, PPPNET, PEER ]],
+ [ "update_dns", \&gst_network_check_type, [ IFACE, "modem", \&gst_replace_sh_bool, PPPNET, PEERDNS ]],
+ [ "mtu", \&gst_replace_sh, PPPNET, MTU ],
+ [ "mru", \&gst_replace_sh, PPPNET, MRU ],
+ [ "serial_port", \&gst_replace_sh, PPPNET, MODEMPORT ],
+ [ "serial_speed", \&gst_replace_sh, PPPNET, LINESPEED ],
+ [ "login", \&gst_replace_sh, PPPNET, USERNAME ],
+ [ "password", \&gst_replace_sh, PPPNET, PASSWORD ],
+ [ "ppp_options", \&gst_replace_sh, PPPNET, PPPOPTIONS ],
+ [ "set_default_gw", \&gst_replace_sh_bool, PPPNET, DEFROUTE ],
+ [ "debug", \&gst_replace_sh_bool, PPPNET, DEBUG ],
+ [ "persist", \&gst_replace_sh_bool, PPPNET, PERSIST ],
+ [ "serial_escapechars", \&gst_replace_sh_bool, PPPNET, ESCAPECHARS ],
+ [ "serial_hwctl", \&gst_replace_sh_bool, PPPNET, HARDFLOWCTL ],
+ [ "phone_number", \&gst_replace_sh, PPPNET, NUMBER ],
+ [ "external_line", \&gst_replace_sh, PPPNET, NUMBER, "%external_line%W%phone_number%" ],
+ [ "volume", \&gst_network_set_modem_volume_string, PPPNET, INITSTRING ],
+ ]
+ },
+
+ "freebsd-5" =>
+ {
+ iface_set => \&gst_network_freebsd_interface_activate,
+ iface_delete => \&gst_network_freebsd_interface_delete,
+ ifaces_get => \&gst_network_freebsd_ifaces_get_existing,
+ fn =>
+ {
+ RC_CONF => "/etc/rc.conf",
+ STARTIF => "/etc/start_if.#iface#",
+ PPPCONF => "/etc/ppp/ppp.conf",
+ IFACE => "#iface#",
+ },
+ table =>
+ [
+ [ "auto", \&gst_network_freebsd5_set_auto, [ RC_CONF, IFACE ]],
+ [ "bootproto", \&gst_network_freebsd5_replace_bootproto, [ RC_CONF, IFACE ]],
+ [ "address", \&gst_replace_sh_re, RC_CONF, "ifconfig_%dev%", "inet[ \t]+([0-9\.]+)", "inet %address%" ],
+ [ "netmask", \&gst_replace_sh_re, RC_CONF, "ifconfig_%dev%", "netmask[ \t]+([0-9\.]+)", " netmask %netmask%" ],
+ [ "remote_address", \&gst_replace_sh_re, RC_CONF, "ifconfig_%dev%", "dest_address[ \t]+([0-9\.]+)", " dest_address %remote_address%" ],
+ [ "essid", \&gst_network_freebsd5_replace_essid, [ RC_CONF, STARTIF, IFACE ]],
+ # Modem stuff
+ # we need this for putting an empty ifconfig_tunX command in rc.conf
+ [ "phone_number", \&gst_replace_sh, RC_CONF, "ifconfig_%dev%", " " ],
+ [ "file", \&gst_network_freebsd_create_ppp_startif, [ STARTIF, IFACE ]],
+ [ "persist", \&gst_network_freebsd_create_ppp_startif, [ STARTIF, IFACE ], "%file%" ],
+ [ "serial_port", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "device" ],
+ [ "serial_speed", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "speed" ],
+ [ "mtu", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "mtu" ],
+ [ "mru", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "mru" ],
+ [ "login", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "authname" ],
+ [ "password", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "authkey" ],
+ [ "update_dns", \&gst_network_replace_pppconf_bool, [ PPPCONF, STARTIF, IFACE ], "dns" ],
+ [ "set_default_gw", \&gst_network_replace_pppconf_route, [ PPPCONF, STARTIF, IFACE ], "default HISADDR" ],
+ [ "phone_number", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "phone" ],
+ [ "external_line", \&gst_network_replace_pppconf, [ PPPCONF, STARTIF, IFACE ], "phone", "%external_line%W%phone_number%" ],
+ [ "dial_command", \&gst_network_replace_pppconf_dial_command, [ PPPCONF, STARTIF, IFACE ]],
+ [ "volume", \&gst_network_replace_pppconf_volume, [ PPPCONF, STARTIF, IFACE ]],
+ ]
+ }
+ );
+
+ my $dist = $dist_map{$gst_dist};
+ return %{$dist_tables{$dist}} if $dist;
+
+ &gst_report ("platform_no_table", $gst_dist);
+ return undef;
+}
+
+1;
diff --git a/knetwortdeconf/backends/parse.pl.in b/knetwortdeconf/backends/parse.pl.in
new file mode 100644
index 0000000..25c9373
--- /dev/null
+++ b/knetwortdeconf/backends/parse.pl.in
@@ -0,0 +1,1828 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# parse.pl: Common parsing stuff for the ximian-setup-tools backends.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+# Arturo Espinosa <arturo@ximian.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/){
+
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/util.pl$DOTIN";
+require "$SCRIPTSDIR/file.pl$DOTIN";
+require "$SCRIPTSDIR/debug.pl$DOTIN";
+
+
+# The concept of keyword (kw) here is a key, normaly in its own line, whose
+# boolean representation is its own existence.
+
+# Every final parsing function to be used by a table must handle one key
+# at a time, but maybe parse several values from there and return a
+# ref to array or hash.
+#
+# Always return a scalar. If you need to return an array or a hash,
+# return a ref to it.
+
+# First some helper functions for the whole process.
+# Expand substrings of the form #$substr# to the $value in
+# the string or recursively in the array $strarr.
+
+sub gst_parse_expand
+{
+ my ($strarr, $substr, $value) = @_;
+
+ if (ref $strarr eq "ARRAY")
+ {
+ my ($i);
+
+ $strarr = [ @$strarr ];
+ foreach $i (@$strarr)
+ {
+ $i = &gst_parse_expand ($i, $substr, $value);
+ }
+
+ return $strarr;
+ }
+
+ $strarr =~ s/\#$substr\#/$value/;
+ return $strarr;
+}
+
+sub gst_parse_replace_hash_values
+{
+ my ($cp, $hash) = @_;
+ my ($j, $replace_key, $value);
+
+ foreach $j (@$cp)
+ {
+ while ($j =~ /%([^%]*)%/)
+ {
+ $replace_key = $1;
+ if (exists $$hash{$replace_key})
+ {
+ $value = $$hash{$replace_key};
+ if (ref $value)
+ {
+ $j = $value;
+ }
+ else
+ {
+ $j =~ s/%$replace_key%/$value/g;
+ }
+ }
+ else
+ {
+ &gst_debug_print_line ("Warning: gst_parse_replace_hash_values: key $replace_key doesn't exist.");
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+sub gst_parse_replace_files
+{
+ my ($values, $fn_hash) = @_;
+ my @ret;
+
+ return () if $values eq undef;
+ $values = [$values] if !ref $values;
+
+ foreach $i (@$values)
+ {
+ if (exists $$fn_hash{$i})
+ {
+ push @ret, $$fn_hash{$i};
+ }
+ else
+ {
+ push @ret, $i;
+ }
+ }
+
+ return @ret;
+}
+
+# Additional abstraction: parse table entries can have
+# arrays inside. The parsing proc will be ran with every
+# combination that the arrays provide. Ex:
+# ["user", \&gst_parse_foo, [0, 1], [2, 3] ] will parse
+# using the combinatory of [0, 1]x[2, 3] until a result
+# ne undef is given. Check RedHat 7.2's network parse table
+# for further enlightenment.
+sub gst_parse_run_entry
+{
+ my ($hash, $key, $proc, $cp) = @_;
+ my ($ncp, $i, $j, $res);
+
+ $ncp = [@$cp];
+ for ($i = 0; $i < scalar (@$cp); $i ++)
+ {
+ if (ref $$cp[$i] eq "ARRAY")
+ {
+ foreach $j (@{$$cp[$i]})
+ {
+ $$ncp[$i] = $j;
+ $res = &gst_parse_run_entry ($hash, $key, $proc, $ncp);
+ return $res if $res ne undef;
+ }
+ return undef;
+ }
+ }
+
+ # OK, the given entry didn't have any array refs in it...
+
+ return undef if (!&gst_parse_replace_hash_values ($cp, $hash));
+
+ &gst_report_enter ();
+ &gst_report ("parse_table", "$key");
+ &gst_report_leave ();
+
+ $$hash{$key} = &$proc (@$cp);
+ return $$hash{$key};
+}
+
+# OK, this is the good stuff:
+
+# gst_parse_from_table takes a file mapping and a parse table.
+#
+# The functions in the replace tables, most of which are coded in
+# this file, receive the mapped files of the first argument, and then
+# a set of values.
+
+# The value the parse function returns is set into a hash,
+# using as key the first item of the parse table entry. This is done
+# only if the $hash{$key} is empty, which allows us to try with
+# several parse methods to try to get a value, where our parse functions
+# can return undef if they failed to get the requested value.
+#
+# A ref to the hash with all the fetched values is returned.
+sub gst_parse_from_table
+{
+ my ($fn, $table) = @_;
+ my %hash;
+ my ($key, $proc, @param);
+ my ($i, @cp, @files);
+
+ foreach $i (@$table)
+ {
+ @cp = @$i;
+ $key = shift (@cp);
+
+ if ($hash{$key} eq undef)
+ {
+ $proc = shift (@cp);
+ @files = &gst_parse_replace_files (shift (@cp), $fn);
+
+ # Don't unshift the resulting files if none were given.
+ unshift @cp, @files if (scalar @files) > 0;
+
+ &gst_parse_run_entry (\%hash, $key, $proc, \@cp);
+ }
+ }
+
+ foreach $i (keys (%hash))
+ {
+ delete $hash{$i} if ($hash{$i} eq undef);
+ }
+
+ return \%hash;
+}
+
+# Just return the passed values. If there's just
+# one value, the value. If more, a reference to an
+# array with the values.
+sub gst_parse_trivial
+{
+ my (@res) = @_;
+
+ &gst_report_enter ();
+ &gst_report ("parse_trivial", "@res");
+ &gst_report_leave ();
+
+ return $res[0] if (scalar @res) <= 1;
+ return \@res;
+}
+
+# Try to read a line from $fd and remove any leading or
+# trailing white spaces. Return ref to read $line or
+# -1 if eof.
+sub gst_parse_chomp_line_std
+{
+ my ($fd) = @_;
+ my $line;
+
+ $line = <$fd>;
+ return -1 if !$line;
+
+ chomp $line;
+ $line =~ s/^[ \t]+//;
+ $line =~ s/[ \t]+$//;
+
+ return \$line;
+}
+
+# Assuming $line is a line read from a shell file,
+# remove comments.
+sub gst_parse_process_sh_line
+{
+ my ($line) = @_;
+ my ($pline);
+
+ # This will put escaped hashes out of danger.
+ # But only inside valid quotes!
+ while ($line =~ /([^\"\']*[\"\'][^\#\"\']*)(\#?)([^\"\']*[\"\'])/g)
+ {
+ $pline .= $1;
+ $pline .= "__hash__" if ($2 ne undef);
+ $pline .= $3;
+ }
+
+ # The line may not match the regexp above,
+ $pline = $line if ($pline eq undef);
+
+ $pline =~ s/\\\#/\\__hash__/g;
+
+ # Nuke everything after a hash and bye bye trailing spaces.
+ $pline =~ s/[ \t]*\#.*//;
+
+ # Let escaped hashes come back home.
+ $pline =~ s/__hash__/\#/g;
+
+ return $pline;
+}
+
+# Same as gst_parse_chomp_line_std, but apply
+# the sh line processing before returning.
+# -1 if eof, ref to read $line if success.
+sub gst_parse_chomp_line_hash_comment
+{
+ my ($fd) = @_;
+ my $line;
+
+ $line = &gst_parse_chomp_line_std ($fd);
+ return -1 if $line == -1;
+
+ $line = &gst_parse_process_sh_line ($$line);
+ return \$line;
+}
+
+# Get an sh line, and remove the export keyword, if any.
+sub gst_parse_chomp_line_sh_export
+{
+ my ($fd) = @_;
+ my $line;
+
+ $line = &gst_parse_chomp_line_hash_comment ($fd);
+ return -1 if $line == -1;
+
+ $line = $$line;
+
+ $line =~ s/^export //;
+
+ return \$line;
+}
+
+# Parse a $file, wich is assumed to have a column-based format, with $re matching field separators
+# and one record per line. Search for $key, and return either a scalar with the first ocurrence,
+# or an array with all the found ocurrences.
+sub gst_parse_split_ref
+{
+ my ($file, $key, $re, $all, $line_read_proc) = @_;
+ my ($fd, @line, @res);
+
+ &gst_report_enter ();
+ &gst_report ("parse_split", $key, $file);
+
+ $proc = $line_read_proc? $line_read_proc : \&gst_parse_chomp_line_std;
+
+ $fd = &gst_file_open_read_from_names ($file);
+ $all = 0 if !$fd;
+
+ while (($line = &$proc ($fd)) != -1)
+ {
+ $line = $$line;
+ next if $line eq "";
+
+ @line = split ($re, $line, 2);
+
+ if (shift (@line) =~ "^$key\$")
+ {
+ if ($all) {
+ push @res, $line[0];
+ }
+ else
+ {
+ &gst_report_leave ();
+ &gst_file_close ($fd);
+ return \$line[0];
+ }
+ }
+ }
+
+ &gst_report_leave ();
+ &gst_file_close ($fd);
+ return \@res if ($all);
+ return -1;
+}
+
+sub gst_parse_split
+{
+ my $res;
+
+ # Don't pass @_ like this anywhere. This is bad practice.
+ $res = &gst_parse_split_ref (@_);
+
+ return $$res if ref $res eq "SCALAR";
+ return @$res if ref $res eq "ARRAY";
+ return undef;
+}
+
+# This gives meaning to the $all flag of gst_parse_split, and returns a reference to the array, which
+# is what we want. (ie search a.com\nsearch b.com\nsearch c.com)
+sub gst_parse_split_all
+{
+ my ($file, $key, $re, $line_read_proc) = @_;
+ my @a;
+
+ @a = &gst_parse_split ($file, $key, $re, 1, $line_read_proc);
+
+ return \@a;
+}
+
+# Same, but use the hash_comment routine for line analysis.
+sub gst_parse_split_all_hash_comment
+{
+ my ($file, $key, $re) = @_;
+
+ return &gst_parse_split_all ($file, $key, $re, \&gst_parse_chomp_line_hash_comment);
+}
+
+# Make the elements of the resulting array unique.
+sub gst_parse_split_all_unique_hash_comment
+{
+ my ($file, $key, $re) = @_;
+ my ($arr, @res);
+ my (%hash, $i);
+
+ $arr = &gst_parse_split_all ($file, $key, $re, \&gst_parse_chomp_line_hash_comment);
+
+ foreach $i (@$arr)
+ {
+ next if exists $hash{$i};
+ $hash{$i} = 1;
+ push @res, $i;
+ }
+
+ return \@res;
+}
+
+sub gst_parse_split_all_array_with_pos
+{
+ my ($file, $key, $pos, $re, $sep, $line_read_proc) = @_;
+ my ($arr, @s, @ret, $i);
+
+ $arr = &gst_parse_split_all ($file, $key, $re, $line_read_proc);
+
+ foreach $i (@$arr)
+ {
+ @s = split ($sep, $i);
+ push @ret, @s[0];
+ }
+
+ return \@ret;
+}
+
+# Same, but for $all = 0. (ie nameserver 10.0.0.1)
+sub gst_parse_split_first_str
+{
+ my ($file, $key, $re, $line_read_proc) = @_;
+
+ return &gst_parse_split ($file, $key, $re, 0, $line_read_proc);
+}
+
+# Interpret the result as a boolean. (ie multi on)
+sub gst_parse_split_first_bool
+{
+ my ($file, $key, $re, $line_read_proc) = @_;
+ my $ret;
+
+ $ret = &gst_parse_split_first_str ($file, $key, $re, $line_read_proc);
+
+ return undef if ($ret eq undef);
+ return (&gst_util_read_boolean ($ret)? 1: 0);
+}
+
+# After getting the first field, split the result with $sep matching separators. (ie order hosts,bind)
+sub gst_parse_split_first_array
+{
+ my ($file, $key, $re, $sep, $line_read_proc) = @_;
+ my @ret;
+
+ @ret = split ($sep, &gst_parse_split ($file, $key, $re, 0, $line_read_proc));
+
+ return \@ret;
+}
+
+sub gst_parse_split_first_array_pos
+{
+ my ($file, $key, $pos, $re, $sep, $line_read_proc) = @_;
+ my (@ret);
+
+ @ret = split ($sep, &gst_parse_split ($file, $key, $re, 0, $line_read_proc));
+ return $ret[$pos];
+}
+
+# Do an gst_parse_split_first_array and then make
+# the array elements unique. This is to fix broken
+# searchdomain entries in /etc/resolv.conf, for example.
+sub gst_parse_split_first_array_unique
+{
+ my ($file, $key, $re, $sep, $line_read_proc) = @_;
+ my (@arr, @res);
+ my (%hash, $i);
+
+ @arr = split ($sep, &gst_parse_split ($file, $key, $re, 0, $line_read_proc));
+
+ foreach $i (@arr)
+ {
+ next if exists $hash{$i};
+ $hash{$i} = 1;
+ push @res, $i;
+ }
+
+ return \@res;
+}
+
+# For all keys in $file, sepparated from its values
+# by $key_re, sepparate its values using $value_re
+# and assign to a newly created hash. Use ONLY when
+# you don't know what keys you are going to parse
+# (i.e. /etc/hosts). Any other application will not
+# be very portable and should be avoided.
+sub gst_parse_split_hash
+{
+ my ($file, $key_re, $value_re) = @_;
+ my ($fd, @line, %res, $key);
+
+ &gst_report_enter ();
+ &gst_report ("parse_split_hash", $file);
+
+ $fd = &gst_file_open_read_from_names ($file);
+
+ while (<$fd>)
+ {
+ chomp;
+ s/^[ \t]+//;
+ s/[ \t]+$//;
+ s/\#.*$//;
+ next if (/^$/);
+ @line = split ($key_re, $_, 2);
+
+ $key = shift (@line);
+ push @{$res{$key}}, split ($value_re, $line[0]);
+ }
+
+ &gst_file_close ($fd);
+ &gst_report_leave ();
+ return undef if (scalar keys (%res) == 0);
+ return \%res;
+}
+
+# Same as above, but join lines that end with '\'.
+sub gst_parse_split_hash_with_continuation
+{
+ my ($file, $key_re, $value_re) = @_;
+ my ($fd, $l, @line, %res, $key);
+
+ &gst_report_enter ();
+ &gst_report ("parse_split_hash_cont", $file);
+
+ $fd = &gst_file_open_read_from_names ($file);
+
+ while (($l = &gst_parse_ini_line_read ($fd)) != -1)
+ {
+ $_ = $$l;
+ chomp;
+ s/^[ \t]+//;
+ s/[ \t]+$//;
+ s/\#.*$//;
+ next if (/^$/);
+ @line = split ($key_re, $_, 2);
+
+ $key = shift (@line);
+ $res{$key} = [ split ($value_re, $line[0]) ];
+ }
+
+ &gst_file_close ($fd);
+ &gst_report_leave ();
+ return undef if (scalar keys (%res) == 0);
+ return \%res;
+}
+
+# Remove escape sequences in a shell value.
+sub gst_parse_shell_unescape
+{
+ my $ret = $_[0];
+
+ # Quote shell special chars.
+ $ret =~ s/\\\"/\\_/g;
+ $ret =~ s/\"//g;
+ $ret =~ s/\\_/\"/g;
+ $ret =~ s/\\\'/\\_/g;
+ $ret =~ s/\'//g;
+ $ret =~ s/\\_/\'/g;
+ $ret =~ s/\\(.)/$1/g;
+
+ return $ret;
+}
+
+# unescape (escape (x)) == x
+sub gst_parse_shell_escape
+{
+ my ($value) = @_;
+
+ $value =~ s/([\"\`\$\\])/\\$1/g;
+ $value = "\"$value\"" if ($value =~ /[ \t\'&|*?\[\]\{\}\{\}<>]/);
+
+ return $value;
+}
+
+# For files which are a list of /bin/sh shell variable declarations. (ie GATEWAY=10.10.10.1)
+sub gst_parse_sh
+{
+ my ($file, $key) = @_;
+ my $ret;
+
+ &gst_report_enter ();
+ &gst_report ("parse_sh", $key, $file);
+ $ret = &gst_parse_split_first_str ($file, $key, "[ \t]*=[ \t]*",
+ \&gst_parse_chomp_line_hash_comment);
+ &gst_report_leave ();
+
+ return &gst_parse_shell_unescape ($ret);
+}
+
+# Same, but interpret the returning value as a bool. (ie NETWORKING=yes)
+sub gst_parse_sh_bool
+{
+ my ($file, $key) = @_;
+ my $ret;
+
+ $ret = &gst_parse_sh ($file, $key);
+
+ return undef if ($ret eq undef);
+ return (&gst_util_read_boolean ($ret)? 1: 0);
+}
+
+# Get an sh value and then split with $re, returning ref to resulting array.
+sub gst_parse_sh_split
+{
+ my ($file, $key, $re) = @_;
+ my (@ret, $val);
+
+ $val = &gst_parse_sh ($file, $key);
+ @ret = split ($re, $val);
+
+ return \@ret;
+}
+
+# Get a fully qualified hostname from a $key shell var in $file
+# and extract the hostname from there. e.g.: suse70's /etc/rc.config's FQHOSTNAME.
+sub gst_parse_sh_get_hostname
+{
+ my ($file, $key) = @_;
+ my ($val);
+
+ $val = &gst_parse_sh_split ($file, $key, "\\.");
+
+ return $$val[0];
+}
+
+# Get a fully qualified hostname from a $key shell var in $file
+# and extract the domain from there. e.g.: suse70's /etc/rc.config's FQHOSTNAME.
+sub gst_parse_sh_get_domain
+{
+ my ($file, $key) = @_;
+ my ($val);
+
+ $val = &gst_parse_sh_split ($file, $key, "\\.");
+
+ return join ".", @$val[1..$#$val];
+}
+
+# For files which are a list of /bin/sh shell variable exports. (eg export GATEWAY=10.10.10.1)
+sub gst_parse_sh_export
+{
+ my ($file, $key) = @_;
+ my $ret;
+
+ &gst_report_enter ();
+ &gst_report ("parse_sh", $key, $file);
+ $ret = &gst_parse_split_first_str ($file, $key, "[ \t]*=[ \t]*",
+ \&gst_parse_chomp_line_sh_export);
+ &gst_report_leave ();
+
+ return &gst_parse_shell_unescape ($ret);
+}
+
+# Same, but interpret the returing value as a bool. (ie export NETWORKING=yes)
+sub gst_parse_sh_export_bool
+{
+ my ($file, $key) = @_;
+ my $ret;
+
+ $ret = &gst_parse_sh_export ($file, $key);
+
+ return undef if ($ret eq undef);
+ return (&gst_util_read_boolean ($ret)? 1: 0);
+}
+
+# Same, but accepting a regexp and returning the value between the paren operator
+sub gst_parse_sh_re
+{
+ my ($file, $key, $re) = @_;
+ my $ret;
+
+ $ret = &gst_parse_sh ($file, $key);
+
+ $ret =~ /$re/i;
+ return $1;
+}
+
+
+# Search for $keyword in $file, delimited by $re (default " ") or EOL.
+# If keyword exists, return 1, else 0.
+sub gst_parse_kw
+{
+ my ($file, $keyword, $re, $line_read_proc) = @_;
+ my $res;
+
+ &gst_report_enter ();
+ &gst_report ("parse_kw", $keyword, $file);
+
+ if (! -f "$gst_prefix/$file")
+ {
+ &gst_report_enter ();
+ &gst_report ("file_open_read_failed", $file);
+ &gst_report_leave ();
+ &gst_report_leave ();
+ return undef;
+ }
+
+ $re = " " if $re eq undef;
+ $res = &gst_parse_split_ref ($file, $keyword, $re, 0, $line_read_proc);
+
+ &gst_report_leave ();
+ return 0 if $res == -1;
+ return 1;
+}
+
+# A file containing the desired value in its first line. (ie /etc/hostname)
+sub gst_parse_line_first
+{
+ my ($file) = @_;
+ my ($fd, $res);
+
+ &gst_report_enter ();
+ &gst_report ("parse_line_first", $file);
+ $fd = &gst_file_open_read_from_names ($file);
+ &gst_report_leave ();
+
+ return undef if !$fd;
+
+ chomp ($res = <$fd>);
+ &gst_file_close ($fd);
+ return $res;
+}
+
+# parse a chat file, searching for an entry that matches $re.
+# $re must have one paren operator (ie "^atd[^0-9]*([0-9, -]+)").
+sub gst_parse_chat
+{
+ my ($file, $re) = @_;
+ my ($fd, $found);
+
+ &gst_report_enter ();
+ &gst_report ("parse_chat", $file);
+ $fd = &gst_file_open_read_from_names ("$file");
+ &gst_report_leave ();
+ return undef if !$fd;
+
+ while (<$fd>)
+ {
+ # We'll be emptying $_ as we "scan".
+ chomp;
+ while ($_ ne "")
+ {
+ # If it uses quotes. FIXME: Assuming they surround the whole string.
+ if (/^\'/)
+ {
+ s/\'([^\']*)\' ?//;
+ $found = $1;
+ }
+ else
+ {
+ s/([^ \t]*) ?//;
+ $found = $1;
+ }
+
+ # If it looks like what we're looking for, return what matched the parens.
+ if ($found =~ /$re/i)
+ {
+ &gst_file_close ($fd);
+ return $1;
+ }
+ }
+ }
+
+ &gst_file_close ($fd);
+ # Oops: not found.
+ return undef;
+}
+
+# Clean an ini line of comments and leading or
+# trailing spaces.
+sub gst_parse_ini_line_clean
+{
+ $_ = $_[0];
+
+ chomp;
+ s/\#.*//;
+ s/;.*//;
+ s/^[ \t]+//;
+ s/[ \t]+$//;
+
+ return $_;
+}
+
+# Read an ini line, which may have to be joined
+# with the next one if it ends with '\'.
+sub gst_parse_ini_line_read
+{
+ my $fd = $_[0];
+ my $l;
+
+ $l = <$fd>;
+ return -1 if ($l eq undef);
+
+ $l = &gst_parse_ini_line_clean ($l);
+ while ($l =~ /\\$/)
+ {
+ $l =~ s/\\$//;
+ $l .= &gst_parse_ini_line_clean (scalar <$fd>);
+ }
+
+ return \$l;
+}
+
+# Return an array of all found sections in $file.
+sub gst_parse_ini_sections
+{
+ my ($file) = @_;
+ my (@sections, $line);
+
+ $fd = &gst_file_open_read_from_names ($file);
+
+ while (($line = &gst_parse_ini_line_read ($fd)) != -1)
+ {
+ $_ = $$line;
+ next if (/^$/);
+ push @sections, $1 if (/\[([^\]]+)\]/i);
+ }
+
+ &gst_file_close ($fd);
+
+ return @sections;
+}
+
+# Get the value of a $var in a $section from $file.
+sub gst_parse_ini
+{
+ my ($file, $section, $var) = @_;
+ my ($fd, $res, $line);
+ my $found_section_flag = 0;
+
+ &gst_report_enter ();
+ &gst_report ("parse_ini", $var, $file, $section);
+ $fd = &gst_file_open_read_from_names ($file);
+ &gst_report_leave ();
+ $res = undef;
+
+ while (($line = &gst_parse_ini_line_read ($fd)) != -1)
+ {
+ $_ = $$line;
+ next if (/^$/);
+
+ if (/\[$section\]/i)
+ {
+ $found_section_flag = 1;
+ next;
+ }
+
+ if ($found_section_flag)
+ {
+ if (/^$var[ \t]*=/i)
+ {
+ s/^$var[ \t]*=[ \t]*//i;
+ $res = $_;
+ last;
+ }
+ elsif (/\[\S+\]/i)
+ {
+ last;
+ }
+ }
+ }
+
+ &gst_file_close ($fd);
+
+ return $res;
+}
+
+# Same, but treat value as bool and return 1/0.
+sub gst_parse_ini_bool
+{
+ my ($file, $section, $var) = @_;
+ my $ret;
+
+ $ret = &gst_parse_ini ($file, $section, $var);
+
+ return undef if ($ret eq undef);
+ return (&gst_util_read_boolean ($ret)? 1: 0);
+}
+
+sub gst_parse_cap_line_clean
+{
+ $_ = $_[0];
+
+ chomp;
+ s/^[ \t]*\#.*//;
+ s/;.*//;
+ s/^[ \t]+//;
+ s/[ \t]+$//;
+
+ return $_;
+}
+
+sub gst_parse_cap_line_read
+{
+ my $fd = $_[0];
+ my $l;
+
+ $l = <$fd>;
+ return -1 if ($l eq undef);
+
+ $l = &gst_parse_cap_line_clean ($l);
+ while ($l =~ /\\$/)
+ {
+ $l =~ s/\\$//;
+ $l .= &gst_parse_cap_line_clean (scalar <$fd>);
+ }
+
+ return \$l;
+}
+
+sub gst_parse_cap_sections
+{
+ my ($file) = @_;
+ my (@sections, $line);
+
+ $fd = &gst_file_open_read_from_names ($file);
+
+ while (($line = &gst_parse_cap_line_read ($fd)) != -1)
+ {
+ $_ = $$line;
+ next if (/^$/);
+ push @sections, $1 if (/^([^:|]+)/i);
+ }
+
+ &gst_file_close ($fd);
+ return @sections;
+}
+
+sub gst_parse_cap
+{
+ my ($file, $section, $var) = @_;
+ my ($fd, $res, $line);
+ my $found_section_flag = 0;
+
+ $fd = &gst_file_open_read_from_names ($file);
+ $res = undef;
+
+ while (($line = &gst_parse_ini_line_read ($fd)) != -1)
+ {
+ $_ = $$line;
+ next if (/^$/);
+ if (/^$section[:|]/i)
+ {
+ $found_section_flag = 1;
+ }
+
+ if ($found_section_flag && /:$var\#/i)
+ {
+ $_ =~ /:$var\#([^:]*)/;
+ $res = $1;
+ last;
+ }
+# if ($found_section_flag && /:$var[#=]/i)
+# {
+# $_ =~ /:$var[#=]([^:]*)/;
+# $res = $1;
+# last;
+# }
+ }
+
+ &gst_file_close ($fd);
+ return $res;
+}
+
+sub gst_parse_cap_bool
+{
+ my ($file, $section, $var) = @_;
+ my ($fd, $res, $line);
+ my $found_section_flag = 0;
+
+ $fd = &gst_file_open_read_from_names ($file);
+ $res = 0;
+
+ while (($line = &gst_parse_ini_line_read ($fd)) != -1)
+ {
+ $_ = $$line;
+ next if (/^$/);
+ if (/^$section[:|]/i)
+ {
+ $found_section_flag = 1;
+ }
+
+ if ($found_section_flag && /:$var[:\#=]/i)
+ {
+ $res = 1;
+ last;
+ }
+ }
+
+ &gst_file_close ($fd);
+ return $res;
+}
+
+# Load a printcap file to buffer, join \ lines and split them back up into a
+# 'one option, printtool comment or section name per line' format.
+sub gst_parse_printcap_buffer_load
+{
+ my ($file) = @_;
+ my ($inbuf, @outbuf);
+
+ $inbuf = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($inbuf);
+
+ for $i (@$inbuf)
+ {
+ my ($comment) = ("");
+
+ chomp $i;
+ $comment = $1 if $i =~ s/^([ \t]*[\#].*)//;
+
+ if ($i ne "")
+ {
+ my @line = split /:/, $i;
+
+ if ($i =~ /^[a-z0-9]+/i)
+ {
+ push @outbuf, ($line [0] . ":\n");
+ shift @line;
+ }
+
+ for $elem (@line)
+ {
+ $elem =~ s/^[ \t]//;
+ $elem =~ s/[ \t]$//;
+ if ($elem ne "")
+ {
+ push @outbuf, ("\t:$elem:\n");
+ }
+ }
+ }
+ elsif ($comment ne "")
+ {
+ push @outbuf, ($comment . "\n");
+ }
+ else
+ {
+ push @outbuf, "\n";
+ }
+ }
+
+ return \@outbuf;
+}
+
+# Find next printer definition, returning (printtool-comment-lineno, stanza-name-lineno).
+sub gst_parse_printcap_get_next_stanza
+{
+ my ($buf, $line_no) = @_;
+ my ($last_printtool_line) = (-1);
+
+ while ($line_no <= $#$buf)
+ {
+ if ($$buf [$line_no] =~ /^\#\#PRINTTOOL3\#\#/)
+ {
+ $last_printtool_line = $line_no;
+ }
+ elsif ($$buf [$line_no] =~ /^[a-z0-9]+/i)
+ {
+ return ($last_printtool_line, $line_no);
+ }
+
+ $line_no++;
+ }
+
+ return (-1, -1);
+}
+
+# Find next printer option.
+sub gst_parse_printcap_get_next_option
+{
+ my ($buf, $line_no) = @_;
+
+ while ($line_no <= $#$buf)
+ {
+ if ($$buf [$line_no] =~ /^\#\#PRINTTOOL3\#\#/ ||
+ $$buf [$line_no] =~ /^[a-z0-9]+/i)
+ {
+ last;
+ }
+
+ if ($$buf [$line_no] =~ /^\t:/)
+ {
+ return $line_no;
+ }
+
+ $line_no++;
+ }
+
+ return -1;
+}
+
+sub gst_parse_printcap_parse_stanza
+{
+ my ($stanza) = @_;
+ my ($key);
+
+ $key = $1 if $stanza =~ /^([a-z0-9]+)/i;
+ return $key;
+}
+
+sub gst_parse_printcap_parse_option
+{
+ my ($option) = @_;
+ my ($key, $value);
+
+ $key = $1 if $option =~ /^\t:([a-z0-9]+)/i;
+ $value = $1 if $option =~ /^\t:[a-z0-9]+[\#=]([a-z0-9\/_-]*)/i;
+ return ($key, $value);
+}
+
+# Locate stanza line for $printer in $buf, starting at $line_no.
+sub gst_parse_printcap_find_stanza
+{
+ my ($buf, $line_no, $printer) = @_;
+ my ($printtool_line_no, $found_printer);
+
+ while ((($printtool_line_no, $line_no) = &gst_parse_printcap_get_next_stanza ($buf, $line_no)))
+ {
+ if ($line_no == -1) { last; }
+
+ $found_printer = &gst_parse_printcap_parse_stanza ($$buf [$line_no]);
+ return ($printtool_line_no, $line_no) if ($found_printer eq $printer);
+ $line_no++;
+ }
+
+ return (-1, -1);
+}
+
+# Search buffer for option with key $key, starting
+# at $line_no position. Return line number, or -1 if not found.
+sub gst_parse_printcap_find_option
+{
+ my ($buf, $line_no, $key) = @_;
+ my $found_key;
+
+ while (($line_no = &gst_parse_printcap_get_next_option ($buf, $line_no)) != -1)
+ {
+ ($found_key) = &gst_parse_printcap_parse_option ($$buf [$line_no]);
+ return $line_no if ($found_key eq $key);
+ $line_no++;
+ }
+
+ return -1;
+}
+
+# High-level API.
+sub gst_parse_printcap
+{
+ my ($file, $section, $var) = @_;
+ my ($printtool_line_no, $stanza_line_no, $option_line_no);
+ my ($buf);
+ my ($key, $value);
+
+ $buf = &gst_parse_printcap_buffer_load ($file);
+
+ ($printtool_line_no, $stanza_line_no) = &gst_parse_printcap_find_stanza ($buf, 0, $section);
+ return undef if ($stanza_line_no == -1);
+
+ $option_line_no = &gst_parse_printcap_find_option ($buf, $stanza_line_no + 1, $var);
+ return undef if ($option_line_no == -1);
+
+ ($key, $value) = &gst_parse_printcap_parse_option ($$buf [$option_line_no]);
+ return $value;
+}
+
+# High-level API.
+sub gst_parse_printcap_bool
+{
+ my ($file, $section, $var) = @_;
+ my ($printtool_line_no, $stanza_line_no, $option_line_no);
+ my ($buf);
+ my ($key, $value);
+
+ $buf = &gst_parse_printcap_buffer_load ($file);
+
+ ($printtool_line_no, $stanza_line_no) = &gst_parse_printcap_find_stanza ($buf, 0, $section);
+ return 0 if ($stanza_line_no == -1);
+
+ $option_line_no = &gst_parse_printcap_find_option ($buf, $stanza_line_no + 1, $var);
+ return 0 if ($option_line_no == -1);
+
+ return 1;
+}
+
+# Debian interfaces(5) states that files starting with # are comments.
+# Also, leading and trailing spaces are ignored.
+sub gst_parse_interfaces_line_clean
+{
+ $_ = $_[0];
+
+ chomp;
+ s/^[ \t]+//;
+ s/^\#.*//;
+ s/[ \t]+$//;
+
+ return $_;
+}
+
+# interfaces(5) also states that \ line continuation is possible.
+sub gst_parse_interfaces_line_read
+{
+ my $fd = $_[0];
+ my $l;
+
+ $l = <$fd>;
+ return -1 if ($l eq undef);
+
+ $l = &gst_parse_interfaces_line_clean ($l);
+ while ($l =~ /\\$/)
+ {
+ $l =~ s/\\$//;
+ $l .= &gst_parse_interfaces_line_clean (scalar <$fd>);
+ }
+
+ return \$l;
+}
+
+# Read lines until a stanza, a line starting with $stanza_type is found.
+# Return ref to an array with the stanza params split.
+sub gst_parse_interfaces_get_next_stanza
+{
+ my ($fd, $stanza_type) = @_;
+ my $line;
+
+ while (($line = &gst_parse_interfaces_line_read ($fd)) != -1)
+ {
+ $_ = $$line;
+ if (/^$stanza_type[ \t]+[^ \t]/)
+ {
+ s/^$stanza_type[ \t]+//;
+ return [ split ("[ \t]+", $_) ];
+ }
+ }
+
+ return -1;
+}
+
+# Read lines until a line not recognized as a stanza is
+# found, and split in a "tuple" of key/value.
+sub gst_parse_interfaces_get_next_option
+{
+ my $fd = $_[0];
+ my $line;
+
+ while (($line = &gst_parse_interfaces_line_read ($fd)) != -1)
+ {
+ $_ = $$line;
+ next if /^$/;
+
+ return [ split ("[ \t]+", $_, 2) ] if (!/^iface[ \t]/);
+ return -1;
+ }
+
+ return -1;
+}
+
+# Get all stanzas from file. Return array.
+sub gst_parse_interfaces_stanzas
+{
+ my ($file, $stanza_type) = @_;
+ my ($fd, @res);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ $res = undef;
+
+ while (($_ = &gst_parse_interfaces_get_next_stanza ($fd, $stanza_type)) != -1)
+ {
+ push @res, $_;
+ }
+
+ &gst_file_close ($fd);
+
+ return @res;
+}
+
+# Find stanza for $iface in $file, and return
+# tuple for option with $key. Return -1 if unexisting.
+sub gst_parse_interfaces_option_tuple
+{
+ my ($file, $iface, $key, $all) = @_;
+ my ($fd, @res);
+
+ $fd = &gst_file_open_read_from_names ($file);
+
+ while (($stanza = &gst_parse_interfaces_get_next_stanza ($fd, "iface")) != -1)
+ {
+ if ($$stanza[0] eq $iface)
+ {
+ while (($tuple = &gst_parse_interfaces_get_next_option ($fd)) != -1)
+ {
+ if ($$tuple[0] =~ /$key/)
+ {
+ return $tuple if !$all;
+ push @res, $tuple;
+ }
+ }
+
+ return -1 if !$all;
+ }
+ }
+
+ return @res if $all;
+ return -1;
+}
+
+# Go get option $kw for $iface stanza. If found,
+# return 1 (true), else, false.
+sub gst_parse_interfaces_option_kw
+{
+ my ($file, $iface, $kw) = @_;
+ my $tuple;
+
+ &gst_report_enter ();
+ &gst_report ("parse_ifaces_kw", $kw, $file);
+ $tuple = &gst_parse_interfaces_option_tuple ($file, $iface, $kw);
+ &gst_report_leave ();
+
+ if ($tuple != -1)
+ {
+ &gst_report ("parse_ifaces_kw_strange", $iface, $file) if ($$tuple[1] ne "");
+
+ return 1;
+ }
+
+ return 0;
+}
+
+# For such keywords as noauto, whose existence means
+# a false value.
+sub gst_parse_interfaces_option_kw_not
+{
+ my ($file, $iface, $kw) = @_;
+
+ return &gst_parse_interfaces_option_kw ($file, $iface, $kw)? 0 : 1;
+}
+
+# Go get option $key for $iface in $file and return value.
+sub gst_parse_interfaces_option_str
+{
+ my ($file, $iface, $key) = @_;
+ my $tuple;
+
+ &gst_report_enter ();
+ &gst_report ("parse_ifaces_str", $kw, $file);
+ $tuple = &gst_parse_interfaces_option_tuple ($file, $iface, $key);
+ &gst_report_leave ();
+
+ if ($tuple != -1)
+ {
+ return $$tuple[1];
+ }
+
+ return undef;
+}
+
+
+# Implementing pump(8) pump.conf file format parser.
+# May be useful for dhcpd too.
+sub gst_parse_pump_get_next_option
+{
+ my ($fd) = @_;
+ my $line;
+
+ while (($line = &gst_parse_interfaces_line_read ($fd)) != -1)
+ {
+ $line = $$line;
+ if ($line ne "")
+ {
+ return [ split ("[ \t]+", $line, 2) ];
+ }
+ }
+
+ return -1;
+}
+
+sub gst_parse_pump_get_device
+{
+ my ($fd, $iface) = @_;
+ my ($opt);
+
+ while (($opt = &gst_parse_pump_get_next_option ($fd)) != -1)
+ {
+ if ($$opt[0] eq "device")
+ {
+ $$opt[1] =~ s/[ \t]*\{//;
+ return 1 if $$opt[1] eq $iface;
+ }
+ }
+
+ return 0;
+}
+
+sub gst_parse_pump_get_iface_option_ref
+{
+ my ($file, $iface, $key) = @_;
+ my ($fd, $opt, $ret);
+
+ $fd = &gst_file_open_read_from_names ($file);
+
+ if (&gst_parse_pump_get_device ($fd, $iface))
+ {
+ while (($opt = &gst_parse_pump_get_next_option ($fd)) != -1)
+ {
+ if ($$opt[0] eq $key)
+ {
+ $ret = &gst_parse_shell_unescape ($$opt[1]);
+ return \$ret;
+ }
+
+ return -1 if ($$opt[0] eq "}");
+ }
+ }
+
+ return -1;
+}
+
+sub gst_parse_pump_get_iface_kw
+{
+ my ($file, $iface, $key) = @_;
+ my ($ret);
+
+ return 1 if &gst_parse_pump_get_iface_option_ref ($file, $iface, $key) != -1;
+ return 0;
+}
+
+sub gst_parse_pump_get_iface_kw_not
+{
+ my ($file, $iface, $key) = @_;
+
+ return 0 if &gst_parse_pump_get_iface_option_ref ($file, $iface, $key) != -1;
+ return 1;
+}
+
+# Read a variable out of an XML document. The varpath is the '/'-separated path to the
+# XML tag. If the name of a property is passed, that property of the leaf tag is read,
+# otherwise the tag's PCDATA.
+sub gst_parse_xml
+{
+ my ($file, $varpath, $property) = @_;
+ my ($model, $branch);
+
+ ($model) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_find ($model, $varpath);
+
+ if ($branch)
+ {
+ return &gst_xml_model_get_attribute ($branch, $property) if $property ne "";
+ return &gst_xml_model_get_pcdata ($branch);
+ }
+
+ return undef;
+}
+
+sub gst_parse_xml_child_names
+{
+ my ($file, $varpath) = @_;
+ my ($model, $branch, @children);
+
+ ($model) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_find ($model, $varpath);
+
+ if (!$branch) { return @children; }
+
+ my @list = @$branch;
+ shift @list; # Attributes
+
+ while (@list)
+ {
+ if ($list [0] ne "__unparsed__" && $list [0] ne "0")
+ {
+ push @children, shift @list;
+ }
+ else
+ {
+ shift @list;
+ }
+
+ shift @list;
+ }
+
+ return @children;
+}
+
+sub gst_parse_alchemist
+{
+ my ($file, $varpath) = @_;
+
+ $varpath = "/adm_context/datatree/" . $varpath;
+ return &gst_parse_xml ($file, $varpath, "VALUE");
+}
+
+sub gst_parse_alchemist_print
+{
+ my ($file, $printer, $varpath) = @_;
+
+ $varpath = "printconf/print_queues/" . $printer . "/" . $varpath;
+ return &gst_parse_alchemist ($file, $varpath);
+}
+
+sub gst_parse_alchemist_print_option
+{
+ my ($file, $printer, $name) = @_;
+ my ($varpath, $model, $branch, $fd, $options, $option);
+
+ ($model) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_find ($model, "/adm_context/datatree/printconf/print_queues/" . $printer .
+ "/filter_data/foomatic_defaults");
+
+ return undef if (!$branch);
+
+ $options = &gst_xml_model_get_children ($branch);
+
+ foreach $o (@$options)
+ {
+ my $opt_node = &gst_xml_model_find ($o, "name");
+ next if (!$opt_node);
+
+ if (&gst_xml_model_get_attribute ($opt_node, "VALUE") eq $name)
+ {
+ $option = $o;
+ last;
+ }
+ }
+
+ return undef if (!$option);
+
+ my $node = &gst_xml_model_find ($option, "default");
+ return undef if (!$node);
+
+ return &gst_xml_model_get_attribute ($node, "VALUE");
+}
+
+# extracts hostname from a fully qualified hostname
+# contained in a file
+sub gst_parse_fq_hostname
+{
+ my ($file) = @_;
+ my ($ret);
+
+ $ret = &gst_parse_line_first ($file);
+ $ret =~ s/\..*//; #remove domain
+
+ return $ret;
+}
+
+# extracts domain from a fully qualified hostname
+# contained in a file
+sub gst_parse_fq_domain
+{
+ my ($file) = @_;
+ my ($ret);
+
+ $ret = &gst_parse_line_first ($file);
+ $ret =~ s/^[^\.]*\.//;
+
+ return $ret;
+}
+
+sub gst_parse_rcinet1conf
+{
+ my ($file, $iface, $kw) = @_;
+ my ($line);
+
+ $iface =~ s/eth//;
+
+ #we must double escape those []
+ $line = "$kw\\[$iface\\]";
+
+ return &gst_parse_sh ($file, $line);
+}
+
+sub gst_parse_rcinet1conf_bool
+{
+ my ($file, $iface, $kw) = @_;
+ my ($ret);
+
+ $ret = &gst_parse_rcinet1conf ($file, $iface, $kw);
+
+ return undef if ($ret eq undef);
+ return (&gst_util_read_boolean ($ret)? 1: 0);
+}
+
+sub gst_parse_wireless_opts
+{
+ my ($file, $iface, $proc, $kw) = @_;
+ my $ifaces = &$proc ();
+ my $found = 0;
+ my $search = 1;
+ my $val = "";
+ my $fd;
+
+ foreach $i (@$ifaces)
+ {
+ $found = 1 if ($iface eq $i);
+ }
+
+ return undef if (!$found);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ while (<$fd>)
+ {
+ $line = $_;
+
+ if ($line =~ /^case/)
+ {
+ # we don't want to search inside the case
+ $search = 0;
+ }
+ elsif ($line =~ /^esac/)
+ {
+ # continue searching
+ $search = 1;
+ }
+ elsif (($line =~ /^[ \t]*$kw/ ) && ($search))
+ {
+ $line =~ s/.*=//;
+
+ if ($line =~ /"(.*)"/)
+ {
+ $line = $1;
+ }
+
+ $val = $line;
+ }
+ }
+
+ &gst_file_close ($fd);
+ return $val;
+}
+
+# function for parsing /etc/start_if.$iface files in FreeBSD
+sub gst_parse_startif
+{
+ my ($file, $regex) = @_;
+ my ($fd, $line, $val);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ $val = undef;
+
+ return undef if ($fd eq undef);
+
+ while (<$fd>)
+ {
+ chomp;
+
+ # ignore comments
+ next if (/^\#/);
+
+ if (/$regex/)
+ {
+ $val = $1;
+ }
+ }
+
+ # remove double quote
+ if ($val =~ /\"(.*)\"/)
+ {
+ $val = $1;
+ }
+
+ return $val;
+}
+
+# functions for parsing /etc/ppp/ppp.conf sections in FreeBSD
+sub gst_parse_pppconf_find_next_stanza
+{
+ my ($buff, $line_no) = @_;
+
+ $line_no = 0 if ($line_no eq undef);
+
+ while ($$buff[$line_no] ne undef)
+ {
+ if ($$buff[$line_no] !~ /^[\#\n]/)
+ {
+ return $line_no if ($$buff[$line_no] =~ /^[^ \t]+/);
+ }
+
+ $line_no++;
+ }
+
+ return -1;
+}
+
+sub gst_parse_pppconf_find_stanza
+{
+ my ($buff, $section) = @_;
+ my ($line_no) = 0;
+
+ while (($line_no = &gst_parse_pppconf_find_next_stanza ($buff, $line_no)) != -1)
+ {
+ return $line_no if ($$buff[$line_no] =~ /^$section\:/);
+ $line_no++;
+ }
+
+ return -1;
+}
+
+sub gst_parse_pppconf_common
+{
+ my ($file, $section, $key) = @_;
+ my ($fd, $val);
+
+ $fd = &gst_file_open_read_from_names ($file);
+ return undef if ($fd eq undef);
+
+ $val = undef;
+
+ # First of all, we must find the line where the section begins
+ while (<$fd>)
+ {
+ chomp;
+ last if (/^$section\:[ \t]*/);
+ }
+
+ while (<$fd>)
+ {
+ chomp;
+
+ # read until the next section arrives
+ last if (/^[^ \t]/);
+
+ next if (/^\#/);
+
+ if (/^[ \t]+(add|set|enable|disable)[ \t]+$key/)
+ {
+ $val = $_;
+ last;
+ }
+ }
+
+ # this is done because commands can be multiline
+ while (<$fd>)
+ {
+ last if (/^[^ \t]/);
+ last if ($val !~ /\\$/);
+
+ s/^[ \t]*/ /;
+ $val =~ s/\\$//;
+ $val .= $_;
+ }
+
+ &gst_file_close ($fd);
+
+ if ($val eq undef)
+ {
+ return undef if ($section eq "default");
+ return &gst_parse_pppconf_common ($file, "default", $key);
+ }
+ else
+ {
+ $val =~ s/\#[^\#]*$//;
+ $val =~ s/[ \t]*$//;
+ $val =~ s/^[ \t]*//;
+ return $val;
+ }
+}
+
+sub gst_parse_pppconf
+{
+ my ($file, $section, $key) = @_;
+ my ($val);
+
+ $val = &gst_parse_pppconf_common ($file, $section, $key);
+
+ if ($val =~ /$key[ \t]+(.+)/)
+ {
+ return $1;
+ }
+}
+
+sub gst_parse_pppconf_bool
+{
+ my ($file, $section, $key) = @_;
+ my ($val);
+
+ $val = &gst_parse_pppconf_common ($file, $section, $key);
+
+ return 1 if ($val ne undef);
+ return 0;
+}
+
+sub gst_parse_pppconf_re
+{
+ my ($file, $section, $key, $re) = @_;
+ my ($val);
+
+ $val = &gst_parse_pppconf_common ($file, $section, $key);
+
+ if ($val =~ /$re/i)
+ {
+ return $1;
+ }
+}
+
+sub gst_parse_confd_net
+{
+ my ($file, $key) = @_;
+ my ($str, $contents, $i);
+
+ $contents = &gst_file_buffer_load ($file);
+
+ for ($i = 0; $i <= scalar (@$contents); $i++)
+ {
+ # search for key
+ if ($$contents[$i] =~ /^$key[ \t]*=[ \t]*\(/)
+ {
+ # contents can be multiline,
+ # just get the first value
+ do {
+ $$contents[$i] =~ /\"([^\"]*)\"/;
+ $str = $1;
+ $i++;
+ } while (!$str);
+ }
+ }
+
+ return $str;
+}
+
+sub gst_parse_confd_net_re
+{
+ my ($file, $key, $re) = @_;
+ my ($str);
+
+ $str = &gst_parse_confd_net ($file, $key);
+
+ if ($str =~ /$re/i)
+ {
+ return $1;
+ }
+}
diff --git a/knetwortdeconf/backends/platform.pl.in b/knetwortdeconf/backends/platform.pl.in
new file mode 100644
index 0000000..2d0534a
--- /dev/null
+++ b/knetwortdeconf/backends/platform.pl.in
@@ -0,0 +1,732 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Determine the platform we're running on.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Arturo Espinosa <arturo@ximian.com>
+# Hans Petter Jansson <hpj@ximian.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+# --- System guessing --- #
+
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/parse.pl$DOTIN";
+require "$SCRIPTSDIR/xml.pl$DOTIN";
+
+
+$PLATFORM_INFO = {
+ "debian-2.2" => "Debian GNU/Linux 2.2 Potato",
+ "debian-3.0" => "Debian GNU/Linux 3.0 Woody",
+ "debian-3.1" => "Debian GNU/Linux 3.1 Sarge",
+ "debian-4.0" => "Debian GNU/Linux 4.0 Etch",
+ "debian-5.0" => "Debian GNU/Linux 5.0 Lenny",
+ "debian-6.0" => "Debian GNU/Linux 6.0 Squeeze",
+ "debian-7.0" => "Debian GNU/Linux 7.0 Wheezy",
+ "debian-testing" => "Debian GNU/Linux Testing/Unstable",
+ "ubuntu-5.04" => "Kubuntu 5.04, Hoary Hedgehog",
+ "ubuntu-5.10" => "Kubuntu 5.10, Breezy Badger",
+ "ubuntu-6.06" => "Kubuntu 6.06, Dapper Drake",
+ "ubuntu-6.10" => "Kubuntu 6.10, Edgy Eft",
+ "ubuntu-7.04" => "Kubuntu 7.04, Feisty Fawn",
+ "ubuntu-7.10" => "Kubuntu 7.10, Gutsy Gibbon",
+ "ubuntu-8.04" => "Kubuntu 8.04, Hardy Heron",
+ "ubuntu-8.10" => "Kubuntu 8.10, Intrepid Ibex",
+ "ubuntu-9.04" => "Kubuntu 9.04, Jaunty Jackalope",
+ "ubuntu-9.10" => "Kubuntu 9.10, Karmic Koala",
+ "ubuntu-10.04" => "Kubuntu 10.04, Lucid Lynx",
+ "ubuntu-10.10" => "Kubuntu 10.10, Maverick Meerkat",
+ "ubuntu-11.04" => "Kubuntu 11.04, Natty Narwhal",
+ "ubuntu-11.10" => "Kubuntu 11.10, Oneiric Ocelot",
+ "ubuntu-12.04" => "Kubuntu 12.04, Precise Pangolin",
+ "redhat-5.2" => "Red Hat Linux 5.2 Apollo",
+ "redhat-6.0" => "Red Hat Linux 6.0 Hedwig",
+ "redhat-6.1" => "Red Hat Linux 6.1 Cartman",
+ "redhat-6.2" => "Red Hat Linux 6.2 Zoot",
+ "redhat-7.0" => "Red Hat Linux 7.0 Guinness",
+ "redhat-7.1" => "Red Hat Linux 7.1 Seawolf",
+ "redhat-7.2" => "Red Hat Linux 7.2 Enigma",
+ "redhat-7.3" => "Red Hat Linux 7.3 Valhalla",
+ "redhat-8.0" => "Red Hat Linux 8.0 Psyche",
+ "redhat-9" => "Red Hat Linux 9.0 Shrike",
+ "rhel-5" => "Enterprise Linux 5",
+ "rhel-6" => "Enterprise Linux 6",
+ "openna-1.0" => "OpenNA Linux 1.0 VSLC",
+ "mandrake-7.1" => "Linux Mandrake 7.1",
+ "mandrake-7.2" => "Linux Mandrake 7.2 Odyssey",
+ "mandrake-8.0" => "Linux Mandrake 8.0 Traktopel",
+ "mandrake-9.0" => "Linux Mandrake 9.0 Dolphin",
+ "mandrake-9.1" => "Linux Mandrake 9.1 Bamboo",
+ "mandrake-9.2" => "Linux Mandrake 9.2 FiveStar",
+ "mandrake-10.0" => "Linux Mandrake 10.0",
+ "mandrake-10.1" => "Linux Mandrake 10.1",
+ "mandrake-10.2" => "Linux Mandrake 2005 LE",
+ "mandriva-2006.0" => "Mandriva Linux 2006.0",
+ "mandriva-2006.1" => "Mandriva Linux 2006.1",
+ "mandriva-2007.0" => "Mandriva Linux 2007.0",
+ "mandriva-2007.1" => "Mandriva Linux 2007.1",
+ "yoper-2.2" => "Yoper Linux 2.2",
+ "blackpanther-4.0" => "Black Panther OS 4.0",
+ "conectiva-9" => "Conectiva Linux 9",
+ "conectiva-10" => "Conectiva Linux 10",
+ "suse-7.0" => "SuSE Linux 7.0",
+ "suse-9.0" => "SuSE Linux 9.0",
+ "suse-9.1" => "SuSE Linux 9.1",
+ "turbolinux-7.0" => "Turbolinux 7.0",
+ "slackware-8.0.0" => "Slackware 8.0.0",
+ "slackware-8.1" => "Slackware 8.1",
+ "slackware-9.0.0" => "Slackware 9.0.0",
+ "slackware-9.1.0" => "Slackware 9.1.0",
+ "slackware-10.0.0" => "Slackware 10.0.0",
+ "slackware-10.1.0" => "Slackware 10.1.0",
+ "slackware-10.2.0" => "Slackware 10.2.0",
+ "slackware-11.0.0" => "Slackware 11.0.0",
+ "slackware-12.0.0" => "Slackware 12.0.0",
+ "slackware-12.1.0" => "Slackware 12.1.0",
+ "slackware-12.2.0" => "Slackware 12.2.0",
+ "slackware-13.0.0" => "Slackware 13.0.0",
+ "slackware-13.1.0" => "Slackware 13.1.0",
+ "slackware-13.37.0" => "Slackware 13.37.0",
+ "slackware-14.0.0" => "Slackware 14.0.0",
+ "freebsd-4" => "FreeBSD 4",
+ "freebsd-5" => "FreeBSD 5",
+ "freebsd-6" => "FreeBSD 6",
+ "gentoo" => "Gentoo Linux",
+ "vlos-1.2" => "Vida Linux OS 1.2",
+ "archlinux" => "Arch Linux",
+ "pld-1.0" => "PLD 1.0 Ra",
+ "pld-1.1" => "PLD 1.1 Ra",
+ "pld-1.99" => "PLD 1.99 Ac-pre",
+ "vine-3.0" => "Vine Linux 3.0",
+ "vine-3.1" => "Vine Linux 3.1",
+ "fedora-1" => "Fedora Core 1 (Yarrow)",
+ "fedora-2" => "Fedora Core 2 (Tettnang)",
+ "fedora-3" => "Fedora Core 3 (Heidelberg)",
+ "fedora-4" => "Fedora Core 4 (Stentz)",
+ "fedora-5" => "Fedora Core 5 (Bordeaux)",
+ "fedora-15" => "Fedora 15 (LoveLock)",
+ "fedora-16" => "Fedora 16 (Verne)",
+ "fedora-17" => "Fedora 17 (Beefy Miracle)",
+ "rpath" => "rPath Linux",
+ "ark" => "Ark Linux",
+};
+
+sub check_lsb
+{
+ my ($ver, $dist);
+# my %vermap =
+# ("3.0" => "woody");
+
+ my %distmap =
+ ("Debian" => "debian"),
+ ("Mandrake" => "mandrake"),
+ ("Conectiva" => "conectiva"),
+ ("Blackpanther" => "blackpanther");
+
+ # gst_prefix not required here: parse already does that for us.
+ $dist = lc (&gst_parse_sh ("/etc/lsb-release", "DISTRIB_ID"));
+ $ver = lc (&gst_parse_sh ("/etc/lsb-release", "DISTRIB_RELEASE"));
+
+# $ver = $vermap{$ver} if exists $vermap{$ver};
+ $dist = $distmap{$dist} if exists $dirmap{$dir};
+
+ return -1 if ($dist eq "") || ($ver eq "");
+ return "$dist-$ver";
+}
+
+sub check_debian
+{
+ my ($ver, $i);
+ my %vermap =
+ ("testing/unstable" => "testing",
+ "lenny/sid" => "testing",
+ "3.1" => "sarge",
+ "4.0" => "etch",
+ "5.0" => "lenny");
+
+ open DEBIAN, "$gst_prefix/etc/debian_version" or return -1;
+ chomp ($ver = <DEBIAN>);
+ close DEBIAN;
+
+ #if $ver is not found, we will assume it is testing
+ if($ver and exists $vermap{$ver}) {
+ $ver = $vermap{$ver};
+ } else {
+ $ver = "testing";
+ }
+
+ return "debian-$ver";
+}
+
+
+sub check_redhat
+{
+ open RELEASE, "$gst_prefix/etc/redhat-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (/^Red Hat Linux.*\s+([0-9.]+)\s+.*/)
+ {
+ close RELEASE;
+ return "redhat-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_rhel
+{
+ open RELEASE, "$gst_prefix/etc/redhat-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (
+ (/^CentOS release (\d)([\d\.]+)\s+.*/)
+ or (/^Scientific Linux release (\d)([\d\.]+)\s+.*/)
+ or (/^Red Hat Enterprise Linux \w release (\d)([\d\.]+)\s+.*/)
+ )
+ {
+ close RELEASE;
+ return "rhel-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+
+sub check_openna
+{
+ open OPENNA, "$gst_prefix/etc/openna-release" or return -1;
+ while (<OPENNA>)
+ {
+ chomp;
+ if (/^OpenNA*/)
+ {
+ close OPENNA;
+ return "openna-$1";
+ }
+ }
+ close OPENNA;
+ return -1;
+}
+
+sub check_caldera
+{
+ open INSTALLED, "$gst_prefix/etc/.installed" or return -1;
+ while (<INSTALLED>)
+ {
+ chomp;
+ if (/^OpenLinux-(.*)-.*/)
+ {
+ close INSTALLED;
+ return "caldera-$1";
+ }
+ }
+ close INSTALLED;
+ return -1;
+}
+
+
+sub check_suse
+{
+ open RELEASE, "$gst_prefix/etc/SuSE-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (/^VERSION\s*=\s*(\S+)/)
+ {
+ close RELEASE;
+ return "suse-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_mandrake
+{
+ open MANDRAKE, "$gst_prefix/etc/mandrake-release" or return -1;
+ while (<MANDRAKE>)
+ {
+ $ver = $_;
+ chomp ($ver);
+ if ($ver =~ /^Linux Mandrake release (\S+)/)
+ {
+ close MANDRAKE;
+ return "mandrake-$1";
+ }
+ elsif ($ver =~ /^Mandrake( L|l)inux release ([\d\.]+)/i)
+ {
+ close MANDRAKE;
+ return "mandrake-$2";
+ }
+ }
+ close MANDRAKE;
+ return -1;
+}
+
+sub check_mandriva
+{
+ open MANDRIVA, "$gst_prefix/etc/mandriva-release" or return -1;
+ while (<MANDRIVA>)
+ {
+ $ver = $_;
+ chomp ($ver);
+ if ($ver =~ /^Linux Mandriva release (\S+)/)
+ {
+ close MANDRIVA;
+ return "mandriva-$1";
+ }
+ elsif ($ver =~ /^Mandriva( L|l)inux release ([\d\.]+)/i)
+ {
+ close MANDRIVA;
+ return "mandriva-$2";
+ }
+ }
+ close MANDRIVA;
+ return -1;
+}
+
+sub check_yoper
+{
+ open YOPER, "$gst_prefix/etc/yoper-release" or return -1;
+ while (<YOPER>)
+ {
+ $ver = $_;
+ chomp ($ver);
+ if ($ver =~ m/Yoper (\S+)/)
+ {
+ close YOPER;
+ # find the first digit of our release
+ $mystring= ~m/(\d)/;
+ #store it in $fdigit
+ $fdigit= $1;
+ # the end of the release is marked with -2 so find the -
+ $end = index($ver,"-");
+ $start = index($ver,$fdigit);
+ # extract the substring into $newver
+ $newver= substr($ver,$start,$end-$start);
+ print $newver;
+ return "yoper-$newver";
+ }
+ }
+ close YOPER;
+ return -1;
+}
+
+sub check_blackpanther
+{
+ open BLACKPANTHER, "$gst_prefix/etc/blackPanther-release" or return -1;
+
+ while (<BLACKPANTHER>)
+ {
+ $ver = $_;
+ chomp ($ver);
+ if ($ver =~ /^Linux Black Panther release (\S+)/)
+ {
+ close BLACKPANTHER;
+ return "blackPanther-$1";
+ }
+ elsif ($ver =~ /^Black Panther ( L|l)inux release ([\d\.]+)/i)
+ {
+ close BLACKPANTHER;
+ return "blackPanther-$2";
+ }
+ }
+
+ close BLACKPANTHER;
+ return -1;
+}
+
+sub check_fedora
+{
+ open FEDORA, "$gst_prefix/etc/fedora-release" or return -1;
+ while (<FEDORA>)
+ {
+ $ver = $_;
+ chomp ($ver);
+
+ if (
+ ($ver =~ /^Fedora Core release (\S+)/)
+ or ($ver =~ /^Fedora release (\S+)/)
+ )
+ {
+ close FEDORA;
+ return "fedora-$1";
+ }
+ }
+
+ close FEDORA;
+ return -1;
+}
+
+sub check_rpath
+{
+ open RPATH, "$gst_prefix/etc/distro-release" or return -1;
+
+ while (<RPATH>)
+ {
+ $ver = $_;
+ chomp ($ver);
+
+ if ($ver =~ /^rPath Linux/)
+ {
+ close RPATH;
+ return "rpath";
+ }
+ if ($ver =~ /Foresight/)
+ {
+ close RPATH;
+ return "rpath";
+ }
+ }
+
+ close RPATH;
+ return -1;
+}
+
+sub check_conectiva
+{
+ open RELEASE, "$gst_prefix/etc/conectiva-release" or return -1;
+
+ while (<RELEASE>)
+ {
+ chomp;
+
+ if (/^Conectiva Linux (\S+)/)
+ {
+ close RELEASE;
+ return "conectiva-$1";
+ }
+ }
+
+ close RELEASE;
+ return -1;
+}
+
+sub check_turbolinux
+{
+ open RELEASE, "$gst_prefix/etc/turbolinux-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (/^Turbolinux\s.*\s([0-9.]+)\s.*/)
+ {
+ close RELEASE;
+ return "turbolinux-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_slackware
+{
+ open RELEASE, "$gst_prefix/etc/slackware-version" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (/^Slackware ([0-9.]+)/)
+ {
+ close RELEASE;
+ return "slackware-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_gentoo
+{
+ return "gentoo" if stat ("$gst_prefix/usr/portage");
+ return -1;
+}
+
+sub check_vlos
+{
+ open RELEASE, "$gst_prefix/etc/vlos-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (/^VLOS.*\s+([0-9.]+)/)
+ {
+ close RELEASE;
+ return "vlos-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_archlinux
+{
+ # Since Arch stores gnome in /opt/gnome, use full dir
+ return "archlinux" if stat ("/etc/arch-release");
+ return -1;
+}
+
+sub check_linuxppc
+{
+ open RELEASE, "$gst_prefix/etc/redhat-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if (/^LinuxPPC\s+(\S+)/)
+ {
+ close RELEASE;
+ return "linuxppc-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_pld
+{
+ open RELEASE, "$gst_prefix/etc/pld-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if(/^([0-9.]+) PLD Linux/)
+ {
+ close RELEASE;
+ return "pld-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_vine
+{
+ open RELEASE, "$gst_prefix/etc/vine-release" or return -1;
+ while (<RELEASE>)
+ {
+ chomp;
+ if(/^Vine Linux ([0-9.]+)\s+.*/)
+ {
+ close RELEASE;
+ return "vine-$1";
+ }
+ }
+ close RELEASE;
+ return -1;
+}
+
+sub check_ark
+{
+ open ARK, "$gst_prefix/etc/ark-release" or return -1;
+ while (<ARK>)
+ {
+ $ver = $_;
+ chomp ($ver);
+
+ if ($ver =~ /^Ark Linux/)
+ {
+ close ARK;
+ return "ark";
+ }
+ }
+
+ close ARK;
+ return -1;
+}
+
+sub check_freebsd
+{
+ my ($sysctl_cmd, @output);
+
+ $sysctl_cmd = &gst_file_locate_tool ("sysctl");
+ @output = (readpipe("$sysctl_cmd -n kern.version"));
+ foreach (@output)
+ {
+ chomp;
+ if (/^FreeBSD\s([0-9]+)\.\S+.*/)
+ {
+ return "freebsd-$1";
+ }
+ }
+ return -1;
+}
+
+sub check_solaris
+{
+ my ($fd, $dist);
+
+ #
+ # The file /etc/release is present for solaris-2.6
+ # solaris 2.5 does not have the file. Solaris-7.0 and 8.0 have not
+ # been checked
+ #
+ # uname output
+ # Solaris 2.5: 5.5(.1)
+ # Solaris 2.6: 5.6
+ # Solaris 7: unknown, assume 7.0
+ # Solaris 8: unknown, assume 8.0
+ #
+ $fd = &gst_file_run_pipe_read ("uname -r");
+ return -1 if $fd eq undef;
+ chomp ($dist = <$fd>);
+ &gst_file_close ($fd);
+
+ if ($dist =~ /^5\.(\d)/) { return "solaris-2.$1" }
+ else { if ($dist =~ /^([78])\.\d/) { return "solaris-$1.0" } }
+ return -1;
+}
+
+sub gst_platform_get_system
+{
+ my ($tool) = @_;
+
+ # get the output of 'uname -s', it returns the system we are running
+ $$tool{"system"} = &gst_file_run_backtick ("uname -s");
+ chomp ($$tool{"system"});
+}
+
+sub gst_platform_guess
+{
+ my ($tool) = @_;
+
+ my %check = (
+ # Red Hat check must run after Vine, Mandrake and Fedora, and Mandrake after BlackPanther
+ "Linux" => [ \&check_lsb, \&check_debian, \&check_caldera, \&check_suse, \&check_blackpanther, \&check_vine,
+ \&check_fedora, \&check_mandrake, \&check_mandriva, \&check_conectiva, \&check_linuxppc, \&check_rhel, \&check_redhat, \&check_openna,
+ \&check_turbolinux, \&check_slackware, \&check_vlos, \&check_gentoo, \&check_pld, \&check_rpath, \&check_archlinux, \&check_ark ],
+ "FreeBSD" => [ \&check_freebsd ],
+ "SunOS" => [ \&check_solaris ]
+ );
+ my $plat;
+
+ # Fool-the-backend hack.
+ if (exists $ENV{"GST_DIST"})
+ {
+ $$tool{"platform"} = $gst_dist = $ENV{"GST_DIST"};
+ return;
+ }
+
+ foreach $plat (keys %check)
+ {
+ if ($$tool{"system"} =~ /$plat/)
+ {
+ my ($check, $dist);
+
+ foreach $check (@{$check{$plat}})
+ {
+ $dist = &$check ();
+ if ($dist != -1)
+ {
+ $$tool{"platform"} = $gst_dist = $dist;
+ return;
+ }
+ }
+ }
+ }
+
+ $$tool{"platform"} = $gst_dist = "unknown";
+}
+
+
+# gst_platform_ensure_supported
+#
+# Takes a list of supported platforms and sees if the one detected is found in
+# this list. If not, will report a list of supported platforms and fail.
+
+sub gst_platform_ensure_supported
+{
+ my ($tool, @supported) = @_;
+
+ $$tool{"platforms"} = [ @supported ];
+
+ foreach $platform (@supported)
+ {
+ if ($platform eq $$tool{"platform"})
+ {
+ &gst_report ("platform_success", $platform, $$PLATFORM_INFO{$platform});
+ return;
+ }
+ }
+
+ # Not supported.
+ if (exists $$tool{"platform"})
+ {
+ &gst_report ("platform_unsup", $$tool{"platform"});
+ }
+ else
+ {
+ &gst_report ("platform_undet");
+ }
+}
+
+
+# A directive handler that sets the currently selected platform.
+sub gst_platform_set
+{
+ my ($tool, $platform) = @_;
+ my ($p);
+
+ foreach $p (@{ $$tool{"platforms"}})
+ {
+ if ($p eq $platform)
+ {
+ $$tool{"platform"} = $gst_dist = $platform;
+ &gst_report ("platform_success", $platform, $$PLATFORM_INFO{$platform});
+ &gst_report_end ();
+ return;
+ }
+ }
+
+ &gst_report ("platform_unsup", $platform);
+ &gst_report_end ();
+}
+
+sub gst_platform_print_list
+{
+ my ($platforms) = @_;
+ my ($platform, $name);
+
+ &gst_xml_print_begin ("platforms");
+ foreach $platform (sort @$platforms)
+ {
+ $name = $$PLATFORM_INFO{$platform};
+
+ &gst_xml_container_enter ("platform");
+ &gst_xml_print_line ("<key>$platform</key>");
+ &gst_xml_print_line ("<name>$name</name>");
+ &gst_xml_container_leave ();
+ }
+ &gst_xml_print_end ("platforms");
+}
+
+sub gst_platform_list
+{
+ my ($tool) = @_;
+
+ &gst_report_end ();
+ &gst_platform_print_list ($$tool{"platforms"});
+}
+
+1;
diff --git a/knetwortdeconf/backends/process.pl.in b/knetwortdeconf/backends/process.pl.in
new file mode 100644
index 0000000..353f6ce
--- /dev/null
+++ b/knetwortdeconf/backends/process.pl.in
@@ -0,0 +1,54 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Common process stuff for the setup tools backends.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Carlos Garnacho Parro <carlosg@gnome.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/general.pl$DOTIN";
+require "$SCRIPTSDIR/file.pl$DOTIN";
+
+sub gst_process_kill_by_pidfile
+{
+ my ($pidfile) = @_;
+ my ($buf, $pid);
+
+ if ($pidfile !~ /^\//)
+ {
+ # add default pidfiles path if it isn't full path
+ $pidfile = "/var/run/" . $pidfile;
+ }
+
+ if (&gst_file_exists ($pidfile))
+ {
+ $buf = &gst_file_buffer_load ($pidfile);
+ $pid = $$buf[0];
+
+ &gst_file_run ("kill -9 $pid");
+ }
+}
+
+1;
diff --git a/knetwortdeconf/backends/replace.pl.in b/knetwortdeconf/backends/replace.pl.in
new file mode 100644
index 0000000..a72e3ef
--- /dev/null
+++ b/knetwortdeconf/backends/replace.pl.in
@@ -0,0 +1,1770 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# replace.pl: Common in-line replacing stuff for the ximian-setup-tools backends.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+# Arturo Espinosa <arturo@ximian.com>
+# Michael Vogt <mvo@debian.org> - Debian 2.[2|3] support.
+# David Lee Ludwig <davidl@wpi.edu> - Debian 2.[2|3] support.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/util.pl$DOTIN";
+require "$SCRIPTSDIR/file.pl$DOTIN";
+require "$SCRIPTSDIR/parse.pl$DOTIN";
+
+
+# General rules: all replacing is in-line. Respect unsupported values, comments
+# and as many spacing as possible.
+
+# The concept of keyword (kw) here is a key, normaly in its own line, whose
+# boolean representation is its own existence.
+
+# A $re is a regular expression. In most functions here, regular expressions
+# are converted to simple separators, by using gst_replace_regexp_to_separator.
+# This makes it easier to convert a parse table into a replace table.
+
+# Every final replacing function to be used by a table must handle one key
+# at a time, but may replace several values from there.
+#
+# Return 0 for success, and -1 for failure.
+#
+# Most of these functions have a parsing counterpart. The convention is
+# that parse becomes replace and split becomes join:
+# gst_parse_split_first_str -> gst_replace_join_first_str
+
+# Additional abstraction: replace table entries can have
+# arrays inside. The replace proc will be ran with every
+# combination that the arrays provide. Ex:
+# ["user", \&gst_replace_foo, [0, 1], [2, 3] ] will replace
+# using all possibilities in the combinatory of [0, 1]x[2, 3].
+# Check RedHat 7.2's network replace table for further
+# enlightenment.
+sub gst_replace_run_entry
+{
+ my ($values_hash, $key, $proc, $cp, $value) = @_;
+ my ($ncp, $i, $j, $res);
+
+ $ncp = [@$cp];
+ for ($i = 0; $i < scalar (@$cp); $i ++)
+ {
+ if (ref $$cp[$i] eq "ARRAY")
+ {
+ foreach $j (@{$$cp[$i]})
+ {
+ $$ncp[$i] = $j;
+ $res = -1 if &gst_replace_run_entry ($values_hash, $key, $proc, $ncp, $value);
+ }
+ return $res;
+ }
+ }
+
+ # OK, the given entry didn't have any array refs in it...
+
+ &gst_debug_print_line ("gst_replace_from_table: $key");
+ return -1 if (!&gst_parse_replace_hash_values ($ncp, $values_hash));
+ push (@$ncp, $$values_hash{$key}) unless $key eq "_always_";
+ $res = -1 if &$proc (@$ncp);
+ return $res;
+}
+
+# gst_replace_from_table takes a file mapping, a replace table, a hash
+# of values, probably made from XML parsing, and whose keys are
+# the same keys the table handles.
+#
+# Table entries whose keys are not present in the values_hash
+# will not be processed. More than one entry may process the same key.
+#
+# The functions in the replace tables, most of which are coded in
+# this file, receive the mapped files of the first argument, and then
+# a set of values. The last argument is the value of the $values_hash
+# for the corresponding key of the entry.
+sub gst_replace_from_table
+{
+ my ($fn, $table, $values_hash, $old_hash) = @_;
+ my ($key, $proc, @param);
+ my ($i, @cp, @files, $res);
+
+ $$fn{"OLD_HASH"} = $old_hash;
+
+ foreach $i (@$table)
+ {
+ @cp = @$i;
+ $key = shift (@cp);
+
+ $proc = shift (@cp);
+ @files = &gst_parse_replace_files (shift (@cp), $fn);
+ unshift @cp, @files if (scalar @files) > 0;
+
+ if ((exists $$values_hash{$key}) or ($key eq "_always_"))
+ {
+ $res = &gst_replace_run_entry ($values_hash, $key, $proc, \@cp, $$values_hash{$key});
+ }
+ elsif ((!exists $$values_hash{$key}) && (exists $$old_hash{$key}))
+ {
+ # we need to remove all the instances of the known variables that doesn't exist in the XML
+ $res = &gst_replace_run_entry ($values_hash, $key, $proc, \@cp, undef);
+ }
+ }
+
+ return $res;
+}
+
+# Wacky function that tries to create a field separator from a regular expression.
+# Doesn't work with all possible regular expressions: just with the ones we are working with.
+sub gst_replace_regexp_to_separator
+{
+ $_ = $_[0];
+
+ s/\[([^^])([^\]])[^\]]*\]/$1/g;
+ s/\+//g;
+ s/\$//g;
+ s/[^\*]\*//g;
+
+ return $_;
+}
+
+sub is_array_ref
+{
+ my $val;
+
+ return 1 if (ref ($val) eq "ARRAY");
+ return 0 if (ref ($val) eq undef);
+
+ &gst_debug_print_line ("is_array_ref: We shouldn't be here!");
+
+ return 0;
+}
+
+sub set_value
+{
+ my ($key, $val, $re) = @_;
+
+ return $key . &gst_replace_regexp_to_separator ($re) . $val;
+}
+
+# Edit a $file, wich is assumed to have a column-based format, with $re matching field separators
+# and one record per line. Search for lines with the corresponding $key.
+# The last arguments can be any number of standard strings.
+sub gst_replace_split
+{
+ my ($file, $key, $re, @value) = @_;
+ my ($fd, @line, @res);
+ my ($buff, $i);
+ my ($pre_space, $post_comment);
+ my ($line_key, $val, $ret);
+
+ &gst_report_enter ();
+ &gst_report ("replace_split", $key, $file);
+
+ $buff = &gst_file_buffer_load ($file);
+
+ foreach $i (@$buff)
+ {
+ $pre_space = $post_comment = "";
+
+ chomp $i;
+ $pre_space = $1 if $i =~ s/^([ \t]+)//;
+ $post_comment = $1 if $i =~ s/([ \t]*\#.*)//;
+
+ if ($i ne "")
+ {
+ @line = split ($re, $i, 2);
+ $line_key = shift (@line);
+
+ # found the key?
+ if ($line_key eq $key)
+ {
+ shift (@value) while ($value[0] eq "" && (scalar @value) > 0);
+
+ if ((scalar @value) == 0)
+ {
+ $i = "";
+ next;
+ }
+
+ $val = shift (@value);
+
+ chomp $val;
+ $i = &set_value ($key, $val, $re);
+ }
+ }
+
+ $i = $pre_space . $i . $post_comment . "\n";
+ }
+
+ foreach $i (@value)
+ {
+ push (@$buff, &set_value ($key, $i, $re) . "\n") if ($i ne "");
+ }
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+# Replace all key/values in file with those in @$value,
+# deleting exceeding ones and appending those required.
+sub gst_replace_join_all
+{
+ my ($file, $key, $re, $value) = @_;
+
+ return &gst_replace_split ($file, $key, $re, @$value);
+}
+
+# Find first $key value and replace with $value. Append if not found.
+sub gst_replace_join_first_str
+{
+ my ($file, $key, $re, $value) = @_;
+
+ return &gst_replace_split ($file, $key, $re, $value);
+}
+
+# Treat value as a bool value, using val_off and val_on as corresponding
+# boolean representations.
+sub gst_replace_join_first_bool
+{
+ my ($file, $key, $re, $val_on, $val_off, $value) = @_;
+
+ # Fixme: on and off should be a parameter.
+ $value = ($value == 1)? $val_on: $val_off;
+
+ return &gst_replace_split ($file, $key, $re, $value);
+}
+
+# Find first key in file, and set array join as value.
+sub gst_replace_join_first_array
+{
+ my ($file, $key, $re1, $re2, $value) = @_;
+
+ return &gst_replace_split ($file, $key, $re1, join (&gst_replace_regexp_to_separator ($re2), @$value));
+}
+
+# Escape $value in /bin/sh way, find/append key and set escaped value.
+sub gst_replace_sh
+{
+ my ($file, $key, $value) = @_;
+ my $ret;
+
+ $value = &gst_parse_shell_escape ($value);
+
+ &gst_report_enter ();
+ &gst_report ("replace_sh", $key, $file);
+
+ # This will expunge the whole var if the value is empty.
+ if ($value eq "")
+ {
+ $ret = &gst_replace_split ($file, $key, "[ \t]*=[ \t]*");
+ }
+ else
+ {
+ $ret = &gst_replace_split ($file, $key, "[ \t]*=[ \t]*", $value);
+ }
+
+ &gst_report_leave ();
+ return $ret;
+}
+
+# Escape $value in /bin/sh way, find/append key and set escaped value, make sure line har
+sub gst_replace_sh_export
+{
+ my ($file, $key, $value) = @_;
+ my $ret;
+
+ $value = &gst_parse_shell_escape ($value);
+
+ # This will expunge the whole var if the value is empty.
+
+ # FIXME: Just adding "export " works for the case I need, though it doesn't
+ # handle arbitraty whitespace. Something should be written to replace gst_replace_split()
+ # here.
+
+ if ($value eq "")
+ {
+ $ret = &gst_replace_split ($file, "export " . $key, "[ \t]*=[ \t]*");
+ }
+ else
+ {
+ $ret = &gst_replace_split ($file, "export " . $key, "[ \t]*=[ \t]*", $value);
+ }
+
+ return $ret;
+}
+
+# Treat value as a yes/no bool, replace in shell style.
+# val_true and val_false have default yes/no values.
+# use &gst_replace_sh_bool (file, key, value) if defaults are desired.
+sub gst_replace_sh_bool
+{
+ my ($file, $key, $val_true, $val_false, $value) = @_;
+
+ # default value magic.
+ if ($val_false eq undef)
+ {
+ $value = $val_true;
+ $val_true = undef;
+ }
+
+ $val_true = "yes" unless $val_true;
+ $val_false = "no" unless $val_false;
+
+ $value = ($value == 1)? $val_true: $val_false;
+
+ return &gst_replace_sh ($file, $key, $value);
+}
+
+# Treat value as a yes/no bool, replace in export... shell style.
+sub gst_replace_sh_export_bool
+{
+ my ($file, $key, $val_true, $val_false, $value) = @_;
+
+ # default value magic.
+ if ($val_false eq undef)
+ {
+ $value = $val_true;
+ $val_true = undef;
+ }
+
+ $val_true = "yes" unless $val_true;
+ $val_false = "no" unless $val_false;
+
+ $value = ($value == 1)? $val_true: $val_false;
+
+ return &gst_replace_sh_export ($file, $key, $value);
+}
+
+# Get a fully qualified hostname from a $key shell var in $file
+# and set the hostname part. e.g.: suse70's /etc/rc.config's FQHOSTNAME.
+sub gst_replace_sh_set_hostname
+{
+ my ($file, $key, $value) = @_;
+ my ($domain);
+
+ $domain = &gst_parse_sh_get_domain ($file, $key);
+ return &gst_replace_sh ($file, $key, "$value.$domain");
+}
+
+# Get a fully qualified hostname from a $key shell var in $file
+# and set the domain part. e.g.: suse70's /etc/rc.config's FQHOSTNAME.
+sub gst_replace_sh_set_domain
+{
+ my ($file, $key, $value) = @_;
+ my ($hostname);
+
+ $hostname = &gst_parse_sh_get_hostname ($file, $key);
+ return &gst_replace_sh ($file, $key, "$hostname.$value");
+}
+
+# Join the array pointed by $value with the corresponding $re separator
+# and assign that to the $key shell variable in $file.
+sub gst_replace_sh_join
+{
+ my ($file, $key, $re, $value) = @_;
+
+ return &gst_replace_sh ($file, $key,
+ join (&gst_replace_regexp_to_separator ($re), @$value));
+}
+
+# replace a regexp with $value
+sub gst_replace_sh_re
+{
+ my ($file, $key, $re, $value) = @_;
+ my ($val);
+
+ $val = &gst_parse_sh ($file, $key);
+
+ if ($val =~ /$re/)
+ {
+ $val =~ s/$re/$value/;
+ }
+ else
+ {
+ $val .= $value;
+ }
+
+ $val = '"' . $val . '"' if ($val !~ /^\".*\"$/);
+
+ return &gst_replace_split ($file, $key, "[ \t]*=[ \t]*", $val)
+}
+
+# Quick trick to set a keyword $key in $file. (think /etc/lilo.conf keywords).
+sub gst_replace_kw
+{
+ my ($file, $key, $value) = @_;
+ my $ret;
+
+ &gst_report_enter ();
+ &gst_report ("replace_kw", $key, $file);
+ $ret = &gst_replace_split ($file, $key, "\$", ($value)? "\n" : "");
+ &gst_report_leave ();
+ return $ret;
+}
+
+# The kind of $file whose $value is its first line contents.
+# (/etc/hostname)
+sub gst_replace_line_first
+{
+ my ($file, $value) = @_;
+ my $fd;
+
+ &gst_report_enter ();
+ &gst_report ("replace_line_first", $file);
+ $fd = &gst_file_open_write_from_names ($file);
+ &gst_report_leave ();
+ return -1 if !$fd;
+
+ print $fd "$value\n";
+ &gst_file_close ($fd);
+
+ return 0;
+}
+
+# For every key in %$value, replace/append the corresponding key/value pair.
+# The separator for $re1
+sub gst_replace_join_hash
+{
+ my ($file, $re1, $re2, $value) = @_;
+ my ($i, $res, $tmp, $val);
+ my ($oldhash, %merge);
+
+ $oldhash = &gst_parse_split_hash ($file, $re1, $re2);
+ foreach $i (keys (%$value), keys (%$oldhash))
+ {
+ $merge{$i} = 1;
+ }
+
+ $res = 0;
+
+ foreach $i (keys (%merge))
+ {
+ if (exists $$value{$i})
+ {
+ $val = join (&gst_replace_regexp_to_separator ($re2), @{$$value{$i}});
+ $tmp = &gst_replace_split ($file, $i, $re1, $val);
+ }
+ else
+ {
+ # This deletes the entry.
+ $tmp = &gst_replace_split ($file, $i, $re1);
+ }
+ $res = $tmp if !$res;
+ }
+
+ return $res;
+}
+
+# Find $re matching send string and replace parenthesyzed
+# part of $re with $value. FIXME: apply meeks' more general impl.
+sub gst_replace_chat
+{
+ my ($file, $re, $value) = @_;
+ my ($buff, $i, $bak, $found, $substr, $ret);
+
+ &gst_report_enter ();
+ &gst_report ("replace_chat", $file);
+ $buff = &gst_file_buffer_load ($file);
+
+ SCAN: foreach $i (@$buff)
+ {
+ $bak = "";
+ $found = "";
+ my ($quoted);
+ chomp $i;
+
+ while ($i ne "")
+ {
+ # If it uses quotes. FIXME: Assuming they surround the whole string.
+ if ($i =~ /^\'/)
+ {
+ $i =~ s/\'([^\']*)\' ?//;
+ $found = $1;
+ $quoted = 1;
+ }
+ else
+ {
+ $i =~ s/([^ \t]*) ?//;
+ $found = $1;
+ $quoted = 0;
+ }
+
+ # If it looks like what we're looking for,
+ # substitute what is in parens with value.
+ if ($found =~ /$re/i)
+ {
+ $substr = $1;
+ $found =~ s/$substr/$value/i;
+
+ if ($quoted == 1)
+ {
+ $i = $bak . "\'$found\' " . $i . "\n";
+ }
+ else
+ {
+ $i = $bak . "$found " . $i . "\n";
+ }
+
+ last SCAN;
+ }
+
+ if ($quoted == 1)
+ {
+ $bak .= "\'$found\'";
+ }
+ else
+ {
+ $bak .= "$found";
+ }
+
+ $bak .= " " if $bak ne "";
+ }
+
+ $i = $bak . "\n";
+ }
+
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+# Find/append $section in ini $file and replace/append
+# $var = $value pair. FIXME: should reimplement with
+# interfaces style. This is too large.
+sub gst_replace_ini
+{
+ my ($file, $section, $var, $value) = @_;
+ my ($buff, $i, $found_flag, $ret);
+ my ($pre_space, $post_comment, $sec_save);
+
+ &gst_report_enter ();
+ &gst_report ("replace_ini", $var, $section, $file);
+
+ $buff = &gst_file_buffer_load ($file);
+
+ &gst_file_buffer_join_lines ($buff);
+ $found_flag = 0;
+
+ foreach $i (@$buff)
+ {
+ $pre_space = $post_comment = "";
+
+ chomp $i;
+ $pre_space = $1 if $i =~ s/^([ \t]+)//;
+ $post_comment = $1 if $i =~ s/([ \t]*[\#;].*)//;
+
+ if ($i ne "")
+ {
+ if ($i =~ /\[$section\]/i)
+ {
+ $i =~ s/(\[$section\][ \t]*)//i;
+ $sec_save = $1;
+ $found_flag = 1;
+ }
+
+ if ($found_flag)
+ {
+ if ($i =~ /\[[^\]]+\]/)
+ {
+ $i = "$var = $value\n$i" if ($value ne "");
+ $found_flag = 2;
+ }
+
+ if ($i =~ /^$var[ \t]*=/i)
+ {
+ if ($value ne "")
+ {
+ $i =~ s/^($var[ \t]*=[ \t]*).*/$1$value/i;
+ }
+ else
+ {
+ $i = "";
+ }
+ $found_flag = 2;
+ }
+ }
+ }
+
+ if ($found_flag && $sec_save ne "")
+ {
+ $i = $sec_save . $i;
+ $sec_save = "";
+ }
+
+ $i = $pre_space . $i . $post_comment . "\n";
+ last if $found_flag == 2;
+ }
+
+ push @$buff, "\n[$section]\n" if (!$found_flag);
+ push @$buff, "$var = $value\n" if ($found_flag < 2 && $value ne "");
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+# Well, removes a $section from an ini type $file.
+sub gst_replace_remove_ini_section
+{
+ my ($file, $section) = @_;
+ my ($buff, $i, $found_flag, $ret);
+ my ($pre_space, $post_comment, $sec_save);
+
+ &gst_report_enter ();
+ &gst_report ("replace_del_ini_sect", $section, $file);
+
+ $buff = &gst_file_buffer_load ($file);
+
+ &gst_file_buffer_join_lines ($buff);
+ $found_flag = 0;
+
+ foreach $i (@$buff)
+ {
+ $pre_space = $post_comment = "";
+
+ chomp $i;
+ $pre_space = $1 if $i =~ s/^([ \t]+)//;
+ $post_comment = $1 if $i =~ s/([ \t]*[\#;].*)//;
+
+ if ($i ne "")
+ {
+ if ($i =~ /\[$section\]/i)
+ {
+ $i =~ s/(\[$section\][ \t]*)//i;
+ $found_flag = 1;
+ }
+ elsif ($found_flag && $i =~ /\[.+\]/i)
+ {
+ $i = $pre_space . $i . $post_comment . "\n";
+ last;
+ }
+ }
+
+ if ($found_flag)
+ {
+ if ($post_comment =~ /^[ \t]*$/)
+ {
+ $i = "";
+ }
+ else
+ {
+ $i = $post_comment . "\n";
+ }
+ }
+ else
+ {
+ $i = $pre_space . $i . $post_comment . "\n";
+ }
+ }
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+# Removes a $var in $section of a ini type $file.
+sub gst_replace_remove_ini_var
+{
+ my ($file, $section, $var) = @_;
+ &gst_replace_ini ($file, $section, $var, "");
+}
+
+# Replace using boolean $value with a yes/no representation,
+# ini style.
+sub gst_replace_ini_bool
+{
+ my ($file, $section, $var, $value) = @_;
+
+ $value = ($value == 1)? "yes": "no";
+
+ return &gst_replace_ini ($file, $section, $var, $value);
+}
+
+# *cap replacement methods.
+#sub gst_replace_cap
+#{
+# my ($file, $section, $var, $value) = @_;
+# my ($buff, $i, $found_flag, $ret);
+# my ($pre_space, $post_comment, $sec_save);
+#
+# $buff = &gst_file_buffer_load ($file);
+## &gst_file_buffer_join_lines ($buff);
+# $found_flag = 0;
+#
+# foreach $i (@$buff)
+# {
+# $pre_space = $post_comment = "";
+#
+# chomp $i;
+# $pre_space = $1 if $i =~ s/^([ \t]+)//;
+# $post_comment = $1 if $i =~ s/^([ \t]*[\#].*)//;
+#
+# if ($i ne "")
+# {
+# if ($i =~ /^$section[|:]/i)
+# {
+# $i =~ s/^($section)//i;
+# $sec_save = $1;
+# $found_flag = 1;
+# }
+#
+# if ($found_flag)
+# {
+# if ($i =~ /^[a-z0-9]+[|:]/)
+# {
+# $i = "\t:$var=$value:\n$i";
+# $found_flag = 2;
+# }
+#
+# if ($found_flag && $i =~ /^:$var[=:]/i)
+# {
+# if ($value ne "")
+# {
+# $i =~ s/^(:$var)[^:]*/$1=$value/i;
+# }
+# else
+# {
+# $i = "";
+# }
+# $found_flag = 2;
+# }
+# }
+# }
+#
+# if ($found_flag && $sec_save ne "")
+# {
+# $i = $sec_save . $i;
+# $sec_save = "";
+# }
+#
+# $i = $pre_space . $i . $post_comment . "\n";
+# last if $found_flag == 2;
+# }
+#
+# push @$buff, "\n$section:\\\n" if (!$found_flag);
+# push @$buff, "\t:$var=$value:\n" if ($found_flag < 2 && $value ne "");
+#
+# &gst_file_buffer_clean ($buff);
+# $ret = &gst_file_buffer_save ($buff, $file);
+# return $ret;
+#}
+
+sub gst_replace_remove_cap_section
+{
+ my ($file, $section) = @_;
+ my ($buff, $i, $found_flag, $ret);
+ my ($pre_space, $post_comment, $sec_save);
+
+ $buff = &gst_file_buffer_load ($file);
+ $found_flag = 0;
+
+ foreach $i (@$buff)
+ {
+ $pre_space = $post_comment = "";
+
+ chomp $i;
+ $pre_space = $1 if $i =~ s/^([ \t]+)//;
+ $post_comment = $1 if $i =~ s/^([ \t]*[\#].*)//;
+
+ if ($i ne "")
+ {
+ if ($i =~ /^$section[|:]/i)
+ {
+ $i = "";
+ $found_flag = 1;
+ }
+ elsif ($found_flag && $i =~ /^[a-z0-9]+[|:]/i)
+ {
+ $i = $pre_space . $i . $post_comment . "\n";
+ last;
+ }
+ }
+
+ if ($found_flag)
+ {
+ if ($post_comment =~ /^[ \t]*$/)
+ {
+ $i = "";
+ }
+ else
+ {
+ $i = $post_comment . "\n";
+ }
+ }
+ else
+ {
+ $i = $pre_space . $i . $post_comment . "\n";
+ }
+ }
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ return $ret;
+}
+
+# Save a printcap buffer to file. This doesn't do any extra processing for now,
+# but it may do so in the future.
+sub gst_replace_printcap_buffer_save
+{
+ my ($file, $buf) = @_;
+ my $ret;
+
+ &gst_file_buffer_clean ($buf);
+ $ret = &gst_file_buffer_save ($buf, $file);
+ return $ret;
+}
+
+sub gst_replace_printcap_print_stanza
+{
+ my ($stanza) = @_;
+ return $stanza . ":\n";
+}
+
+sub gst_replace_printcap_print_option
+{
+ my ($option, $type, $value) = @_;
+ return "\t:" . $option . $type . $value . ":\n";
+}
+
+sub gst_replace_printcap_add_stanza
+{
+ my ($buf, $stanza) = @_;
+
+ push @$buf, "\n";
+ push @$buf, "##PRINTTOOL3## LOCAL unknown NAxNA {} Unknown Default {}\n";
+ push @$buf, &gst_replace_printcap_print_stanza ($stanza);
+
+ return ($#$buf - 1, $#$buf);
+}
+
+sub gst_replace_printcap_add_option_slot
+{
+ my ($buf, $stanza_line_no) = @_;
+ my (@buf_tail);
+
+ @buf_tail = splice (@$buf, $stanza_line_no + 1);
+ push @$buf, "\t:NEW_OPTION:\n";
+ push @$buf, @buf_tail;
+
+ return $stanza_line_no + 1;
+}
+
+sub gst_replace_printcap_remove_stanza_from_buf
+{
+ my ($buf, $printtool_line_no, $stanza_line_no) = @_;
+ my ($next_printtool_line_no, $next_stanza_line_no);
+ my ($splice_start, $splice_end);
+
+ ($next_printtool_line_no, $next_stanza_line_no) =
+ &gst_parse_printcap_get_next_stanza ($buf, $stanza_line_no + 1);
+
+ if ($printtool_line_no != -1)
+ {
+ $splice_start = $printtool_line_no;
+ }
+ else
+ {
+ $splice_start = $stanza_line_no;
+ }
+
+ if ($next_printtool_line_no != -1)
+ {
+ $splice_end = $next_printtool_line_no;
+ }
+ else
+ {
+ $splice_end = $next_stanza_line_no;
+ }
+
+ if ($splice_end != -1)
+ {
+ splice (@$buf, $splice_start, $splice_end - $splice_start);
+ }
+ else
+ {
+ splice (@$buf, $splice_start);
+ }
+}
+
+sub gst_replace_printcap_remove_option_slot
+{
+ my ($buf, $option_line_no) = @_;
+ splice (@$buf, $option_line_no, 1);
+}
+
+# High-level API.
+sub gst_replace_printcap_remove_printer
+{
+ my ($file, $printer) = @_;
+ my ($buf, $printtool_line_no, $stanza_line_no);
+
+ $buf = &gst_parse_printcap_buffer_load ($file);
+
+ ($printtool_line_no, $stanza_line_no) = &gst_parse_printcap_find_stanza ($buf, 0, $printer);
+ &gst_replace_printcap_remove_stanza_from_buf ($buf, $printtool_line_no, $stanza_line_no);
+
+ $ret = &gst_replace_printcap_buffer_save ($file, $buf);
+ return $ret;
+}
+
+# High-level API.
+sub gst_replace_printcap
+{
+ my ($file, $section, $var, $type, $value) = @_;
+ my ($printtool_line_no, $stanza_line_no, $option_line_no);
+ my ($buf, $ret);
+
+ $buf = &gst_parse_printcap_buffer_load ($file);
+
+ ($printtool_line_no, $stanza_line_no) = &gst_parse_printcap_find_stanza ($buf, 0, $section);
+ if ($stanza_line_no == -1)
+ {
+ ($printtool_line_no, $stanza_line_no) = &gst_replace_printcap_add_stanza ($buf, $section);
+ }
+
+ $option_line_no = &gst_parse_printcap_find_option ($buf, $stanza_line_no + 1, $var);
+ if ($option_line_no == -1)
+ {
+ $option_line_no = &gst_replace_printcap_add_option_slot ($buf, $stanza_line_no);
+ }
+
+ if ($type ne "")
+ {
+ $$buf [$option_line_no] = "\t:" . $var . $type . $value . ":\n";
+ }
+ elsif ($value == 1)
+ {
+ $$buf [$option_line_no] = "\t:" . $var . ":\n";
+ }
+ else
+ {
+ &gst_replace_printcap_remove_option_slot ($buf, $option_line_no);
+ }
+
+ $ret = &gst_replace_printcap_buffer_save ($file, $buf);
+ return $ret;
+}
+
+# Debian /etc/network/interfaces in-line replacing methods.
+
+# From loaded buffer, starting at $line_no, find next debian
+# interfaces format stanza. Return array ref with all stanza args.
+# -1 if not found.
+# NOTE: $line_no is a scalar ref. and gives the position of next stanza.
+sub gst_replace_interfaces_get_next_stanza
+{
+ my ($buff, $line_no, $stanza_type) = @_;
+ my ($i, $line);
+
+ while ($$line_no < (scalar @$buff))
+ {
+ $_ = $$buff[$$line_no];
+ $_ = &gst_parse_interfaces_line_clean ($_);
+
+ if (/^$stanza_type[ \t]+[^ \t]/)
+ {
+ s/^$stanza_type[ \t]+//;
+ return [ split ("[ \t]+", $_) ];
+ }
+ $$line_no ++;
+ }
+
+ return -1;
+}
+
+sub gst_replace_interfaces_line_is_stanza
+{
+ my ($line) = @_;
+
+ return 1 if $line =~ /^(iface|auto|mapping|allow-\w+)[ \t]+[^ \t]/;
+ return 0;
+}
+
+# Scan for next option. An option is something that is
+# not a stanza. Return key/value tuple ref, -1 if not found.
+# $$line_no will contain position.
+sub gst_replace_interfaces_get_next_option
+{
+ my ($buff, $line_no) = @_;
+ my ($i, $line, $empty_lines);
+
+ $empty_lines = 0;
+
+ while ($$line_no < (scalar @$buff))
+ {
+ $_ = $$buff[$$line_no];
+ $_ = &gst_parse_interfaces_line_clean ($_);
+
+ if (!/^$/)
+ {
+ return [ split ("[ \t]+", $_, 2) ] if (! &gst_replace_interfaces_line_is_stanza ($_));
+ $$line_no -= $empty_lines;
+ return -1;
+ }
+ else
+ {
+ $empty_lines ++;
+ }
+
+ $$line_no ++;
+ }
+
+ $$line_no -= $empty_lines;
+ return -1;
+}
+
+# Search buffer for option with key $key, starting
+# at $$line_no position. Return 1/0 found result.
+# $$line_no will show position.
+sub gst_replace_interfaces_option_locate
+{
+ my ($buff, $line_no, $key) = @_;
+ my $option;
+
+ while (($option = &gst_replace_interfaces_get_next_option ($buff, $line_no)) != -1)
+ {
+ return 1 if ($$option[0] eq $key);
+ $$line_no ++;
+ }
+
+ return 0;
+}
+
+# Locate stanza line for $iface in $buff, starting at $$line_no.
+sub gst_replace_interfaces_next_stanza_locate
+{
+ my ($buff, $line_no) = @_;
+
+ return &gst_replace_interfaces_get_next_stanza ($buff, \$$line_no, "(iface|auto|mapping)");
+}
+
+sub gst_replace_interfaces_iface_stanza_locate
+{
+ my ($buff, $line_no, $iface) = @_;
+
+ return &gst_replace_interfaces_generic_stanza_locate ($buff, \$$line_no, $iface, "iface");
+}
+
+sub gst_replace_interfaces_auto_stanza_locate
+{
+ my ($buff, $line_no, $iface) = @_;
+
+ return &gst_replace_interfaces_generic_stanza_locate ($buff, \$$line_no, $iface, "auto");
+}
+
+sub gst_replace_interfaces_generic_stanza_locate
+{
+ my ($buff, $line_no, $iface, $stanza_name) = @_;
+ my $stanza;
+
+ while (($stanza = &gst_replace_interfaces_get_next_stanza ($buff, \$$line_no, $stanza_name)) != -1)
+ {
+ return 1 if ($$stanza[0] eq $iface);
+ $$line_no++;
+ }
+
+ return 0;
+}
+
+# Create a Debian Woody stanza, type auto, with the requested
+# @ifaces as values.
+sub gst_replace_interfaces_auto_stanza_create
+{
+ my ($buff, @ifaces) = @_;
+ my ($count);
+
+ push @$buff, "\n" if ($$buff[$count] ne "");
+ push @$buff, "auto " . join (" ", @ifaces) . "\n";
+}
+
+# Append a stanza for $iface to buffer.
+sub gst_replace_interfaces_iface_stanza_create
+{
+ my ($buff, $iface) = @_;
+ my ($count);
+
+ $count = $#$buff;
+ push @$buff, "\n" if ($$buff[$count] ne "");
+ push @$buff, "iface $iface inet static\n";
+}
+
+# Delete $iface stanza and all its option lines.
+sub gst_replace_interfaces_iface_stanza_delete
+{
+ my ($file, $iface) = @_;
+ my ($buff, $line_no, $line_end, $stanza);
+
+ $buff = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buff);
+ $line_no = 0;
+
+ return -1 if (!&gst_replace_interfaces_iface_stanza_locate ($buff, \$line_no, $iface));
+ $line_end = $line_no + 1;
+ &gst_replace_interfaces_next_stanza_locate ($buff, \$line_end);
+
+ while ($line_no < $line_end)
+ {
+ delete $$buff[$line_no];
+ $line_no++;
+ }
+
+ $line_no = 0;
+ if (&gst_replace_interfaces_auto_stanza_locate ($buff, \$line_no, $iface))
+ {
+ $line_end = $line_no + 1;
+ &gst_replace_interfaces_next_stanza_locate ($buff, \$line_end);
+
+ while ($line_no < $line_end)
+ {
+ delete $$buff[$line_no];
+ $line_no++;
+ }
+ }
+
+ &gst_file_buffer_clean ($buff);
+ return &gst_file_buffer_save ($buff, $file);
+}
+
+# Find $iface stanza line and replace $pos value (ie the method).
+sub gst_replace_interfaces_stanza_value
+{
+ my ($file, $iface, $pos, $value) = @_;
+ my ($buff, $line_no, $stanza);
+ my ($pre_space, $line, $line_arr);
+
+ $buff = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buff);
+ $line_no = 0;
+
+ if (!&gst_replace_interfaces_iface_stanza_locate ($buff, \$line_no, $iface))
+ {
+ $line_no = 0;
+ &gst_replace_interfaces_iface_stanza_create ($buff, $iface);
+ &gst_replace_interfaces_iface_stanza_locate ($buff, \$line_no, $iface);
+ }
+
+ $line = $$buff[$line_no];
+ chomp $line;
+ $pre_space = $1 if $line =~ s/^([ \t]+)//;
+ $line =~ s/^iface[ \t]+//;
+ @line_arr = split ("[ \t]+", $line);
+ $line_arr[$pos] = $value;
+ $$buff[$line_no] = $pre_space . "iface " . join (' ', @line_arr) . "\n";
+
+ &gst_file_buffer_clean ($buff);
+ return &gst_file_buffer_save ($buff, $file);
+}
+
+# Find/append $key option in $iface stanza and set $value.
+sub gst_replace_interfaces_option_str
+{
+ my ($file, $iface, $key, $value) = @_;
+ my ($buff, $line_no, $stanza, $ret);
+ my ($pre_space, $line, $line_arr);
+
+ &gst_report_enter ();
+ &gst_report ("replace_ifaces_str", $key, $iface);
+
+ $buff = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buff);
+ $line_no = 0;
+
+ if (!&gst_replace_interfaces_iface_stanza_locate ($buff, \$line_no, $iface))
+ {
+ $line_no = 0;
+ &gst_replace_interfaces_iface_stanza_create ($buff, $iface);
+ &gst_replace_interfaces_iface_stanza_locate ($buff, \$line_no, $iface);
+ }
+
+ $line_no++;
+
+ if (&gst_replace_interfaces_option_locate ($buff, \$line_no, $key))
+ {
+ if ($value eq "") # Delete option if value is empty.
+ {
+ $$buff[$line_no] = "";
+ }
+ else
+ {
+ chomp $$buff[$line_no];
+ $$buff[$line_no] =~ s/^([ \t]*$key[ \t]).*/$1/;
+ }
+ }
+ elsif ($value ne "")
+ {
+ $line_no --;
+ chomp $$buff[$line_no];
+ $$buff[$line_no] =~ s/^([ \t]*)(.*)/$1$2\n$1$key /;
+ }
+
+ $$buff[$line_no] .= $value . "\n" if $value ne "";
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+# $key option is keyword. $value says if it should exist or not.
+sub gst_replace_interfaces_option_kw
+{
+ my ($file, $iface, $key, $value) = @_;
+
+ return &gst_replace_interfaces_option_str ($file, $iface, $key, $value? " ": "");
+}
+
+# !$value says if keyword should exist or not (ie noauto).
+sub gst_replace_interfaces_option_kw_not
+{
+ my ($file, $iface, $key, $value) = @_;
+
+ return &gst_replace_interfaces_option_kw ($file, $iface, $key, !$value);
+}
+
+
+# Implementing pump(8) pump.conf file format replacer.
+# May be useful for dhcpd too.
+
+# Try to find the next option, returning an array ref
+# with the found key and the rest of the options in
+# two items, or -1 if not found.
+sub gst_replace_pump_get_next_option
+{
+ my ($buff, $line_no) = @_;
+
+ while ($$line_no < (scalar @$buff))
+ {
+ $_ = $$buff[$$line_no];
+ $_ = &gst_parse_interfaces_line_clean ($_);
+ if ($_ ne "")
+ {
+ return [ split ("[ \t]+", $_, 2) ];
+ }
+
+ $$line_no ++;
+ }
+
+ return -1;
+}
+
+# Iterate with get_next_option, starting at $line_no
+# until the option with $key is found, or eof.
+# Return 0/1 as found.
+sub gst_replace_pump_option_locate
+{
+ my ($buff, $line_no, $key) = @_;
+ my ($opt);
+
+ while (($opt = &gst_replace_pump_get_next_option ($buff, $line_no)) != -1)
+ {
+ return 1 if $$opt[0] eq $key;
+ return 0 if $$opt[0] eq "}";
+
+ $$line_no ++;
+ }
+
+ return 0;
+}
+
+# Try to find a "device" option whose interface is $iface,
+# starting at $$line_no. Return 0/1 as found.
+sub gst_replace_pump_get_device
+{
+ my ($buff, $line_no, $iface) = @_;
+ my ($opt);
+
+ while (($opt = &gst_replace_pump_get_next_option ($buff, $line_no)) != -1)
+ {
+ if ($$opt[0] eq "device")
+ {
+ $$opt[1] =~ s/[ \t]*\{//;
+ return 1 if $$opt[1] eq $iface;
+ }
+
+ $$line_no ++;
+ }
+
+ return 0;
+}
+
+# Add a device entry for $iface at the end of $buff.
+sub gst_replace_pump_add_device
+{
+ my ($buff, $iface) = @_;
+
+ push @$buff, "\n";
+ push @$buff, "device $iface {\n";
+ push @$buff, "\t\n";
+ push @$buff, "}\n";
+}
+
+# Find a "device" section for $iface and
+# replace/add/delete the $key option inside the section.
+sub gst_replace_pump_iface_option_str
+{
+ my ($file, $iface, $key, $value) = @_;
+ my ($line_no, $ret);
+
+ $buff = &gst_file_buffer_load ($file);
+ $line_no = 0;
+
+ if (!&gst_replace_pump_get_device ($buff, \$line_no, $iface))
+ {
+ $line_no = 0;
+ &gst_replace_pump_add_device ($buff, $iface);
+ &gst_replace_pump_get_device ($buff, \$line_no, $iface);
+ }
+
+ $line_no ++;
+
+ if (&gst_replace_pump_option_locate ($buff, \$line_no, $key))
+ {
+ if ($value eq "")
+ {
+ $$buff[$line_no] = "";
+ }
+ else
+ {
+ chomp $$buff[$line_no];
+ $$buff[$line_no] =~ s/^([ \t]*$key[ \t]).*/$1/;
+ }
+ }
+ elsif ($value ne "")
+ {
+ $line_no --;
+ chomp $$buff[$line_no];
+ $$buff[$line_no] =~ s/^([ \t]*)(.*)/$1$2\n$1$key /;
+ }
+
+ if ($value ne "")
+ {
+ $value =~ s/^[ \t]+//;
+ $value =~ s/[ \t]+$//;
+ $$buff[$line_no] .= &gst_parse_shell_escape ($value) . "\n";
+ }
+
+ &gst_file_buffer_clean ($buff);
+ $ret = &gst_file_buffer_save ($buff, $file);
+ &gst_report_leave ();
+ return $ret;
+}
+
+# Same as function above, except $key is a keyword.
+sub gst_replace_pump_iface_kw
+{
+ my ($file, $iface, $key, $value) = @_;
+
+ return &gst_replace_pump_iface_option_str ($file, $iface, $key, $value? " ": "");
+}
+
+# Same, but use the negative of $value (i.e. nodns)
+sub gst_replace_pump_iface_kw_not
+{
+ my ($file, $iface, $key, $value) = @_;
+
+ return &gst_replace_pump_iface_kw ($file, $iface, $key, !$value);
+}
+
+sub gst_replace_xml_pcdata
+{
+ my ($file, $varpath, $data) = @_;
+ my ($model, $branch, $fd, $compressed);
+
+ ($model, $compressed) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_ensure ($model, $varpath);
+
+ &gst_xml_model_set_pcdata ($branch, $data);
+
+ return &gst_xml_model_save ($model, $file, $compressed);
+}
+
+sub gst_replace_xml_attribute
+{
+ my ($file, $varpath, $attr, $value) = @_;
+ my ($model, $branch, $fd, $compressed);
+
+ ($model, $compressed) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_ensure ($model, $varpath);
+
+ &gst_xml_model_set_attribute ($branch, $attr, $value);
+
+ return &gst_xml_model_save ($model, $file, $compressed);
+}
+
+sub gst_replace_xml_pcdata_with_type
+{
+ my ($file, $varpath, $type, $data) = @_;
+ my ($model, $branch, $fd, $compressed);
+
+ ($model, $compressed) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_ensure ($model, $varpath);
+
+ &gst_xml_model_set_pcdata ($branch, $data);
+ &gst_xml_model_set_attribute ($branch, "TYPE", $type);
+
+ return &gst_xml_model_save ($model, $file, $compressed);
+}
+
+sub gst_replace_xml_attribute_with_type
+{
+ my ($file, $varpath, $attr, $type, $value) = @_;
+ my ($model, $branch, $fd, $compressed);
+
+ ($model, $compressed) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_ensure ($model, $varpath);
+
+ &gst_xml_model_set_attribute ($branch, $attr, $value);
+ &gst_xml_model_set_attribute ($branch, "TYPE", $type);
+
+ return &gst_xml_model_save ($model, $file, $compressed);
+}
+
+sub gst_replace_alchemist_ensure_list_types
+{
+ my ($model, $varpath, $setpath) = @_;
+ my ($branch, @path);
+
+ $branch = &gst_xml_model_find ($model, $varpath);
+ @path = split /\//, $setpath;
+
+ # NOTE: The following could be done with a depth-iterator callback from a func
+ # similar to gst_xml_model_find ().
+
+ for $elem (@path)
+ {
+ next if ($elem eq "");
+ my @children = @$branch;
+ shift @children; # Attributes
+ $branch = undef;
+
+ while (@children)
+ {
+ if ($children [0] eq $elem)
+ {
+ shift @children;
+ $branch = shift @children;
+ &gst_xml_model_set_attribute ($branch, "TYPE", "LIST");
+ last;
+ }
+
+ shift @children;
+ shift @children;
+ }
+
+ last if ($branch == undef);
+ }
+}
+
+sub gst_replace_alchemist
+{
+ my ($file, $varpath, $type, $value) = @_;
+ my ($fullpath, $model, $branch, $fd, $compressed);
+
+ $fullpath = "/adm_context/datatree/" . $varpath;
+ ($model, $compressed) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_ensure ($model, $fullpath);
+ &gst_replace_alchemist_ensure_list_types ($model, "/adm_context/datatree/", $varpath);
+
+ &gst_xml_model_set_attribute ($branch, "VALUE", $value);
+ &gst_xml_model_set_attribute ($branch, "TYPE", $type);
+
+ return &gst_xml_model_save ($model, $file, $compressed);
+}
+
+sub gst_replace_alchemist_print
+{
+ my ($file, $printer, $varpath, $type, $value) = @_;
+ my ($fullpath, $model, $branch, $fd, $compressed);
+
+ $fullpath = "/adm_context/datatree/printconf/print_queues/" . $printer . "/" . $varpath;
+ ($model, $compressed) = &gst_xml_model_scan ($file);
+
+ $branch = &gst_xml_model_ensure ($model, $fullpath);
+
+ &gst_replace_alchemist_ensure_list_types ($model, "/adm_context/datatree/",
+ "printconf/print_queues/" . $printer . "/" . $varpath);
+
+ &gst_xml_model_set_attribute ($branch, "VALUE", $value);
+ &gst_xml_model_set_attribute ($branch, "TYPE", $type);
+
+ $branch = &gst_xml_model_find ($model, "/adm_context/datatree/printconf/print_queues/" . $printer);
+ &gst_xml_model_set_attribute ($branch, "ATOMIC", "TRUE");
+
+ return &gst_xml_model_save ($model, $file, $compressed);
+}
+
+# This could be split up.
+sub gst_replace_alchemist_print_option
+{
+ my ($file, $printer, $name, $type, $value) = @_;
+ my ($varpath, $model, $branch, $fd, $compressed, $options, $option);
+
+ ($model, $compressed) = &gst_xml_model_scan ($file);
+ $branch = &gst_xml_model_ensure ($model, "/adm_context/datatree/printconf/print_queues/" . $printer .
+ "/filter_data/foomatic_defaults");
+ &gst_replace_alchemist_ensure_list_types ($model, "/adm_context/datatree/", "printconf/print_queues/" .
+ $printer . "/filter_data/foomatic_defaults");
+ &gst_xml_model_set_attribute ($branch, "ANONYMOUS", "TRUE");
+
+ # See if option is already defined.
+
+ $options = &gst_xml_model_get_children ($branch);
+
+ foreach $o (@$options)
+ {
+ my $opt_node = &gst_xml_model_find ($o, "name");
+ next if (!$opt_node);
+
+ if (&gst_xml_model_get_attribute ($opt_node, "VALUE") eq $name)
+ {
+ $option = $o;
+ last;
+ }
+ }
+
+ # If not, create node for it.
+
+ if (!$option)
+ {
+ $option = &gst_xml_model_add ($branch, "", $option_default);
+ &gst_xml_model_set_attribute ($option, "TYPE", "LIST");
+ }
+
+ # Set the option attributes.
+
+ my $node = &gst_xml_model_ensure ($option, "name");
+ &gst_xml_model_set_attribute ($node, "TYPE", "STRING");
+ &gst_xml_model_set_attribute ($node, "VALUE", $name);
+
+ $node = &gst_xml_model_ensure ($option, "type");
+ &gst_xml_model_set_attribute ($node, "TYPE", "STRING");
+ &gst_xml_model_set_attribute ($node, "VALUE", $type);
+
+ $node = &gst_xml_model_ensure ($option, "default");
+ &gst_xml_model_set_attribute ($node, "TYPE", "STRING");
+ &gst_xml_model_set_attribute ($node, "VALUE", $value);
+
+ return &gst_xml_model_save ($model, $file, $compressed);
+}
+
+sub gst_replace_fq_hostname
+{
+ my ($file, $hostname, $domain) = @_;
+
+ if ($domain eq undef)
+ {
+ return &gst_replace_line_first ($file, "$hostname");
+ }
+ else
+ {
+ return &gst_replace_line_first ($file, "$hostname.$domain");
+ }
+}
+
+sub gst_replace_rcinet1conf
+{
+ my ($file, $iface, $kw, $val) = @_;
+ my ($line);
+
+ $iface =~ s/eth//;
+ $line = "$kw\[$iface\]";
+
+ $val = "\"$val\"" if ($val ne undef);
+
+ return &gst_replace_split ($file, $line, "[ \t]*=[ \t]*", $val);
+}
+
+sub gst_replace_rcinet1conf_global
+{
+ my ($file, $kw, $val) = @_;
+
+ $val = "\"$val\"";
+
+ return &gst_replace_split ($file, $kw, "[ \t]*=[ \t]*", $val)
+}
+
+sub gst_replace_wireless_opts
+{
+ my ($file, $iface, $proc, $kw, $value) = @_;
+ my $ifaces = &$proc ();
+ my $found = 0;
+ my $search = 1;
+ my $buff;
+
+ foreach $i (@$ifaces)
+ {
+ $found = 1 if ($iface eq $i);
+ }
+
+ $buff = &gst_file_buffer_load ($file);
+
+ foreach $i (@$buff)
+ {
+ if (/^case/)
+ {
+ # we don't want to search inside the case
+ $search = 0;
+ }
+ elsif (/^esac/)
+ {
+ # we want to continue searching
+ $search = 1;
+ }
+ if ((/^[ \t]*$kw/) && ($search))
+ {
+ $_ = "$kw=\"$value\"";
+ $found = 1;
+ }
+ }
+
+ if (!$found)
+ {
+ push @$buff, "$kw=\"$value\"";
+ }
+
+ &gst_file_buffer_clean ($buff);
+ return &gst_file_buffer_save ($buff, $file);
+}
+
+# Functions for replacing in FreeBSD's /etc/ppp/ppp.conf
+sub gst_replace_pppconf_common
+{
+ my ($pppconf, $section, $key, $string) = @_;
+ my ($buff, $line_no, $end_line_no, $i, $found);
+
+ $buff = &gst_file_buffer_load ($pppconf);
+
+ $line_no = &gst_parse_pppconf_find_stanza ($buff, $section);
+
+ if ($line_no ne -1)
+ {
+ # The stanza exists
+ $line_no++;
+
+ $end_line_no = &gst_parse_pppconf_find_next_stanza ($buff, $line_no);
+ $end_line_no = scalar @$buff + 1 if ($end_line_no == -1);
+ $end_line_no--;
+
+ for ($i = $line_no; $i <= $end_line_no; $i++)
+ {
+ if ($$buff[$i] =~ /[ \t]+$key/)
+ {
+ if ($string ne undef)
+ {
+ $$buff[$i] = " $string\n";
+ $found = 1;
+ }
+ else
+ {
+ delete $$buff[$i];
+ }
+ }
+ }
+
+ if ($found != 1)
+ {
+ $$buff[$end_line_no] .= " $string\n" if ($string ne undef);
+ }
+ }
+ else
+ {
+ if ($string ne undef)
+ {
+ push @$buff, "$section:\n";
+ push @$buff, " $string\n";
+ }
+ }
+
+ &gst_file_buffer_clean ($buff);
+ return &gst_file_buffer_save ($buff, $pppconf);
+}
+
+sub gst_replace_pppconf
+{
+ my ($pppconf, $section, $key, $value) = @_;
+ &gst_replace_pppconf_common ($pppconf, $section, $key, "set $key $value");
+}
+
+sub gst_replace_pppconf_bool
+{
+ my ($pppconf, $section, $key, $value) = @_;
+ &gst_replace_pppconf_common ($pppconf, $section, $key,
+ ($value == 1)? "enable $key" : "disable $key");
+}
+
+sub gst_replace_confd_net_re
+{
+ my ($file, $key, $re, $value) = @_;
+ my ($str, $contents, $i, $found, $done);
+
+ $found = $done = 0;
+ $contents = &gst_file_buffer_load ($file);
+
+ for ($i = 0; $i <= scalar (@$contents); $i++)
+ {
+ # search for key
+ if ($$contents[$i] =~ /^$key[ \t]*=[ \t]*\(/)
+ {
+ $found = 1;
+
+ do {
+ if ($$contents[$i] =~ /\"([^\"]*)\"/)
+ {
+ $str = $1;
+
+ if ($str =~ /$re/)
+ {
+ $str =~ s/$re/$value/;
+ }
+ else
+ {
+ $str .= $value;
+ }
+
+ $$contents[$i] =~ s/\"([^\"]*)\"/\"$str\"/;
+ $done = 1;
+ }
+
+ $i++;
+ } while (!$done);
+ }
+ }
+
+ if (!$found)
+ {
+ push @$contents, "$key=(\"$value\")\n";
+ }
+
+ return &gst_file_buffer_save ($contents, $file);
+}
+
+sub gst_replace_confd_net
+{
+ my ($file, $key, $value) = @_;
+
+ return &gst_replace_confd_net_re ($file, $key, ".*", $value);
+}
diff --git a/knetwortdeconf/backends/report.pl.in b/knetwortdeconf/backends/report.pl.in
new file mode 100644
index 0000000..68326dd
--- /dev/null
+++ b/knetwortdeconf/backends/report.pl.in
@@ -0,0 +1,366 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# /* Functions for on-the-fly commentary on a tool's work. */
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/general.pl$DOTIN";
+
+# --- Progress printing --- #
+
+
+$gst_progress_current = 0; # Compat with old $progress_max use.
+$gst_progress_last_percentage = 0;
+
+
+sub gst_progress
+{
+ my $prc = $_[0];
+
+ # /* Don't go backwards. */
+ $prc = $gst_progress_last_percentage if ($prc < $gst_progress_last_percentage);
+
+ # /* Don't go above 99%. */
+ $prc = 99 if ($prc >= 100);
+
+ if ($gst_progress && (int $prc > int $gst_progress_last_percentage))
+ {
+ &gst_report ("progress", $prc);
+ $gst_progress_last_percentage = $prc;
+ }
+}
+
+
+sub gst_progress_begin
+{
+ &gst_progress (0);
+}
+
+
+sub gst_progress_end
+{
+ &gst_progress (99);
+}
+
+
+sub gst_print_progress # Compat with old $progress_max use.
+{
+ my $prc;
+
+ $gst_progress_current++;
+ &gst_progress (($gst_progress_current * 100) / $progress_max);
+}
+
+
+# --- Report printing --- #
+
+
+sub gst_report_begin
+{
+ my ($tool) = @_;
+
+ &gst_report ("begin");
+ &gst_report_enter ();
+ &gst_progress_begin ();
+}
+
+
+sub gst_report_end
+{
+ &gst_progress_end ();
+ &gst_report_leave ();
+ &gst_report ("end");
+}
+
+
+sub gst_report_set_threshold
+{
+ $gst_report_threshold = $_[0];
+}
+
+
+sub gst_report_enter
+{
+ # This has been trivialized because it is not working
+ # correctly at the moment and is causing some trouble.
+ # /* We'll probably replace this with something smarter */
+ # (like a detail-level value in the report hash)
+ # when the report strings are used at the gui-level again.
+# $gst_report_level ++;
+ $gst_report_level = 0;
+}
+
+
+sub gst_report_leave
+{
+# $gst_report_level --;
+ $gst_report_level = 0;
+}
+
+
+# Escapes a report using the report line format.
+sub gst_report_escape
+{
+ my ($args) = @_;
+ my ($arg);
+
+ foreach $arg (@$args)
+ {
+ $arg =~ s/\\/\\\\/g;
+ $arg =~ s/::/\\::/g;
+ }
+}
+
+
+$gst_report_level = 0;
+$gst_report_started = 0;
+
+# Just to trap these errors with the debugger easily.
+sub gst_report_stderr
+{
+ my ($major, $key, $res) = @_;
+
+ print STDERR "$gst_name - $major::${key}::$res";
+}
+
+sub gst_report
+{
+ my (@args) = @_;
+ my ($key, $major, $minor, $str, $format, $res);
+ my $report_message = &gst_report_table ();
+
+ &gst_report_escape (\@args);
+
+ $key = shift @args;
+
+ if (! (exists $$report_message{$key}))
+ {
+ &gst_report ("report_minor_unk", $key);
+ return;
+ }
+
+ ($major, $str) = @{$$report_message{$key}};
+
+ if (! (exists $gst_report_valid_majors{$major}))
+ {
+ &gst_report ("report_major_unk", $major, join ("::", $key, @args));
+ return;
+ }
+
+ $gst_report_started = 1 if !$gst_report_started && $key eq "begin" && $major eq "sys";
+
+ # Verbose (--verbose) output is human-readable only.
+ $format = "$str\n";
+ $res = sprintf ($format, @args);
+
+ if ($gst_do_verbose ||
+ $major eq "error" ||
+ $major eq "debug")
+ {
+ &gst_report_stderr ($major, $key, $res);
+ }
+
+ if ($key ne "progress")
+ {
+ return if ($gst_report_level >= $gst_report_threshold || !$gst_report_started);
+ }
+
+ # Report (--report) output is machine-readable.
+ if ($gst_do_report)
+ {
+ print STDOUT join ("::", $major, $key, $str, @args) . "\n";
+ }
+
+ &gst_debug_print_indented_string ($gst_report_level, "report $major:$key: $res");
+}
+
+# Internal
+{
+ my $report_table = \%gst_report_message;
+ sub gst_report_table
+ {
+ my $table = shift @_;
+
+ if ($table) # Add
+ {
+ foreach my $key (keys %$table)
+ {
+ $$report_table{$key} = $$table{$key} unless exists $$report_table{$key};
+ }
+ }
+
+ else # Get
+ {
+ return $report_table;
+ }
+ }
+}
+
+# This disables reporting.
+&gst_report_set_threshold (0);
+
+%gst_report_valid_majors = (
+ "sys" => 1,
+ "error" => 1,
+ "warn" => 1,
+ "info" => 1,
+ "debug" => 1
+ );
+
+%gst_report_message =
+ (
+ "begin" => ["sys", "Start of work report."],
+ "end" => ["sys", "End of work report."],
+ "progress" => ["sys", "%d"],
+ "compat" => ["info", "%s."],
+
+ "report_major_unk" => ["error", "Unknown major [%s] in report [%s]."],
+ "report_minor_unk" => ["error", "Unknown minor [%s]."],
+
+ "directive_run" => ["info", "Running directive [%s] with args [%s]."],
+ "directive_unsup" => ["error", "Directive [%s] not supported."],
+ "directive_invalid" => ["error", "Directive [%s] structure has wrong format."],
+ "directive_badargs" => ["error", "Directive [%s] requires exactly [%s] args in [%s]."],
+ "directive_lowargs" => ["error", "Directive [%s] requires at least [%s] args in [%s]."],
+
+ "platform_unsup" => ["error", "Your platform [%s] is not supported."],
+ "platform_undet" => ["error", "Unable to determine host platform."],
+ "platform_success" => ["sys", "Configuring for platform [%s] (%s)."],
+ "platform_no_table" => ["error", "No parse/replace table for platform [%s]."],
+
+ "xml_unexp_tag" => ["error", "Unexpected tag [%s]."],
+ "xml_unexp_arg" => ["error", "Unexpected argument [%s] to tag [%s]."],
+
+ "file_copy_failed" => ["debug", "Could not copy file [%s] to [%s]."],
+ "file_open_read_failed" => ["warn", "Could not open [%s] for reading."],
+ "file_open_read_success" => ["info", "Reading options from [%s]."],
+ "file_open_write_failed" => ["error", "Failed to write to [%s]."],
+ "file_open_write_create" => ["warn", "Could not find [%s] for writing. Creating [%s]."],
+ "file_open_write_success" => ["info", "Writing to [%s]."],
+ "file_run_pipe_failed" => ["warn", "Failed to pipe command [%s] for reading."],
+ "file_run_pipe_success" => ["info", "Piping command [%s] for reading."],
+ "file_run" => ["info", "Running command [%s]."],
+ "file_create_path" => ["info", "Directory [%s] created."],
+ "file_backup_rotate" => ["info", "Backup directory [%s] was rotated."],
+ "file_backup_success" => ["info", "Saved backup for [%s]."],
+ "file_open_filter_failed" => ["warn", "No file to patch: [%s]."],
+ "file_open_filter_create" => ["warn", "Could not find [%s] for patching. Creating [%s]."],
+ "file_open_filter_success" => ["info", "Found [%s]. Patching [%s]."],
+ "file_buffer_load" => ["info", "Loading file [%s] to buffer."],
+ "file_buffer_save" => ["info", "Saving buffer to file [%s]."],
+ "file_remove" => ["info", "Removing file [%s]."],
+ "file_locate_tool_success" => ["info", "Found tool [%s]."],
+ "file_locate_tool_failed" => ["warn", "Couldn't find tool [%s]."],
+
+ "parse_table" => ["info", "Parsing option [%s]."],
+ "parse_trivial" => ["info", "Trivialy passing [%s]."],
+ "parse_split" => ["info", "Getting option [%s] from [%s]."],
+ "parse_split_hash" => ["info", "Getting configuration from [%s]."],
+ "parse_split_hash_cont" => ["info", "Getting configuration from [%s]."],
+ "parse_sh" => ["info", "Getting shell option [%s] from [%s]."],
+ "parse_kw" => ["info", "Getting keyword [%s] from [%s]."],
+ "parse_line_first" => ["info", "Getting information from [%s]."],
+ "parse_chat" => ["info", "Getting chat information from [%s]."],
+ "parse_ini" => ["info", "Getting option [%s] from [%s], section [%s]."],
+ "parse_ifaces_str" => ["info", "Getting option [%s] from interface [%s]."],
+ "parse_ifaces_kw" => ["info", "Getting keyword [%s] from interface [%s]."],
+ "parse_ifaces_kw_strange" => ["warn", "Keyword for interface [%s] in [%s] had unexpected value."],
+
+ "replace_split" => ["info", "Replacing key [%s] in [%s]."],
+ "replace_sh" => ["info", "Replacing shell var [%s] in [%s]."],
+ "replace_kw" => ["info", "Replacing keyword [%s] in [%s]."],
+ "replace_line_first" => ["info", "Replacing contents of file [%s]."],
+ "replace_chat" => ["info", "Replacing values in [%s]."],
+ "replace_ini" => ["info", "Replacing variable [%s] in section [%s] of [%s]."],
+ "replace_del_ini_sect" => ["info", "Removing section [%s] from [%s]."],
+ "replace_ifaces_str" => ["info", "Replacing option [%s] from interface [%s]."],
+ "replace_ifaces_kw" => ["info", "Replacing keyword [%s] from interface [%s]."],
+
+ "service_status_running" => ["info", "Service [%s] is running."],
+ "service_status_stopped" => ["info", "Service [%s] is stopped."],
+ "service_sysv_unsupported" => ["info", "No SystemV support for platform [%s]."],
+ "service_sysv_not_found" => ["warn", "Could not find SystemV scripts for service [%s]."],
+ "service_sysv_no_runlevel" => ["warn", "Could not find SystemV runlevel [%s] directory [%s]."],
+ "service_sysv_remove_link" => ["info", "Removed SystemV link [%s]."],
+ "service_sysv_add_link" => ["info", "Created SystemV link [%s]."],
+ "service_sysv_op_unk" => ["error", "Unknown initd operation [%s]."],
+ "service_sysv_op_success" => ["info", "Service [%s] %s."],
+ "service_sysv_op_failed" => ["warn", "Service [%s] could not be %s."],
+
+ "network_dialing_get" => ["info", "Loading ISP configurations."],
+ "network_iface_active_get" => ["info", "Finding active interfaces."],
+ "network_iface_is_active" => ["info", "Checking if interface [%s] is active."],
+ "network_hostname_set" => ["info", "Setting hostname to [%s]."],
+ "network_dialing_set" => ["info", "Saving ISP configurations."],
+ "network_remove_pap" => ["info", "Removing entry [%s] from [%s]."],
+ "network_iface_set" => ["info", "Configuring interface [%s]."],
+ "network_iface_activate" => ["info", "Activating interface [%s]."],
+ "network_iface_deactivate" => ["info", "Deactivating interface [%s]."],
+ "network_ifaces_set" => ["info", "Setting up interfaces."],
+ "network_get_pap_passwd" => ["info", "Getting PAP/CHAP password for [%s] from [%s]."],
+ "network_get_ppp_option" => ["info", "Getting option [%s] from [%s]."],
+ "network_set_ppp_option" => ["info", "Setting option [%s] in [%s]."],
+ "network_set_ppp_connect" => ["info", "Setting connect option in [%s]."],
+ "network_get_ppp_unsup" => ["info", "Getting additional options from [%s]."],
+ "network_set_ppp_unsup" => ["info", "Setting additional options in [%s]."],
+ "network_bootproto_unsup" => ["warn", "Boot method [%s] for interface [%s] not supported."],
+ "network_get_remote" => ["info", "Getting remote address for interface [%s]."],
+ "network_set_remote" => ["info", "Setting remote address for interface [%s]."],
+ "network_ensure_lo" => ["info", "Ensuring loopback interface configuration."],
+
+ "filesys_mount" => ["info", "Mounting [%s] on [%s]."],
+ "filesys_mount_failed" => ["warn", "Failed to mount [%s] on [%s]."],
+ "filesys_unmount" => ["info", "Unmounting [%s] from [%s]."],
+ "filesys_unmount_failed" => ["warn", "Failed to unmount [%s] from [%s]."],
+
+ "boot_lilo_failed" => ["warn", "Failed to run lilo."],
+ "boot_lilo_success" => ["info", "Succesfully executed lilo."],
+ "boot_conf_read_failed" => ["error", "Failed to open boot configuration file [%s]."],
+ "boot_grub_convert_failed" => ["error", "Conversion of [%s] failed."],
+
+ "sfdisk_failed" => ["error", "Could not run sfdisk."],
+
+ "disks_fstab_add" => ["info", "Adding [%s] to fstab."],
+ "disks_partition_probe" => ["info", "Looking for partitions on [%s]."],
+ "disks_size_query" => ["info", "Querying size of [%s]."],
+ "disks_mount" => ["info", "Mounting [%s]."],
+ "disks_umount" => ["info", "Unmounting [%s]."],
+ "disks_mount_error" => ["error", "Could not find mount tools. No mounting done."],
+
+ "memory_swap_found" => ["info", "Found swap entry [%s]."],
+ "memory_swap_probe" => ["info", "Looking for swap entries."],
+
+ "print_no_printtool" => ["warn", "No printtool setup in directory [%s]."],
+
+ "time_timezone_scan" => ["info", "Scanning timezones."],
+ "time_timezone_cmp" => ["info", "Scanning timezones: [%s]."],
+ "time_timezone_set" => ["info", "Setting timezone as [%s]."],
+ "time_localtime_set" => ["info", "Setting local time as [%s]."]
+ );
+
+1;
diff --git a/knetwortdeconf/backends/service-list.pl.in b/knetwortdeconf/backends/service-list.pl.in
new file mode 100644
index 0000000..3b7f2a1
--- /dev/null
+++ b/knetwortdeconf/backends/service-list.pl.in
@@ -0,0 +1,337 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Functions for getting service descriptions.
+#
+# Copyright (C) 2002 Ximian, Inc.
+#
+# Authors: Carlos Garnacho Parro <garnacho@tuxerver.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+# This function determines if a service is "forbidden" or not (if runlevel-admin must show it or not)
+sub gst_service_list_service_is_forbidden
+{
+ my ($service) = @_;
+ my ($ret);
+
+ my ($service_forbidden_list) =
+ [
+ # These are the forbidden services I found in Red Hat
+ "halt",
+ "functions",
+ "killall",
+ # These are the forbidden services I found in Debian Woody
+ "single",
+ "sendsigs",
+ "reboot",
+ "rcS",
+ "modutils",
+ "hostname\.sh",
+ "devpts\.sh",
+ "console-screen\.sh",
+ "checkroot\.sh",
+ "checkfs\.sh",
+ "bootmisc\.sh",
+ "bootclean\.sh",
+ "checkfs\.sh",
+ "keymap\.sh",
+ "hwclockfirst\.sh",
+ "etc-setserial",
+ "procps\.sh",
+ "mountall\.sh",
+ "dns-clean",
+ "ifupdown",
+ "networking",
+ "mountnfs\.sh",
+ "mountkernfs",
+ "mountvirtfs",
+ "setserial",
+ "hwclock\.sh",
+ "urandom",
+ "nviboot",
+ "pppd-dns",
+ "skeleton",
+ "xfree86-common",
+ "rc",
+ ".*\.dpkg-old",
+ ".*~",
+ # this shouldn't be shown in slackware
+ "inet2",
+ # those were found in gentoo
+ "bootmisc",
+ "checkfs",
+ "checkroot",
+ "clock",
+ "consolefont",
+ "crypto-loop",
+ "domainname",
+ "hostname",
+ "keymaps",
+ "localmount",
+ "net\..*",
+ "numlock",
+ "depscan\.sh",
+ "functions\.sh",
+ "halt\.sh",
+ "reboot\.sh",
+ "rmnologin",
+ "runscript\.sh",
+ "serial",
+ "shutdown\.sh",
+ "switch",
+ # those were found in FreeBSD
+ "DAEMON",
+ "LOGIN",
+ "NETWORKING",
+ "SERVERS",
+ "addswap",
+ "adjkerntz",
+ "archdep",
+ "atm2\.sh",
+ "atm3\.sh",
+ "ccd",
+ "cleanvar",
+ "devdb",
+ "devfs",
+ "dhclient",
+ "diskless",
+ "dumpon",
+ "fsck",
+ "hostname",
+ "initdiskless",
+ "initrandom",
+ "ldconfig",
+ "local",
+ "localdaemons",
+ "mountcritlocal",
+ "mountcritremote",
+ "msgs",
+ "netif",
+ "network1",
+ "network2",
+ "network3",
+ "nisdomain",
+ "othermta",
+ "pccard",
+ "pcvt",
+ "pwcheck",
+ "random",
+ "rcconf\.sh",
+ "root",
+ "savecore",
+ "securelevel",
+ "serial",
+ "sppp",
+ "swap1",
+ "syscons",
+ "sysctl",
+ "ttys",
+ "virecover",
+ # These are the services found in SuSE
+ "rc[sS0-9]\.d",
+ "boot",
+ "boot\..*",
+ ];
+
+ foreach $i (@$service_forbidden_list)
+ {
+ return 1 if ($service =~ "^$i\$");
+ }
+
+ return undef;
+}
+
+
+# Ok, maybe we should define this roles stuff a bit:
+#
+# SYSTEM: all system related services that only powerusers care of
+# SOUND: any service related to sound
+# WEB_SERVER: any web server
+# COMMAND_SCHEDULER: any service which runs scheduled commands
+# NETWORK: network related services that only powerusers care of
+# PRINTER_SERVICE: printing daemons in general
+# DYNAMIC_DNS: Dinamic DNS services
+# DICT:
+# MTA: Mail transport agents
+# MAIL_FETCHER: services that fetch the mail from other accounts
+# DISPLAY_MANAGER: Display managers
+# SYSTEM_LOGGER: system log services
+# DATABASE_SERVER: database servers
+# FILE_SERVER: file servers
+# NTP_SERVER: Network time protocol servers
+# SECURE_SHELL_SERVER: Secure shell servers
+# AUTOMOUNTER: automounter daemons and so
+# ANTIVIRUS:
+# FILE_SHARING: for emule-like services
+# FTP_SERVER:
+#
+#
+# If you feel that there are more important/necessary roles,
+# mail me at carlosg@gnome.org
+
+sub gst_service_get_role
+{
+ my ($script) = @_;
+
+ my %service_roles = (
+ "acpid" => "SYSTEM",
+ "alsa" => "SOUND",
+ "am-utils" => "AUTOMOUNTER",
+ "amavis" => "ANTIVIRUS",
+ "amavis-ng" => "ANTIVIRUS",
+ "apache" => "WEB_SERVER",
+ "apache-perl" => "WEB_SERVER",
+ "apache-ssl" => "WEB_SERVER",
+ "apache2" => "WEB_SERVER",
+ "anacron" => "COMMAND_SCHEDULER",
+ "apmd" => "SYSTEM",
+ "atd" => "COMMAND_SCHEDULER", #FIXME
+ "atftpd" => "FTP_SERVER",
+ "aumix" => "SOUND",
+ "autofs" => "AUTOMOUNTER",
+ "bind" => "NETWORK",
+ "binfmt-support" => "SYSTEM",
+ "bootlogd" => "SYSTEM",
+ "chargen" => "NETWORK",
+ "chargen-udp" => "NETWORK",
+ "cherokee" => "WEB_SERVER",
+ "clamav-daemon" => "ANTIVIRUS",
+ "courier" => "MTA",
+ "courier-mta" => "MTA",
+ "cpufreqd" => "SYSTEM",
+ "cron" => "COMMAND_SCHEDULER",
+ "crond" => "COMMAND_SCHEDULER",
+ "cupsd" => "PRINTER_SERVICE",
+ "cups" => "PRINTER_SERVICE",
+ "cupsys" => "PRINTER_SERVICE",
+ "daytime" => "NETWORK",
+ "daytime-udp" => "NETWORK",
+ "dbus-1" => "SYSTEM",
+ "ddclient" => "DYNAMIC_DNS",
+ "dhis-client" => "DYNAMIC_DNS",
+ "dictd" => "DICT",
+ "echo" => "NETWORK",
+ "echo-udp" => "NETWORK",
+ "esound" => "SOUND",
+ "exim" => "MTA",
+ "fam" => "SYSTEM",
+ "fcron" => "COMMAND_SCHEDULER",
+ "firstboot" => "SYSTEM",
+ "festival" => "SOUND", #FIXME
+ "fetchmail" => "MAIL_FETCHER",
+ "freenet6" => "NETWORK",
+ "ftpd" => "FTP_SERVER",
+ "gdm" => "DISPLAY_MANAGER",
+ "gpm" => "SYSTEM", #FIXME
+ "hdparm" => "SYSTEM",
+ "hotplug" => "SYSTEM",
+ "httpd" => "WEB_SERVER",
+ "inetd" => "NETWORK",
+ "iptables" => "NETWORK",
+ "irda" => "SYSTEM",
+ "isakmpd" => "NETWORK",
+ "isdn" => "NETWORK",
+ "joystick" => "SYSTEM",
+ "tdm" => "DISPLAY_MANAGER",
+ "keytable" => "SYSTEM",
+ "klogd" => "SYSTEM_LOGGER",
+ "kudzu" => "SYSTEM",
+ "lircd" => "SYSTEM",
+ "lircmd" => "SYSTEM",
+ "local" => "SYSTEM",
+ "lpd" => "PRINTER_SERVICE",
+ "lpdng" => "PRINTER_SERVICE",
+ "mailscanner" => "ANTIVIRUS",
+ "makedev" => "SYSTEM",
+ "metalog" => "SYSTEM_LOGGER",
+ "mldonkey-server" => "FILE_SHARING",
+ "modules" => "SYSTEM",
+ "module-init-tools" => "SYSTEM",
+ "mysql" => "DATABASE_SERVER",
+ "muddleftpd" => "FTP_SERVER",
+ "named" => "NETWORK",
+ "netfs" => "SYSTEM",
+ "network" => "SYSTEM",
+ "nfs" => "FILE_SERVER",
+ "nfs-user-server" => "FILE_SERVER",
+ "nfs-kernel-server" => "FILE_SERVER",
+ "nfslock" => "SYSTEM",
+ "nscd" => "NETWORK",
+ "ntpd" => "NTP_SERVER",
+ "ntpdate" => "NTP_SERVER",
+ "ntp-client" => "NTP_CLIENT",
+ "ntp-simple" => "NTP_SERVER",
+ "oftpd" => "FTP_SERVER",
+ "oops" => "NETWORK",
+ "pcmcia" => "SYSTEM",
+ "pdnsd" => "NETWORK",
+ "pipsecd" => "NETWORK",
+ "portmap" => "NETWORK",
+ "postfix" => "MTA",
+ "postgresql" => "DATABASE_SERVER",
+ "postgresql-7.4" => "DATABASE_SERVER",
+ "postgresql-8.0" => "DATABASE_SERVER",
+ "ppp" => "NETWORK",
+ "proftpd" => "FTP_SERVER",
+ "privoxy" => "NETWORK",
+ "pure-ftpd" => "FTP_SERVER",
+ "qmail" => "MTA",
+ "random" => "SYSTEM",
+ "rawdevices" => "SYSTEM",
+ "rhnsd" => "SYSTEM",
+ "rsync" => "NETWORK",
+ "rsyncd" => "NETWORK",
+ "samba" => "FILE_SERVER",
+ "saslauthd" => "SYSTEM", # FIXME: maybe a SECURITY role makes sense?
+ "sendmail" => "MTA",
+ "servers" => "NETWORK",
+ "services" => "NETWORK",
+ "setserial" => "SYSTEM",
+ "sgi_fam" => "SYSTEM",
+ "smartmontools" => "SYSTEM",
+ "spamassassin" => "SYSTEM",
+ "snmpd" => "NETWORK",
+ "ssh" => "SECURE_SHELL_SERVER",
+ "sshd" => "SECURE_SHELL_SERVER",
+ "sysklogd" => "SYSTEM_LOGGER",
+ "syslog" => "SYSTEM_LOGGER",
+ "tftpd-hpa" => "FTP_SERVER",
+ "time" => "NETWORK",
+ "time-udp" => "NETWORK",
+ "urandom" => "SYSTEM",
+ "vcron" => "COMMAND_SCHEDULER",
+ "vmware" => "SYSTEM", # FIXME
+ "vsftpd" => "FTP_SERVER",
+ "wdm" => "DISPLAY_MANAGER",
+ "webmin" => "SYSTEM", # FIXME as well
+ "winbind" => "NETWORK",
+ "wine" => "SYSTEM", # FIXME like vmware
+ "wu-ftpd" => "FTP_SERVER",
+ "wzdftpd" => "FTP_SERVER",
+ "xdm" => "DISPLAY_MANAGER",
+ "xfs" => "SYSTEM",
+ "xinetd" => "NETWORK",
+ "zmailer" => "MTA",
+ );
+
+ my ($role) = $service_roles{$script};
+
+ return $role if ($role);
+ return "UNKNOWN";
+}
+
+1;
diff --git a/knetwortdeconf/backends/service.pl.in b/knetwortdeconf/backends/service.pl.in
new file mode 100644
index 0000000..08caca7
--- /dev/null
+++ b/knetwortdeconf/backends/service.pl.in
@@ -0,0 +1,2153 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Functions for manipulating system services, like daemons and network.
+#
+# Copyright (C) 2002 Ximian, Inc.
+#
+# Authors: Carlos Garnacho Parro <garparr@teleline.es>,
+# Hans Petter Jansson <hpj@ximian.com>,
+# Arturo Espinosa <arturo@ximian.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+$rcd_path;
+$initd_path;
+$relative_path;
+
+$SCRIPTSDIR = "@scriptsdir@";
+$FILESDIR = "@filesdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $FILESDIR = "files";
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+use File::Copy;
+
+require "$SCRIPTSDIR/file.pl$DOTIN";
+require "$SCRIPTSDIR/report.pl$DOTIN";
+require "$SCRIPTSDIR/service-list.pl$DOTIN";
+
+# Where is the SysV subsystem installed?
+sub gst_service_sysv_get_paths
+{
+ my %dist_map =
+ (
+ # gst_dist => [rc.X dirs location, init.d scripts location, relative path location]
+ "redhat-5.2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-6.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-6.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-6.2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-7.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-7.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-7.2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-7.3" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-8.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "redhat-9" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "openna-1.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "rhel-5" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "rhel-6" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "mandrake-7.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandrake-7.2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandrake-9.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandrake-9.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandrake-9.2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandrake-10.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandrake-10.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandrake-10.2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandriva-2006.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandriva-2006.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandriva-2007.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "mandriva-2007.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "yoper-2.2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "blackpanther-4.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "conectiva-9" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "conectiva-10" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "debian-2.2" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "debian-3.0" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "debian-3.1" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "debian-4.0" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "debian-5.0" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "debian-testing" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "ubuntu-5.04" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "ubuntu-5.10" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "ubuntu-6.06" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "ubuntu-6.10" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "ubuntu-7.04" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "ubuntu-7.10" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+ "ubuntu-8.04" => ["$gst_prefix/etc", "$gst_prefix/etc/init.d", "../init.d"],
+
+ "suse-7.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d", "../"],
+ "suse-9.0" => ["$gst_prefix/etc/init.d", "$gst_prefix/etc/init.d", "../"],
+ "suse-9.1" => ["$gst_prefix/etc/init.d", "$gst_prefix/etc/init.d", "../"],
+
+ "turbolinux-7.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "pld-1.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "pld-1.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "pld-1.99" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "fedora-1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "fedora-2" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "fedora-3" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "fedora-4" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "fedora-5" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "rpath" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "fedora-15" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "fedora-16" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "fedora-17" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+
+ "vine-3.0" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "vine-3.1" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ "ark" => ["$gst_prefix/etc/rc.d", "$gst_prefix/etc/rc.d/init.d", "../init.d"],
+ );
+ my $res;
+
+ $res = $dist_map{$gst_dist};
+ &gst_report ("service_sysv_unsupported", $gst_dist) if ($res eq undef);
+ return @$res;
+}
+
+# Those runlevels that are usually used. Maybe we should add
+# the current running runlevel, using the "runlevel" command.
+sub gst_service_sysv_get_runlevels
+{
+ my %dist_map =
+ (
+ "redhat-5.2" => [3, 5],
+ "redhat-6.0" => [3, 5],
+ "redhat-6.1" => [3, 5],
+ "redhat-6.2" => [3, 5],
+ "redhat-7.0" => [3, 5],
+ "redhat-7.1" => [3, 5],
+ "redhat-7.2" => [3, 5],
+ "redhat-7.3" => [3, 5],
+ "redhat-8.0" => [3, 5],
+ "redhat-9" => [3, 5],
+ "openna-1.0" => [3, 5],
+
+ "rhel-5" => [3, 5],
+ "rhel-6" => [3, 5],
+
+ "mandrake-7.1" => [3, 5],
+ "mandrake-7.2" => [3, 5],
+ "mandrake-9.0" => [3, 5],
+ "mandrake-9.1" => [3, 5],
+ "mandrake-9.2" => [3, 5],
+ "mandrake-10.0" => [3, 5],
+ "mandrake-10.1" => [3, 5],
+ "mandrake-10.2" => [3, 5],
+ "mandriva-2006.0" => [3, 5],
+ "mandriva-2006.1" => [3, 5],
+ "mandriva-2007.0" => [3, 5],
+ "mandriva-2007.1" => [3, 5],
+
+ "yoper-2.2" => [3, 5],
+
+ "blackpanther-4.0" => [3, 5],
+
+ "conectiva-9" => [3, 5],
+ "conectiva-10" => [3, 5],
+
+ "debian-2.2" => [2, 3],
+ "debian-3.0" => [2, 3],
+ "debian-3.1" => [2, 3],
+ "debian-4.0" => [2, 3],
+ "debian-5.0" => [2, 3],
+ "debian-testing" => [2, 3],
+ "ubuntu-5.04" => [2, 3],
+ "ubuntu-5.10" => [2, 3],
+ "ubuntu-6.06" => [2, 3],
+ "ubuntu-6.10" => [2, 3],
+ "ubuntu-7.04" => [2, 3],
+ "ubuntu-7.10" => [2, 3],
+ "ubuntu-8.04" => [2, 3],
+
+ "suse-7.0" => [3, 5],
+ "suse-9.0" => [3, 5],
+ "suse-9.1" => [3, 5],
+
+ "turbolinux-7.0" => [3, 5],
+
+ "pld-1.0" => [3, 5],
+ "pld-1.1" => [3, 5],
+ "pld-1.99" => [3, 5],
+
+ "fedora-1" => [3, 5],
+ "fedora-2" => [3, 5],
+ "fedora-3" => [3, 5],
+ "fedora-4" => [3, 5],
+ "fedora-5" => [3, 5],
+ "rpath" => [3, 5],
+
+ "fedora-15" => [3, 5],
+ "fedora-16" => [3, 5],
+ "fedora-17" => [3, 5],
+
+ "vine-3.0" => [3, 5],
+ "vine-3.1" => [3, 5],
+ "ark" => [3, 5],
+ );
+ my $res;
+
+ $res = $dist_map{$gst_dist};
+ &gst_report ("service_sysv_unsupported", $gst_dist) if ($res eq undef);
+ return @$res;
+}
+
+sub gst_service_get_runlevel_roles
+{
+ my (%dist_map, %runlevels, $desc, $distro);
+ %dist_map =
+ (
+ "redhat-5.2" => "redhat-5.2",
+ "redhat-6.0" => "redhat-5.2",
+ "redhat-6.1" => "redhat-5.2",
+ "redhat-6.2" => "redhat-5.2",
+ "redhat-7.0" => "redhat-5.2",
+ "redhat-7.1" => "redhat-5.2",
+ "redhat-7.2" => "redhat-5.2",
+ "redhat-7.3" => "redhat-5.2",
+ "redhat-8.0" => "redhat-5.2",
+ "redhat-9" => "redhat-5.2",
+ "openna-1.0" => "redhat-5.2",
+
+ "rhel-5" => "redhat-5.2",
+ "rhel-6" => "redhat-5.2",
+
+ "mandrake-7.1" => "redhat-5.2",
+ "mandrake-7.2" => "redhat-5.2",
+ "mandrake-9.0" => "redhat-5.2",
+ "mandrake-9.1" => "redhat-5.2",
+ "mandrake-9.2" => "redhat-5.2",
+ "mandrake-10.0" => "redhat-5.2",
+ "mandrake-10.1" => "redhat-5.2",
+ "mandrake-10.2" => "redhat-5.2",
+ "mandriva-2006.0" => "redhat-5.2",
+ "mandriva-2006.1" => "redhat-5.2",
+ "mandriva-2007.0" => "redhat-5.2",
+ "mandriva-2007.1" => "redhat-5.2",
+
+ "yoper-2.2" => "redhat-5.2",
+
+ "blackpanther-4.0" => "redhat-5.2",
+
+ "conectiva-9" => "redhat-5.2",
+ "conectiva-10" => "redhat-5.2",
+
+ "debian-2.2" => "debian-2.2",
+ "debian-3.0" => "debian-2.2",
+ "debian-3.1" => "debian-2.2",
+ "debian-4.0" => "debian-2.2",
+ "debian-5.0" => "debian-2.2",
+ "debian-testing" => "debian-2.2",
+ "ubuntu-5.04" => "debian-2.2",
+ "ubuntu-5.10" => "debian-2.2",
+ "ubuntu-6.06" => "debian-2.2",
+ "ubuntu-6.10" => "debian-2.2",
+ "ubuntu-7.04" => "debian-2.2",
+ "ubuntu-7.10" => "debian-2.2",
+ "ubuntu-8.04" => "debian-2.2",
+
+ "suse-7.0" => "redhat-5.2",
+ "suse-9.0" => "redhat-5.2",
+ "suse-9.1" => "redhat-5.2",
+
+ "turbolinux-7.0" => "redhat-5.2",
+ "pld-1.0" => "redhat-5.2",
+ "pld-1.1" => "redhat-5.2",
+ "pld-1.99" => "redhat-5.2",
+ "fedora-1" => "redhat-5.2",
+ "fedora-2" => "redhat-5.2",
+ "fedora-3" => "redhat-5.2",
+ "fedora-4" => "redhat-5.2",
+ "fedora-5" => "redhat-5.2",
+ "rpath" => "redhat-5.2",
+
+ "fedora-15" => "redhat-5.2",
+ "fedora-16" => "redhat-5.2",
+ "fedora-17" => "redhat-5.2",
+
+ "vine-3.0" => "redhat-5.2",
+ "vine-3.1" => "redhat-5.2",
+ "ark" => "redhat-5.2",
+
+ "slackware-9.1.0" => "slackware-9.1.0",
+ "slackware-10.0.0" => "slackware-9.1.0",
+ "slackware-10.1.0" => "slackware-9.1.0",
+ "slackware-10.2.0" => "slackware-9.1.0",
+ "slackware-11.0.0" => "slackware-9.1.0",
+ "slackware-12.0.0" => "slackware-9.1.0",
+ "slackware-12.1.0" => "slackware-9.1.0",
+ "slackware-12.2.0" => "slackware-9.1.0",
+ "slackware-13.0.0" => "slackware-9.1.0",
+ "slackware-13.1.0" => "slackware-9.1.0",
+ "slackware-13.37.0" => "slackware-9.1.0",
+ "slackware-14.0.0" => "slackware-9.1.0",
+
+ "gentoo" => "gentoo",
+ "vlos-1.2" => "gentoo",
+
+ "archlinux" => "freebsd-5",
+ "freebsd-5" => "freebsd-5",
+ "freebsd-6" => "freebsd-5",
+ );
+
+ %runlevels=
+ (
+ "redhat-5.2" => {"0" => "HALT",
+ "1" => "RECOVER",
+ "2" => "NONE",
+ "3" => "TEXT",
+ "4" => "NONE",
+ "5" => "GRAPHICAL",
+ "6" => "REBOOT"
+ },
+ "debian-2.2" => {"0" => "HALT",
+ "1" => "RECOVER",
+ "2" => "NONE",
+ "3" => "NONE",
+ "4" => "NONE",
+ "5" => "NONE",
+ "6" => "REBOOT"
+ },
+ "gentoo" => {"boot" => "BOOT",
+ "default" => "GRAPHICAL",
+ "nonetwork" => "RECOVER"
+ },
+ "freebsd-5" => {"rc" => "GRAPHICAL" },
+ "slackware-9.1.0" => {"4" => "GRAPHICAL" }
+ );
+
+ $distro = $dist_map{$gst_dist};
+ $desc = $runlevels{$distro};
+
+ return $runlevels{$distro};
+}
+
+# --- Plain process utilities --- #
+
+# Get owners list (login) of named process.
+sub gst_service_proc_get_owners
+{
+ my ($service) = @_;
+ my ($user, $pid, $command);
+ my ($fd);
+ my (@arr);
+
+ &gst_report_enter ();
+
+ $fd = gst_file_run_pipe_read ("ps acx -o user,pid,command");
+
+ while (<$fd>)
+ {
+ /(.*)[ \t]+(.*)[ \t]+(.*)/;
+ $user = $1;
+ $pid = $2;
+ $command = $3;
+
+ push @arr, $user if ($command eq $service);
+ }
+
+ &gst_report_leave ();
+ return \@arr;
+}
+
+# Stops all instances of a process
+sub gst_service_proc_stop_all
+{
+ my ($service) = @_;
+
+ return &gst_file_run ("killall $service");
+}
+
+# Starts instances of a process for a given list of users
+sub gst_service_proc_start_all
+{
+ my ($cmd, $users) = @_;
+ my ($fqcmd, $fqsu);
+
+ $fqcmd = &gst_file_get_cmd_path ($cmd);
+ $fqsu = &gst_file_locate_tool ("su");
+
+ foreach $user (@$users)
+ {
+ # Can't use gst_file_run_bg here, since it clobbers the quotes.
+ system ("$fqsu $user -c \"$fqcmd &\" >/dev/null 2>/dev/null");
+ }
+}
+
+sub gst_service_sysv_list_dir
+{
+ my ($path) = @_;
+ my ($service, @services);
+
+ foreach $service (<$path/*>)
+ {
+ if (-x $service)
+ {
+ $service =~ s/.*\///;
+ push @services, $service;
+ }
+ }
+
+ return \@services;
+}
+
+sub gst_service_sysv_list_available
+{
+ my ($rcd_path, $initd_path);
+
+ ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+
+ return &gst_service_sysv_list_dir ($initd_path);
+}
+
+# Return 1 or 0: is the service running?
+# Depends on the rc script to support the "status" arg.
+# Maybe we should do something more portable.
+sub gst_service_sysv_get_status
+{
+ my ($service) = @_;
+ my ($rc_path, $initd_path, $res);
+ my ($pid);
+
+ &gst_report_enter ();
+
+ # Stolen from RedHat's /etc/rc.d/init.d/functions:status
+ # FIXME: portable to other UNIXES?
+ $pid = &gst_file_run_backtick ("pidof -o %PPID -x $service");
+ chomp $pid;
+
+ if ($pid)
+ {
+ $res = 1;
+ &gst_report ("service_status_running", $service);
+ }
+ else
+ {
+ $res = 0;
+ &gst_report ("service_status_stopped", $service);
+ }
+
+# ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+# $res = 0;
+#
+# if (-f "$initd_path/$service")
+# {
+# $res = &gst_file_run ("$initd_path/$service status")? 0 : 1;
+# &gst_report ("service_status_running", $service) if $res;
+# &gst_report ("service_status_stopped", $service) if !$res;
+# }
+
+ &gst_report_leave ();
+ return $res;
+}
+
+# If any of the passed services is running, return true.
+sub gst_service_sysv_get_status_any
+{
+ my (@services) = @_;
+ my $i;
+
+ foreach $i (@services)
+ {
+ return 1 if &gst_service_sysv_get_status ($i);
+ }
+
+ return 0;
+}
+
+# Set start links and remove stop links at the usual runlevels.
+# Old start link is removed, in case the priority is different from $pri.
+sub gst_service_sysv_set_links_active
+{
+ my ($pri, $service) = @_;
+
+ foreach $runlevel (&gst_service_sysv_get_runlevels ())
+ {
+ &gst_service_sysv_remove_link ($runlevel, $service);
+ &gst_service_sysv_add_link ($runlevel, "S", $pri, $service);
+ }
+}
+
+# Set stop links and remove start links at the usual runlevels.
+sub gst_service_sysv_set_links_inactive
+{
+ my ($pri, $service) = @_;
+
+ foreach $runlevel (&gst_service_sysv_get_runlevels ())
+ {
+ &gst_service_sysv_remove_link ($runlevel, "$service");
+ &gst_service_sysv_add_link ($runlevel, "K", $pri, $service);
+ }
+}
+
+# Set links for active/inactive service at the given priority.
+sub gst_service_sysv_set_links
+{
+ my ($pri, $service, $active) = @_;
+
+ if ($active)
+ {
+ &gst_service_sysv_set_links_active ($pri, $service);
+ }
+ else
+ {
+ &gst_service_sysv_set_links_inactive (100 - $pri, $service);
+ }
+}
+
+
+
+# Start or stop the service, depending on $active. Set
+# links accordingly. $force makes this function use
+# start/stop only, without considerations for restart.
+# Not to be called from parse/replace tables, due to last $force
+# param: use the following two functions instead.
+sub gst_service_sysv_set_status_do
+{
+ my ($priority, $service, $active, $force) = @_;
+ my ($arg, $status);
+
+ &gst_service_sysv_set_links ($priority, $service, $active);
+
+ $status = &gst_service_sysv_get_status ($service);
+ if ($status && !$force)
+ {
+ # if it's already active and you want it active, restart.
+ $arg = $active? "restart" : "stop";
+ }
+ else
+ {
+ # normal operation.
+ $arg = $active? "start" : "stop";
+ }
+
+ return &gst_service_sysv_run_initd_script ($service, $arg);
+}
+
+sub gst_service_sysv_set_status
+{
+ my ($priority, $service, $active) = @_;
+
+ return &gst_service_sysv_set_status_do ($priority, $service, $active, 0);
+}
+
+sub gst_service_sysv_force_status
+{
+ my ($priority, $service, $active) = @_;
+
+ return &gst_service_sysv_set_status_do ($priority, $service, $active, 1);
+}
+
+sub gst_service_sysv_install_script
+{
+ my ($service, $file) = @_;
+ my ($res, $rcd_path, $initd_path);
+
+ ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+
+ if (!copy ("$FILESDIR/$file", "$initd_path/$service"))
+ {
+ &gst_report ("file_copy_failed", "$FILESDIR/$file", "$initd_path/$service");
+ return -1;
+ }
+
+ chmod (0755, "$initd_path/$service");
+
+ return 0;
+}
+
+# THESE ARE THE FUNCTIONS WHICH EXTRACT THE CONFIGURATION FROM THE COMPUTER
+
+# we are going to extract the name of the script
+sub gst_service_sysv_get_service_name
+{
+ my ($service) = @_;
+
+ $service =~ s/$initd_path\///;
+
+ return $service;
+}
+
+# This function gets the state of the service along the runlevels,
+# it also returns the average priority
+sub gst_service_sysv_get_runlevels_status
+{
+ my ($service) = @_;
+ my ($link);
+ my ($runlevel, $action, $priority);
+ my (@arr, @ret);
+
+ foreach $link (<$rcd_path/rc[0-6].d/[SK][0-9][0-9]$service>)
+ {
+ $link =~ s/$rcd_path\///;
+ $link =~ /rc([0-6])\.d\/([SK])([0-9][0-9]).*/;
+ ($runlevel,$action,$priority)=($1,$2,$3);
+ if ($action eq "S")
+ {
+ push @arr, { "name" => $runlevel,
+ "priority" => $priority,
+ "action" => "start" };
+ }
+ elsif ($action eq "K")
+ {
+ push @arr, { "name" => $runlevel,
+ "priority" => (100 - $priority),
+ "action" => "stop" };
+ }
+ }
+
+ return undef if (scalar(@arr) eq 0);
+
+ push @ret, { "runlevel" => \@arr };
+ return \@ret;
+}
+
+# We are going to extract the information of the service
+sub gst_service_sysv_get_service_info
+{
+ my ($service) = @_;
+ my ($script, @actions, @runlevels);
+ my %hash, $role;
+
+ # Return if it's a directory
+ return undef if (-d $service);
+
+ # We have to check if the service is executable
+ return undef unless (-x $service);
+
+ $script = &gst_service_sysv_get_service_name ($service);
+
+ # We have to check out if the service is in the "forbidden" list
+ return undef if (&gst_service_list_service_is_forbidden ($script));
+
+ $runlevels = &gst_service_sysv_get_runlevels_status($script);
+
+ $hash{"script"} = $script;
+ $hash{"runlevels"} = $runlevels unless ($runlevels eq undef);
+ $hash{"role"} = &gst_service_get_role ($script);
+
+ return \%hash;
+}
+
+# This function gets an ordered array of the available services from a SysV system
+sub gst_service_sysv_get_services
+{
+ my ($service);
+ my (@arr,%ret);
+
+ ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+
+ foreach $service (<$initd_path/*>)
+ {
+ my (%hash);
+ $hash = &gst_service_sysv_get_service_info ($service);
+ if ($hash ne undef)
+ {
+ $ret{$service} = $hash;
+ }
+ }
+
+ return \%ret;
+}
+
+# This functions get an ordered array of the available services from a file-rc system
+sub gst_service_filerc_get_runlevels_status
+{
+ my ($start_service, $stop_service, $priority) = @_;
+ my (@arr, @ret);
+
+ # we start with the runlevels in which the service starts
+ if ($start_service !~ /-/) {
+ my (@runlevels);
+
+ @runlevels = split /,/, $start_service;
+
+ foreach $runlevel (@runlevels)
+ {
+ push @arr, { "name" => $runlevel,
+ "action" => "start",
+ "priority" => $priority};
+ }
+ }
+
+ # now let's go with the runlevels in which the service stops
+ if ($stop_service !~ /-/) {
+ my (@runlevels);
+
+ @runlevels = split /,/, $stop_service;
+
+ foreach $runlevel (@runlevels)
+ {
+ push @arr, { "name" => $runlevel,
+ "action" => "stop",
+ "priority" => $priority};
+ }
+ }
+
+ push @ret, {"runlevel" => \@arr};
+ return \@ret;
+}
+
+sub gst_service_filerc_get_service_info
+{
+ my ($line, %ret) = @_;
+ my %hash;
+ my @runlevels;
+
+ if ($line =~ /^([0-9][0-9])[\t ]+([0-9\-S,]+)[\t ]+([0-9\-S,]+)[\t ]+\/etc\/init\.d\/(.*)/)
+ {
+ $priority = $1;
+ $stop_service = $2;
+ $start_service = $3;
+ $script = $4;
+
+ return undef if (&gst_service_list_service_is_forbidden ($script));
+
+ $hash{"script"} = $script;
+
+ $hash{"runlevels"} = &gst_service_filerc_get_runlevels_status ($start_service, $stop_service, $priority);
+ $hash{"role"} = &gst_service_get_role ($script);
+
+ return (\%hash);
+ }
+
+ return undef;
+}
+
+sub gst_service_filerc_get_services
+{
+ my ($script);
+ my (%ret);
+
+ open FILE, "$gst_prefix/etc/runlevel.conf" or return undef;
+ while ($line = <FILE>)
+ {
+ if ($line !~ /^#.*/)
+ {
+ my (%hash);
+ my ($start_service, $stop_service);
+ $hash = &gst_service_filerc_get_service_info ($line);
+
+ if ($hash ne undef)
+ {
+ $script = $$hash{"script"};
+
+ if ($ret{$script} eq undef)
+ {
+ $ret{$script} = $hash;
+ }
+ else
+ {
+ my (@runlevels);
+
+ # We need to mix the runlevels
+ @runlevels = $$hash{"runlevels"}[0]{"runlevel"};
+ foreach $runlevel (@runlevels)
+ {
+ push @{$ret{$script}{"runlevels"}[0]{"runlevel"}}, $runlevel;
+ }
+ }
+ }
+ }
+ }
+
+ return \%ret;
+}
+
+# this functions get a list of the services that run on a bsd init
+sub gst_service_bsd_get_service_info
+{
+ my ($service) = @_;
+ my ($script);
+ my (%hash);
+ my (@arr, @rl);
+
+ $script = $service;
+ $script =~ s/^.*\///;
+ $script =~ s/^rc\.//;
+
+ return undef if (! gst_file_exists ($service));
+
+ return undef if (&gst_service_list_service_is_forbidden ($script));
+
+ $hash {"script"} = $service;
+
+ # we hardcode the fourth runlevel, it's the graphical one
+ if ( -x $service)
+ {
+ push @arr, { "name" => 4,
+ "action" => "start" };
+ }
+ else
+ {
+ push @arr, { "name" => 4,
+ "action" => "stop" };
+ }
+
+ push @rl, { "runlevel" => \@arr };
+
+ $hash{"runlevels"} = \@rl;
+ $hash{"role"} = &gst_service_get_role ($script);
+
+ return \%hash;
+}
+
+sub gst_service_bsd_get_services
+{
+ my (%ret);
+ my ($files) = [ "rc.M", "rc.inet2", "rc.4" ];
+ my ($file);
+
+ foreach $i (@$files)
+ {
+ $file = "/etc/rc.d/" . $i;
+ $fd = &gst_file_open_read_from_names ($file);
+
+ if (!$fd) {
+ &gst_report ("rc_file_read_failed", $file);
+ return undef;
+ }
+
+ while (<$fd>)
+ {
+ $line = $_;
+
+ if ($line =~ /^if[ \t]+\[[ \t]+\-x[ \t]([0-9a-zA-Z\/\.\-_]+) .*\]/)
+ {
+ my (%hash);
+ $service = $1;
+
+ $hash = &gst_service_bsd_get_service_info ($service);
+
+ if ($hash ne undef)
+ {
+ $ret{$service} = $hash;
+ }
+ }
+ }
+
+ gst_file_close ($fd);
+ }
+
+ return \%ret;
+}
+
+# these functions get a list of the services that run on a gentoo init
+sub gst_service_gentoo_get_service_status
+{
+ my ($script, $runlevel) = @_;
+ my ($services) = &gst_service_gentoo_get_services_by_runlevel ($runlevel);
+
+ foreach $i (@$services)
+ {
+ return 1 if ($i eq $script);
+ }
+
+ return 0;
+}
+
+sub gst_service_gentoo_get_runlevels
+{
+ my($raw_output) = gst_file_run_backtick("rc-status -l");
+ my(@runlevels) = split(/\n/,$raw_output);
+
+ return @runlevels;
+}
+
+sub gst_service_gentoo_get_services_by_runlevel
+{
+ my($runlevel) = @_;
+ my($raw_output) = gst_file_run_backtick("rc-status $runlevel");
+ my(@raw_lines) = split(/\n/,$raw_output);
+ my(@services);
+ my($line);
+
+ foreach $line (@raw_lines)
+ {
+ if ($line !~ /^Runlevel/)
+ {
+ $line=(split(" ",$line))[0];
+ push(@services,$line);
+ }
+ }
+
+ return \@services
+}
+
+sub gst_service_gentoo_get_services_list
+{
+ return &gst_service_sysv_list_dir ("/etc/init.d/");
+}
+
+sub gst_service_gentoo_service_exist
+{
+ my($service) = @_;
+ my($services) = &gst_service_gentoo_get_services_list();
+
+ foreach $i (@$services)
+ {
+ return 1 if ($i =~ /$service/);
+ }
+
+ return 0;
+}
+
+sub gst_service_gentoo_get_runlevels_by_service
+{
+ my ($service) = @_;
+ my(@runlevels,@services_in_runlevel,@contain_runlevels, $runlevel);
+ my ($elem);
+
+ # let's do some caching to improve performance
+ if ($gentoo_services_hash eq undef)
+ {
+ @runlevels = &gst_service_gentoo_get_runlevels ();
+
+ foreach $runlevel (@runlevels)
+ {
+ $$gentoo_services_hash{$runlevel} = &gst_service_gentoo_get_services_by_runlevel ($runlevel);
+ }
+ }
+
+ if (&gst_service_gentoo_service_exist($service))
+ {
+ foreach $runlevel (keys %$gentoo_services_hash)
+ {
+ $services_in_runlevel = $$gentoo_services_hash {$runlevel};
+
+ foreach $elem (@$services_in_runlevel)
+ {
+ push (@contain_runlevels, $runlevel) if ($elem eq $service);
+ }
+ }
+ }
+
+ return @contain_runlevels;
+}
+
+sub gst_service_gentoo_runlevel_status_by_service
+{
+ my ($service) = @_;
+ my (@arr, @ret);
+ my (@runlevels) = &gst_service_gentoo_get_runlevels();
+ my (@started) = &gst_service_gentoo_get_runlevels_by_service($service);
+ my (%start_runlevels) = map { $started[$_], 1 } 0 .. $#started;
+
+ foreach $runlevel (@runlevels)
+ {
+ if (defined $start_runlevels{$runlevel})
+ {
+ push @arr, { "name" => $runlevel,
+ "action" => "start" };
+ }
+ else
+ {
+ push @arr, { "name" => $runlevel,
+ "action" => "stop" };
+ }
+ }
+
+ push @ret, { "runlevel" => \@arr };
+ return @ret;
+}
+
+sub gst_service_gentoo_get_service_info
+{
+ my ($service) = @_;
+ my ($script, @actions, @runlevels);
+ my %hash;
+
+ # We have to check out if the service is in the "forbidden" list
+ return undef if (&gst_service_list_service_is_forbidden ($service));
+
+ my($runlevels) = &gst_service_gentoo_runlevel_status_by_service ($service);
+
+ $hash{"script"} = $service;
+ $hash{"runlevels"} = $runlevels unless ($runlevels eq undef);
+ $hash{"role"} = &gst_service_get_role ($service);
+
+ return \%hash;
+}
+
+sub gst_service_gentoo_get_services
+{
+ my ($service);
+ my (%ret);
+ my ($service_list) = &gst_service_gentoo_get_services_list ();
+
+ foreach $service (@$service_list)
+ {
+ my (%hash);
+ $hash = &gst_service_gentoo_get_service_info ($service);
+
+ $ret{$service} = $hash if ($hash ne undef);
+ }
+
+ return \%ret;
+}
+
+# rcNG functions, mostly for FreeBSD
+
+
+sub gst_service_archlinux_status_by_service
+{
+ my ($service) = @_;
+ return 1 if( -f "/var/run/daemons/$service");
+ return 0;
+}
+
+sub gst_service_rcng_status_by_service
+{
+ my ($service) = @_;
+ my ($fd, $line, $active);
+
+ $fd = &gst_file_run_pipe_read ("/etc/rc.d/$service rcvar");
+
+ while (<$fd>)
+ {
+ $line = $_;
+
+ if ($line =~ /^\$.*=YES$/)
+ {
+ $active = 1;
+ last;
+ }
+ }
+
+ gst_file_close ($fd);
+ return $active;
+}
+
+sub gst_service_rcng_get_service_info
+{
+ my ($service) = @_;
+ my ($script, @actions, @runlevels);
+ my (%hash, @arr, @rl);
+
+ # We have to check if the service is in the "forbidden" list
+ return undef if (&gst_service_list_service_is_forbidden ($service));
+
+ $hash{"script"} = $service;
+
+ if (gst_service_rcng_status_by_service ($service))
+ {
+ push @arr, { "name" => "rc",
+ "action" => "start" };
+ }
+ else
+ {
+ push @arr, { "name" => "rc",
+ "action" => "stop" };
+ }
+
+ push @rl, { "runlevel", \@arr };
+
+ $hash {"runlevels"} = \@rl;
+ $hash{"role"} = &gst_service_get_role ($service);
+
+ return \%hash;
+}
+
+sub gst_service_archlinux_get_service_info
+{
+ my ($service) = @_;
+ my ($script, @actions, @runlevels);
+ my (%hash, @arr, @rl);
+
+ # We have to check if the service is in the "forbidden" list
+ return undef if (&gst_service_list_service_is_forbidden ($service));
+
+ $hash{"script"} = $service;
+
+ if (&gst_service_archlinux_status_by_service ($service))
+ {
+ push @arr, { "name" => "rc",
+ "action" => "start" };
+ }
+ else
+ {
+ push @arr, { "name" => "rc",
+ "action" => "stop" };
+ }
+
+ push @rl, { "runlevel", \@arr };
+
+ $hash {"runlevels"} = \@rl;
+ $hash{"role"} = &gst_service_get_role ($service);
+
+ return \%hash;
+}
+
+sub gst_service_archlinux_get_services
+{
+ my ($service);
+ my (%ret);
+
+ foreach $service (<$gst_prefix/etc/rc.d/*>)
+ {
+ my (%hash);
+
+ $service =~ s/.*\///;
+ $hash = &gst_service_archlinux_get_service_info ($service);
+
+ $ret{$service} = $hash if ($hash ne undef);
+ }
+
+ return \%ret;
+}
+
+sub gst_service_rcng_get_services
+{
+ my ($service);
+ my (%ret);
+
+ foreach $service (<$gst_prefix/etc/rc.d/*>)
+ {
+ my (%hash);
+
+ $service =~ s/.*\///;
+ $hash = &gst_service_rcng_get_service_info ($service);
+
+ $ret{$service} = $hash if ($hash ne undef);
+ }
+
+ return \%ret;
+}
+# SuSE functions, quite similar to SysV, but not equal...
+sub gst_service_suse_get_service_info ($service)
+{
+ my ($service) = @_;
+ my (%hash, @arr, @ret);
+
+ # We have to check if the service is in the "forbidden" list
+ return undef if (&gst_service_list_service_is_forbidden ($service));
+
+ $hash{"script"} = $service;
+
+ foreach $link (<$rcd_path/rc[0-9S].d/S[0-9][0-9]$service>)
+ {
+ $link =~ s/$rcd_path\///;
+ $link =~ /rc([0-6])\.d\/S[0-9][0-9].*/;
+ $runlevel = $1;
+
+ push @arr, { "name" => $runlevel,
+ "action" => "start" };
+ }
+
+ foreach $link (<$rcd_path/boot.d/S[0-9][0-9]$service>)
+ {
+ push @arr, {"name" => "B",
+ "action" => "start" };
+ }
+
+ if (scalar @arr > 0)
+ {
+ push @ret, { "runlevel" => \@arr };
+ $hash{"runlevels"} = \@ret;
+ $hash{"role"} = &gst_service_get_role ($service);
+ }
+
+ return \%hash;
+}
+
+sub gst_service_suse_get_services
+{
+ my ($service, %ret);
+
+ ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+
+ foreach $service (<$gst_prefix/etc/init.d/*>)
+ {
+ my (%hash);
+
+ next if (-d $service || ! -x $service);
+
+ $service =~ s/.*\///;
+ $hash = &gst_service_suse_get_service_info ($service);
+
+ $ret{$service} = $hash if ($hash ne undef);
+ }
+
+ return \%ret;
+}
+
+# generic functions to get the available services
+sub gst_get_init_type
+{
+ if (($gst_dist =~ /debian/) && (stat ("$gst_prefix/etc/runlevel.conf")))
+ {
+ return "file-rc";
+ }
+ elsif ($gst_dist =~ /slackware/)
+ {
+ return "bsd";
+ }
+ elsif ($gst_dist =~ /freebsd/)
+ {
+ return "rcng";
+ }
+ elsif ($gst_dist =~ /archlinux/)
+ {
+ return "archlinux";
+ }
+ elsif (($gst_dist =~ /gentoo/) || ($gst_dist =~ /^vlos/))
+ {
+ return "gentoo";
+ }
+ elsif ($gst_dist =~ /suse/)
+ {
+ return "suse";
+ }
+ else
+ {
+ return "sysv";
+ }
+}
+
+sub gst_service_get_services
+{
+ $type = &gst_get_init_type ();
+
+ return &gst_service_sysv_get_services () if ($type eq "sysv");
+ return &gst_service_filerc_get_services () if ($type eq "file-rc");
+ return &gst_service_bsd_get_services () if ($type eq "bsd");
+ return &gst_service_gentoo_get_services () if ($type eq "gentoo");
+ return &gst_service_rcng_get_services () if ($type eq "rcng");
+ return &gst_service_suse_get_services () if ($type eq "suse");
+ return &gst_service_archlinux_get_services() if ($type eq "archlinux");
+ return undef;
+}
+
+
+# This function gets the runlevel that is in use
+sub gst_service_sysv_get_default_runlevel
+{
+ my (@arr);
+
+ @arr = split / /, `/sbin/runlevel` ;
+ $arr[1] =~ s/\n//;
+
+ return $arr[1];
+}
+
+sub gst_service_get_default_runlevel
+{
+ my ($type) = &gst_get_init_type ();
+
+ return "default" if ($type eq "gentoo");
+ return "rc" if ($type eq "rcng");
+ return "rc" if ($type eq "archlinux");
+ return &gst_service_sysv_get_default_runlevel ();
+}
+
+
+# THESE ARE THE FUNCTIONS WHICH APPLY THE CHANGES MADE TO THE CONFIGURATION OF THE COMPUTER
+
+sub gst_service_sysv_add_link
+{
+ my ($runlevel, $action, $priority, $service) = @_;
+ my ($prio) = sprintf ("%0.2d",$priority);
+
+ symlink ("$relative_path/$service", "$rcd_path/rc$runlevel.d/$action$prio$service");
+
+ &gst_report_enter ();
+ &gst_report ("service_sysv_add_link", "$rcd_path/rc$runlevel.d/$action$prio$service");
+ &gst_report_leave ();
+}
+
+sub gst_service_sysv_remove_link
+{
+ my ($runlevel, $script) = @_;
+
+ foreach $link (<$rcd_path/rc$runlevel.d/[SK][0-9][0-9]$script>)
+ {
+ &gst_report ("service_sysv_remove_link", "$link");
+ unlink ("$link");
+ &gst_report_leave ();
+ }
+}
+
+
+# These are the functions for storing the service settings from XML in SysV
+sub gst_service_sysv_set_service
+{
+ my ($service) = @_;
+ my ($script, $priority, $runlevels);
+ my ($action);
+
+ ($rcd_path, $initd_path, $relative_path) = &gst_service_sysv_get_paths ();
+
+ $script = $$service{"script"};
+ $runlevels = $$service{"runlevels"}[0]{"runlevel"};
+
+ # pass though all the runlevels checking if the service must be started, stopped or removed
+ for ($i = 0; $i <= 6; $i++)
+ {
+ &gst_service_sysv_remove_link ($i, $script);
+
+ $action = undef;
+ foreach $j (@$runlevels)
+ {
+ if ($i == $$j{"name"})
+ {
+ $found = 1;
+ $action = $$j{"action"};
+ $priority = $$j{"priority"};
+ $priority = 50 if (!$priority); #very rough guess
+ }
+ }
+
+ if ($action ne undef)
+ {
+ if ($action eq "start")
+ {
+ &gst_service_sysv_add_link ($i, "S", $priority, $script);
+ }
+ else
+ {
+ &gst_service_sysv_add_link ($i, "K", 100 - $priority, $script);
+ }
+ }
+ }
+}
+
+sub gst_service_sysv_set_services
+{
+ my ($services, $runlevel) = @_;
+
+ foreach $i (@$services)
+ {
+ &gst_service_sysv_set_service($i);
+ }
+}
+
+sub gst_service_filerc_concat_runlevels
+{
+ my (@runlevels) = @_;
+
+ $str = join (",", sort (@runlevels));
+ return ($str) ? $str : "-";
+}
+
+sub gst_service_filerc_set_service
+{
+ my ($buff, $service) = @_;
+ my (%hash, $priority, $line, $str);
+
+ $arr = $$service{"runlevels"}[0]{"runlevel"};
+
+ foreach $i (@$arr)
+ {
+ $priority = 0 + $$i{"priority"};
+ $priority = 50 if ($priority == 0); #very rough guess
+
+ if ($$i{"action"} eq "start")
+ {
+ $hash{$priority}{"start"} = [] if (!$hash{$priority}{"start"});
+ push @{$hash{$priority}{"start"}}, $$i{"name"};
+ }
+ else
+ {
+ $hash{$priority}{"stop"} = [] if (!$hash{$priority}{"stop"});
+ push @{$hash{$priority}{"stop"}}, $$i{"name"};
+ }
+ }
+
+ foreach $priority (keys %hash)
+ {
+ $line = sprintf ("%0.2d", $priority) . "\t";
+ $line .= &gst_service_filerc_concat_runlevels (@{$hash{$priority}{"stop"}}) . "\t";
+ $line .= &gst_service_filerc_concat_runlevels (@{$hash{$priority}{"start"}}) . "\t";
+ $line .= "/etc/init.d/" . $$service{"script"} . "\n";
+
+ push @$buff, $line;
+ }
+}
+
+# This is the function for storing the service settings from XML in file-rc
+sub gst_service_filerc_set_services
+{
+ my ($services, $runlevel) = @_;
+ my ($buff, $lineno, $line, $file);
+ my ($rcd_path, $initd_path, $relative_path) = &gst_service_sysv_get_paths ();
+
+ $file = "$gst_prefix/etc/runlevel.conf";
+
+ $buff = &gst_file_buffer_load ($file);
+ &gst_file_buffer_join_lines ($buff);
+
+ $lineno = 0;
+
+ # We prepare the file for storing the configuration, save the initial comments
+ # and delete the rest
+ while ($$buff[$lineno] =~ /^#.*/)
+ {
+ $lineno++;
+ }
+
+ for ($i = $lineno; $i < scalar (@$buff); $i++)
+ {
+ $$buff[$i] =~ /.*\/etc\/init\.d\/(.*)/;
+
+ # we need to keep the forbidden services and the services that only start in rcS.d
+ if (!gst_service_list_service_is_forbidden ($1))
+ {
+ delete $$buff[$i];
+ }
+ }
+
+ # Now we append the services
+ foreach $service (@$services)
+ {
+ &gst_service_filerc_set_service ($buff, $service);
+ }
+
+ @$buff = sort @$buff;
+
+ push @$buff, "\n";
+ &gst_file_buffer_clean ($buff);
+ &gst_file_buffer_save ($buff, $file);
+}
+
+sub gst_service_bsd_set_services
+{
+ my ($services, $runlevel) = @_;
+ my ($script, $runlevels);
+
+ foreach $service (@$services)
+ {
+ $script = $$service{"script"};
+ $runlevels = $$service{"runlevels"}[0]{"runlevel"}[0];
+
+ $action = $$runlevels {"action"};
+
+ if ($action eq "start")
+ {
+ &gst_file_run ("chmod ugo+x $script");
+ }
+ else
+ {
+ &gst_file_run ("chmod ugo-x $script");
+ }
+ }
+}
+
+sub gst_service_gentoo_set_services
+{
+ my ($services, $runlevel) = @_;
+ my ($action);
+
+ foreach $service (@$services)
+ {
+ $script = $$service{"script"};
+ $arr = $$service{"runlevels"}[0]{"runlevel"};
+
+ foreach $i (@$arr)
+ {
+ $action = $$i{"action"};
+ $rl = $$i{"name"};
+
+ if ( $action eq "start")
+ {
+ &gst_file_run ("rc-update add $script $rl");
+ }
+ elsif ($action eq "stop")
+ {
+ &gst_file_run ("rc-update del $script $rl");
+ }
+ }
+ }
+}
+
+sub gst_service_rcng_set_status
+{
+ my ($service, $action) = @_;
+ my ($fd, $key, $res);
+ my ($default_rcconf) = "/etc/defaults/rc.conf";
+ my ($rcconf) = "/etc/rc.conf";
+
+ if (&gst_file_exists ("/etc/rc.d/$service"))
+ {
+ $fd = &gst_file_run_pipe_read ("/etc/rc.d/$service rcvar");
+
+ while (<$fd>)
+ {
+ if (/^\$(.*)=.*$/)
+ {
+ # to avoid cluttering rc.conf with duplicated data,
+ # we first look in the defaults/rc.conf for the key
+ $key = $1;
+ $res = &gst_parse_sh_bool ($default_rcconf, $key);
+
+ if ($res == $action)
+ {
+ &gst_replace_sh ($rcconf, $key);
+ }
+ else
+ {
+ &gst_replace_sh_bool ($rcconf, $key, "YES", "NO", $action);
+ }
+ }
+ }
+
+ &gst_file_close ($fd);
+ }
+ elsif (&gst_file_exists ("/usr/local/etc/rc.d/$service.sh"))
+ {
+ if ($action)
+ {
+ gst_file_copy ("/usr/local/etc/rc.d/$service.sh.sample",
+ "/usr/local/etc/rc.d/$service.sh");
+ }
+ else
+ {
+ gst_file_remove ("/usr/local/etc/rc.d/$service.sh");
+ }
+ }
+}
+
+sub gst_service_rcng_set_services
+{
+ my ($services, $runlevel) = @_;
+ my ($action, $runlevels, $script);
+
+ foreach $service (@$services)
+ {
+ $script = $$service {"script"};
+ $runlevels = $$service{"runlevels"}[0]{"runlevel"}[0];
+ $action = ($$runlevels {"action"} eq "start")? 1 : 0;
+
+ &gst_service_rcng_set_status ($script, $action);
+ }
+}
+
+sub gst_service_suse_set_services
+{
+ my ($services, $runlevel) = @_;
+ my ($action, $runlevels, $script, $rllist);
+
+ foreach $service (@$services)
+ {
+ $script = $$service{"script"};
+ $runlevels = $$service{"runlevels"}[0]{"runlevel"};
+ $rllist = "";
+
+ &gst_file_run ("insserv -r $script");
+
+ foreach $rl (@$runlevels)
+ {
+ if ($$rl{"action"} eq "start")
+ {
+ $rllist .= $$rl{"name"} . ",";
+ }
+ }
+
+ if ($rllist ne "")
+ {
+ $rllist =~ s/,$//;
+
+ &gst_file_run ("insserv $script,start=$rllist");
+ }
+ }
+}
+
+
+sub gst_service_archlinux_set_status
+{
+ my ($script, $active) = @_;
+ my $rcconf = '/etc/rc.conf';
+ open DATA, "$rcconf";
+ my @rcconflines = <DATA>;
+ close (DATA);
+ open DATAOUT, ">", "$rcconf";
+ if(($active) && (! -f "/var/run/daemons/$script"))
+ {
+ &gst_service_archlinux_run_script($script,"start");
+ }
+ if((!$active) && ( -f "/var/run/daemons/$script"))
+ {
+ &gst_service_archlinux_run_script($script,"start");
+ }
+
+
+ foreach my $line (@rcconflines)
+ {
+ if($line =~ /\DAEMONS=/)
+ {
+ if($line =~ m/$script/)
+ {
+ if(!$active)
+ {
+ $line =~ s/$script //;
+ }
+ }
+ else
+ {
+ if($active)
+ {
+ $line =~ s/network/network $script/g;
+ }
+ }
+ }
+ print DATAOUT "$line";
+ }
+
+ close (DATAOUT);
+}
+
+sub gst_service_archlinux_set_services
+{
+ my ($services, $runlevel) = @_;
+ my ($action, $runlevels, $script);
+ foreach $service (@$services)
+ {
+ $script = $$service {"script"};
+ $runlevels = $$service{"runlevels"}[0]{"runlevel"}[0];
+ $action = ($$runlevels {"action"} eq "start")? 1 : 0;
+ &gst_service_archlinux_set_status ($script, $action);
+ }
+}
+
+sub gst_service_set_services
+{
+ my ($services, $runlevel) = @_;
+
+ $type = &gst_get_init_type ();
+ &gst_service_sysv_set_services ($services, $runlevel) if ($type eq "sysv");
+ &gst_service_filerc_set_services ($services, $runlevel) if ($type eq "file-rc");
+ &gst_service_bsd_set_services ($services, $runlevel) if ($type eq "bsd");
+ &gst_service_gentoo_set_services ($services, $runlevel) if ($type eq "gentoo");
+ &gst_service_rcng_set_services ($services, $runlevel) if ($type eq "rcng");
+ &gst_service_suse_set_services ($services, $runlevel) if ($type eq "suse");
+ &gst_service_archlinux_set_services ($services, $runlevel) if ($type eq "archlinux");
+}
+
+sub gst_service_set_conf
+{
+ my ($hash) = @_;
+ my ($services, $runlevel);
+
+ return unless $hash;
+ $services = $$hash{"services"}[0]{"service"};
+ return unless $services;
+ $runlevel = $$hash{"runlevel"};
+ return unless $runlevel;
+
+ &gst_service_set_services($services, $runlevel);
+}
+
+# stuff for checking whether service is running
+sub gst_service_debian_get_status
+{
+ my ($service) = @_;
+ my ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+ my ($output, $pidfile);
+
+ $output = `grep "\/var\/run\/.*\.pid" $initd_path\/$service`;
+
+ if ($output =~ /.*(\/var\/run\/.*\.pid).*/ )
+ {
+ $pidfile = $1;
+ $pidval = `cat $pidfile`;
+
+ return 0 if $pidval eq "";
+
+ $pid = `ps h $pidval`;
+
+ if ($pid eq "")
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+
+ return undef;
+}
+
+sub gst_service_redhat_get_status
+{
+ my ($service) = @_;
+ my ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+
+ if (-f "/var/lock/subsys/$service")
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
+sub gst_service_gentoo_get_status
+{
+ my ($service) = @_;
+
+ $line = `/etc/init.d/$service status`;
+
+ return 1 if ($line =~ /started/);
+ return 0;
+}
+
+sub gst_service_rcng_get_status
+{
+ my ($service) = @_;
+
+ $line = gst_file_run_backtick ("/etc/rc.d/$service forcestatus");
+ return 1 if ($line =~ /pid [0-9]*/);
+
+ # hacky as hell, we need to check services in /usr/local/etc/rc.d
+ # and there's no standard way to check they're running
+ return 1 if (-f "/var/run/$service.pid");
+
+ # we give up, the service isn't running
+ return 0;
+}
+sub gst_service_archlinux_get_status
+{
+ my ($service) = @_;
+ return 1 if( -f "/var/run/daemons/$service");
+ return 0;
+}
+
+sub gst_service_suse_get_status
+{
+ my ($service) = @_;
+
+ $line = gst_file_run_backtick ("/etc/init.d/$service status");
+ return 1 if ($line =~ /running/);
+ return 0;
+}
+
+# returns true if the service is already running
+sub gst_service_get_status
+{
+ my ($service) = @_;
+ my %dist_map =
+ (
+ "debian-2.2" => \&gst_service_debian_get_status,
+ "debian-3.0" => \&gst_service_debian_get_status,
+ "debian-3.1" => \&gst_service_debian_get_status,
+ "debian-4.0" => \&gst_service_debian_get_status,
+ "debian-5.0" => \&gst_service_debian_get_status,
+ "debian-testing" => \&gst_service_debian_get_status,
+ "ubuntu-5.04" => \&gst_service_debian_get_status,
+ "ubuntu-5.10" => \&gst_service_debian_get_status,
+ "ubuntu-6.06" => \&gst_service_debian_get_status,
+ "ubuntu-6.10" => \&gst_service_debian_get_status,
+ "ubuntu-7.04" => \&gst_service_debian_get_status,
+ "ubuntu-7.10" => \&gst_service_debian_get_status,
+ "ubuntu-8.04" => \&gst_service_debian_get_status,
+
+ "redhat-5.2" => \&gst_service_redhat_get_status,
+ "redhat-6.0" => \&gst_service_redhat_get_status,
+ "redhat-6.1" => \&gst_service_redhat_get_status,
+ "redhat-6.2" => \&gst_service_redhat_get_status,
+ "redhat-7.0" => \&gst_service_redhat_get_status,
+ "redhat-7.1" => \&gst_service_redhat_get_status,
+ "redhat-7.2" => \&gst_service_redhat_get_status,
+ "redhat-7.3" => \&gst_service_redhat_get_status,
+ "redhat-8.0" => \&gst_service_redhat_get_status,
+ "redhat-9" => \&gst_service_redhat_get_status,
+ "rhel-5" => \&gst_service_redhat_get_status,
+ "rhel-6" => \&gst_service_redhat_get_status,
+ "mandrake-7.2" => \&gst_service_redhat_get_status,
+ "fedora-1" => \&gst_service_redhat_get_status,
+ "fedora-2" => \&gst_service_redhat_get_status,
+ "fedora-3" => \&gst_service_redhat_get_status,
+ "fedora-4" => \&gst_service_redhat_get_status,
+ "fedora-5" => \&gst_service_redhat_get_status,
+ "fedora-15" => \&gst_service_redhat_get_status,
+ "fedora-16" => \&gst_service_redhat_get_status,
+ "fedora-17" => \&gst_service_redhat_get_status,
+
+ "rpath" => \&gst_service_redhat_get_status,
+
+ "suse-9.0" => \&gst_service_suse_get_status,
+ "suse-9.1" => \&gst_service_suse_get_status,
+ "archlinux" => \&gst_service_archlinux_get_status,
+ "gentoo" => \&gst_service_gentoo_get_status,
+ "vlos-1.2" => \&gst_service_gentoo_get_status,
+
+ "freebsd-5" => \&gst_service_rcng_get_status,
+ "freebsd-6" => \&gst_service_rcng_get_status,
+ );
+ my $proc;
+
+ $proc = $dist_map {$gst_dist};
+
+ return undef if ($proc eq undef);
+
+ return &$proc ($service);
+}
+
+# Functions to run a service
+sub gst_service_sysv_run_initd_script
+{
+ my ($service, $arg) = @_;
+ my ($rc_path, $initd_path);
+ my $str;
+ my %map =
+ ("restart" => "restarted",
+ "stop" => "stopped",
+ "start" => "started");
+
+ &gst_report_enter ();
+
+ if (!exists $map{$arg})
+ {
+ &gst_report ("service_sysv_op_unk", $arg);
+ &gst_report_leave ();
+ return -1;
+ }
+
+ $str = $map{$arg};
+
+ ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+
+ if (-f "$initd_path/$service")
+ {
+ if (!&gst_file_run ("$initd_path/$service $arg"))
+ {
+ &gst_report ("service_sysv_op_success", $service, $str);
+ &gst_report_leave ();
+ return 0;
+ }
+ }
+
+ &gst_report ("service_sysv_op_failed", $service, $str);
+ &gst_report_leave ();
+ return -1;
+}
+
+sub gst_service_bsd_run_script
+{
+ my ($service, $arg) = @_;
+ my ($chmod) = 0;
+
+ return if (!&gst_file_exists ($service));
+
+ # if it's not executable then chmod it
+ if (!((stat ($service))[2] & (S_IXUSR || S_IXGRP || S_IXOTH)))
+ {
+ $chmod = 1;
+ &gst_file_run ("chmod ugo+x $service");
+ }
+
+ &gst_file_run ("$service $arg");
+
+ # return it to it's normal state
+ if ($chmod)
+ {
+ &gst_file_run ("chmod ugo-x $service");
+ }
+}
+
+sub gst_service_gentoo_run_script
+{
+ my ($service, $arg) = @_;
+ my ($option);
+
+ my %map =
+ ("stop" => "stopped",
+ "start" => "started"
+ );
+
+ &gst_report_enter ();
+
+ if (!exists $map{$arg})
+ {
+ &gst_report ("service_sysv_op_unk", $arg);
+ &gst_report_leave ();
+ return -1;
+ }
+
+ if (&gst_service_gentoo_service_exist ($service))
+ {
+ if (!&gst_file_run ("/etc/init.d/$service $arg"))
+ {
+ &gst_report ("service_sysv_op_success", $service, $str);
+ &gst_report_leave ();
+ return 0;
+ }
+ }
+
+ &gst_report ("service_sysv_op_failed", $service, $str);
+ &gst_report_leave ();
+ return -1;
+}
+
+
+sub gst_service_rcng_run_script
+{
+ my ($service, $arg) = @_;
+ my ($farg);
+
+ my %map =
+ ("stop" => "forcestop",
+ "start" => "forcestart"
+ );
+
+ &gst_report_enter ();
+
+ if (!exists $map{$arg})
+ {
+ &gst_report ("service_sysv_op_unk", $arg);
+ &gst_report_leave ();
+ return -1;
+ }
+
+ $farg = $map {$arg};
+
+ if (!&gst_file_run ("/etc/rc.d/$service $farg"))
+ {
+ &gst_report ("service_sysv_op_success", $service, $str);
+ &gst_report_leave ();
+ return 0;
+ }
+
+ &gst_report ("service_sysv_op_failed", $service, $str);
+ &gst_report_leave ();
+ return -1;
+}
+
+sub gst_service_archlinux_run_script
+{
+ my ($service, $arg) = @_;
+ my ($farg);
+
+ my %map =
+ ("stop" => "stop",
+ "start" => "start"
+ );
+
+ &gst_report_enter ();
+
+ if (!exists $map{$arg})
+ {
+ &gst_report ("service_sysv_op_unk", $arg);
+ &gst_report_leave ();
+ return -1;
+ }
+
+ $farg = $map {$arg};
+
+ if (!&gst_file_run ("/etc/rc.d/$service $farg"))
+ {
+ &gst_report ("service_sysv_op_success", $service, $str);
+ &gst_report_leave ();
+ return 0;
+ }
+
+ &gst_report ("service_sysv_op_failed", $service, $str);
+ &gst_report_leave ();
+ return -1;
+}
+sub gst_service_run_script
+{
+ my ($service, $arg) = @_;
+ my ($proc, $type);
+ my %map =
+ (
+ "file-rc" => \&gst_service_sysv_run_initd_script,
+ "sysv" => \&gst_service_sysv_run_initd_script,
+ "bsd" => \&gst_service_bsd_run_script,
+ "gentoo" => \&gst_service_gentoo_run_script,
+ "rcng" => \&gst_service_rcng_run_script,
+ "suse" => \&gst_service_sysv_run_initd_script,
+ "archlinux" => \&gst_service_archlinux_run_script,
+ );
+
+ $type = &gst_get_init_type ();
+
+ $proc = $map {$type};
+
+ &$proc ($service, $arg);
+}
+
+# functions to know if a service will be installed
+sub gst_service_sysv_installed
+{
+ my ($service) = @_;
+ my ($res, $rcd_path, $initd_path);
+
+ &gst_report_enter ();
+
+ ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+
+ $res = 1;
+ if (! -f "$initd_path/$service")
+ {
+ $res = 0;
+ &gst_report ("service_sysv_not_found", $service);
+ }
+
+ &gst_report_leave ();
+ return $res;
+}
+
+sub gst_service_bsd_installed
+{
+ my ($service) = @_;
+
+ return 1 if ( -f "$service");
+ return 0;
+}
+
+sub gst_service_gentoo_installed
+{
+ my ($service) = @_;
+
+ return 1 if ( -f "/etc/init.d/$service");
+ return 0;
+}
+
+sub gst_service_rcng_installed
+{
+ my ($service) = @_;
+
+ return 1 if ( -f "/etc/rc.d/$service");
+ return 1 if ( -f "/usr/local/etc/rc.d/$service.sh.sample");
+ return 0;
+}
+
+sub gst_service_installed
+{
+ my ($service) = @_;
+ my ($type);
+ $type = &gst_get_init_type ();
+
+ return &gst_service_sysv_installed ($service) if (($type eq "sysv") || ($type eq "file-rc") || ($type eq "suse"));
+ return &gst_service_bsd_installed ($service) if ($type eq "bsd");
+ return &gst_service_gentoo_installed ($service) if ($type eq "gentoo");
+ return &gst_service_rcng_installed ($service) if ($type eq "rcng");
+ return &gst_service_rcng_installed ($service) if ($type eq "archlinux");
+ return 0;
+}
+
+sub gst_service_list_any_installed
+{
+ my @service = @_;
+ my $res;
+
+ $res = 0;
+
+ foreach $serv (@service)
+ {
+ if (gst_service_installed ($serv))
+ {
+ $res = 1;
+ }
+ }
+
+ return $res;
+}
+
+sub gst_service_bsd_set_status
+{
+ my ($script, $active) = @_;
+ my (@arr);
+
+ if ($active)
+ {
+ &gst_file_run ("chmod ugo+x $script");
+ &gst_service_run_script ($script, "start");
+ }
+ else
+ {
+ &gst_service_run_script ($script, "stop");
+ &gst_file_run ("chmod ugo-x $script");
+ }
+}
+
+sub gst_service_gentoo_set_status
+{
+ my ($script, $force_now, $active) = @_;
+ my (@arr);
+
+ if ($active)
+ {
+ &gst_file_run ("rc-update add $script default");
+ &gst_file_run ("/etc/init.d/$script start") if ($force_now == 1);
+ }
+ else
+ {
+ &gst_file_run ("rc-update del $script default");
+ &gst_file_run ("/etc/init.d/$script stop") if ($force_now == 1);
+ }
+}
+
+sub gst_service_suse_set_status
+{
+ my ($script, $active) = @_;
+ my (@runlevels, $rllist);
+ my ($rcd_path, $initd_path);
+ my ($rl);
+
+ ($rcd_path, $initd_path) = &gst_service_sysv_get_paths ();
+ @runlevels = &gst_service_sysv_get_runlevels ();
+
+ if ($active)
+ {
+ $rllist = join ",", @runlevels;
+ &gst_file_run ("insserv $script,start=$rllist");
+ &gst_service_run_script ($script, "start");
+ }
+ else
+ {
+ # to remove a service from a few runlevels we need to run
+ # insserv -r and then insserv blah,start=x,y,z
+ foreach $link (<$rcd_path/rc[0-9S].d/S[0-9][0-9]$script>)
+ {
+ $link =~ s/$rcd_path\///;
+ $link =~ /rc([0-9S])\.d\/S[0-9][0-9].*/;
+ $rllist .= "$1,";
+ }
+
+ foreach $link (<$rcd_path/boot.d/S[0-9][0-9]$service>)
+ {
+ $rllist .= "B,";
+ }
+
+ # remove the default runlevels from the list
+ foreach $runlevel (@runlevels)
+ {
+ $rllist =~ s/$runlevel,//;
+ }
+
+ $rllist =~ s/,$//;
+
+ &gst_file_run ("insserv -r $script");
+
+ if ($rllist ne "")
+ {
+ &gst_file_run ("insserv $script,start=$rllist");
+ }
+
+ &gst_service_run_script ($script, "stop");
+ }
+}
diff --git a/knetwortdeconf/backends/system-tools-backends.pc.in b/knetwortdeconf/backends/system-tools-backends.pc.in
new file mode 100644
index 0000000..185778f
--- /dev/null
+++ b/knetwortdeconf/backends/system-tools-backends.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=
+libdir=
+includedir=
+
+filessdir=@filesdir@
+backenddir=@scriptsdir@
+
+Name: gst-backends
+Description: GNOME System Tools backends
+Version: @VERSION@
+Requires:
+Libs:
+Cflags:
diff --git a/knetwortdeconf/backends/type1inst b/knetwortdeconf/backends/type1inst
new file mode 100755
index 0000000..86d6425
--- /dev/null
+++ b/knetwortdeconf/backends/type1inst
@@ -0,0 +1,1387 @@
+#!/usr/bin/perl
+#
+# You may need to change the above path.
+#
+#-----------------------------------------------------------------------------
+#
+# Copyright (C) 1996-1998 James Macnicol
+#
+# 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, 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 MERCHANTIBILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+#-----------------------------------------------------------------------------
+#
+# type1inst : Generate a "fonts.scale" file for Type 1 fonts in PFB format
+# for use with your favourite X server. Also generate a "Fontmap" for use
+# with ghostscript.
+#
+# cd to the directory you want to install fonts in and invoke this script.
+# Options:
+#
+# -samples Create sample PS files for each font
+# -nox Do not create fonts.scale and fonts.dir for X11
+# -nogs Do not create Fontmap for GhostScript
+# -quiet Don't print anything on the stdout, just to the log
+# (see also next section).
+# -silent Same as -quiet (for backwards compatiblity)
+# -q Same as -quiet
+# -nolog Don't create a log file
+# -version Print version info and quit
+# -v Same as -version
+#
+#
+#
+# THIS IS BETA SOFTWARE! PLEASE READ THE "README" FILE!!!
+#
+# Direct all correspondence regarding this software to
+#
+# J.Macnicol@student.anu.edu.au
+#
+#
+# Good luck!
+#
+#
+# James Macnicol
+#
+#-----------------------------------------------------------------------------
+
+# Version number and date information
+
+# NOTE THAT MY E-MAIL ADDRESS HAS CHANGED (AS OF VERSION 0.6.1) !!!!
+
+$version = "0.6.1";
+$versiondate = "11th February 1998";
+$emailaddress = "james.macnicol\@mailexcite.com";
+$copyright = "Copyright (C) 1996-1998 James Macnicol ($emailaddress)";
+
+#
+# Map identifying strings in /Notice into foundry names. Separate identifier
+# from name with a :. Someone let me know if this is a problem (i.e. foundry
+# has a : in its name which really ought to be there (although I may not
+# believe it) ; we'll change it to ! or something.
+#
+# You probably want to put foundries which license type from others near the
+# top of this list (e.g. Adobe). If the name of the original source of the
+# face is listed lower down then it will be used that instead. It's just that
+# Adobe does have its own faces too, but more often than not they are
+# licensed. Doing it this way will make it work out correctly in either case.
+#
+
+
+@foundries = (
+ "Adobe:adobe",
+ "Allied Corporation:allied",
+ "Publishers' Paradise:paradise",
+ "PUBLISHERS' PARADISE:paradise",
+ "Bigelow & Holmes:b&h",
+ "Bitstream:bitstream",
+ "Corel Corporation:corel",
+ "International Typeface Corporation:itc",
+ "IBM:ibm",
+ "LETRASET:letraset",
+ "Monotype Corporation:monotype",
+ "SoftMaker:softmaker",
+ "URW:urw",
+ "Jonathan Brecher:brecher",
+ "Brendel Informatik:brendel",
+ "A. Carr:carr",
+ "FontBank:fontbank",
+ "Hershey:hershey",
+ "A.S.Meit:meit",
+ "Andrew s. Meit:meit",
+ "S.G. Moye:moye",
+ "S. G. Moye:moye",
+ "D. Rakowski:rakowski",
+ "David Rakowski:rakowski",
+ "Reasonable Solutions:reasonable",
+ "Southern Software:southern",
+ "Title Wave:titlewave",
+ "ZSoft:zsoft",
+ "Digiteyes Multimedia:digiteyes",
+ "MWSoft:mwsoft",
+ "MacroMind:macromind",
+ "Three Islands Press:3ip",
+ "Hank Gillette:gillette",
+ "Doug Miles:miles",
+ "Richard Mitchell:mitchell");
+
+# Note: Hershey is the public Hershey fonts which come with Ghostscript.
+# These cause no end of problems since they look inside like funny PS
+# programs rather than standard fonts. The current version of type1inst will
+# refuse to process such fonts. Older versions (< 0.6) tended to fall over
+# when these were present.
+
+# Note 2 : Some of these are obviously names of people only, not companies.
+# They are generally public domain fonts.
+
+# Note 3 : Publisher's Paradise did not produce a majority of the fonts that
+# contain their name in the /Notice field, rather they distributed them on
+# their BBS. Unfortunately there is no other identifying info in these fonts.
+
+#
+# These are font weights. Some are synonyms, e.g. regular for medium. It
+# has been suggested we map "thin" to "light", however there are some font
+# families which have both "thin" and "light" variants. An example is
+# Linotype's Helvetica Neue. Please let me know if you find a font where
+# assuming "semi", and "demi" to be the same fails.
+#
+
+@weights = (
+ "book:book",
+ "demibold:demibold",
+ "semibold:demibold",
+ "demi:demibold",
+ "semi:demibold",
+ "extrabold:extrabold",
+ "boldface:bold",
+ "bold:bold",
+ "heavyface:heavyface",
+ "heavy:heavy",
+ "ultrablack:ultrablack",
+ "extrablack:extrablack",
+ "ultra:ultra", # it's gonna break some widths...
+ "black:black",
+ "extralight:extralight",
+ "light:light",
+ "thin:thin",
+ "super:super",
+ "thin:thin",
+ "light:light",
+ "semi:demi",
+ "bold:bold",
+ "heavy:heavy",
+ "black:black",
+ "normal:medium",
+ "regular:regular",
+ "roman:regular" # this too might break something...
+ );
+
+#
+# Likewise for slants
+#
+
+@slants = (
+ "italic:i",
+ "roman:r",
+ "regular:r",
+ # "it:i",
+ "cursive:i",
+ "kursiv:i",
+ "oblique:o",
+ "obl:o",
+ "slanted:o",
+ # Cyrillic fonts
+ "upright:r",
+ "inclined:i");
+
+#
+# Style. Wondering if we should put "serif" in here somehow....?
+#
+# I haven't put "ultracondensed" here since I think they're two different
+# things, i.e. Garamond Ultra Condensed is very bold but condensed.
+
+@styles = (
+ "extracondensed:extracondensed",
+ "condensed:condensed",
+ "cond:condensed",
+ "sans:sans",
+ "wide:wide",
+ "cn:condensed",
+ "narrow:narrow",
+ "extracompressed:extracompressed",
+ "compressed:compressed",
+ "extraextended:extraextended",
+ "extended:extended",
+ "expanded:expanded",
+ "normal:normal");
+
+#
+# Additional styles. Refer to the line that puts together $xline.
+#
+
+@addstyles = ("alt:alternate",
+ "beginning:beginning",
+ "display:display",
+ "dfr:dfr",
+ "ending:ending",
+ # "exp" and "ep" seems to be sometimes part of a fonts name,
+ # sometimes part of additional classification. I'm crying... :-(
+ "ep:expert",
+ "exp:expert",
+ "ornaments:ornaments",
+ "osf:oldstylefigures",
+ "outline:outline",
+ "sc:smallcaps",
+ "shaded:shaded",
+ "shadowed:shadowed",
+ "stencil:stencil",
+ "swash:swash",
+ "sw:swash",
+ "one:one",
+ "two:two",
+ "three:three",
+ "four:four",
+ # Some fonts use just "a" to mean a font with alternate
+ # character set.
+ "a:alternate");
+
+#
+# Write a message to the stdout and/or the log file depending on what the
+# user chose.
+#
+
+sub log_msg {
+ ($msg) = @_;
+
+ if (! $silent) {
+ print STDOUT "$msg";
+ }
+ if ($dologfile) {
+ print LOG "$msg";
+ }
+}
+
+sub log_only_msg {
+ ($msg) = @_;
+
+ if ($dologfile) {
+ print LOG "$msg";
+ }
+}
+
+#
+# Die with a bug message
+#
+
+sub die_bug {
+ ($msg) = @_;
+
+ die("BUG: $msg\nIf you have not modified the script in a way which might have\ncaused this error you are encouraged to report it as a bug to\n\n$emailaddress\n\n");
+}
+
+#
+# Print out a string with a given minimum width. This is used to make the
+# Fontmap entries look nice.
+#
+
+sub print_min_width {
+ ($stream, $minwidth, $string) = @_;
+ $_ = $string;
+ $strlength = length($string);
+ # Print the string
+ print $stream $string;
+ # Now pad out the rest of the space if the string is short.
+ if ($strlength < $minwidth) {
+ for ($i = 0; $i < ($minwidth - $strlength); $i = $i + 1) {
+ print $stream " ";
+ }
+ }
+}
+
+#
+# Indicate progress through the directory on the command line
+#
+
+sub print_progress {
+ $totalfonts = $numpffonts + $numgsfonts + $badfonts;
+ if (! $silent) {
+ if (($totalfonts % 10) == 0) {
+ print "[$totalfonts]\n";
+ }
+ }
+}
+
+#
+# Put the processing stuff into a procedure since we want to do the same for
+# .pfb, .pfa and .gsf files (once .pfb's are decompressed).
+#
+# Argument : filename.
+# Returns : X font description, name of font for Fontmap
+#
+
+sub process_font {
+ ($fname) = @_;
+ local($xline);
+
+ # Check to see if this is a ghostscript font
+ if ($fname =~ /\.gsf\s*$/) {
+ $gsfont = 1;
+ } else {
+ $gsfont = 0;
+ }
+
+ # Default is not MultipleMaster
+ $mm = 0;
+
+ open(IN, $fname) || die "cannot open $file for reading";
+ # An unlikely name to check to see we get a fontname out of the file.
+ $fontname = "abcXYZ:!@#";
+ $foundry = "unknown";
+ $notice = "No notice given.";
+ while(<IN>) {
+ if (/\/isFixedPitch\s+(.+)\s+def\s*/) {
+ if ($1 =~ /true/) {
+ $fixedpitch = "m";
+ } else {
+ $fixedpitch = "p";
+ }
+ }
+
+ # I think that we should accept the manufacturers classification.
+ # Try to extract this from FontName only if it's missing.
+ # (It shouldn't. There are other reasons why this won't work, though.)
+ if (/\/FamilyName\s*\((.+)\)\s+readonly\s+def\s*/) {
+ $familyname = $1;
+
+ # Convert to lower case (because case is insignificant).
+ # Spaces are acceptable according to XLFD.
+ $familyname =~ tr/A-Z/a-z/;
+ }
+ # Previous applies to this also... This might make xfontsels list a
+ # a little cluttered, though. Perhaps it would be better to map it
+ # to standard strings like you do. It's named $weight_add because
+ # you already used $weight...
+ if (/\/Weight\s*\((.+)\)\s+readonly\s+def\s*/) {
+ $weight_add = $1;
+
+ # Convert to lower case. Spaces are acceptable according to XLFD?
+ # Remove for consistency (as there would be any left after my
+ # slaughtering).
+ $weight_add =~ tr/A-Z/a-z/;
+ $weight_add =~ s/\s*//g;
+
+ # Remember if it's a MultipleMaster font
+ $mm = 1 if ($weight_add =~ /^all$/);
+ # Strange. This field seems to contain also width sometimes... remove it.
+ $numstyles = @styles;
+ for ($x = 0; $x < $numstyles; $x = $x + 1) {
+ $ident = $styles[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The style identification \"$ident\" is bad\n");
+ }
+ # Remove matched word from the font's name
+ $weight_add =~ s/$fields[0]//;
+ }
+ }
+ # FullName might contain useful information in determining
+ # the properties of a font.
+ if (/\/FullName\s*\((.+)\)\s+readonly\s+def\s*/) {
+ $fullname = $1;
+
+ # Convert to lower case
+ $fullname =~ tr/A-Z/a-z/;
+
+ # Some names got extra numerical information at the start.
+ $fullname =~ s/^\d*\s*(.+)/$1/;
+ }
+ # Note : some fonts have a suspect /FontName declaration where there
+ # is no space between /FontName and the name of the font itself....
+ if (/\/FontName\s*[\/\(]([^\)]+)\)?\s+def\s*/) {
+ $fontname = $1;
+
+ # Remove any embedded spaces
+ # (Probably unnecessary. If I remember it right, it can't contain any spaces,
+ # because it's a PostScript identifier/keyword or what's the right term...)
+ $fontname =~ s/\s//g;
+
+ # Save a copy of original full name for later
+ $fontnamecopy = $fontname;
+
+ # Convert to lower case
+ $fontname =~ tr/A-Z/a-z/;
+
+ # There are fonts like Mendoza Roman, Baskerville Book etc, where what
+ # looks like weight is part of the font's name, not it's weight.
+ # Split the name into fontname and fontstyle instead and handle them separate.
+ ($fontname, $fontstyle) = split(/-/, $fontname);
+
+ # Remove -s
+ $fontname =~ s/-//g;
+ $fontstyle =~ s/-//g;
+
+
+ # Check for weight modifiers (medium, bold, demi, light etc.)
+ $weight = "medium";
+ $numweights = @weights;
+ for ($x = 0; $x < $numweights; $x = $x + 1) {
+ $ident = $weights[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The weight identification \"$ident\" is bad\n");
+ }
+ if ($fontstyle =~ /$fields[0]/) {
+ $weight = $fields[1];
+ } elsif ($weight_add) {
+ # Try any possible way
+ $weight = $weight_add;
+ }
+ # Remove matched word from the font's name
+ $fontstyle =~ s/$fields[0]//;
+ }
+
+ # Check for slant (italic, roman, oblique)
+ $slant = "r";
+
+ $numslants = @slants;
+ for ($x = 0; $x < $numslants; $x = $x + 1) {
+ $ident = $slants[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The slant identification \"$ident\" is bad\n");
+ }
+ if ($fontstyle =~ /$fields[0]/) {
+ $slant = $fields[1];
+ }
+ # Remove matched word from the font's name
+ $fontstyle =~ s/$fields[0]//;
+ }
+
+ # Check for style (condensed, normal, sans, or wide)
+ $style = "normal";
+
+ $numstyles = @styles;
+ for ($x = 0; $x < $numstyles; $x = $x + 1) {
+ $ident = $styles[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The style identification \"$ident\" is bad\n");
+ }
+ if ($fontstyle =~ /$fields[0]/) {
+ $style = $fields[1];
+ }
+ # Remove matched word from the font's name
+ $fontstyle =~ s/$fields[0]//;
+ }
+
+ # Check for additional styles (alternate, smallcaps, oldstylefigures etc.)
+ $addstyle = "";
+
+ $numaddstyles = @addstyles;
+ for ($x = 0; $x < $numaddstyles; $x = $x + 1) {
+ $ident = $addstyles[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The additional style identification \"$ident\" is bad.\n");
+ }
+ if ($fontstyle =~ /$fields[0]/) {
+ $addstyle = $fields[1];
+ }
+ # Remove matched word from the font's name
+ $fontstyle =~ s/$fields[0]//;
+ }
+ }
+ if (/^\/Encoding\s+(\S+)\s*/) {
+ if ($1 =~ /StandardEncoding/) {
+ $encoding = "iso8859-1";
+ } else {
+ # This needs work
+ $encoding = "adobe-fontspecific";
+ }
+ }
+
+ if (/^\s*\/Notice\s*(.*)$/) {
+ $notice = $1;
+
+ $notice =~ s/readonly def//g;
+
+ $numfoundries = @foundries;
+ for ($x = 0; $x < $numfoundries; $x = $x + 1) {
+ $ident = $foundries[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The foundry identification \"$ident\" is bad.\n");
+ }
+ if ($notice =~ /$fields[0]/) {
+ $foundry = $fields[1];
+ }
+ }
+ }
+
+ # MultipleMaster fonts have this field.
+ if (/\/BlendAxisTypes\s+\[([^\]]+)\]\s*def/) {
+ $axis = $1;
+ # Remove axises we don't need
+ $axis =~ s/\/Weight\s+//;
+ $axis =~ s/\/Width\s+//;
+ # Are there still some axises left?
+ if ($axis =~ /\//) {
+ # Remove trailing spaces
+ $axis =~ s/^(.*?)\s*$/$1/;
+ $axis =~ s/\/\S+/0/g;
+ $axis= "[$axis]";
+ }
+ }
+
+ # Break out of loop if we've passed the interesting stuff.
+ # And time to try another way to find out the fontname.
+ if ((! $gsfont) && (/currentfile\s+eexec/)) {
+ &try_another_way();
+ # This is for .pfa and .pfb fonts
+ last;
+ } elsif (($gsfont) && (/currentdict\s+end/)) {
+ &try_another_way();
+ # This is for ghostscript .gsf fonts. Why don't all these have a
+ # currentfile eexec ?
+ last;
+ }
+ }
+ close(IN);
+
+ # I use quite different mechanism to get fontname etc. However it's done,
+ # the results are hard to get right. Should it be a command-line option?
+ # Now I try both ways.
+
+ # familyname, use fontname
+ $familyname = ($anotherway ? $familyname : $fontname);
+
+ # Oh, we are dealing with a MultipleMaster font...
+ if ($mm) {
+ $weight = "0";
+ $style = "0";
+ $addstyle .= $axis;
+ }
+
+ if ($familyname =~ /abcXYZ\:\!\@\#/) {
+ log_only_msg("\n");
+ log_only_msg("$filename : could not determine font name\n");
+ log_only_msg("\n");
+ $badfonts = $badfonts + 1;
+ &print_progress();
+ return;
+ }
+
+ if (($dox) && (! $gsfont) && ($foundry =~ /unknown/)) {
+ $nofoundry = $nofoundry + 1;
+ log_only_msg("\n");
+ log_only_msg("$filename ($fontnamecopy) : foundry not matched\n");
+ log_only_msg(" /Notice said : \"$notice\"\n");
+ log_only_msg("\n");
+ } elsif ($dox) {
+# log_only_msg("$filename ($fontnamecopy) : okay\n");
+ }
+
+ if (($dox) && (! $gsfont)) {
+ # Addstyle is any extra information needed to uniquely identify a variation of a font
+ # in it's family, like "alternate" (ACaslon-AltRegular) or "one" (EuropeanPi-One).
+ # Changed fontname to familyname because it describes that field better, but that's
+ # just my opinion...
+ $xline = "-$foundry-$familyname-$weight-$slant-$style-$addstyle-0-0-0-0-$fixedpitch-0-$encoding";
+ }
+
+ # Update count of each type
+ if ($gsfont) {
+ $numgsfonts = $numgsfonts + 1;
+ } else {
+ $numpffonts = $numpffonts + 1;
+ }
+
+ &print_progress();
+
+ ($xline, $fontnamecopy);
+}
+
+
+#
+# An alternative way to get fontname
+#
+
+sub try_another_way {
+ # Strip familyname from fullname. This seems to work most of time.
+ # Some fontnames have extra numerical information after familyname.
+ # Strip it if it's longer than two numbers.
+ # Otherwise, it's probably part of additional style classification.
+ # In a few cases it IS part of the name, and this algorithm should break.
+ # Sometimes there's a strange string of *'s somewhere. Get rid of it.
+ $fullname =~ s/\*//g;
+ print STDERR "1: ${fullname}:\n" if $debug;
+ if ($fullname =~ s/^$familyname\s*(\d\d+)?\s*(.*)/$2/) {
+ # Wow. It worked. Let's continue and remove excess whitespace.
+ $anotherway = 1;
+ $fullname =~ s/\s+//g;
+
+ # familyname can now stripped of -s
+ $familyname =~ s/-//g; # Or space?
+ print STDERR "2: ${fullname}:\n" if $debug;
+
+ # Check for weight modifiers (medium, bold, demi, light etc.)
+ $weight = "medium";
+ $numweights = @weights;
+ for ($x = 0; $x < $numweights; $x = $x + 1) {
+ $ident = $weights[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The weight identification \"$ident\" is bad\n");
+ }
+ if ($fullname =~ /$fields[0]/) {
+ $weight = $fields[1];
+ $weight =~ s/-//g;
+ }
+ # Remove matched word from the font's name
+ $fullname =~ s/$fields[0]//;
+ }
+
+ print STDERR "3: ${fullname}:\n" if $debug;
+
+ # Check for slant (italic, oblique)
+ $slant = "r";
+
+ $numslants = @slants;
+ for ($x = 0; $x < $numslants; $x = $x + 1) {
+ $ident = $slants[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The slant identification \"$ident\" is bad\n");
+ }
+ if ($fullname =~ /$fields[0]/) {
+ $slant = $fields[1];
+ $slant =~ s/-//g;
+ }
+ # Remove matched word from the font's name
+ $fullname =~ s/$fields[0]//;
+ }
+ print STDERR "4: ${fullname}:\n" if $debug;
+ # Check for style (normal or sans)
+ $style = "normal";
+
+ $numstyles = @styles;
+ for ($x = 0; $x < $numstyles; $x = $x + 1) {
+ $ident = $styles[$x];
+ @fields = split(/:/, $ident);
+ $numfields = @fields;
+ if ($numfields != 2) {
+ die_bug("The style identification \"$ident\" is bad\n");
+ }
+ if ($fullname =~ /$fields[0]/) {
+ $style = $fields[1];
+ $style =~ s/-//g;
+ }
+ # Remove matched word from the font's name
+ $fullname =~ s/$fields[0]//;
+ }
+
+ # What's left of fullname is probably additional style information.
+ # Some fontnames have some strange numerical information here too.
+ # If it's just one number, it usually refers to some variant of the
+ # fontfamily, otherwise, just get rid of it.
+ $fullname = "" if ($fullname =~ /^\d\d+$/);
+ print STDERR "5: ${fullname}:\n" if $debug;
+ $addstyle = $fullname;
+ $addstyle =~ s/-//g;
+ } else {
+ $anotherway = 0;
+ }
+}
+
+#
+# Makes associative array out of current entries in fonts.scale
+#
+
+sub read_fonts_scale {
+ local($finish, %rv, $line, $filename, $fontname);
+
+ $finish = open(SCALE, "fonts.scale") ? 0 : 1;
+ if ($finish == 1) {
+ %rv;
+ }
+
+ log_only_msg("Reading fonts.scale ....");
+
+ # First line should be an integer saying how many fonts there are.
+ # Discard.
+ $line = <SCALE>;
+ if (! $line =~ /\s*[0-9]+\s*/) {
+ log_only_msg("Warning : first line of fonts.scale is bad\n");
+ }
+
+ while (<SCALE>) {
+ # Very rough pattern
+ if (/\s*(\S+)\s+(.+)\s*/) {
+ chop;
+ $filename = $1;
+ $fontname = $2;
+ if (! -e $filename) {
+ $numxremoved++;
+ log_only_msg("Removed fonts.scale entry \"$_\" since the file did not exist\n");
+ next;
+ }
+ if ($rv{$filename}) {
+ $numxduplicates++;
+ log_only_msg("Warning : fonts.scale already contains a line for file \"$filename\"\n");
+ log_only_msg(" the line \"$_\" has been ignored\n");
+ } else {
+ $rv{$filename} = $fontname;
+ }
+ } else {
+ log_only_msg(" Couldn't understand line : \n");
+ log_only_msg(" \"$_\"\n");
+ }
+ }
+ close(SCALE);
+
+ log_only_msg("Done.\n");
+
+ %rv;
+}
+
+#
+# Write out an associative array into fonts.scale, making a backup copy
+# first.
+#
+
+sub write_fonts_scale {
+ (%fontdata) = @_;
+ local($numentries, $key);
+
+ # First, make backup copy
+ if (-e "fonts.scale") {
+ system ("cp -f fonts.scale fonts.scale.bak");
+ }
+
+ log_only_msg("Writing fonts.scale....\n");
+
+ $numentries = keys(%fontdata);
+ open(SCALE, ">fonts.scale") || die("Can't open fonts.scale!\n");
+ print SCALE "$numentries\n";
+ foreach $key (sort(keys %fontdata)) {
+ print_min_width(SCALE, 12, $key);
+ print SCALE " ";
+ print SCALE "$fontdata{$key}\n";
+ }
+ close(SCALE);
+ system ("chmod 0755 fonts.scale") && log_msg("Coudln't chmod \"fonts.scale\" ... continuing on anyway\n");
+
+ log_only_msg(" Done.\n");
+}
+
+#
+# Read the current Fontmap and return associative array with data.
+#
+
+sub read_fontmap {
+ local(%rv, $finish, $fontname, $filename);
+
+ $finish = open(FONTMAP, "Fontmap") ? 0 : 1;
+ if ($finish) {
+ %rv;
+ }
+
+ log_only_msg("Reading Fontmap ....\n");
+
+ while (<FONTMAP>) {
+ if (/\/+(\S+)\s+\((.*)\)\s+;\s+/) {
+ chop;
+ $fontname = $1;
+ $filename = $2;
+ if (! -e $filename) {
+ $numgsremoved++;
+ log_only_msg("Removed Fontmap entry \"$_\" since the file did not exist\n");
+ next;
+ }
+ if ($rv{$filename}) {
+ # Entry already exists
+ $numgsduplicates++;
+ log_only_msg("Warning : the Fontmap already contains a line for file \"$filename\"\n");
+ log_only_msg(" the line \"$_\" has been ignored\n");
+ } else {
+ $rv{$filename} = $fontname;
+ }
+ } else {
+ $numgsbarf++;
+ log_only_msg("Couldn't understand line :\n");
+ log_only_msg(" $_\n");
+ }
+ }
+
+ close(FONTMAP);
+
+ log_only_msg("Done.\n");
+
+ %rv;
+}
+
+#
+# Write associative array containing font data to Fontmap
+#
+
+sub write_fontmap {
+ (%fontdata) = @_;
+ local($numentries, $key);
+
+ # First, make backup copy
+ if (-e "Fontmap") {
+ system ("cp -f Fontmap Fontmap.bak");
+ }
+
+ log_only_msg("Writing Fontmap....");
+
+ $numentries = keys(%fontdata);
+ open(FONTMAP, ">Fontmap") || die("Couldn't open Fontmap!\n");
+ foreach $key (sort(keys %fontdata)) {
+ print_min_width(FONTMAP, 40, "/$fontdata{$key}");
+ print FONTMAP " ";
+ print FONTMAP "($key)\t;\n";
+ }
+ close(FONTMAP);
+ system ("chmod 0755 Fontmap") && log_msg("Couldn't chmod \"Fontmap\" ... continuing on anyway\n");
+
+ log_only_msg(" Done.\n");
+}
+
+#
+# Add a font (either X or gs) to hash table
+#
+
+sub add_font_to_aarray {
+ ($fname, $text, %aa) = @_;
+
+ if (($text =~ /^\s*$/) || ($fname =~ /^\s*$/)) {
+ # This will occur if the font is a dud (e.g. a Hershey font). We
+ # assume that $badfonts has been incremented and we just return.
+ %aa;
+ }
+
+ if (! $aa{$fname}) {
+ $aa{$fname} = $text;
+ }
+
+ %aa;
+}
+
+#
+# Create sample text using each font
+#
+
+sub font_sample {
+ ($filename, $fontname, $height) = @_;
+ local($text, $alltext, $samplefile);
+
+ if (($filename =~ /^\s*$/) || ($fontname =~ /^s*$/)) {
+ print "font_sample: $filename, $fontname\n";
+ die_bug("Bad argument(s) to font_sample()!\n");
+ }
+
+# Here we create a full page sample for the current font. It contains
+# a large point-size version, a normal sized version, and a small version.
+
+ $text = <<"TEXT";
+%!
+%%EndComments
+/$samplefont findfont
+18 scalefont
+setfont
+newpath
+200 715 moveto
+(File : $filename) show
+200 695 moveto
+(Font Name : $fontname) show
+% t1embed : $filename $fontname
+closepath
+
+/$fontname findfont
+60 scalefont
+setfont
+newpath
+40 640 moveto
+(ABCDE) show
+40 575 moveto
+(FGHIJK) show
+40 510 moveto
+(LMNOP) show
+40 445 moveto
+(QRSTU) show
+40 380 moveto
+(VWXYZ) show
+40 305 moveto
+(abcdefghijklm) show
+40 240 moveto
+(nopqrstuvwxyz) show
+40 175 moveto
+(1234567890) show
+closepath
+
+/$fontname findfont
+12 scalefont
+setfont
+newpath
+50 148 moveto
+(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) show
+50 132 moveto
+(a b c d e f g h i j k l m n o p q r s t u v w x y z) show
+50 116 moveto
+(1 2 3 4 5 6 7 8 9 0 \! \$ \% \& \\\( \\\) \; \: \< \> ) show
+closepath
+
+/$fontname findfont
+4 scalefont
+setfont
+newpath
+50 99 moveto
+(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) show
+50 93 moveto
+(a b c d e f g h i j k l m n o p q r s t u v w x y z) show
+50 87 moveto
+(1 2 3 4 5 6 7 8 9 0 \! \$ \% \& \\\( \\\) \; \: \< \> ) show
+closepath
+showpage
+TEXT
+
+ $samplefile = $fontname . ".ps";
+ open(SAMPLE, ">samples/$samplefile") ||
+ die("Couldn't open samples/$samplefile\n");
+ print SAMPLE "$text\n";
+ close(SAMPLE);
+ system("chmod 0755 samples/$samplefile") && log_msg("Couldn't chmod individual sample file \"samples/$samplefile\" ... continuing on anyway\n");
+
+# For the "allfont.ps" files we use a standard font for the font name so
+# that in the case of non-alpha fonts we still can still read the name of
+# the font (eg symbol or dingbats).
+
+ if ($height == 700) {
+ $allsample = "samples/allfont-$allcount.ps";
+ $allcount = $allcount + 1;
+
+ log_only_msg("Creating new sample file \"$allsample\"....");
+ open(ALLSAMPLE, ">$allsample") ||
+ die("Couldn't open $allsample\n");
+ log_only_msg("done\n");
+ print ALLSAMPLE "%!\n";
+ print ALLSAMPLE "%%EndComments\n";
+ }
+
+ $alltext = <<"ALLTEXT";
+
+% t1embed : $filename $fontname
+/$samplefont findfont
+12 scalefont
+setfont
+newpath
+30 $height moveto
+($fontname : ) show
+/$fontname findfont
+20 scalefont
+setfont
+(AbCdEfGhIjKlMnOpQrStUvWxYz 0123456789) show
+closepath
+ALLTEXT
+
+ print ALLSAMPLE "$alltext\n";
+ $height = $height - 32;
+ if ($height < 100) {
+ print ALLSAMPLE "showpage\n";
+ close(ALLSAMPLE);
+ system("chmod 0755 $allsample") && log_msg("Couldn't chmod all sample sheet \"$allsample\" ... continuing on anyway\n");
+ $height = 700;
+ }
+
+ ($height);
+}
+
+#
+# Some users have had problems with perl's file globbing not working. This
+# gets a shell to do it for us. It matches all files with the extension
+# specified in the parameter, i.e. if pat = "foo" then it matches all of
+# *.foo .
+#
+
+sub do_glob {
+ ($pat) = @_;
+ local($raw, @fnames);
+ open(SHELL, "echo *.$pat|") || die("Couldn't open shell in do_glob\n");
+ $raw = <SHELL>;
+ $raw =~ s/\*\.$pat//;
+ @fnames = split(/\s/,$raw);
+ close(SHELL);
+ (@fnames);
+}
+
+# ------------------------------------------------------------------------
+# Start of program proper
+# ------------------------------------------------------------------------
+
+# Process command line arguments
+$workdir = 0;
+$dox = 1;
+$dogs = 1;
+$silent = 0;
+$samples = 0;
+$dologfile = 1;
+@argvcopy = (@ARGV);
+$numargs = @ARGV;
+for ($x = 0; $x < $numargs; $x = $x + 1) {
+ $arg = $ARGV[$x];
+ if ($arg =~ /-nox/) {
+ $dox = 0;
+ } elsif ($arg =~ /-nogs/) {
+ $dogs = 0;
+ } elsif ($arg =~ /-silent/) {
+ $silent = 1;
+ } elsif ($arg =~ /-quiet/) {
+ $silent = 1;
+ } elsif ($arg =~ /-q/) {
+ $silent = 1;
+ } elsif ($arg =~ /-samples/) {
+ $samples = 1;
+ } elsif ($arg =~ /-nolog/) {
+ $dologfile = 0;
+ } elsif ($arg =~ /-d/) {
+ $x++;
+ $workdir = $ARGV[$x];
+ } elsif ($arg =~ /-version/) {
+ die("type1inst version $version ($versiondate)\n$copyright\n");
+ } elsif ($arg =~ /-v/) {
+ die("type1inst version $version ($versiondate)\n$copyright\n");
+ } else {
+ die("Usage: $0 [-silent] [-quiet] [-q] [-nox] [-nogs] [-samples] [-version] [-v]\n");
+ }
+}
+if ((! $dox) && (! $dogs) && (! $samples)) {
+ die("$0: Nothing to do!\n");
+}
+
+if ($workdir) {
+ chdir $workdir || die "Cannot change to \"$workdir\"";
+}
+
+# Open logfile
+if ($dologfile) {
+ open(LOG, ">type1inst.log") || die "Cannot open log file \"type1inst.log\"";
+}
+
+log_only_msg("type1inst Version $version ($versiondate)\n");
+log_only_msg("$copyright\n\n");
+open (DATE, "date|") || die("Couldn't run \"date\"\n");
+$currenttime = <DATE>;
+log_only_msg("Run started at $currenttime\n");
+close(DATE);
+
+# Setup directory for font samples
+if ($samples) {
+ if (! -e "samples") {
+ # Create directory for sample text PS files
+ log_only_msg("Creating directory for samples ...\n");
+ system("mkdir samples");
+ system("chmod 0755 samples") && log_msg("Coudln't chmod \"samples\" directory\n");
+
+ } elsif (-f "samples") {
+ die("$0: remove file \"samples\" or do not use -samples option\n");
+ } else {
+ log_msg("Clearing samples directory\n");
+ system("rm -f samples/*.ps");
+ }
+ $height = 700;
+ $samplefont = "Helvetica";
+ $allcount = 0;
+ $allsample = "samples/allfont-$allcount.ps";
+ log_only_msg("Creating new sample file \"$allsample\"....");
+ open(ALLSAMPLE, ">$allsample") || die("Couldn't open all sample file \"$allsample\"\n");
+ log_only_msg("done\n");
+ print ALLSAMPLE "%!\n";
+ print ALLSAMPLE "%%EndComments\n";
+}
+
+
+# Counts how many fonts we come across
+$numpffonts = 0;
+$numgsfonts = 0;
+$nofoundry = 0;
+$badfonts = 0;
+$numskipped = 0;
+$numxremoved = 0;
+$numgsremoved = 0;
+$numxduplicates = 0;
+$numgsduplicates = 0;
+$numxbarf = 0;
+$numgsbarf = 0;
+
+if (! $silent) {
+ print "type1inst Version $version ($versiondate)\n";
+ print "$copyright\n\n";
+}
+
+$totalfonts = 0;
+foreach $filename (do_glob("pfa")) {
+ $totalfonts++;
+}
+foreach $filename (do_glob("pfb")) {
+ $totalfonts++;
+}
+foreach $filename (do_glob("pfa.gz")) {
+ $totalfonts++;
+}
+foreach $filename (do_glob("pfb.gz")) {
+ $totalfonts++;
+}
+foreach $filename (do_glob("gsf")) {
+ $totalfonts++;
+}
+if (! $silent) {
+ if ($totalfonts == 0) {
+ die("There are no PostScript fonts in this directory\n");
+ } elsif ($totalfonts == 1) {
+ print "There is 1 PostScript font in this directory\n";
+ } else {
+ print "There are a total of $totalfonts PostScript fonts in this directory\n";
+ }
+}
+
+if ($dox) {
+ %fs = &read_fonts_scale();
+}
+if (($dogs) || ($samples)) {
+ %fm = &read_fontmap();
+}
+
+# Process ASCII PS fonts
+foreach $filename (do_glob("pfa")) {
+ if (($dox && (! $fs{$filename})) ||
+ (($dogs || $samples) && (! $fm{$filename}))) {
+ ($x, $gs) = &process_font($filename);
+ if ($dox) {
+ %fs = &add_font_to_aarray($filename, $x, %fs);
+ }
+ if (($dogs) || ($samples)) {
+ %fm = &add_font_to_aarray($filename, $gs, %fm);
+ }
+ } else {
+ $numpffonts = $numpffonts + 1;
+ $numskipped = $numskipped + 1;
+ &print_progress();
+ }
+ if ($samples) {
+ ($height) = &font_sample($filename, $fm{$filename}, $height);
+ }
+}
+
+# Process binary PS fonts
+foreach $filename (do_glob("pfb")) {
+ if (($dox && (! $fs{$filename})) ||
+ (($dogs || $samples) && (! $fm{$filename}))) {
+ system("pfbtops $filename > foo");
+ ($x, $gs) = &process_font("foo");
+ system("rm foo");
+ if ($dox) {
+ %fs = &add_font_to_aarray($filename, $x, %fs);
+ }
+ if ($dogs || $samples) {
+ %fm = &add_font_to_aarray($filename, $gs, %fm);
+ }
+ } else {
+ $numpffonts = $numpffonts + 1;
+ $numskipped = $numskipped + 1;
+ &print_progress();
+ }
+ if ($samples) {
+ ($height) = &font_sample($filename, $fm{$filename}, $height);
+ }
+}
+
+# Process binary PS fonts
+foreach $filename (do_glob("pfa.gz")) {
+ if (($dox && (! $fs{$filename})) ||
+ (($dogs || $samples) && (! $fm{$filename}))) {
+ system("gunzip -c $filename > foo");
+ ($x, $gs) = &process_font("foo");
+ system("rm foo");
+ if ($dox) {
+ %fs = &add_font_to_aarray($filename, $x, %fs);
+ }
+ if ($dogs || $samples) {
+ %fm = &add_font_to_aarray($filename, $gs, %fm);
+ }
+ } else {
+ $numpffonts = $numpffonts + 1;
+ $numskipped = $numskipped + 1;
+ &print_progress();
+ }
+ if ($samples) {
+ ($height) = &font_sample($filename, $fm{$filename}, $height);
+ }
+}
+
+# Process binary PS fonts
+foreach $filename (do_glob("pfb.gz")) {
+ if (($dox && (! $fs{$filename})) ||
+ (($dogs || $samples) && (! $fm{$filename}))) {
+ system("gunzip -c $filename | pfbtops > foo");
+ ($x, $gs) = &process_font("foo");
+ system("rm foo");
+ if ($dox) {
+ %fs = &add_font_to_aarray($filename, $x, %fs);
+ }
+ if ($dogs || $samples) {
+ %fm = &add_font_to_aarray($filename, $gs, %fm);
+ }
+ } else {
+ $numpffonts = $numpffonts + 1;
+ $numskipped = $numskipped + 1;
+ &print_progress();
+ }
+ if ($samples) {
+ ($height) = &font_sample($filename, $fm{$filename}, $height);
+ }
+}
+
+# Process Ghostscript fonts
+if ($dogs || $samples) {
+ foreach $filename (do_glob("gsf")) {
+ if (! $fm{$filename}) {
+ ($x, $gs) = &process_font($filename);
+ %fm = &add_font_to_aarray($filename, $gs, %fm);
+ } else {
+ $numgsfonts = $numgsfonts + 1;
+ $numskipped = $numskipped + 1;
+ &print_progress();
+ }
+ if ($samples) {
+ ($height) = &font_sample($filename, $fm{$filename}, $height);
+ }
+ }
+}
+
+if ($dox) {
+ &write_fonts_scale(%fs);
+ system("mkfontdir"); # Generate fonts.dir
+ system("chmod 0755 fonts.dir") && log_msg("Couldn't chmod \"fonts.dir\" ... continuing on anyway\n");
+}
+if ($dogs) {
+ &write_fontmap(%fm);
+}
+
+# Finish up the all font sample file
+if ($samples) {
+ log_only_msg("Finished font sample files\n");
+ if ($height < 700) {
+ print ALLSAMPLE "showpage\n";
+ close(ALLSAMPLE);
+ system("chmod 0755 $allsample") && log_msg("Couldn't chmod \"$allsample\" ... continuing on anyway\n");
+ }
+}
+
+# Report
+if (! $silent) {
+ $totalfonts = $numpffonts + $numgsfonts + $badfonts;
+
+ # List statistics
+ print "-------------------------------------------------------\n";
+ if ($totalfonts == 0) {
+ print "No fonts were found in this directory\n";
+ } elsif ($totalfonts == 1) {
+ print "1 font was found in this directory\n";
+ } else {
+ print "$totalfonts fonts found\n";
+ }
+ if ($numpffonts == 1) {
+ print "1 was a PostScript font\n";
+ } elsif ($numpffonts > 1) {
+ print "$numpffonts were standard PostScript fonts\n";
+ }
+ if ($numgsfonts == 1) {
+ print "1 was a Ghostscript font\n";
+ } elsif ($numgsfonts > 1) {
+ print "$numgsfonts were Ghostscript fonts\n";
+ }
+ if ($numskipped == 1) {
+ print "\n";
+ print "I skipped one of these fonts because it already had\n";
+ print "an overriding entry in both fonts.scale and/or Fontmap\n";
+ print "(X Windows font or Ghostscript font respectively).\n";
+ } elsif ($numskipped > 1) {
+ print "\n";
+ print "I skipped $numskipped of these fonts because they already\n";
+ print "had overriding entries in both fonts.scale and/or Fontmap\n";
+ print "(X Windows fonts or Ghostscript fonts respectively).\n";
+ }
+
+ # Print error messages
+ $wereerrors = 0;
+ if ($badfonts > 0) {
+ $wereerrors = 1;
+ print "-------------------------------------------------------\n";
+ if ($badfonts == 1) {
+ print "I couldn't extract a font name for 1 font in\n";
+ } else {
+ print "I couldn't extract font names for $ badfonts fonts in\n";
+ }
+ print "this directory. This means the font file had a non-standard\n";
+ print "format which this program doesn't know about or cannot do\n";
+ print "anything with. Check the README file to find out more.\n";
+ }
+ if ($dox) {
+ if ($nofoundry > 0) {
+ $wereerrors = 1;
+ print "-------------------------------------------------------\n";
+ print "For $nofoundry of these I couldn't figure out which foundry\n";
+ print "the font is from. Thus, these fonts will appear under the\n";
+ print "foundry unknown, i.e. X font name -unknown-*.\n";
+ print "Please consult the README file to see what this means.\n";
+ }
+
+ if ($numxremoved > 0) {
+ $wereerrors = 1;
+ print "-------------------------------------------------------\n";
+ if ($numxremoved == 1) {
+ print "While reading the existing fonts.scale file I saw 1 entry\n";
+ } else {
+ print "While reading the existing fonts.scale file I saw $numxremoved entries\n";
+ }
+ print "which mentioned a filename which now does not exist. Most likely\n";
+ print "you removed or renamed the file. I ignored these entries.\n";
+ }
+ if ($numxbarf > 0) {
+ $wereerrors = 1;
+ print "-------------------------------------------------------\n";
+ if ($numxbarf == 1) {
+ print "There was a line in fonts.scale I couldn't understand.\n";
+ } else {
+ print "There were $numxbarf lines in fonts.scale which I couldn't understand\n";
+ }
+ print "These were ignored.\n";
+ }
+ }
+ if ($dogs) {
+ if ($numgsremoved > 0) {
+ $wereerrors = 1;
+ print "-------------------------------------------------------\n";
+ if ($numgsremoved == 1) {
+ print "While reading the existing Fontmap file I saw 1 entry\n";
+ } else {
+ print "While reading the existing Fontmap file I saw $numgsremoved entries\n";
+ }
+ print "which mentioned a filename which now does not exist. Most likely\n";
+ print "you removed or renamed the file. I ignored these entries.\n";
+ }
+ if ($numgsbarf > 0) {
+ $wereerrors = 1;
+ print "-------------------------------------------------------\n";
+ if ($numgsbarf == 1) {
+ print "There was a line in Fontmap I couldn't understand.\n";
+ } else {
+ print "There were $numgsbarf lines in Fontmap which I couldn't understand\n";
+ }
+ print "These were ignored.\n";
+ }
+ }
+
+ if ($wereerrors) {
+ print "-------------------------------------------------------\n";
+ print "\n";
+ print "A log of errors is located in the file \"type1inst.log\"\n";
+ print "\n";
+ }
+}
diff --git a/knetwortdeconf/backends/util.pl.in b/knetwortdeconf/backends/util.pl.in
new file mode 100644
index 0000000..b175fb8
--- /dev/null
+++ b/knetwortdeconf/backends/util.pl.in
@@ -0,0 +1,463 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# Utility functions.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+# Arturo Espinosa <arturo@ximian.com>
+# Michael Vogt <mvo@debian.org> - Debian 2.[2|3] support.
+# David Lee Ludwig <davidl@wpi.edu> - Debian 2.[2|3] support.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+# --- Utilities for strings, arrays and other data structures --- #
+
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+sub gst_max
+{
+ return ($_[0] > $_[1])? $_[0]: $_[1];
+}
+
+# Boolean <-> strings conversion.
+
+sub gst_util_read_boolean
+{
+ my ($v) = @_;
+
+ return 1 if ($v =~ "true" ||
+ $v =~ "yes" ||
+ $v =~ "YES" ||
+ $v =~ "on" ||
+ $v eq "1");
+ return 0;
+}
+
+
+sub gst_print_boolean_yesno
+{
+ if ($_[0] == 1) { return "yes"; }
+ return "no";
+}
+
+
+sub gst_print_boolean_truefalse
+{
+ if ($_[0] == 1) { return "true"; }
+ return "false";
+}
+
+
+sub gst_print_boolean_onoff
+{
+ if ($_[0] == 1) { return "on"; }
+ return "off";
+}
+
+
+# Pushes a list to an array, only if it's not already in there.
+# I'm sure there's a smarter way to do this. Should only be used for small
+# lists, as it's O(N^2). Larger lists with unique members should use a hash.
+
+sub gst_push_unique
+{
+ my $arr = $_[0];
+ my $found;
+ my $i;
+
+ # Go through all elements in pushed list.
+
+ for ($i = 1; $_[$i]; $i++)
+ {
+ # Compare against all elements in destination array.
+
+ $found = "";
+ for $elem (@$arr)
+ {
+ if ($elem eq $_[$i]) { $found = $elem; last; }
+ }
+
+ if ($found eq "") { push (@$arr, $_[$i]); }
+ }
+}
+
+
+# Merges scr array into dest array.
+sub gst_arr_merge
+{
+ my ($dest, $src) = @_;
+ my (%h, $i);
+
+ foreach $i (@$a, @$b)
+ {
+ $h{$i} = 1;
+ }
+
+ @$a = keys %h;
+ return $a;
+}
+
+# Given an array and a pattern, it returns the index of the
+# array that contains it
+sub gst_array_find_index
+{
+ my($arrayRef, $pattern) = @_;
+ my(@array) = @{$arrayRef};
+ my($numElements) = scalar(@array);
+ my(@indexes) = (0..$numElements);
+ my(@elements);
+
+ @elements = grep @{$arrayRef}[$_] =~ /$pattern/, @indexes;
+ return(wantarray ? @elements : $elements[0]);
+}
+
+
+
+sub gst_ignore_line
+{
+ if (($_[0] =~ /^[ \t]*\#/) || ($_[0] =~ /^[ \t\n\r]*$/)) { return 1; }
+ return 0;
+}
+
+
+# &gst_item_is_in_list
+#
+# Given:
+# * A scalar value.
+# * An array.
+# this function will return 1 if the scalar value is in the array, 0 otherwise.
+
+sub gst_item_is_in_list
+{
+ my ($value, @arr) = @_;
+ my ($item);
+
+ foreach $item (@arr)
+ {
+ return 1 if $value eq $item;
+ }
+
+ return 0;
+}
+
+
+# Recursively compare a structure made of nested arrays and hashes, diving
+# into references, if necessary. Circular references will cause a loop.
+# Watch it: arrays must have elements in the same order to be equal.
+sub gst_util_struct_eq
+{
+ my ($a1, $a2) = @_;
+ my ($type1, $type2);
+ my (@keys1, @keys2);
+ my ($elem1, $elem2);
+ my $i;
+
+ $type1 = ref $a1;
+ $type2 = ref $a2;
+
+ return 0 if $type1 != $type2;
+ return 1 if $a1 eq $a2;
+ return 0 if (!$type1); # Scalars
+
+ if ($type1 eq "SCALAR") {
+ return 0 if $$a1 ne $$a2;
+ }
+ elsif ($type1 eq "ARRAY")
+ {
+ return 0 if $#$a1 != $#$a2;
+
+ for ($i = 0; $i <= $#$a1; $i++)
+ {
+ return 0 if !&gst_util_struct_eq ($$a1[$i], $$a2[$i]);
+ }
+ }
+ elsif ($type1 eq "HASH") {
+ @keys1 = sort keys (%$a1);
+ @keys2 = sort keys (%$a2);
+
+ return 0 if !&gst_util_struct_eq (\@keys1, \@keys2);
+ foreach $i (@keys1)
+ {
+ return 0 if !&gst_util_struct_eq ($$a1{$i}, $$a2{$i});
+ }
+ }
+ else
+ {
+ return 0;
+ }
+
+ return 1;
+}
+
+
+# &gst_get_key_for_subkeys
+#
+# Given:
+# * A hash-table with its values containing references to other hash-tables,
+# which are called "sub-hash-tables".
+# * A list of possible keys (stored as strings), called the "match_list".
+# this method will look through the "sub-keys" (the keys of each
+# sub-hash-table) seeing if one of them matches up with an item in the
+# match_list. If so, the key will be returned.
+
+sub gst_get_key_for_subkeys
+{
+ my %hash = %{$_[0]};
+ my @match_list = @{$_[1]};
+
+ foreach $key (keys (%hash))
+ {
+ my %subhash = %{$hash{$key}};
+ foreach $item (@match_list)
+ {
+ if ($subhash{$item} ne "") { return $key; }
+ }
+ }
+
+ return "";
+}
+
+
+# &gst_get_key_for_subkey_and_subvalues
+#
+# Given:
+# * A hash-table with its values containing references to other hash-tables,
+# which are called "sub-hash-tables". These sub-hash-tables contain
+# "sub-keys" with associated "sub-values".
+# * A sub-key, called the "match_key".
+# * A list of possible sub-values, called the "match_list".
+# this function will look through each sub-hash-table looking for an entry
+# whose:
+# * sub-key equals match_key.
+# * sub-key associated sub-value is contained in the match_list.
+
+sub gst_get_key_for_subkey_and_subvalues
+{
+ my %hash = %{$_[0]};
+ my $key;
+ my $match_key = $_[1];
+ my @match_list = @{$_[2]};
+
+ foreach $key (keys (%hash))
+ {
+ my %subhash = %{$hash{$key}};
+ my $subvalue = $subhash{$match_key};
+
+ if ($subvalue eq "") { next; }
+
+ foreach $item (@match_list)
+ {
+ if ($item eq $subvalue) { return $key; }
+ }
+ }
+
+ return "";
+}
+
+
+# --- IP calculation --- #
+
+
+# &gst_ip_calc_network (<IP>, <netmask>)
+#
+# Calculates the network address and returns it as a string.
+
+sub gst_ip_calc_network
+{
+ my @ip_reg1;
+ my @ip_reg2;
+
+ @ip_reg1 = ($_[0] =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);
+ @ip_reg2 = ($_[1] =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);
+
+ $ip_reg1[0] = ($ip_reg1[0] * 1) & ($ip_reg2[0] * 1);
+ $ip_reg1[1] = ($ip_reg1[1] * 1) & ($ip_reg2[1] * 1);
+ $ip_reg1[2] = ($ip_reg1[2] * 1) & ($ip_reg2[2] * 1);
+ $ip_reg1[3] = ($ip_reg1[3] * 1) & ($ip_reg2[3] * 1);
+
+ return join ('.', @ip_reg1);
+}
+
+
+# &gst_ip_calc_network (<IP>, <netmask>)
+#
+# Calculates the broadcast address and returns it as a string.
+
+sub gst_ip_calc_broadcast
+{
+ my @ip_reg1;
+ my @ip_reg2;
+
+ @ip_reg1 = ($_[0] =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);
+ @ip_reg2 = ($_[1] =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);
+
+ @ip_reg1 = ($cf_hostip =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);
+
+ $ip_reg1[0] = ($ip_reg1[0] * 1) | (~($ip_reg2[0] * 1) & 255);
+ $ip_reg1[1] = ($ip_reg1[1] * 1) | (~($ip_reg2[1] * 1) & 255);
+ $ip_reg1[2] = ($ip_reg1[2] * 1) | (~($ip_reg2[2] * 1) & 255);
+ $ip_reg1[3] = ($ip_reg1[3] * 1) | (~($ip_reg2[3] * 1) & 255);
+
+ return join ('.', @ip_reg1);
+}
+
+# Forks a process, running $proc with @args in the child, and
+# printing the returned value of $proc in the pipe. Parent
+# returns a structure with useful data about the process.
+sub gst_process_fork
+{
+ my ($proc, @args) = @_;
+ my $pid;
+ local *PARENT_RDR;
+ local *CHILD_WTR;
+
+ pipe (PARENT_RDR, CHILD_WTR);
+
+ $pid = fork ();
+ if ($pid)
+ {
+ # Parent
+ close CHILD_WTR;
+ return {"pid" => $pid, "fd" => *PARENT_RDR, "fileno" => fileno (*PARENT_RDR)};
+ }
+ else
+ {
+ my $ret;
+ close PARENT_RDR;
+ # Child
+ $ret = &$proc (@args);
+ my $type = ref ($ret);
+
+ if (!$type)
+ {
+ print CHILD_WTR $ret;
+ }
+ elsif ($type eq 'ARRAY')
+ {
+ print CHILD_WTR "$_\n" foreach (@$ret);
+ }
+
+ close CHILD_WTR;
+ exit (0);
+ }
+}
+
+
+# Close pipe, kill process, wait for it to finish.
+sub gst_process_kill
+{
+ my ($proc) = @_;
+
+ &gst_file_close ($$proc{"fd"});
+ kill 2, $$proc{"pid"};
+ waitpid ($$proc{"pid"}, undef);
+}
+
+
+# Populate a bitmap of the used file descriptors.
+sub gst_process_list_build_fd_bitmap
+{
+ my ($procs) = @_;
+ my ($bits, $proc);
+
+ foreach $proc (@$procs)
+ {
+ vec ($bits, $$proc{"fileno"}, 1) = 1;
+ }
+
+ return $bits;
+}
+
+
+# Receives a seconds timeout (may be float) and a ref to
+# a list of processes (each returned by gst_fork_process), and
+# set the "ready" key to true in all the procs that are ready
+# to return values, false otherwise. Returns time left before
+# timeout.
+sub gst_process_list_check_ready
+{
+ my ($timeout, $procs) = @_;
+ my ($bits, $bitsleft, $bitsready, $timestamp, $timeleft);
+
+ $procs = [ $procs ] if ref ($procs) ne 'ARRAY';
+ $bits = &gst_process_list_build_fd_bitmap ($procs);
+
+ # Check with timeout which descriptors are ready with info.
+ $timeout = undef if $timeout == 0;
+ $timeleft = $timeout;
+ $bitsleft = $bits;
+ while (($timeout eq undef) || ($timeleft > 0))
+ {
+ $timestamp = time;
+ select ($bitsleft, undef, undef, $timeleft);
+ $timeleft -= time - $timestamp if $timeout ne undef;
+
+ $bitsready |= $bitsleft;
+ $bitsleft = $bits & (~$bitsready);
+ last if $bitsready eq $bits;
+ }
+ $bits = $bitsready;
+
+ # For every process, set "ready" key to 1/0 depending on
+ # its file descriptor bit.
+ foreach $proc (@$procs)
+ {
+ $$proc{"ready"} = (ord ($bits) & (1 << $$proc{"fileno"}))? 1 : 0;
+ }
+
+ return $timeleft;
+}
+
+
+sub gst_process_result_collect
+{
+ my ($proc, $func, @args) = @_;
+ my ($value, $tmp, $lines);
+
+ if ($$proc{"ready"})
+ {
+ my @list;
+
+ $lines .= $tmp while (sysread ($$proc{"fd"}, $tmp, 4096));
+ goto PROC_KILL unless $lines;
+ if ($lines =~ /\n/)
+ {
+ @list = split ("\n", $lines);
+ }
+ else
+ {
+ push @list, $line;
+ }
+
+ $value = &$func (\@list, @args);
+ }
+
+ PROC_KILL:
+ &gst_process_kill ($proc);
+
+ return $value;
+}
+
+
+1;
diff --git a/knetwortdeconf/backends/xml.pl.in b/knetwortdeconf/backends/xml.pl.in
new file mode 100644
index 0000000..b9810c6
--- /dev/null
+++ b/knetwortdeconf/backends/xml.pl.in
@@ -0,0 +1,1012 @@
+#!/usr/bin/env perl
+#-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+# XML printing, scanning and parsing.
+#
+# Copyright (C) 2000-2001 Ximian, Inc.
+#
+# Authors: Hans Petter Jansson <hpj@ximian.com>
+# Arturo Espinosa <arturo@ximian.com>
+# Kenneth Christiansen <kenneth@gnu.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library 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.
+
+
+$SCRIPTSDIR = "@scriptsdir@";
+if ($SCRIPTSDIR =~ /^@scriptsdir[@]/)
+{
+ $SCRIPTSDIR = ".";
+ $DOTIN = ".in";
+}
+
+require "$SCRIPTSDIR/util.pl$DOTIN";
+require "$SCRIPTSDIR/general.pl$DOTIN";
+require "$SCRIPTSDIR/debug.pl$DOTIN";
+
+use Text::ParseWords;
+
+$has_encode = 0;
+if (eval "require Encode") {
+ Encode->import ();
+ $has_encode = 1;
+}
+
+# --- XML print formatting --- #
+
+
+# &gst_xml_enter: Call after entering a block. Increases indent level.
+# &gst_xml_leave: Call before leaving a block. Decreases indent level.
+# &gst_xml_print_indent: Call before printing a line. Indents to current level.
+# &gst_xml_print_vspace: Ensures there is a vertical space of one and only one line.
+# &gst_xml_print: Indent, then print all arguments. Just for sugar.
+
+
+my $gst_indent_level = 0;
+my $gst_have_vspace = 0;
+
+my @gst_xml_stack;
+
+sub gst_xml_print_comment # (comment text)
+{
+ my ($comment) = @_;
+
+ &gst_xml_print_line ("<!-- $comment -->") if $comment;
+}
+
+
+sub gst_xml_print_begin
+{
+ my ($name) = @_;
+
+ $name = $gst_name if !$name;
+
+ &gst_xml_print_string ("<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n");
+ &gst_xml_print_string ("<!DOCTYPE $name []>\n\n");
+ &gst_xml_print_string ("<$name>\n");
+
+ &gst_xml_enter ();
+
+ &gst_xml_print_vspace ();
+}
+
+
+# The frontend expects exactly this string. Don not alter.
+sub gst_xml_print_request_end
+{
+ print "\n<!-- GST: end of request -->\n";
+}
+
+
+sub gst_xml_print_end
+{
+ my ($name) = @_;
+
+ $name = $gst_name if !$name;
+
+ &gst_xml_leave ();
+
+ &gst_xml_print_vspace ();
+ &gst_xml_print_string ("</$name>\n");
+}
+
+
+sub gst_xml_enter
+{
+ $gst_indent_level += 2;
+}
+
+
+sub gst_xml_leave
+{
+ $gst_indent_level -= 2;
+}
+
+
+sub gst_xml_print_string
+{
+ if ($has_encode)
+ {
+ if (&decode_utf8 ($_[0]) eq undef)
+ {
+ # we first decode the string, if it's not
+ # utf-8 (returns undef), then encode it
+ print "" . &encode_utf8 ($_[0]);
+ return;
+ }
+ }
+
+ # It could not encode the string, write it as is
+ print $_[0];
+}
+
+sub gst_xml_format_indent
+{
+ $gst_have_vspace = 0;
+ return " " x $gst_indent_level;
+}
+
+sub gst_xml_print_indent
+{
+ &gst_xml_print_string(&gst_xml_format_indent ());
+}
+
+sub gst_xml_print_vspace
+{
+ if (not $gst_have_vspace)
+ {
+ &gst_xml_print_string ("\n");
+ $gst_have_vspace = 1;
+ }
+}
+
+
+sub gst_xml_print_line
+{
+ my $line;
+ $line = join ("", @_);
+ $line =~ tr/\n//d;
+
+ &gst_xml_print_indent ();
+ &gst_xml_print_string ($line . "\n");
+}
+
+sub gst_xml_format_pcdata # (name, pcdata)
+{
+ my ($name, $pcdata) = @_;
+ return "<$name>$pcdata</$name>" if defined ($name) || defined ($pcdata);
+}
+
+sub gst_xml_print_pcdata # (name, pcdata)
+{
+ my ($name, $pcdata) = @_;
+ my $line = &gst_xml_format_pcdata ($name, $pcdata);
+
+ &gst_xml_print_line ($line) if $line;
+}
+
+sub gst_xml_format_state_tag
+{
+ my ($name, $state) = @_;
+ my $boolean = &gst_print_boolean_truefalse ($state);
+
+ return "<$name state='$boolean'/>";
+}
+
+sub gst_xml_print_state_tag
+{
+ my ($name, $state) = @_;
+ my $state_tag = &gst_xml_format_state_tag ($name, $state);
+
+ &gst_xml_print_line ($state_tag);
+}
+
+# Pass a hash and the keys whose items are scalars. Print <key>val</key>.
+sub gst_xml_print_scalars
+{
+ my ($h, @scalar_keys) = @_;
+ my ($i, $val);
+
+ @scalar_keys = sort @scalar_keys;
+
+ while ($i = shift @scalar_keys)
+ {
+ $val = &gst_xml_quote ($$h{$i});
+ &gst_xml_print_line ("<$i>$val</$i>\n") if exists $$h{$i};
+ }
+
+}
+
+# Print the @$array using <$tag>val</$tag> foreach val in the array.
+# Actually lets print_structure do that now. Just print sequentially
+# the given elements, using as $tag as the surrounding tags.
+sub gst_xml_print_array
+{
+ my ($array, $tag) = @_;
+ my ($i, $val);
+
+ return if (scalar @$array <= 0);
+
+ &gst_xml_print_vspace ();
+ foreach $i (@$array)
+ {
+ &gst_xml_print_structure ($i, $tag);
+ }
+}
+
+# Pass a hash and the keys whose items are arrays. Print <key>val</key> foreach val
+# in the array at hash{key}
+sub gst_xml_print_arrays
+{
+ my ($h, @array_keys) = @_;
+ my ($i, $j, $val);
+
+ foreach $i (sort @array_keys)
+ {
+ &gst_xml_print_array ($$h{$i}, $i) if (exists $$h{$i})
+ }
+}
+
+# Pass a hash, create a parent tag $tag and print <key>val</key> for every
+# value pair in the hash. If structure refs are found, these are recursively
+# printed with print_structure.
+sub gst_xml_print_hash
+{
+ my ($hash, $tag) = @_;
+ my ($j, $val);
+
+ &gst_xml_print_vspace ();
+ if (defined $tag) {
+ &gst_xml_print_line ("<$tag>\n");
+ &gst_xml_enter ();
+ }
+
+ foreach $j (sort keys (%$hash))
+ {
+ &gst_xml_print_structure ($$hash{$j}, $j);
+ }
+
+ if (defined $tag) {
+ &gst_xml_leave ();
+ &gst_xml_print_line ("</$tag>\n");
+ }
+}
+
+# Call the corresponding function depending on the reference
+# type of $x. If just a scalar, print <$tag>$x</$tag>.
+sub gst_xml_print_structure
+{
+ my ($x, $tag) = @_;
+
+ if (ref $x eq "ARRAY") { &gst_xml_print_array ($x, $tag); }
+ elsif (ref $x eq "HASH") { &gst_xml_print_hash ($x, $tag); }
+ else
+ {
+ &gst_xml_print_line ("<$tag>" . &gst_xml_quote ($x) . "</$tag>\n");
+ }
+}
+
+# Treats hash as an array: doesn't use the keys as tags for its
+# elements, but the given tag.
+sub gst_xml_print_hash_hash
+{
+ my ($h, $tag) = @_;
+ my $i;
+
+ foreach $i (sort keys %$h)
+ {
+ &gst_xml_print_hash ($$h{$i}, $tag);
+ }
+}
+
+
+sub gst_xml_container_enter # (name)
+{
+ my ($container) = @_;
+
+ ## gst_xml_stack is not my, as it is defined at top,
+ ## so it is global
+ push @gst_xml_stack, $container;
+
+ &gst_xml_print_line ("<$container>");
+ &gst_xml_enter();
+}
+
+
+sub gst_xml_container_leave
+{
+ ## checks if there is a start tag
+ if ($#gst_xml_stack >= 0)
+ {
+ my $current_container = pop @gst_xml_stack;
+
+ &gst_xml_leave ();
+ &gst_xml_print_line ("</$current_container>");
+ }
+}
+
+
+sub gst_xml_print_container # (name, @strings)
+{
+ my ($name, @strings) = @_;
+
+ if (@strings) {
+ &gst_xml_container_enter ($name);
+ foreach $tag (@strings) {
+ &gst_xml_print_line ("$tag");
+ }
+ &gst_xml_container_leave ();
+ }
+}
+
+# --- XML printing from in-memory model --- #
+
+sub gst_xml_model_print_attributes
+{
+ my ($tree) = @_;
+ my ($attrs, $string);
+
+ $attrs = @$tree [0];
+
+ for $attr (keys %$attrs)
+ {
+ $string .= " " . $attr . "=\"" . $$attrs{$attr} . "\"";
+ }
+
+ return $string;
+}
+
+sub gst_xml_model_print_recurse
+{
+ my ($tree, $indent) = @_;
+ my ($string);
+
+ my @children = @$tree;
+ shift @children; # Attributes
+
+ while (@children)
+ {
+ my $branch = $children [1];
+
+ if ($children [0] eq "__unparsed__")
+ {
+ $string .= "<" . $children [1] . ">";
+ }
+ elsif ($children [0] eq "0")
+ {
+ $string .= $children [1];
+ }
+ elsif (@$branch == 1) # Empty tag.
+ {
+ $string .= "<" . $children [0] . &gst_xml_model_print_attributes ($branch) . "/>";
+ }
+ else
+ {
+ $string .= "<" . $children [0] . &gst_xml_model_print_attributes ($branch) . ">";
+ $string .= &gst_xml_model_print_recurse ($branch);
+ $string .= "</" . $children [0] . ">";
+ }
+
+ shift @children;
+ shift @children;
+ }
+
+# if ($branch)
+# {
+# return &gst_xml_get_attribute ($branch, $property) if $property ne "";
+# return &gst_xml_get_pcdata ($branch);
+# }
+
+ return $string;
+}
+
+sub gst_xml_model_print
+{
+ my ($tree) = @_;
+ my ($string);
+
+ $string = &gst_xml_model_print_recurse ($tree);
+ chomp $string;
+ $string .= "\n";
+
+ return $string;
+}
+
+# --- XML scanning --- #
+
+
+# This code tries to replace XML::Parser scanning from stdin in tree mode.
+
+sub gst_xml_scan_make_kid_array
+{
+ my $line = shift;
+ my (%hash, @sublist, @attr, @list);
+
+ # Remove < and />
+ $line =~ s/^[ \t]*<//;
+ $line =~ s/[\/]?>[ \t]*$//;
+
+ my @list = &quotewords ('[ \t]+', 1, $line);
+ shift @list; # push tag name.
+
+ foreach (@list)
+ {
+ my @tmp = split '[ \t]*=[ \t]*';
+ if (scalar @tmp == 2 && $tmp[1] =~ s/[\"\']//g)
+ {
+ push @attr, @tmp;
+ }
+ }
+
+ %hash = @attr;
+
+ push (@sublist, \%hash);
+ return \@sublist;
+}
+
+
+sub gst_xml_scan_recurse
+{
+ my ($gst_xml_scan_list, $list_arg) = @_;
+ my @list;
+ if ($list_arg ne undef) { @list = $$list_arg[0]; }
+
+ while (@$gst_xml_scan_list)
+ {
+ $el = shift @$gst_xml_scan_list;
+
+ if (($el eq "") || $el =~ /^\<[!?].*\>$/s) { next; } # Empty strings, PI and DTD must go.
+ if ($el =~ /^\<.*\/\>$/s) # Empty.
+ {
+ $el =~ /^\<([a-zA-Z0-9_-]+).*\/\>$/s;
+ push (@list, $1);
+ push (@list, &gst_xml_scan_make_kid_array ($el));
+ }
+ elsif ($el =~ /^\<\/.*\>$/s) # End.
+ {
+ last;
+ }
+ elsif ($el =~ /^\<.*\>$/s) # Start.
+ {
+ $el =~ /^\<([a-zA-Z0-9_-]+).*\>$/s;
+ push (@list, $1);
+ $sublist = &gst_xml_scan_make_kid_array ($el);
+ push (@list, &gst_xml_scan_recurse ($gst_xml_scan_list, $sublist));
+ next;
+ }
+ elsif ($el ne "") # PCDATA.
+ {
+ push (@list, 0);
+ push (@list, "$el");
+ }
+ }
+
+ return \@list;
+}
+
+
+sub gst_xml_read_file
+{
+ my ($file) = @_;
+ my ($doc, $i);
+ local *INPUT_FILE;
+
+ open INPUT_FILE, $file;
+ $doc .= $i while ($i = <INPUT_FILE>);
+ close INPUT_FILE;
+
+ return $doc;
+}
+
+
+sub gst_xml_read_compressed_file
+{
+ my ($file) = @_;
+ my ($doc, $i, $fd);
+
+ $fd = &gst_file_run_pipe_read ("gunzip -c $file");
+ return undef if $fd eq undef;
+ $doc .= $i while ($i = <$fd>);
+ &gst_file_close ($fd);
+
+ if (length ($doc) < 4) # Allow for one blank line from gzip, '\n\r'.
+ {
+ $doc = undef;
+ }
+
+ return $doc;
+}
+
+
+sub gst_xml_read_stdin
+{
+ my ($i, $doc);
+
+ do {
+ $i = <STDIN>;
+
+ if ($i ne undef)
+ {
+ $doc .=$i;
+ }
+ } while (! ($i =~ /^<!-- GST: end of request -->$/));
+
+ return $doc;
+}
+
+# (file, tool) If no file specified, reads stdin.
+# file could also contain xml document.
+# If tool is an gst_tool, stores the read buffer in
+# $$tool{"xml_doc"}.
+sub gst_xml_scan
+{
+ my ($file, $tool) = @_;
+ my ($doc, @tree, @gst_xml_scan_list);
+
+ $file = $gst_input_file unless $file;
+
+ if ($file && stat ($file))
+ {
+ $doc = &gst_xml_read_file ($file);
+ }
+ elsif ($file)
+ {
+ $doc = $file;
+ }
+ else
+ {
+ $doc = &gst_xml_read_stdin ();
+ }
+
+ # remove any blank or carriage return at the beginning of the xml
+ $doc =~ s/^[ \n]*//;
+
+ &gst_debug_print_log_to_file ("in.xml", $doc);
+
+ $$tool{"xml_doc"} = $doc if (&gst_is_tool ($tool));
+
+ @gst_xml_scan_list = ($doc =~ /([^\<]*)(\<[^\>]*\>)[ \t\n\r]*/mg); # pcdata, tag, pcdata, tag, ...
+ $tree = &gst_xml_scan_recurse (\@gst_xml_scan_list);
+
+ return $tree;
+}
+
+# XML scanning that preserves more exact attributes of the scanned XML.
+
+sub gst_xml_model_scan_recurse
+{
+ my @list;
+ if (@_) { @list = $_[0]->[0]; }
+
+ while (@gst_xml_scan_list)
+ {
+ $el = $gst_xml_scan_list[0]; shift @gst_xml_scan_list;
+
+ if ($el eq "") # Empty strings.
+ {
+ next;
+ }
+ elsif ($el =~ /^\<[!?].*\>$/s) # PI and DTD.
+ {
+ $el =~ /^\<([^\>]+)\>$/s;
+ push (@list, "__unparsed__");
+ push (@list, $1);
+ }
+ elsif ($el =~ /^\<.*\/\>$/s) # Empty.
+ {
+ $el =~ /^\<([a-zA-Z0-9_-]+).*\/\>$/s;
+ push (@list, $1);
+ push (@list, &gst_xml_scan_make_kid_array ($el));
+ }
+ elsif ($el =~ /^\<\/.*\>$/s) # End.
+ {
+ last;
+ }
+ elsif ($el =~ /^\<.*\>$/s) # Start.
+ {
+ $el =~ /^\<([a-zA-Z0-9_-]+).*\>$/s;
+ push (@list, $1);
+ $sublist = &gst_xml_scan_make_kid_array ($el);
+ push (@list, &gst_xml_model_scan_recurse ($sublist));
+ next;
+ }
+ elsif ($el ne "") # PCDATA.
+ {
+ push (@list, 0);
+ push (@list, "$el");
+ }
+ }
+
+ return \@list;
+}
+
+sub gst_xml_model_scan # (file) If no file specified, reads stdin.
+{
+ my ($file) = @_;
+ my ($doc, $tree, $compressed);
+
+ $file = $gst_input_file if $file eq undef;
+
+ if ($file)
+ {
+ $doc = &gst_xml_read_compressed_file ($file);
+ if (!$doc)
+ {
+ $doc = &gst_xml_read_file ($file);
+ $compressed = 0;
+ }
+ else
+ {
+ $compressed = 1;
+ }
+ }
+ else
+ {
+ return undef, 0;
+ }
+
+ @gst_xml_scan_list = ($doc =~ /([^\<]*)(\<[^\>]*\>)/mg); # pcdata, tag, pcdata, tag, ...
+ $tree = &gst_xml_model_scan_recurse;
+
+ return $tree, $compressed;
+}
+
+sub gst_xml_model_save
+{
+ my ($model, $file, $compressed) = @_;
+ my $fd;
+
+ if ($compressed == 1)
+ {
+ $fd = &gst_file_open_write_compressed ($file);
+ }
+ else
+ {
+ $fd = &gst_file_open_write_from_names ($file);
+ }
+
+ if ($fd == -1) { return -1; }
+
+ print $fd &gst_xml_model_print ($model);
+ &gst_file_close ($fd);
+
+ return 0;
+}
+
+# Quote/unquote.
+
+@gst_xml_entities = ( "&lt;", '<', "&gt;", '>', "&apos;", '\'', "&quot;", '"', "&amp;", '&' );
+
+
+sub gst_xml_quote
+{
+ my $in = $_[0];
+ my $out = "";
+ my @xe;
+ my $joined = 0;
+
+ my @clist = split (//, $in);
+
+ while (@clist)
+ {
+ # Find character and join its entity equivalent.
+ # If none found, simply join the character.
+
+ $joined = 0; # Cumbersome.
+
+ for (@xe = @gst_xml_entities; @xe && !$joined; )
+ {
+ if ($xe [1] eq $clist [0]) { $out = join ('', $out, $xe [0]); $joined = 1; }
+ shift @xe; shift @xe;
+ }
+
+ if (!$joined) { $out = join ('', $out, $clist [0]); }
+ shift @clist;
+ }
+
+ return $out;
+}
+
+
+sub gst_xml_unquote
+{
+ my $ret = $_[0];
+ my $i;
+
+ #print STDERR "INI U: $ret\n";
+
+ for ($i = 0; $gst_xml_entities[$i] ne undef; $i += 2)
+ {
+ $ret =~ s/$gst_xml_entities[$i]/$gst_xml_entities[$i + 1]/g;
+ }
+
+ while ($ret =~ /&#([0-9]+);/)
+ {
+ $num = $1;
+ $c = chr ($num);
+ $ret =~ s/&#$num;/$c/g;
+ }
+
+ #print STDERR "END U: $ret\n";
+
+ return $ret;
+}
+
+
+# --- XML parsing --- #
+
+
+sub gst_xml_get_pcdata
+{
+ my $tree = $_[0];
+ my $retval;
+
+ shift @$tree; # Skip attributes.
+
+ while (@$tree)
+ {
+ if ($$tree[0] == 0)
+ {
+ $retval = &gst_xml_unquote ($$tree[1]);
+ &gst_debug_print_line ("gst_xml_get_pcdata: $retval");
+ return ($retval);
+ }
+
+ shift @$tree;
+ shift @$tree;
+ }
+
+ return "";
+}
+
+# Compresses node into a word and returns it.
+
+sub gst_xml_get_word
+{
+ my $tree = $_[0];
+ my $retval;
+
+ $retval = &gst_xml_get_pcdata ($tree);
+ $retval =~ tr/ \n\r\t\f//d;
+ return $retval;
+}
+
+
+# Compresses node into a size and returns it.
+
+sub gst_xml_get_size
+{
+ my $tree = $_[0];
+ my $retval;
+
+ $retval = &gst_xml_get_word ($tree);
+ if ($retval =~ /Mb$/)
+ {
+ $retval =~ tr/ Mb//d;
+ $retval *= 1024;
+ }
+
+ return $retval;
+}
+
+
+# Replaces misc. whitespace with spaces and returns text.
+
+sub gst_xml_get_text
+{
+ my $tree = $_[0];
+ my $retval;
+
+ $retval = &gst_xml_get_pcdata ($tree);
+ my $type = ref ($retval);
+
+ if (!$type) { $retval =~ tr/\n\r\t\f/ /; }
+
+ return $retval;
+}
+
+sub gst_xml_get_attribute
+{
+ my ($tree, $attr) = @_;
+
+ return $$tree[0]->{$attr};
+}
+
+sub gst_xml_get_state
+{
+ my ($tree) = @_;
+
+ # Check attribute; 'yes', 'true', 'no', 'false'.
+ return &gst_util_read_boolean ($$tree[0]->{state});
+}
+
+# XML model operations.
+
+# Locate a node from the branch leading up to it.
+sub gst_xml_model_find
+{
+ my ($model, $varpath) = @_;
+ my ($branch, @path);
+
+ $branch = $model;
+ @path = split /\//, $varpath;
+
+ for $elem (@path)
+ {
+ next if ($elem eq "");
+ my @children = @$branch;
+ shift @children; # Attributes
+ $branch = undef;
+
+ while (@children)
+ {
+ if ($children [0] eq $elem)
+ {
+ shift @children;
+ $branch = shift @children;
+ last;
+ }
+
+ shift @children;
+ shift @children;
+ }
+
+ last if ($branch == undef);
+ }
+
+ return $branch;
+}
+
+# Add a branch to another branch. Allows duplicates.
+sub gst_xml_model_add
+{
+ my ($model, $varpath, $addpath) = @_;
+ my ($branch, @path);
+
+ @path = split /\//, $addpath;
+ $branch = &gst_xml_model_find ($model, $varpath);
+ if ($branch == undef)
+ {
+ return -1;
+ }
+
+ for $elem (@path)
+ {
+ my %hash;
+ my @list = ();
+
+ push @list, \%hash;
+
+ push @$branch, $elem;
+ push @$branch, \@list;
+
+ $branch = \@list;
+ }
+
+ return 0;
+}
+
+# Ensure a branch exists, by extending the branch with given elements, if needed.
+sub gst_xml_model_ensure
+{
+ my ($model, $varpath) = @_;
+ my ($branch, @path);
+
+ $branch = $model;
+ @path = split /\//, $varpath;
+
+ for $elem (@path)
+ {
+ next if ($elem eq "");
+
+ my @children = @$branch;
+ my $parent_branch = $branch;
+
+ shift @children; # Attributes
+ $branch = undef;
+
+ while (@children)
+ {
+ if ($children [0] eq $elem)
+ {
+ shift @children;
+ $branch = shift @children;
+ last;
+ }
+
+ shift @children;
+ shift @children;
+ }
+
+ if ($branch == undef)
+ {
+ my %hash;
+ my @list = ();
+
+ $branch = \@list;
+
+ push @list, \%hash;
+
+ push @$parent_branch, $elem;
+ push @$parent_branch, $branch;
+ }
+ }
+
+ return $branch;
+}
+
+sub gst_xml_model_remove
+{
+ my ($model, $varpath, $tag) = @_;
+ my ($branch, $i);
+
+ @path = split /\//, $addpath;
+ $branch = &gst_xml_model_find ($model, $varpath);
+ if ($branch == undef)
+ {
+ return -1;
+ }
+
+ for ($i = 1; $i < @$branch; $i += 2)
+ {
+ if (@$branch [$i] eq $tag)
+ {
+ @$branch = (@$branch [0 .. $i - 1], @$branch [$i + 2 .. @$branch - 1]);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+sub gst_xml_model_get_children
+{
+ my ($branch) = @_;
+ my (@children);
+
+ if (!$branch) { return \@children; }
+
+ for ($i = 1; $i < @$branch; $i += 2)
+ {
+ if (@$branch [$i] ne "__unparsed__" && @$branch [$i] ne "0")
+ {
+ push @children, @$branch [$i + 1];
+ }
+ }
+
+ return \@children;
+}
+
+sub gst_xml_model_get_pcdata
+{
+ my ($branch) = @_;
+ my ($i);
+
+ for ($i = 1; $i < @$branch; $i += 2)
+ {
+ if ($$branch [$i] == 0)
+ {
+ my $retval = &gst_xml_unquote ($$branch [$i + 1]);
+ return ($retval);
+ }
+ }
+
+ return "";
+}
+
+sub gst_xml_model_set_pcdata
+{
+ my ($branch, $pcdata) = @_;
+
+ @$branch = (@$branch [0]);
+
+ $$branch [1] = 0;
+ $$branch [2] = &gst_xml_quote ($pcdata);
+}
+
+sub gst_xml_model_get_attribute
+{
+ my ($branch, $attr) = @_;
+
+ return $$branch[0]->{$attr};
+}
+
+sub gst_xml_model_set_attribute
+{
+ my ($branch, $attr, $value) = @_;
+
+ return $$branch[0]->{$attr} = $value;
+}
+
+1;
diff --git a/knetwortdeconf/config.h.in b/knetwortdeconf/config.h.in
new file mode 100644
index 0000000..3e565ad
--- /dev/null
+++ b/knetwortdeconf/config.h.in
@@ -0,0 +1,204 @@
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define if you have the CoreAudio API */
+#undef HAVE_COREAUDIO
+
+/* Define to 1 if you have the <crt_externs.h> header file. */
+#undef HAVE_CRT_EXTERNS_H
+
+/* Defines if your system has the crypt function */
+#undef HAVE_CRYPT
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define if you have libjpeg */
+#undef HAVE_LIBJPEG
+
+/* Define if you have libpng */
+#undef HAVE_LIBPNG
+
+/* Define if you have a working libpthread (will enable threaded code) */
+#undef HAVE_LIBPTHREAD
+
+/* Define if you have libz */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define if your system needs _NSGetEnviron to set up the environment */
+#undef HAVE_NSGETENVIRON
+
+/* Define to 1 if you have the <pthread/linuxthreads/pthread.h> header file.
+ */
+#undef HAVE_PTHREAD_LINUXTHREADS_PTHREAD_H
+
+/* Define if you have the res_init function */
+#undef HAVE_RES_INIT
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have strlcat */
+#undef HAVE_STRLCAT
+
+/* Define if you have the strlcat prototype */
+#undef HAVE_STRLCAT_PROTO
+
+/* Define if you have strlcpy */
+#undef HAVE_STRLCPY
+
+/* Define if you have the strlcpy prototype */
+#undef HAVE_STRLCPY_PROTO
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Suffix for lib directories */
+#undef KDELIBSUFF
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of a `char *', as computed by sizeof. */
+#undef SIZEOF_CHAR_P
+
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of a `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of a `size_t', as computed by sizeof. */
+#undef SIZEOF_SIZE_T
+
+/* The size of a `unsigned long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/*
+ * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
+ * headers and I'm too lazy to write a configure test as long as only
+ * unixware is related
+ */
+#ifdef _UNIXWARE
+#define HAVE_BOOLEAN
+#endif
+
+
+
+/*
+ * AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
+ * that defines bzero.
+ */
+
+#if defined(_AIX)
+#include <strings.h>
+#endif
+
+
+
+#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
+# include <sys/time.h>
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+#endif
+
+
+
+#if !defined(HAVE_STRLCAT_PROTO)
+#ifdef __cplusplus
+extern "C"
+#endif
+unsigned long strlcat(char*, const char*, unsigned long);
+#endif
+
+
+
+#if !defined(HAVE_STRLCPY_PROTO)
+#ifdef __cplusplus
+extern "C"
+#endif
+unsigned long strlcpy(char*, const char*, unsigned long);
+#endif
+
+
+
+/*
+ * On HP-UX, the declaration of vsnprintf() is needed every time !
+ */
+
+#if !defined(HAVE_VSNPRINTF) || defined(hpux)
+#if __STDC__
+#include <stdarg.h>
+#include <stdlib.h>
+#else
+#include <varargs.h>
+#endif
+#ifdef __cplusplus
+extern "C"
+#endif
+int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
+#ifdef __cplusplus
+extern "C"
+#endif
+int snprintf(char *str, size_t n, char const *fmt, ...);
+#endif
+
+
+
+#if defined(__SVR4) && !defined(__svr4__)
+#define __svr4__ 1
+#endif
+
+
+/* Compatibility define */
+#undef ksize_t
+
+/* Define the real type of socklen_t */
+#undef socklen_t
diff --git a/knetwortdeconf/knetwortdeconf-mdk.spec b/knetwortdeconf/knetwortdeconf-mdk.spec
new file mode 100644
index 0000000..8322e55
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf-mdk.spec
@@ -0,0 +1,159 @@
+%define name knetwortdeconf
+%define version 0.6.1
+%define release 1mdk
+#%define _unpackaged_files_terminate_build 0
+
+Summary: A TDE Control Center Module to configure Network settings.
+Name: %{name}
+Version: %{version}
+Release: %{release}
+License: GPL
+Url: http://www.merlinux.org/knetwortdeconf/
+Group: Networking/Other
+Source: %{name}-%{version}.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-buildroot
+Requires: %_bindir/tdesu
+Patch1: knetwortdeconf-0.6-fix-menu.patch.bz2
+
+%description
+KNetworkConf is a TDE Control Center module to configure the Network
+settings in a Linux machine. I developed it because I couldn't find any
+application to do this from within KDE, and I think this is a "must have"
+app for a serious Desktop Enviroment like KDE.
+KNetworkConf can configure installed network devices (you can't
+add new ones for now), the default gateway,host and domain names,
+add/remove DNS servers and add/remove static hosts.
+
+%prep
+rm -rf $RPM_BUILD_ROOT
+
+%setup -q
+%patch1 -p0 -b .fix_menu
+
+%build
+make -f Makefile.cvs
+QTDIR=%qtdir
+export LD_LIBRARY_PATH=$QTDIR/%_lib:$LD_LIBRARY_PATH
+
+# Search for qt/kde libraries in the right directories (avoid patch)
+# NOTE: please don't regenerate configure scripts below
+perl -pi -e "s@/lib(\"|\b[^/])@/%_lib\1@g if /(kde|qt)_(libdirs|libraries)=/" configure
+
+
+%{?__cputoolize: %{__cputoolize} }
+
+
+%ifarch %ix86
+CFLAGS="%optflags" CXXFLAGS="`echo %optflags |sed -e 's/-fomit-frame-pointer//'`" \
+%else
+CFLAGS="%optflags" CXXFLAGS="%optflags" \
+%endif
+ %configure --disable-debug
+
+%make
+
+%install
+
+%makeinstall_std
+
+%find_lang %name
+
+mkdir -p %buildroot/{%_miconsdir,%{_prefix}/share/pixmaps/}
+install -m 644 %{name}/lo16-app-%{name}.png %buildroot/%{_miconsdir}/%{name}.png
+install -m 644 %{name}/lo32-app-%{name}.png %buildroot/%{_iconsdir}/%{name}.png
+install -m 644 %{name}/network_card.png %buildroot/%{_prefix}/share/pixmaps/network_card.png
+
+mkdir -p %{buildroot}/%{_menudir}
+kdedesktop2mdkmenu.pl %{name} System/Configuration/KDE/Network $RPM_BUILD_ROOT%{_datadir}/applications/tde/kcm_knetwortdeconfmodule.desktop $RPM_BUILD_ROOT%{_menudir}/%{name}
+
+
+%post
+/sbin/ldconfig
+%{update_menus}
+
+%postun
+/sbin/ldconfig
+%{clean_menus}
+
+%clean
+rm -rf $RPM_BUILD_ROOT/*
+
+%files -f %name.lang
+
+#Quick Hack: for some reason the %find_lang command doesn't find
+#the translations files, it outputs a knetwortdeconf.lang file full
+#of empty lines instead of the following ones:
+%lang(de) /usr/share/locale/de/LC_MESSAGES/knetwortdeconfmodule.mo
+%lang(es) /usr/share/locale/es/LC_MESSAGES/knetwortdeconfmodule.mo
+%lang(eu) /usr/share/locale/eu/LC_MESSAGES/knetwortdeconfmodule.mo
+%lang(fr) /usr/share/locale/fr/LC_MESSAGES/knetwortdeconfmodule.mo
+%lang(hu) /usr/share/locale/hu/LC_MESSAGES/knetwortdeconfmodule.mo
+%lang(no) /usr/share/locale/no/LC_MESSAGES/knetwortdeconfmodule.mo
+%lang(pl) /usr/share/locale/pl/LC_MESSAGES/knetwortdeconfmodule.mo
+%lang(pt_BR) /usr/share/locale/pt_BR/LC_MESSAGES/knetwortdeconfmodule.mo
+
+%defattr(-,root,root,0755)
+%doc README COPYING AUTHORS LEAME
+
+%{_libdir}/menu/*
+
+%{_libdir}/trinity/*.la
+%{_libdir}/trinity/*.so
+%{_libdir}/pkgconfig/*.pc
+%{_iconsdir}/*.png
+%{_miconsdir}/%{name}.png
+%_datadir/applications/tde/*.desktop
+%_datadir/pixmaps/network_card.png
+
+%_datadir/icons/locolor/16x16/apps/*.png
+%_datadir/icons/locolor/22x22/apps/*.png
+%_datadir/icons/locolor/32x32/apps/*.png
+%_datadir/icons/hicolor/22x22/actions/*.png
+
+#%dir %_docdir/HTML/en/%{name}/
+%_docdir/HTML/en/%{name}/
+#%dir %_docdir/HTML/de/%{name}/
+%_docdir/HTML/de/%{name}/
+#%dir %_docdir/HTML/es/%{name}/
+%_docdir/HTML/es/%{name}/
+
+%dir %_datadir/apps/%{name}/backends/
+%_datadir/apps/%{name}/backends/*
+
+%dir %_datadir/apps/%{name}/pixmaps/
+%_datadir/apps/%{name}/pixmaps/*.png
+
+
+%changelog
+* Sun Feb 20 2005 Juan Luis Baptiste <juan.baptiste@kdemail.net> 0.6.1-1mdk
+- 0.6.1
+
+* Tue Feb 08 2005 Laurent MONTEL <lmontel@mandrakesoft.com> 0.6-3mdk
+- Fix section
+
+* Thu Sep 30 2004 Laurent MONTEL <lmontel@mandrakesoft.com> 0.6-2mdk
+- Fix menu
+
+* Tue Aug 10 2004 Lenny Cartier <lenny@mandrakesoft.com> 0.6-1mdk
+- from Juan Luis Baptiste <juan.baptiste@kdemail.net> :
+ - 0.6
+
+* Tue Jun 15 2004 Lenny Cartier <lenny@mandrakesoft.com> 0.5-2mdk
+- rebuild
+
+* Thu Feb 26 2004 Lenny Cartier <lenny@mandrakesoft.com> 0.5-1mdk
+- 0.5
+
+* Thu Oct 02 2003 Lenny Cartier <lenny@mandrakesoft.com> 0.4.2-1mdk
+- 0.4.2
+
+* Fri Jul 18 2003 Laurent MONTEL <lmontel@mandrakesoft.com> 0.4.1-2mdk
+- Rebuild
+
+* Thu Apr 10 2003 Lenny Cartier <lenny@mandrakesoft.com> 0.4.1-1mdk
+- 0.4.1
+- find lang macro
+
+* Fri Mar 28 2003 Lenny Cartier <lenny@mandrakesoft.com> 0.4-1mdk
+- from Juan Luis Baptiste <juancho@linuxmail.org> :
+ - Initial release.
diff --git a/knetwortdeconf/knetwortdeconf.lsm b/knetwortdeconf/knetwortdeconf.lsm
new file mode 100644
index 0000000..9ec30c9
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf.lsm
@@ -0,0 +1,14 @@
+Begin4
+Title: KNetworkConf
+Version: R14.0.0
+Entered-date: 2010-05-10
+Description: A system settings module to configure networking for the Trinity Desktop Environment
+Keywords: TDE Qt
+Author: Juan Luis Baptiste <jbaptiste@merlinux.org>
+Maintained-by: The Trinity Desktop Environment (TDE) http://www.trinitydesktop.org/
+Primary-site: http://git.trinitydesktop.org/cgit/
+Alternate-site:
+Original-site: http://www.kde.org/
+Platforms: Linux and other Unices running TDE
+Copying-policy: GPL
+End
diff --git a/knetwortdeconf/knetwortdeconf.spec b/knetwortdeconf/knetwortdeconf.spec
new file mode 100644
index 0000000..89a3414
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf.spec
@@ -0,0 +1,110 @@
+# This spec file was generated using Kpp
+# If you find any problems with this spec file please report
+# the error to ian geiser <geiseri@msoe.edu>
+%define name knetwortdeconf
+%define version 0.5
+%define release 1mdk
+
+Summary: A KDE application to configure TCP/IP settings.
+Name: %{name}
+Version: %{version}
+Release: %{release}
+License: GPL
+Url: http://www.merlinux.org/knetwortdeconf/
+Group: Networking/Other
+Source: %{name}-%{version}.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-buildroot
+Requires: %_bindir/tdesu
+
+%description
+KNetworkConf is a KDE application to configure TCP/IP settings
+in a Linux machine. I developed it because I couldn't find any
+application to configure TCP/IP settings from within KDE, and I
+think this is a "must have" app for a serious Desktop Enviroment
+like KDE.
+KNetworkConf can configure installed network devices (you can't
+add new ones for now), the default gateway,host and domain names,
+and add/remove DNS servers. This first version is a standalone
+application, but the idea is to make it a TDE Control Center
+module and a KApplet to have a fast access to it from the KDE
+panel.
+
+%prep
+rm -rf $RPM_BUILD_ROOT
+
+%setup
+
+./configure --prefix=%_prefix --mandir=%_mandir --datadir=%_datadir --libdir=%_libdir
+
+%build
+
+%make
+
+%install
+#icons
+mkdir -p %buildroot/{%_miconsdir,%{_prefix}/share/pixmaps/}
+#cd $RPM_BUILD_DIR/%{name}-%{version}
+install -m 644 %{name}/lo16-app-%{name}.png %buildroot/%{_miconsdir}/%{name}.png
+install -m 644 %{name}/lo32-app-%{name}.png %buildroot/%{_iconsdir}/%{name}.png
+install -m 644 %{name}/network_card.png %buildroot/%{_prefix}/share/pixmaps/network_card.png
+
+# Menu
+mkdir -p %buildroot/%_menudir
+cat <<EOF > %buildroot/%_menudir/%name
+?package(%name): command="tdesu %_bindir/%name" needs="X11" \
+icon="%name.png" section="Configuration/Networking" \
+title="KNetworkConf" longtitle="Configure TCP/IP settings under KDE"
+EOF
+
+make DESTDIR=$RPM_BUILD_ROOT bitsdata=$RPM_BUILD_ROOT/%{_datadir} bitssysconf=$RPM_BUILD_ROOT/%{_sysconfdir} install
+
+%find_lang %name
+
+%post
+%{update_menus}
+
+%postun
+%{clean_menus}
+
+%clean
+rm -rf $RPM_BUILD_ROOT/*
+
+
+%files -f %name.lang
+%defattr(-,root,root,0755)
+%doc README COPYING AUTHORS LEAME
+%{_libdir}/menu/*
+%{_bindir}/knetwortdeconf
+%{_iconsdir}/*.png
+%{_miconsdir}/%{name}.png
+%_datadir/pixmaps/network_card.png
+%_datadir/applnk-mdk/Configuration/Networking/*
+%_datadir/applnk/System/*
+#%_datadir/applnk/Internet/*
+%_datadir/icons/locolor/16x16/apps/*
+%_datadir/icons/locolor/32x32/apps/*
+%_docdir/HTML/en/knetwortdeconf
+%_docdir/HTML/de/knetwortdeconf
+%_docdir/HTML/es/knetwortdeconf
+%_datadir/apps/knetwortdeconf/backends/*
+%_datadir/apps/knetwortdeconf/pixmaps/*
+%{_libdir}/pkgconfig/system-tools-backends.pc
+
+
+%changelog
+* Sun Feb 22 2004 Juan Luis Baptiste <juan.baptiste@kdemail.net> 0.5-1mdk
+- 0.5
+
+* Thu Oct 02 2003 Lenny Cartier <lenny@mandrakesoft.com> 0.4.2-1mdk
+- 0.4.2
+
+* Fri Jul 18 2003 Laurent MONTEL <lmontel@mandrakesoft.com> 0.4.1-2mdk
+- Rebuild
+
+* Thu Apr 10 2003 Lenny Cartier <lenny@mandrakesoft.com> 0.4.1-1mdk
+- 0.4.1
+- find lang macro
+
+* Fri Mar 28 2003 Lenny Cartier <lenny@mandrakesoft.com> 0.4-1mdk
+- from Juan Luis Baptiste <juancho@linuxmail.org> :
+ - Initial release.
diff --git a/knetwortdeconf/knetwortdeconf/Makefile.am b/knetwortdeconf/knetwortdeconf/Makefile.am
new file mode 100644
index 0000000..3fc914f
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/Makefile.am
@@ -0,0 +1,41 @@
+# set the include path for X, qt and KDE
+#INCLUDES= $(all_includes)
+AM_CPPFLAGS = $(all_includes)
+
+# We use deprecated routines in QButton, undefine QT_NO_COMPAT.
+KDE_CXXFLAGS = -UQT_NO_COMPAT
+
+METASOURCES = AUTO
+#bin_PROGRAMS = knetwortdeconf
+
+kde_module_LTLIBRARIES = kcm_knetwortdeconfmodule.la
+
+kcm_knetwortdeconfmodule_la_LIBADD = $(LIB_TDEUI)
+
+# the library search path.
+kcm_knetwortdeconfmodule_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+
+## INCLUDES were found outside tdevelop specific part
+
+kcm_knetwortdeconfmodule_la_SOURCES = kselectdistrodlg.ui kknownhostinfo.cpp \
+ kinterfaceupdowndlg.ui kaddknownhostdlg.ui kdetectdistrodlg.ui knetwortdeconfmodule.cpp \
+ kroutinginfo.cpp kreloadnetworkdlg.ui kaddressvalidator.cpp kdnsinfo.cpp \
+ knetworkinfo.cpp kadddevicedlg.ui kadddnsserverdlg.ui knetwortdeconfigparser.cpp \
+ knetworkinterface.cpp knetwortdeconfdlg.ui knetwortdeconf.cpp main.cpp kadddevicedlgextension.ui \
+ knetwortdeconfiface.skel kwirelessinterface.cpp kadddevicewifiext.ui kadddevicecontainer.cpp \
+ kprofileslistviewtooltip.cpp
+
+
+EXTRA_DIST = main.cpp knetwortdeconf.cpp knetwortdeconf.h knetwortdeconf.desktop cr16-app-knetwortdeconf.png cr22-app-knetwortdeconf.png cr32-app-knetwortdeconf.png knetwortdeconfdlg.ui knetworkinterface.cpp knetworkinterface.h knetwortdeconfigparser.cpp knetwortdeconfigparser.h kadddnsserverdlg.ui kadddevicedlg.ui knetworkinfo.cpp knetworkinfo.h kdnsinfo.cpp kdnsinfo.h kaddressvalidator.cpp kaddressvalidator.h kreloadnetworkdlg.ui network_card.png kroutinginfo.cpp kroutinginfo.h knetwortdeconfmodule.cpp knetwortdeconfmodule.h kdetectdistrodlg.ui kaddknownhostdlg.ui kinterfaceupdowndlg.ui kadddnsserverdlg.ui.h kadddevicedlg.ui.h kaddknownhostdlg.ui.h kknownhostinfo.cpp kknownhostinfo.h kselectdistrodlg.ui kcm_knetwortdeconfmodule version.h
+
+xdg_apps_DATA = kcm_knetwortdeconfmodule.desktop
+
+KDE_ICON = AUTO
+
+messages: rc.cpp
+ LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \
+ if test -n "$$LIST"; then \
+ $(XGETTEXT) $$LIST -o $(podir)/knetwortdeconf.pot; \
+ fi
+
+noinst_HEADERS = kprofileslistviewtooltip.h
diff --git a/knetwortdeconf/knetwortdeconf/hi16-app-knetwortdeconf.png b/knetwortdeconf/knetwortdeconf/hi16-app-knetwortdeconf.png
new file mode 100644
index 0000000..34a5b4b
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/hi16-app-knetwortdeconf.png
Binary files differ
diff --git a/knetwortdeconf/knetwortdeconf/hi22-app-knetwortdeconf.png b/knetwortdeconf/knetwortdeconf/hi22-app-knetwortdeconf.png
new file mode 100644
index 0000000..aabf851
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/hi22-app-knetwortdeconf.png
Binary files differ
diff --git a/knetwortdeconf/knetwortdeconf/hi32-app-knetwortdeconf.png b/knetwortdeconf/knetwortdeconf/hi32-app-knetwortdeconf.png
new file mode 100644
index 0000000..0aba00e
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/hi32-app-knetwortdeconf.png
Binary files differ
diff --git a/knetwortdeconf/knetwortdeconf/kadddevicecontainer.cpp b/knetwortdeconf/knetwortdeconf/kadddevicecontainer.cpp
new file mode 100644
index 0000000..d68dffe
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddevicecontainer.cpp
@@ -0,0 +1,205 @@
+
+/***************************************************************************
+ kadddevicecontainer.cpp - description
+ -------------------
+ begin : Wed Jun 15 00:40:33 UTC 2005
+ copyright : (C) 2005 by Juan Luis Baptiste
+ email : juan.baptiste@kdemail.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#include "kadddevicecontainer.h"
+
+KAddDeviceContainer::KAddDeviceContainer(TQWidget *parent, const char *name)
+ : KDialog(parent, name)
+{
+ _modified = false;
+ _advanced = false;
+
+ //Setup extension dialog
+ setExtension( new KAddDeviceDlgExtension( this ) );
+ setOrientation(Qt::Vertical );
+
+ //Create dialog that contains the KAddDeviceDlg and KAddDeviceWifiExt (when
+ //configuring a wireless interface) widgets
+ TQPixmap activeEthernetDeviceImg(BarIcon("network_connected_lan_knc"));
+ setIcon(activeEthernetDeviceImg);
+ //First create a main TQHBoxLayout
+ mainLayout = new TQVBoxLayout( this, 10, 2, "mainLayout");
+
+ //Create the Addvanced settings, Ok and Cancel buttons and add them to a TQHBoxLayout
+ buttonsLayout = new TQHBoxLayout( 0, 0, 4, "buttonsLayout");
+ kpbAdvanced = new KPushButton( this, "kpbAdvanced" );
+ buttonsLayout->addWidget( kpbAdvanced );
+ buttonsSpacer = new TQSpacerItem( 70, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
+ buttonsLayout->addItem( buttonsSpacer );
+
+ kpbApply = new KPushButton( this, "kpbApply" );
+ kpbApply->setEnabled( FALSE );
+ kpbApply->setDefault( TRUE );
+ buttonsLayout->addWidget( kpbApply );
+
+ kpbCancel = new KPushButton( this, "kpbCancel" );
+ buttonsLayout->addWidget( kpbCancel );
+
+ setCaption( TQString() );
+ kpbAdvanced->setText( i18n( "&Advanced Settings" ) );
+ TQToolTip::add( kpbAdvanced, i18n( "Toggle between advanced and basic settings" ) );
+ TQWhatsThis::add( kpbAdvanced, i18n( "Toggle between advanced and basic settings" ) );
+ kpbApply->setText( i18n( "&OK" ) );
+ TQToolTip::add( kpbApply, i18n( "Apply changes" ) );
+ kpbCancel->setText( i18n( "&Cancel" ) );
+ TQToolTip::add( kpbCancel, i18n( "Forget changes" ) );
+
+ //Creat and add the KAddDeviceDlg widget to the main layout
+ addDlg = new KAddDeviceDlg(this);
+ mainLayout->addWidget(addDlg);
+ mainLayout->setResizeMode(TQLayout::Auto);
+
+ //Setup connections
+ connect((KAddDeviceDlgExtension*)extension(),TQT_SIGNAL(valueChangedSignal(int)),this,TQT_SLOT(toggleApplyButtonSlot(int)));
+ connect(addDlg->kleIPAddress,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(toggleApplyButtonSlot(const TQString&)));
+// connect(addDlg->kleGateway,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(toggleApplyButtonSlot(const TQString&)));
+ connect(addDlg->kcbNetmask,TQT_SIGNAL(activated(int)),this,TQT_SLOT(toggleApplyButtonSlot(int)));
+ connect(addDlg->kcbAutoBootProto,TQT_SIGNAL(activated(const TQString&)),this,TQT_SLOT(toggleApplyButtonSlot(const TQString&)));
+ connect(addDlg->kcbstartAtBoot,TQT_SIGNAL(stateChanged(int)),this,TQT_SLOT(toggleApplyButtonSlot(int)));
+ connect(addDlg->rbBootProtoAuto,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(toggleAdvancedOptionsSlot(bool)));
+ connect(addDlg->rbBootProtoAuto,TQT_SIGNAL(toggled(bool)),kpbAdvanced,TQT_SLOT(setDisabled(bool)));
+ connect(addDlg->rbBootProtoAuto,TQT_SIGNAL(stateChanged(int)),this,TQT_SLOT(toggleApplyButtonSlot(int)));
+ // connect(addDlg->rbBootProtoAuto,TQT_SIGNAL(toggled(bool)),addDlg->kleIPAddress,TQT_SLOT(setDisabled(bool)));
+ // connect(addDlg->rbBootProtoAuto,TQT_SIGNAL(toggled(bool)),addDlg->kcbNetmask,TQT_SLOT(setDisabled(bool)));
+ // connect(addDlg->rbBootProtoManual,TQT_SIGNAL(toggled(bool)),addDlg->kcbAutoBootProto,TQT_SLOT(setDisabled(bool)));
+ connect(kpbCancel,TQT_SIGNAL(clicked()),this,TQT_SLOT(cancelSlot()));
+ connect(kpbApply,TQT_SIGNAL(clicked()),this,TQT_SLOT(verifyDeviceInfoSlot()));
+ connect(kpbAdvanced,TQT_SIGNAL(clicked()),this,TQT_SLOT(advancedOptionsSlot()));
+
+}
+
+void KAddDeviceContainer::addWirelessWidget(){
+ extDlg = new KAddDeviceWifiExt(this);
+ mainLayout->addWidget( extDlg );
+ connect(extDlg->kleEssid,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(toggleApplyButtonSlot(const TQString&)));
+ connect(extDlg->kleWepKey,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(toggleApplyButtonSlot(const TQString&)));
+ connect(extDlg->qcbKeyType,TQT_SIGNAL(activated(const TQString&)),this,TQT_SLOT(toggleApplyButtonSlot(const TQString&)));
+}
+void KAddDeviceContainer::toggleApplyButtonSlot( const TQString & )
+{
+ toggleApplyButtonSlot(0);
+}
+
+void KAddDeviceContainer::toggleApplyButtonSlot( int )
+{
+ _modified = true;
+ kpbApply->setEnabled(true);
+}
+
+void KAddDeviceContainer::toggleAdvancedOptionsSlot(bool enabled )
+{
+ KAddDeviceDlgExtension *advancedOptions = (KAddDeviceDlgExtension *)this->extension();
+
+ if (enabled)
+ advancedOptions->gbAdvancedDeviceInfo->setEnabled(false);
+ else
+ advancedOptions->gbAdvancedDeviceInfo->setEnabled(true);
+
+ _modified = true;
+ kpbApply->setEnabled(true);
+}
+
+void KAddDeviceContainer::verifyDeviceInfoSlot()
+{
+ KAddDeviceDlgExtension *advancedOptions = (KAddDeviceDlgExtension *)this->extension();
+
+ if (addDlg->rbBootProtoManual->isChecked())
+ {
+ TQString ipAddress = addDlg->kleIPAddress->text();
+ TQString netmask = addDlg->kcbNetmask->currentText();
+ TQString broadcast = advancedOptions->kleBroadcast->text();
+ TQString gateway = advancedOptions->kleGateway->text();
+
+ if (!KAddressValidator::isValidIPAddress(ipAddress))
+ {
+ KMessageBox::error(this,i18n("The format of the specified IP address is not valid."),i18n("Invalid IP Address"));
+ }
+ else if (_advanced && !KAddressValidator::isNetmaskValid(netmask))
+ KMessageBox::error(this,i18n("The format of the specified netmask is not valid."),i18n("Invalid IP Address"));
+
+ else if (!broadcast.isEmpty() && _advanced && !KAddressValidator::isBroadcastValid(broadcast))
+ KMessageBox::error(this,i18n("The format of the specified broadcast is not valid."),i18n("Invalid IP Address"));
+
+ else if (!gateway.isEmpty() && _advanced && !KAddressValidator::isValidIPAddress(gateway))
+ KMessageBox::error(this,i18n("The format of the specified Gateway is not valid."),i18n("Invalid IP Address"));
+
+ else
+ {
+ _modified = true;
+ close();
+ }
+ }
+ else if (addDlg->rbBootProtoAuto->isChecked())
+ {
+ _modified = true;
+ close();
+ }
+}
+
+void KAddDeviceContainer::makeButtonsResizeable()
+{
+ kpbApply->setAutoResize(true);
+ kpbAdvanced->setAutoResize(true);
+ kpbCancel->setAutoResize(true);
+}
+
+bool KAddDeviceContainer::modified()
+{
+ return _modified;
+}
+bool KAddDeviceContainer::advanced()
+{
+ return _advanced;
+}
+
+
+void KAddDeviceContainer::advancedOptionsSlot()
+{
+ if (!_advanced)
+ {
+ kpbAdvanced->setText(i18n("Basic Settings"));
+ addDlg->kcbNetmask->setEditable(true);
+ }
+ else
+ {
+ kpbAdvanced->setText(i18n("Advanced Settings"));
+ addDlg->kcbNetmask->setEditable(false);
+ }
+ _advanced = !_advanced;
+ showExtension(_advanced );
+}
+
+
+void KAddDeviceContainer::cancelSlot()
+{
+ _modified = false;
+ close();
+}
+
+
+KAddDeviceContainer::~KAddDeviceContainer()
+{
+}
+
+void KAddDeviceContainer::addButtons()
+{
+ widgetHSpacer = new TQSpacerItem( 20, 16, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
+ mainLayout->addItem( widgetHSpacer );
+ mainLayout->addLayout( buttonsLayout );
+}
+
+#include "kadddevicecontainer.moc"
diff --git a/knetwortdeconf/knetwortdeconf/kadddevicecontainer.h b/knetwortdeconf/knetwortdeconf/kadddevicecontainer.h
new file mode 100644
index 0000000..4491991
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddevicecontainer.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+ kadddevicecontainer.h - description
+ -------------------
+ begin : Wed Jun 15 00:40:33 UTC 2005
+ copyright : (C) 2005 by Juan Luis Baptiste
+ email : juan.baptiste@kdemail.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef KADDDEVICECONTAINER_H
+#define KADDDEVICECONTAINER_H
+
+#include <tqcheckbox.h>
+#include <tqgroupbox.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqradiobutton.h>
+#include <tqtooltip.h>
+#include <tqwhatsthis.h>
+#include <kcombobox.h>
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klineedit.h>
+#include <kpassdlg.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpushbutton.h>
+
+#include "kadddevicedlg.h"
+#include "kadddevicedlgextension.h"
+#include "kadddevicewifiext.h"
+#include "kaddressvalidator.h"
+
+/**
+Network interface configuration dialog. This dialog contains the KAddDeviceDlg and KAddDeviceWifiExt widgets.
+
+@author Juan Luis Baptiste
+*/
+class KAddDeviceContainer : public KDialog
+{
+ Q_OBJECT
+
+ public:
+ KAddDeviceContainer(TQWidget *parent = 0, const char *name = 0);
+
+ ~KAddDeviceContainer();
+ KPushButton* kpbAdvanced;
+ KPushButton* kpbApply;
+ KPushButton* kpbCancel;
+ void addButtons();
+ KAddDeviceDlg *addDlg;
+ KAddDeviceWifiExt *extDlg;
+ void addWirelessWidget();
+ bool modified();
+ bool advanced();
+
+ private:
+ void makeButtonsResizeable();
+
+ protected:
+ TQVBoxLayout* mainLayout;
+ TQHBoxLayout* buttonsLayout;
+ TQSpacerItem* buttonsSpacer;
+ TQSpacerItem* widgetHSpacer;
+ bool _modified;
+ bool _advanced;
+
+ protected slots:
+ void toggleApplyButtonSlot( const TQString & );
+ void toggleApplyButtonSlot( int );
+ void toggleAdvancedOptionsSlot(bool enabled );
+ void verifyDeviceInfoSlot();
+ void advancedOptionsSlot();
+ void cancelSlot();
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/kadddevicedlg.ui b/knetwortdeconf/knetwortdeconf/kadddevicedlg.ui
new file mode 100644
index 0000000..60a720f
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddevicedlg.ui
@@ -0,0 +1,411 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAddDeviceDlg</class>
+<comment>Dialog to add/configure an network device.</comment>
+<author>Juan Luis Baptiste</author>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>KAddDeviceDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>299</width>
+ <height>167</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Configure Interface</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQButtonGroup">
+ <property name="name">
+ <cstring>gbBasicDeviceInfo</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="title">
+ <string>TCP/IP Address</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="1" column="2" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>130</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KComboBox" row="0" column="3">
+ <item>
+ <property name="text">
+ <string>dhcp</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>bootp</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kcbAutoBootProto</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The boot protocol this network device should use</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The boot protocol this network device should use</string>
+ </property>
+ </widget>
+ <spacer row="0" column="4">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQRadioButton" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>rbBootProtoManual</cstring>
+ </property>
+ <property name="text">
+ <string>Manual:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Use a static IP address. Use the fields below to enter the values</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;Sets this interface to use static IP settings.&lt;/p&gt;
+&lt;p&gt;In this case, please use the fields below to enter the desired values manually.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>rbBootProtoAuto</cstring>
+ </property>
+ <property name="text">
+ <string>Automatic:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Use a dynamic IP address</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;Using an dynamic IP address causes this device to get a free IP address automatically.&lt;/p&gt;
+&lt;p&gt;The interface will try to contact an DHCP- or BOOTP-Server during the boot process.&lt;/p&gt;
+&lt;p&gt;Rendevouz is not supported yet.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQCheckBox" row="4" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>kcbstartAtBoot</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Activate when the computer starts</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Ensures that this interface gets activated during boot time</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;Ensures that this interface gets activated during boot time.&lt;/p&gt;
+&lt;p&gt;Otherwise, you will have to active the interface manually after you have logged in after the boot process.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="3" column="3" rowspan="1" colspan="2">
+ <item>
+ <property name="text">
+ <string>255.255.255.0</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>255.255.0.0</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>255.0.0.0</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>255.255.255.128</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>255.255.255.192</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>255.255.255.240</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>255.255.255.248</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kcbNetmask</cstring>
+ </property>
+ <property name="editable">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Subnetmask of the network device</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;Please enter the desired subnetmask for the interface here.&lt;/p&gt;
+&lt;p&gt;For small private networks, 255.255.255.0 will most often be a reasonable default value.&lt;/p&gt;
+&lt;p&gt;This field will change from a popup box to a combo box as soon as you enable the advanced settings below.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer11_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="3" column="2">
+ <property name="name">
+ <cstring>spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="3" column="1">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Netmask:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The netmask defines a range of IP numbers which will build a subnet inside the network.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The netmask defines a range of IP numbers which will build a subnet inside the network.</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="3" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kleIPAddress</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>IP address for the network device</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;Here you should enter the IP address for the network interface.&lt;/p&gt;
+&lt;p&gt;Please note: If your network is connected to the internet, you should only enter IP addresses you have been given by your provider.&lt;/p&gt;
+&lt;p&gt;Otherwise, you should enter one of the IP addresses which are explicitly reserved for private use.&lt;/p&gt;
+&lt;p&gt;Most small private networks use class C networks, which allow up to 255 computers in your network. So simply use addresses like 192.168.1.1, 192.168.1.2, 192.168.1.171 and so on for your computers.&lt;/p&gt;
+&lt;p&gt;Cass C networks: 192.168.0.0 to 192.168.255.25, for example 192.168.0.13.&lt;/p&gt;
+&lt;p&gt;Class B networks: 172.16.0.0 to 172.31.255.255, for example 172.28.2.5&lt;/p&gt;
+&lt;p&gt;Class A networks: 10.0.0.0 to 10.255.255.255, for example 10.5.12.14&lt;/p&gt;
+&lt;p&gt;Please ensure that all IP addresses you give to your computers are unique; you will have many problems if the same address is assigned to more than one network device.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <spacer row="2" column="2">
+ <property name="name">
+ <cstring>spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="2" column="1">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>IP address:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer10_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </hbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="789">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000002dc49444154388ded953f881c551cc73f77f79417988419509807296e20ca2d88ba7b09648514b7100857990b69fc53b8d7e5fc53d819cb04d28be99254bb6062568c70290e6ebb150cdca231792709cc6a1666c4c179c5c0fe8a81b5b88b4ad8d1e2c0ca5ff378ff3e7ce1f37e3cf8bff66bae6ae3cb9b0f7e9547327de7e2f29bfa0c0ffcf380ec6faabd410394fbf3727fa1603afa8842558125499f88a797c333fa4aeb93f0e5e8858038138c179167101413b6551fe3415ef868df479c90e0042567e7abc0ddadce9d9008b43efcf1a90dd3f2eba613d7ccc6589b8dc50b66722f32fa1826f1306f9f5c35c68b4cebf89a914c4794bc5699b87df65335ca7234ba8c49894c83db2706049ecf4ed9a3f19ec1954d5afe2adc3548d921a9a704be4f8a9bab04bb3227442308068d9b68dc31b0ce214ab099a5ee19e251423e8ab1654cf39421cf0414d34a70e81946ce42a0f11f251c5a6cb29d399ab2862d2c511861b39895a36f30aa3b1a5e0351b0e96d4209aacabe2d769e078394b2108c5336a58b3e1a32bc95607d8bff529343bacd30ed93f427586d59fd601529f65e89aab2efbceb87f331ac47f557cfc936c669f2b1263a61885d82b63bb8dd75e47487c92b201a821f03b4af01165477ab73e7c2e94bcb4fedbbc4d2bae78803c897da5cbbd17b8e77fbc485b0bef416837142ebf526d7ee77496f5cfe81afb88f621ea0470f4ae6814c1dc87ee6be23e3c3bf5a06d86bbaa93aa0fd9f2999cc92af0e68ff97a7099f05cfa7454248888860c68ec1e32ebeb788fd26c70e2d761482b4198e863cec3fa4b3759b899efc697f16f46f8973b486eda508e3d588b301adf3357abb97a98fdb0c9fa4b8da6cfb557da0f6126b2858386742c8635a51037efb96c1ca452eddfa9cab9ff5ef02bfcfb25f098e5eac69eb864842b17ef57a5153a8b8d0d348fba40a06630b8fb9097c31cb7e1578ae79726dc53979dfee6e7e0da4c091672e2c003f01df5741fea98e00c1bf9ca9fc14fed3fa03e75097599478d74a0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>rbBootProtoManual</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcbAutoBootProto</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>rbBootProtoAuto</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kleIPAddress</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>rbBootProtoAuto</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcbNetmask</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>rbBootProtoAuto</tabstop>
+ <tabstop>kcbAutoBootProto</tabstop>
+ <tabstop>rbBootProtoManual</tabstop>
+ <tabstop>kleIPAddress</tabstop>
+ <tabstop>kcbNetmask</tabstop>
+ <tabstop>kcbstartAtBoot</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">kadddevicedlg.ui.h</include>
+</includes>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kadddevicedlg.ui.h b/knetwortdeconf/knetwortdeconf/kadddevicedlg.ui.h
new file mode 100644
index 0000000..658941e
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddevicedlg.ui.h
@@ -0,0 +1,13 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** TQt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+
+void KAddDeviceDlg::init()
+{
+}
diff --git a/knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui b/knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui
new file mode 100644
index 0000000..ebbca21
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui
@@ -0,0 +1,156 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAddDeviceDlgExtension</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>KAddDeviceDlgExtension</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>298</width>
+ <height>131</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Advanced Options</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>gbAdvancedDeviceInfo</cstring>
+ </property>
+ <property name="title">
+ <string>Advanced Device Information</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Set advanced setting for the network device</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Description:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>IP address of the network device</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>kleDescription</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Simply enter a short human-readable description for this device</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Simply enter a short human-readable description for this device</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>kleBroadcast</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>IP address of the network device</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The Broadcast is a special address. All devices of a network respond if packages are sent to this address.</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Gateway:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kleGateway</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>An IP address is an unique identifier of a networking device in an TCP/IP network</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>kleGateway</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Default gateway for the network device</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;Here you should enter the default gateway for the network device.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Broadcast:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+</widget>
+<connections>
+ <connection>
+ <sender>kleBroadcast</sender>
+ <signal>textChanged(const TQString&amp;)</signal>
+ <receiver>KAddDeviceDlgExtension</receiver>
+ <slot>valueChanged(const TQString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>kleDescription</sender>
+ <signal>textChanged(const TQString&amp;)</signal>
+ <receiver>KAddDeviceDlgExtension</receiver>
+ <slot>valueChanged(const TQString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>kleGateway</sender>
+ <signal>textChanged(const TQString&amp;)</signal>
+ <receiver>KAddDeviceDlgExtension</receiver>
+ <slot>valueChanged(const TQString&amp;)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">kadddevicedlgextension.ui.h</include>
+</includes>
+<Q_SIGNALS>
+ <signal>valueChangedSignal(int)</signal>
+</Q_SIGNALS>
+<Q_SLOTS>
+ <slot access="private">valueChanged( const TQString &amp; s )</slot>
+</Q_SLOTS>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui.h b/knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui.h
new file mode 100644
index 0000000..2d08799
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddevicedlgextension.ui.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** TQt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+void KAddDeviceDlgExtension::init()
+{
+
+}
+
+
+void KAddDeviceDlgExtension::valueChanged( const TQString &s )
+{
+ emit valueChangedSignal(0);
+}
diff --git a/knetwortdeconf/knetwortdeconf/kadddevicewifiext.ui b/knetwortdeconf/knetwortdeconf/kadddevicewifiext.ui
new file mode 100644
index 0000000..6b60cf2
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddevicewifiext.ui
@@ -0,0 +1,96 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAddDeviceWifiExt</class>
+<comment>Extension to the KAddDeviceDlg dialog to configure wireless settings.</comment>
+<author>Juan Luis Baptiste</author>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>KAddDeviceWifiExt</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>186</width>
+ <height>104</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Wireless Settings</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="TQButtonGroup">
+ <property name="name">
+ <cstring>gbWirelessSettings</cstring>
+ </property>
+ <property name="title">
+ <string>Wireless Settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>WEP key:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>kleEssid</cstring>
+ </property>
+ </widget>
+ <widget class="KPasswordEdit" row="1" column="1">
+ <property name="name">
+ <cstring>kleWepKey</cstring>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>ESSID:</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Key type:</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>ASCII</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Hexadecimal</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>qcbKeyType</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpassdlg.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui b/knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui
new file mode 100644
index 0000000..f79401d
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui
@@ -0,0 +1,166 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAddDNSServerDlg</class>
+<widget class="KDialog">
+ <property name="name">
+ <cstring>KAddDNSServerDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>234</width>
+ <height>81</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Add New DNS Server</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit" row="0" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kleNewServer</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>IP address of the new DNS server</string>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>lIPAddress</cstring>
+ </property>
+ <property name="text">
+ <string>IP address:</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>kpbAddServer</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add the server to the list</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="3">
+ <property name="name">
+ <cstring>kpbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Forget it</string>
+ </property>
+ </widget>
+ <spacer row="1" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1073">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003f84944415418959d9541681d4518c7ff9b6e9aefc9a6cec0537645211b5aec8ba2264dc13cad90e2a9a508f556bc786cf0a2201e8a88470d150a012dbc8b20b9350791d04349413116f56541db6eb1f18dd887b34d9ebb2359df7ed66dc743c84b2d496afd6018e6303fbef9ff8619586bb1d50080993333e3692b6da6ad2ea7bf75396d75b9bb72ef6cb9fb6b97bba92d9a8bcd85e977a7f701808b1d6aa83ab49709e1fc4533a0fb19a1ef834b862f249276067209baa3505913a0c104c7c76b23a69c1b02707d473083fb842b9db96b8b205143a4196120b1a8015991d0ab05500aa85f140eef0fc0861d4162d77d3b968312096b14b980ce154435042b052281a43440299019059313545b030890e40900a06f2770c6197c0a608c823680e928a024e80ea3e0f518c012fa860281a0730ddff371df8e032f80e10c4401b8a3912104b30251006334c0eb27412991e409248530b959073b8e83993333e3278e9d380bd05320000c7457bae01c7d44e86fbc5943e08d015c80bc0ae6be5fc27c14203680f44264a5c2900851e480f0c466c7ffc5fefcb54dfb479eab61fec70841b586cc28a0eac3200348f63276ff8f7d62c6a94901788074c3db9c33e0c251edf84fe18a6e0ffca0f61901544761c4abd8a56b573bacf9eba44c7466b2388aa3b8772b1edc7e86117f04c215ced1178f3e1c8e8603c4f4e9c2c585c6a9b74e757ae07fd9cf353243506d05ce1949a2c086a092bbecbb15e85c833c82326a1781a4326a776d5fedd681970ed85e14599961d493208a51f343b05b81a84a8033480aa10cdf6bdf6637b23f66afcf4654d295e872f4b9beae7f983d3f6b37ae6a1f0048928ee10c52046062045501e931023f04bcf5b5a00cb2671fb7e376dc8e2fab8f55477f32397efce7daa13a4d7ff099b301760140adaaac4ef5b57327e59ec20d2d180e48f6b12900f2a10d43baa1edd94fe25df5d1fa934aeb8f0219ac162edf098cb8b07069e17d00c52678597d77eec2b90f032fa8e95c0f8ded1d3b04c2a02001ddd1a8b815bb7879e92fbec1bfeb52134adc61e69c725a8dca6f5ae4893b6a39be69564d2f0a00406bb1e54cbd3e35d038db984c5be95776c5deb2a9b576c55a9b5a9bfe945a9bdaa2f96df38bc6e9c6c1c99727079a5f361d005bbee5d6daf58c87ebc3367c3afcdbf77c28a3060a148ece350a145046ed687fbb72ee5e4c9d9c1a1cdb3ff63c08af848f84cf0a219e61668e757ce52efb9766cfcfae6decd9f86db6054f9f6ef405108fc2c7434830a8cbe485578f1d7f63fee2fcaa5a5633a22aae8e3e5e2fa276b446aee8bcfdce6b7627f0e6b39973c554cd7b134f4c1cd483dc5ff3c2c70acec49189c3c38bded2f076f6b7ab1e385a5eba2d3a52e944ef1190bb233703111994000cd21ded6f51ff00b4d6ba80c75184550000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>kpbAddServer</sender>
+ <signal>clicked()</signal>
+ <receiver>KAddDNSServerDlg</receiver>
+ <slot>validateAddressSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KAddDNSServerDlg</receiver>
+ <slot>close()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">kadddnsserverdlg.ui.h</include>
+</includes>
+<Q_SLOTS>
+ <slot access="private">validateAddressSlot()</slot>
+ <slot access="private">makeButtonsResizeable()</slot>
+</Q_SLOTS>
+<functions>
+ <function specifier="non virtual">setAddingAlias( bool add )</function>
+ <function returnType="bool">modified()</function>
+ <function access="private" specifier="non virtual">init()</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kdialog.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui.h b/knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui.h
new file mode 100644
index 0000000..dd6057f
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kadddnsserverdlg.ui.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** TQt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include "kaddressvalidator.h"
+#include <kmessagebox.h>
+
+bool _modified2;
+bool addingAlias;
+
+void KAddDNSServerDlg::setAddingAlias(bool add)
+{
+ addingAlias = add;
+}
+
+bool KAddDNSServerDlg::modified()
+{
+ return _modified2;
+}
+void KAddDNSServerDlg::init()
+{
+ _modified2 = false;
+ addingAlias = false;
+ makeButtonsResizeable();
+}
+
+void KAddDNSServerDlg::validateAddressSlot()
+{
+ if (!addingAlias)
+ {
+ if (KAddressValidator::isValidIPAddress(kleNewServer->text()))
+ {
+ _modified2 = true;
+ close();
+ }
+ else
+ {
+ KMessageBox::error(this,i18n("The format of the specified IP address is not valid."),i18n("Invalid IP Address"));
+ }
+ }
+ else
+ {
+ if (kleNewServer->text() !="")
+ {
+ _modified2 = true;
+ close();
+ }
+ else
+ {
+ KMessageBox::error(this,i18n("You have to type an alias first."),i18n("Invalid Text"));
+ }
+ }
+}
+
+
+void KAddDNSServerDlg::makeButtonsResizeable()
+{
+ kpbAddServer->setAutoResize(true);
+ kpbCancel->setAutoResize(true);
+}
diff --git a/knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui b/knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui
new file mode 100644
index 0000000..430b37e
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui
@@ -0,0 +1,303 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KAddKnownHostDlg</class>
+<widget class="KDialog">
+ <property name="name">
+ <cstring>KAddKnownHostDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>324</width>
+ <height>210</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add New Static Host</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>IP address:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>kleIpAddress</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>180</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="3" column="2">
+ <property name="name">
+ <cstring>kpbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer51</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>kpbAdd</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <spacer row="2" column="2">
+ <property name="name">
+ <cstring>spacer51_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQGroupBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Aliases</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>klbAliases</cstring>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbAddHost</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbEditHost</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbRemoveHost</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1012">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003bb49444154189595954f681d451cc73f9b6c9adf93973a0b0f794f3cf495886eeb9f1a5a685a7a48f0d25c84debd14415a4490209e8a781215052120855c04cf39a83c7a90f4505ac55a1525ddd204b7d092599b676724ebdb9f75dbf590e6352d49205f1866e630dff9f1fd0cbf09aaaa62330541c0cce733074f1c3f719650f61302258880eac659a05410a9d2a5e4fbce379d37cf7c786631dcd4f5819a8de6287569cf9df7c36e085a0d0380a90b5e1500e7335815a211cfd481f63e45f700db1b030382049d6b16ea6dc42acd8641011912bc5354057bcb72643462725403096510605b63a909bef414b9e0738b69b450cd1011b4542805e72d3e079b392823bcfab58ab633d65231a1c17b8bed2abe6b29146c572972b05d8be682bd69a104a70e236b716d5b7124115a2a2211da7538df42d52262f0a507155c9e4159c3ab47c226fa20fb702bfa7796efa0ca80840ccdbe13133da02f22747e4d98bb6c487388a4892b339af5e6c357b25ef14ee94fbed0a6f37b424bda386fa161d05021947ec6eb51ec88fed4f3caf431410cd468dd2bd62e0fb22cfd47905edf78a7f4b58cb0ded2ae4b75f546daf5d65ff4a5b7cebb24594c92feabd839fd8276a34d2451307978f2c9f89578989c2fe7cfcfcf4ebf3ddded1b3f425f1dce439659342fc8ba16f560bb1be8c3da2c42966783944436b7bbe267e3bb47278f56fd280a0a442244a0dd688108c6445016d4c216362f1ea75fd9d4fe9d2c26bfa02c24d792afd3c5f4b7b97373fdc61302d4c25aa0a52332069f2b2d13217545c2165a7a5a123d4eff5e9aa5b7b2cc7f611ae6eaf8c1a9c23413199f98cadf7def8d87155b67dd7838befad5a9f66e858a92809001cd154283cb951aadaa4fbf9b0e8ebd38f69c6dbacfcc48b482703feaca77977ebaf40150f48dd3a5f47267a8f3712451ecd4ed89f7c4c76af5da888482cb1d40f5f352f2afbfe9ff72a5134aeeab6a4ece8a2ffd1f5237f7d3a5e44fbfe21fedc10b97168293af9f1c9e3d3b3bb17c7df942ef76ef6eef76af5a1fcbd797abdeed5e71e5c72bdfce7c347368e2d589e18bf3170380aaaa361d0300fb8fecafe203f17fa66eb0b91dd65203af1e2d952ccfb6a5bf95828d9bd3a74e8fec1bdd7758eaf25a336abe1c35a29734574d57d2850df47f983b37b7ba7e66cb1f687df1c9a7b30311f29434e509cd74c495fee8d4f1a9b7ce5f985f4997d219d33057e367c68ae456b22aa174d7e96f65dc6f9bea5d4d9bd1fb712b3ee4467428169ea62cccc4a1f1bda66ef66e457f2bf58d931bc93de3a3d46676b720bb081511f194a05eef6c4b7f13fd0f228d8a497c524ca50000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>kpbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KAddKnownHostDlg</receiver>
+ <slot>close()</slot>
+ </connection>
+ <connection>
+ <sender>kpbAdd</sender>
+ <signal>clicked()</signal>
+ <receiver>KAddKnownHostDlg</receiver>
+ <slot>validateAddressSlot()</slot>
+ </connection>
+ <connection>
+ <sender>klbAliases</sender>
+ <signal>doubleClicked(TQListBoxItem*)</signal>
+ <receiver>KAddKnownHostDlg</receiver>
+ <slot>editHostSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbAddHost</sender>
+ <signal>clicked()</signal>
+ <receiver>KAddKnownHostDlg</receiver>
+ <slot>addHostSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbEditHost</sender>
+ <signal>clicked()</signal>
+ <receiver>KAddKnownHostDlg</receiver>
+ <slot>editHostSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbRemoveHost</sender>
+ <signal>clicked()</signal>
+ <receiver>KAddKnownHostDlg</receiver>
+ <slot>removeHostSlot()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>kleIpAddress</tabstop>
+ <tabstop>kpbAdd</tabstop>
+ <tabstop>kpbCancel</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">kaddknownhostdlg.ui.h</include>
+</includes>
+<Q_SLOTS>
+ <slot access="private">validateAddressSlot()</slot>
+ <slot access="private">makeButtonsResizeable()</slot>
+ <slot access="private">editHostSlot()</slot>
+ <slot access="private">removeHostSlot()</slot>
+ <slot access="private">addHostSlot()</slot>
+</Q_SLOTS>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+ <function specifier="non virtual" returnType="bool">modified()</function>
+</functions>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kdialog.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui.h b/knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui.h
new file mode 100644
index 0000000..1ace4eb
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kaddknownhostdlg.ui.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** TQt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include "kaddressvalidator.h"
+#include "kadddnsserverdlg.h"
+
+#include <kmessagebox.h>
+
+bool _modifiedhost;
+
+void KAddKnownHostDlg::init()
+{
+ _modifiedhost = false;
+ makeButtonsResizeable();
+}
+void KAddKnownHostDlg::validateAddressSlot()
+{
+ if (!KAddressValidator::isValidIPAddress(kleIpAddress->text()))
+ {
+ KMessageBox::error(this,i18n("The format of the specified IP address is not valid."),i18n("Invalid IP Address"));
+ }
+ else if ((klbAliases->firstItem() == 0))
+ {
+ KMessageBox::error(this,i18n("You must add at least one alias for the specified IP address."),i18n("Insufficient Aliases"));
+ }
+ else
+ {
+ _modifiedhost = true;
+ close();
+ }
+
+}
+
+
+void KAddKnownHostDlg::makeButtonsResizeable()
+{
+ kpbAdd->setAutoResize(true);
+ kpbCancel->setAutoResize(true);
+ kpbAddHost->setAutoResize(true);
+ kpbEditHost->setAutoResize(true);
+ kpbRemoveHost->setAutoResize(true);
+}
+
+
+bool KAddKnownHostDlg::modified()
+{
+ return _modifiedhost;
+}
+
+
+void KAddKnownHostDlg::editHostSlot()
+{
+ KAddDNSServerDlg dlg(this, 0);
+
+ if (klbAliases->currentItem() >= 0)
+ {
+ int currentPos = klbAliases->currentItem();
+ dlg.setCaption(i18n("Edit Alias"));
+ dlg.lIPAddress->setText(i18n("Alias:"));
+ dlg.setAddingAlias(true);
+ TQListBoxItem *item = klbAliases->item(currentPos);
+ TQString currentText = item->text();
+ dlg.kleNewServer->setText(currentText);
+ dlg.kpbAddServer->setText(i18n("&OK"));
+ dlg.exec();
+
+ if(dlg.modified())
+ {
+ klbAliases->changeItem(dlg.kleNewServer->text(),currentPos);
+// enableApplyButtonSlot();
+ }
+ }
+}
+
+
+void KAddKnownHostDlg::removeHostSlot()
+{
+ if (klbAliases->currentItem() >= 0)
+ klbAliases->removeItem(klbAliases->currentItem());
+}
+
+
+void KAddKnownHostDlg::addHostSlot()
+{
+ KAddDNSServerDlg addDlg(this, 0);
+ addDlg.setCaption(i18n("Add New Alias"));
+ addDlg.lIPAddress->setText(i18n("Alias:"));
+ addDlg.setAddingAlias(true);
+
+ addDlg.exec();
+ if(addDlg.modified())
+ {
+ klbAliases->insertItem(addDlg.kleNewServer->text());
+// enableApplyButtonSlot();
+ }
+
+}
diff --git a/knetwortdeconf/knetwortdeconf/kaddressvalidator.cpp b/knetwortdeconf/knetwortdeconf/kaddressvalidator.cpp
new file mode 100644
index 0000000..03d21c6
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kaddressvalidator.cpp
@@ -0,0 +1,240 @@
+/***************************************************************************
+ kaddressvalidator.cpp - description
+ -------------------
+ begin : Wed Jan 22 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "kaddressvalidator.h"
+
+/*
+ Class for validating IP address and netmasks, and to calculate network and broadcast values.
+ The functions to do the last two things where taken from the code of ipcalc.c, made by
+ Erik Troan <ewt@redhat.com> and Preston Brown <pbrown@redhat.com> from Red Hat Inc. .
+*/
+
+KAddressValidator::KAddressValidator(){
+}
+KAddressValidator::~KAddressValidator(){
+}
+/** Validates if the address written by the user is a valid one. Return true if it is and false if not. */
+bool KAddressValidator::isValidIPAddress(TQString addr){
+ TQString s = "";
+ int i;
+ int number;
+ bool ok;
+ if ((addr.contains('.') > 3) || (addr.length() > 15))
+ return false;
+ for (i = 0; i < 4; i++)
+ {
+ s = addr.section('.',i,i);
+ number = s.toInt(&ok);
+ if (!ok)
+ return false;
+ if ((i == 0) && (number == 0))
+ return false;
+ if ((number < 0) || (number > 255))
+ return false;
+ if ((i == 3) && (number == 0))
+ return false;
+ }
+ if (i == 4)
+ return true;
+ else
+ return false;
+}
+bool KAddressValidator::isNetmaskValid(TQString addr){
+ TQString s = "";
+ int i;
+ int number;
+ bool ok;
+ for (i = 0; i < 4; i++)
+ {
+ s = addr.section('.',i,i);
+ number = s.toInt(&ok);
+ if (!ok)
+ return false;
+ if ((i == 0) && (number == 0))
+ return false;
+ if ((number < 0) || (number > 255))
+ return false;
+ }
+ if (i == 4)
+ return true;
+ else
+ return false;
+
+}
+
+bool KAddressValidator::isNetworkValid(const TQString &addr){
+ TQString s = "";
+ int i;
+ int number;
+ bool ok;
+ for (i = 0; i < 4; i++)
+ {
+ s = addr.section('.',i,i);
+ number = s.toInt(&ok);
+ if (!ok)
+ return false;
+ if ((i == 0) && (number == 0))
+ return false;
+ if ((number < 0) || (number >= 255))
+ return false;
+ }
+ if (i == 4)
+ return true;
+ else
+ return false;
+
+}
+bool KAddressValidator::isBroadcastValid(TQString addr){
+ TQString s = "";
+ int i;
+ int number;
+ bool ok;
+ for (i = 0; i < 4; i++)
+ {
+ s = addr.section('.',i,i);
+ number = s.toInt(&ok);
+ if (!ok)
+ return false;
+ if ((i == 0) && (number == 0))
+ return false;
+ if ((number < 0) || (number > 255))
+ return false;
+ if ((i == 3) && (number == 0))
+ return false;
+ }
+ if (i == 4)
+ return true;
+ else
+ return false;
+
+}
+
+/** \fn unsigned long int prefix2mask(int bits)
+ \brief creates a netmask from a specified number of bits
+
+ This function converts a prefix length to a netmask. As CIDR (classless
+ internet domain internet domain routing) has taken off, more an more IP
+ addresses are being specified in the format address/prefix
+ (i.e. 192.168.2.3/24, with a corresponding netmask 255.255.255.0). If you
+ need to see what netmask corresponds to the prefix part of the address, this
+ is the function. See also \ref mask2prefix.
+
+ \param prefix is the number of bits to create a mask for.
+ \return a network mask, in network byte order.
+ */
+unsigned long int KAddressValidator::prefix2mask(int prefix){
+ return htonl(~((2 << (31 - prefix)) - 1));
+}
+/** \fn int mask2prefix(unsigned long int mask)
+ \brief calculates the number of bits masked off by a netmask.
+
+ This function calculates the significant bits in an IP address as specified by
+ a netmask. See also \ref prefix2mask.
+
+ \param mask is the netmask, specified as an unsigned long integer in network byte order.
+ \return the number of significant bits. */
+int KAddressValidator::mask2prefix(unsigned long int mask){
+ unsigned i;
+ int count = IPBITS;
+
+ for (i = 0; i < IPBITS; i++)
+ {
+ if (!(ntohl(mask) & ((2 << i) - 1)))
+ count--;
+ }
+
+ return count;
+}
+/*!
+ \fn unsigned long int calc_broadcast(unsigned long int addr, int prefix)
+
+ \brief calculate broadcast address given an IP address and a prefix length.
+
+ \param addr an IP address in network byte order.
+ \param prefix a prefix length.
+
+ \return the calculated broadcast address for the network, in network byte
+ order. */
+unsigned long int KAddressValidator::calc_broadcast(unsigned long int addr, int prefix){
+ return (addr & prefix2mask(prefix)) | ~prefix2mask(prefix);
+}
+/** \fn unsigned long int calc_network(unsigned long int addr, int prefix)
+ \brief calculates the network address for a specified address and prefix.
+
+ \param addr an IP address, in network byte order
+ \param prefix the network prefix
+ \return the base address of the network that addr is associated with, in
+ network byte order. */
+unsigned long int KAddressValidator::calc_network(unsigned long int addr, int prefix){
+ return (addr & prefix2mask(prefix));
+}
+/** Is a wrapper function to calc_network that receives the IP address and netsmask as TQString and
+returns the network value also as a TQString, or NULL if it couldn't be calculated. */
+TQString KAddressValidator::calculateNetwork(TQString addr,TQString netmask){
+ struct in_addr _addr, _netmask, _network;
+ int prefix = 0;
+ TQString s;
+ if (addr.isNull() || netmask.isNull())
+ return NULL; //bad address
+ if (!inet_pton(AF_INET,addr.latin1(),&_addr))
+ return NULL; //bad address
+ else
+ {
+ if (!inet_pton(AF_INET,netmask.latin1(),&_netmask))
+ return NULL; //bad address
+ else
+ {
+ prefix = mask2prefix(_netmask.s_addr);
+ _network.s_addr = calc_network(_addr.s_addr, prefix);
+ char * char_network = new char[20];
+ if (!inet_ntop(AF_INET,&_network,char_network,20))
+ return NULL;
+ else
+ s = char_network;
+ }
+ }
+ return s;
+}
+
+/** Is a wrapper function to calc_broadcast that receives the IP address and netsmask as TQString and
+returns the broadcast value also as a TQString, or NULL if it couldn't be calculated. */
+TQString KAddressValidator::calculateBroadcast(TQString addr, TQString netmask){
+ struct in_addr _addr, _netmask, _network;
+ int prefix = 0;
+ TQString s;
+ if (addr.isNull() || netmask.isNull())
+ return NULL; //bad address
+ if (!inet_pton(AF_INET,addr.latin1(),&_addr))
+ return NULL; //bad address
+ else
+ {
+ if (!inet_pton(AF_INET,netmask.latin1(),&_netmask))
+ return NULL; //bad address
+ else
+ {
+ prefix = mask2prefix(_netmask.s_addr);
+ _network.s_addr = calc_broadcast(_addr.s_addr, prefix);
+ char * char_network = new char[20];
+ if (!inet_ntop(AF_INET,&_network,char_network,20))
+ return NULL;
+ else
+ s = char_network;
+ }
+ }
+ return s;
+
+}
diff --git a/knetwortdeconf/knetwortdeconf/kaddressvalidator.h b/knetwortdeconf/knetwortdeconf/kaddressvalidator.h
new file mode 100644
index 0000000..790703d
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kaddressvalidator.h
@@ -0,0 +1,116 @@
+/***************************************************************************
+ kaddressvalidator.h - description
+ -------------------
+ begin : Wed Jan 22 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KADDRESSVALIDATOR_H
+#define KADDRESSVALIDATOR_H
+
+/*
+ Class for validating IP address and netmasks, and to calculate network and broadcast values.
+ The functions to do the last two things where taken from the code of ipcalc.c, made by
+ Erik Troan <ewt@redhat.com> and Preston Brown <pbrown@redhat.com> from Red Hat Inc.
+*/
+
+
+
+/*!
+ \def IPBITS
+ \brief the number of bits in an IP address.
+*/
+#define IPBITS (sizeof(TQ_UINT32) * 8)
+/*!
+ \def IPBYTES
+ \brief the number of bytes in an IP address.
+*/
+#define IPBYTES (sizeof(TQ_UINT32))
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <tqstring.h>
+
+/**Class that has simple methods for validating IP addresses, netmasks, calculating
+ broadcast and network addresses.
+
+ *@author Juan Luis Baptiste
+ */
+
+class KAddressValidator {
+public:
+ KAddressValidator();
+ ~KAddressValidator();
+ /** Validates if the address written by the user is a valid one. Return true if it is and false if not. */
+ static bool isValidIPAddress(TQString addr);
+ /** Validates if the Netmask written by the user is a valid one. Return true if it is and false if not. */
+ static bool isNetmaskValid(TQString addr);
+/** Validates if the Network written by the user is a valid one. Return true if it is and false if not. */
+ static bool isNetworkValid(const TQString &addr);
+/** Validates if the Broadcast written by the user is a valid one. Return true if it is and false if not. */
+ static bool isBroadcastValid(TQString addr);
+
+ /** Is a wrapper function to calc_network that receives the IP address and netsmask as TQString and
+ returns the network value also as a TQString, or NULL if it couldn't be calculated. */
+ static TQString calculateNetwork(TQString addr,TQString netmask);
+/** Is a wrapper function to calc_broadcast that receives the IP address and netsmask as TQString and
+returns the broadcast value also as a TQString, or NULL if it couldn't be calculated. */
+ static TQString calculateBroadcast(TQString addr, TQString netmask);
+
+private: // Private methods
+/** \fn unsigned long int calc_broadcast(unsigned long int addr, int prefix)
+
+ \brief calculate broadcast address given an IP address and a prefix length.
+
+ \param addr an IP address in network byte order.
+ \param prefix a prefix length.
+
+ \return the calculated broadcast address for the network, in network byte
+ order. */
+ static unsigned long int calc_broadcast(unsigned long int addr, int prefix);
+ /** \fn unsigned long int calc_network(unsigned long int addr, int prefix)
+ \brief calculates the network address for a specified address and prefix.
+
+ \param addr an IP address, in network byte order
+ \param prefix the network prefix
+ \return the base address of the network that addr is associated with, in
+ network byte order. */
+ static unsigned long int calc_network(unsigned long int addr, int prefix);
+ /** \fn unsigned long int prefix2mask(int bits)
+ \brief creates a netmask from a specified number of bits
+
+ This function converts a prefix length to a netmask. As CIDR (classless
+ internet domain internet domain routing) has taken off, more an more IP
+ addresses are being specified in the format address/prefix
+ (i.e. 192.168.2.3/24, with a corresponding netmask 255.255.255.0). If you
+ need to see what netmask corresponds to the prefix part of the address, this
+ is the function. See also \ref mask2prefix.
+
+ \param prefix is the number of bits to create a mask for.
+ \return a network mask, in network byte order.
+ */
+ static unsigned long int prefix2mask(int prefix);
+ /** \fn int mask2prefix(unsigned long int mask)
+ \brief calculates the number of bits masked off by a netmask.
+
+ This function calculates the significant bits in an IP address as specified by
+ a netmask. See also \ref prefix2mask.
+
+ \param mask is the netmask, specified as an unsigned long integer in network byte order.
+ \return the number of significant bits. */
+ static int mask2prefix(unsigned long int mask);
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule b/knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule
new file mode 100644
index 0000000..dd4137d
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule
@@ -0,0 +1 @@
+?package(local.kcm_knetwortdeconfmodule.desktop):needs="x11" kde_filename="kcm_knetwortdeconfmodule" section="System/Configuration/KDE/Network" command="tdecmshell kcm_knetwortdeconfmodule" icon="locolor/32x32/apps/knetwortdeconf.png" longtitle="Configure your Network settings" title="Network Settings" kde_opt="Encoding=UTF-8\\nX-TDE-RootOnly=true\\nX-TDE-ModuleType=Library\\nX-TDE-Library=knetwortdeconfmodule\\nX-TDE-FactoryName=knetwortdeconfmodule\\nX-TDE-ParentApp=kcontrol\\nType=Application\\nDocPath=knetwortdeconf/index.docbook\\nComment[es]=Configurar las propiedades de Red\\nComment[de]=Netzwerkschnittstellen konfigurieren\\nTerminal=0\\nName[es]=Propiedades de Red\\nName[de]=Netzwerkschnittstellen konfigurieren\\nGenericName=Configure TCP/IP settings\\nGenericName[es]=Configurar las propiedades de red\\nKeywords=Network,DNS,routes,interfaces\\n"
diff --git a/knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule.desktop b/knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule.desktop
new file mode 100644
index 0000000..d51ca0f
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kcm_knetwortdeconfmodule.desktop
@@ -0,0 +1,177 @@
+[Desktop Entry]
+X-TDE-RootOnly=true
+Categories=Qt;TDE;Settings;X-TDE-settings-network;
+X-TDE-ModuleType=Library
+X-TDE-Library=knetwortdeconfmodule
+X-TDE-FactoryName=knetwortdeconfmodule
+Type=Application
+Exec=tdecmshell kcm_knetwortdeconfmodule
+Icon=knetwortdeconf
+DocPath=knetwortdeconf/index.html
+
+Comment=Configure Network Settings
+Comment[ar]=إعداد تعيينات الشبكة
+Comment[be]=ÐаÑтавіць Ñетку
+Comment[bg]=ÐаÑтройване на мрежата
+Comment[bn]=নেটওয়ারà§à¦• মানসমূহ কনফিগার করে
+Comment[br]=Kefluniañ dibarzhoù ar rouedad
+Comment[bs]=Podesi postavke mreže
+Comment[ca]=Configura els paràmetres de la xarxa
+Comment[cs]=Nastavení sítě
+Comment[da]=Indstil netværksopsætning
+Comment[de]=Netzwerkeinstellungen einrichten
+Comment[el]=ΔιαμόÏφωση Ïυθμίσεων δικτÏου
+Comment[es]=Configure los parámetros de red
+Comment[et]=Võrguseadistuste seadistamine
+Comment[eu]=Konfiguratu sareko ezarpenak
+Comment[fa]=پیکربندی تنظیمات شبکه
+Comment[fi]=Aseta tietoverkon asetukset
+Comment[fr]=Configuration des paramètres réseau
+Comment[ga]=Cumraigh na Socruithe Líonra
+Comment[gl]=Configuración da Rede
+Comment[he]=שינוי הגדרות רשת
+Comment[hr]=Konfiguriranje mrežnih postavki
+Comment[hu]=A hálózat beállításai
+Comment[is]=Umsjón netstillinga
+Comment[it]=Configura le impostazioni di rete
+Comment[ja]=ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯è¨­å®š
+Comment[ka]=ქსელის პáƒáƒ áƒáƒ›áƒ”ტრების კáƒáƒœáƒ¤áƒ˜áƒ’ურáƒáƒªáƒ˜áƒ
+Comment[kk]=Желінің параметрлерін баптау
+Comment[km]=កំណážáŸ‹â€‹ážšáž…នា​សម្ពáŸáž“្ធ​ការ​កំណážáŸ‹â€‹áž”ណ្ដាញ
+Comment[ko]=ë„¤íŠ¸ì›Œí¬ ì„¤ì •
+Comment[lt]=Konfigūruoti tinklo nustatymus
+Comment[mk]=Конфигурирајте ги поÑтавуањата за мрежата
+Comment[nb]=Sett opp nettverksinnstillinger
+Comment[nds]=Nettwark-Instellen fastleggen
+Comment[ne]=सञà¥à¤œà¤¾à¤² सेटिङ कनà¥à¤«à¤¿à¤—र गरà¥à¤¨à¥à¤¹à¥‹à¤¸à¥
+Comment[nl]=Netwerk instellen
+Comment[nn]=Set opp nettverket
+Comment[pa]=ਨੈੱਟਵਰਕ ਸਥਾਪਨ ਸੰਰਚਨਾ
+Comment[pl]=Konfiguracja ustawień sieci
+Comment[pt]=Configurar Opções de Rede
+Comment[pt_BR]=Configurar rede
+Comment[ro]=Configurează setările de reţea
+Comment[ru]=Утилита наÑтройки Ñети
+Comment[se]=Heivet fierpmádaga
+Comment[sk]=Konfigurácia sieťových nastavení
+Comment[sl]=Nastavite omrežne nastavitve
+Comment[sr]=Подешавање поÑтавки мреже
+Comment[sr@Latn]=Podešavanje postavki mreže
+Comment[sv]=Anpassa nätverksinställningar
+Comment[th]=ตั้งค่าà¸à¸²à¸£à¸›à¸£à¸±à¸šà¹à¸•à¹ˆà¸‡à¹€à¸„รือข่าย
+Comment[tr]=Ağ Ayarlarını Yapılandır
+Comment[uk]=Ðалаштувати мережні параметри
+Comment[vi]=Cấu hình thiết lập mạng
+Comment[wa]=Apontiaedjes del rantoele
+Comment[zh_CN]=é…置网络设置
+Comment[zh_HK]=設定網絡設置
+Comment[zh_TW]=設定網路
+Terminal=false
+Name=Network Settings
+Name[ar]=تعيينات الشبكة
+Name[be]=ÐаÑтавіць Ñетку
+Name[bg]=Мрежови наÑтройки
+Name[bn]=নেটওয়ারà§à¦• মানসমূহ
+Name[br]=Kefluniadur ar Rouedad
+Name[bs]=Postavke mreže
+Name[ca]=Paràmetres de xarxa
+Name[cs]=Nastavení sítě
+Name[cy]=Gosodiadau Rhwydwaith
+Name[da]=Netværksopsætning
+Name[de]=Netzwerkeinstellungen
+Name[el]=Ρυθμίσεις δικτÏου
+Name[es]=Parámetros de red
+Name[et]=Võrguseadistused
+Name[eu]=Sareko ezarpenak
+Name[fa]=تنظیمات شبکه
+Name[fi]=Verkkoasetukset
+Name[fr]=Paramètres réseau
+Name[ga]=Socruithe Líonra
+Name[gl]=Configuración da Rede
+Name[he]=הגדרות רשת
+Name[hr]=Mrežne postavke
+Name[hu]=Hálózati beállítások
+Name[is]=Netstillingar
+Name[it]=Impostazioni di rete
+Name[ja]=ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯è¨­å®š
+Name[ka]=ქსელის პáƒáƒ áƒáƒ›áƒ”ტრები
+Name[kk]=Желінің параметрлері
+Name[km]=ការ​កំណážáŸ‹â€‹áž”ណ្ដាញ
+Name[ko]=ë„¤íŠ¸ì›Œí¬ ì„¤ì •
+Name[lt]=Tinklo nustatymai
+Name[mk]=ПоÑтавувања на мрежа
+Name[nb]=Nettverksoppsett
+Name[nds]=Nettwark-Instellen
+Name[ne]=सञà¥à¤œà¤¾à¤² सेटिङ
+Name[nl]=Netwerkinstellingen
+Name[nn]=Nettverksinnstillingar
+Name[pa]=ਨੈੱਟਵਰਕ ਸਥਾਪਨ
+Name[pl]=Ustawienia sieci
+Name[pt]=Configuração da Rede
+Name[pt_BR]=Configurações de Rede
+Name[ro]=Setări de reţea
+Name[ru]=ÐаÑтройка Ñети
+Name[se]=Fierpmádatheivehusat
+Name[sk]=Sieťové nastavenia
+Name[sl]=Omrežne nastavitve
+Name[sr]=ПоÑтавке мреже
+Name[sr@Latn]=Postavke mreže
+Name[sv]=Nätverksinställningar
+Name[th]=ตั้งค่าเครือข่าย
+Name[tr]=Ağ Ayarları
+Name[uk]=Мережні параметри
+Name[vi]=Thiết lập mạng
+Name[wa]=Apontiaedjes del rantoele
+Name[zh_CN]=网络设置
+Name[zh_HK]=網絡設置
+Name[zh_TW]=網路設定
+Keywords=Network,DNS,routes,interfaces
+Keywords[ar]=الشبكة,خادم اسماء المجال,الطرق,الواجهات
+Keywords[bg]=мрежа, рутер, интерфейÑ, мрежова, карта, Network, DNS, routes, interfaces
+Keywords[br]=Rouedad,DNS,hentoù,etrefasoù
+Keywords[bs]=Network,DNS,routes,interfaces,mreža,interfejsi
+Keywords[ca]=Xarxa,DNS,rutes,interfícies
+Keywords[cs]=síť,DNS,route,rozhraní
+Keywords[da]=Netværk,DNS,routes,grænseflader
+Keywords[de]=Netzwerk,DNS,Routen,Schnittstellen
+Keywords[el]=Δίκτυο,DNS,routes,διεπαφές
+Keywords[es]=Red, DNS, rutas, interfaces
+Keywords[et]=Võrk,DNS,marsruudid,liidesed
+Keywords[eu]=Sarea,DNS,bideak, iterfazeak
+Keywords[fa]=شبکه، خدمت نام دامنه، مسیرها، واسطها
+Keywords[fi]=tietoverkko,DNS,reitit,rajapinnat
+Keywords[fr]=réseau,DNS,serveur de noms,routes,interfaces
+Keywords[ga]=Líonra,DNS,róid,comhéadain
+Keywords[gl]=Rede,DNS,rutas,interfaces
+Keywords[he]=Network,DNS,routes,interfaces,רשת,כתובתשמות,ממשקי×,נתיבי×
+Keywords[hr]=Network,DNS,routes,interfaces,mreža,preusmjeravanje,suÄelja
+Keywords[hu]=Hálózat,DNS,útvonalak,hálózati csatolók
+Keywords[it]=Rete,DNS,route,interfacce
+Keywords[ja]=ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯,DNS,ルート,インターフェース
+Keywords[ka]=ქსელი,DNS,ბილიკები,ინტერფეისი
+Keywords[km]=បណ្ដាញ,DNS,ផ្លូវ,ចំណុច​ប្រទាក់
+Keywords[ko]=네트워í¬,DNS,ì¸í„°íŽ˜ì´ìŠ¤
+Keywords[lt]=Network,DNS,routes,interfaces,tinklas,DNS,maršrutai,sąsajos
+Keywords[mk]=Network,DNS,routes,interfaces,Мрежа,рути,интерфејÑи
+Keywords[nb]=Nettverk,DNS,ruter,grensesnitt
+Keywords[nds]=Nettwark,DNS,route,Anslüss,Koppelsteed,Nettweg
+Keywords[ne]=सञà¥à¤œà¤¾à¤², डीà¤à¤¨à¤à¤¸, मारà¥à¤—, इनà¥à¤Ÿà¤°à¤«à¥‡à¤¸
+Keywords[nl]=netwerk,DNS,routes,interfaces,netwerkkaart
+Keywords[nn]=nettverk,DNS,ruter,grensesnitt
+Keywords[pa]=ਨੈੱਟਵਰਕ,DNS,ਰੂਟ,ਇੰਟਰਫੇਸ
+Keywords[pl]=sieć,Internet,DNS,trasy,routowanie,rutowanie,interfejsy
+Keywords[pt]=Rede,DNS,rotas,interfaces
+Keywords[pt_BR]=Rede,DNS,rotas,interfaces
+Keywords[ro]=Reţea,DNS,rute,interfeţe
+Keywords[se]=Fierpmádat,DNS,routes,lavttat
+Keywords[sl]=Network,DNS,routes,interfaces,omrežje,vmesniki,poti,usmerjanje
+Keywords[sr]=Мрежа,DNS,руте,интерфејÑи
+Keywords[sr@Latn]=Mreža,DNS,rute,interfejsi
+Keywords[sv]=Nätverk,DNS,route,gränssnitt
+Keywords[th]=เครือข่าย,DNS,routes,interfaces
+Keywords[tr]=Ağ,DNS,routes,arayüzler
+Keywords[uk]=Network,DNS,routes,interfaces,мережа,інтерфейÑи
+Keywords[vi]=Network,mạng,DNS,routes,tuyến,interfaces,giao diện
+Keywords[zh_CN]=Network,DNS,routes,interfaces,网络,路由,接å£
+Keywords[zh_HK]=Network,DNS,routes,interfaces,網絡,路由,介é¢
+Keywords[zh_TW]=網路,DNS,路由,介é¢
diff --git a/knetwortdeconf/knetwortdeconf/kdetectdistrodlg.ui b/knetwortdeconf/knetwortdeconf/kdetectdistrodlg.ui
new file mode 100644
index 0000000..af91fc8
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kdetectdistrodlg.ui
@@ -0,0 +1,73 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KDetectDistroDlg</class>
+<widget class="TQDialog">
+ <property name="name">
+ <cstring>KDetectDistroDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>415</width>
+ <height>56</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Detecting Your Current Platform</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>pixmapLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>text</cstring>
+ </property>
+ <property name="text">
+ <string>Please wait while detecting your current platform...</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="983">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000039e4944415418959595cd6b1d5518c67f934e9a776452cf40948e74915b2af6aa2897a6602a2e6e6a5d74e3dafe03d28f8d0b71292eba312808052964e34297154442119b2e44234aaca8ed151332c586ccd85cef1cc9e8bcd6938e8b9b7b136b6e4b5e18e683f33ef39ce77738c7abaa8a9dcaf33c2ebc7761e2e48993171179aaf75d7c50b7fd2e80822f557a3399bff4f1a557cf4f9f5ff47754dd2c33660e8931b50fafa6233a1c1019417c41a42baa4e290b8bae433caa4c3d1d3f89cf38707f6141867078577fb6941210858a31029b5d5a802d20cf721ae3c2e4213c600ff4870ca8615094b2005be44084aaed3bc6416e736ca1d876371175ca8385bbaeb13627d5a0eb3214284000ab8a1690decaa99b685be60f10ee0d1209d0a224b742a08a88609d82425e28b89e5301d7edf507d15ffd7515750c810ecfbc5627d8a42fbe30f753c247f342aa10f942eec088e9c6b369d587ddd39f3c1c33fb6302614ceee75da7b209747bc6bba53f7518ce4e8219035cb4a1ae048767dbd99f38fedaca7897f44b85bcc89150aa74256d6769f6a53a4d739bb7922469010cfd8f7e66b1ed9cbc2849db25a52d49db39d676e9ab2aea203631511879c7268e3ddc6834464a5b7e3077756ee6ec99b3edad28764bdf29eaba20adda3daa1a59b57beb8fd7ef1c7fe978b515850ff88288101b4142c184d29f8b55bd977e952c267fb4165bd7b4d0ebc952f2496bb1f5c3ece5d9fec6d35bc71e289111ac0fb18990b03b13754aa0c1bdf437d276ba9265f67d33666e34269aa5d95f9366f364f1fa1be7b61cdb759b0baccf9caeed5347d5fd1143aadd455faa828baa3e7d9beda9d7eb4fc4fbf55d09644dc2e0ae647c7eedfbefde02cabe70b2947c3b373cf7b6f85257a7e3b503b51722138d0294ae449d56c9cde4efec56f67be94ac17157550b2d744d9d2e4b68ee264baddfec9afdef1ebcf0d58277ea9553233317679acb3796bfe8dceedce9ac76aaceed4ed559ed54cbbf2c579dd54eb9f0cdc2a7d3e7a78f365f6c8e5cf9ec8a075055d58ed710c0916347aac644e31f09855cf31155f5d429aa8a557b5ffa83cadbfe72e6f499d1da78edb9c8442f9bd03c1bc5d133a52d35cbb3ebdbe87f3d7b7976bdd733f004ea3d4cbf333314c0a366bf79c86676b474fafcd489e6b9f9f9f9b56429b960c6cc8dda817a99acdc5c179f768ffe20e1feb669db69101c88df8c1f898f9ad16838f0794cc04c361a074d680e0ea23fa8fac2c94ab291173649b3741fb0577c10118b036b6de7bef477a87f018b9f681dd4db618a0000000049454e44ae426082</data>
+ </image>
+</images>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kdnsinfo.cpp b/knetwortdeconf/knetwortdeconf/kdnsinfo.cpp
new file mode 100644
index 0000000..724118c
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kdnsinfo.cpp
@@ -0,0 +1,61 @@
+/***************************************************************************
+ kdnsinfo.cpp - description
+ -------------------
+ begin : Sat Jan 18 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "kdnsinfo.h"
+
+KDNSInfo::KDNSInfo(){
+}
+KDNSInfo::~KDNSInfo(){
+}
+TQStringList KDNSInfo::getNameServers(){
+ return nameServers;
+}
+TQString KDNSInfo::getDomainName(){
+ return domainName;
+}
+TQString KDNSInfo::getMachineName(){
+ return machineName;
+}
+
+TQStringList KDNSInfo::getSearchDomains(){
+ return searchDomains;
+}
+void KDNSInfo::setNameServers(const TQStringList &nameServers){
+ KDNSInfo::nameServers = nameServers;
+}
+void KDNSInfo::setDomainName(const TQString &domain){
+ KDNSInfo::domainName = domain;
+}
+void KDNSInfo::setMachineName(const TQString &machine){
+ KDNSInfo::machineName = machine;
+}
+
+void KDNSInfo::setSearchDomains(const TQStringList &searchDomains){
+ KDNSInfo::searchDomains = searchDomains;
+}
+TQPtrList<KKnownHostInfo> KDNSInfo::getKnownHostsList(){
+ return knownHosts;
+}
+void KDNSInfo::addKnownHost(KKnownHostInfo *host){
+ knownHosts.append(host);
+}
+bool KDNSInfo::removeKnownHost(int index){
+ return knownHosts.remove(index);
+}
+void KDNSInfo::setKnownHostsList(TQPtrList<KKnownHostInfo> hostsList){
+ KDNSInfo::knownHosts = hostsList;
+}
diff --git a/knetwortdeconf/knetwortdeconf/kdnsinfo.h b/knetwortdeconf/knetwortdeconf/kdnsinfo.h
new file mode 100644
index 0000000..9c1a27d
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kdnsinfo.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ kdnsinfo.h - description
+ -------------------
+ begin : Sat Jan 18 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KDNSINFO_H
+#define KDNSINFO_H
+
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqptrlist.h>
+#include "kknownhostinfo.h"
+
+/**
+ *@author Juan Luis Baptiste
+ */
+
+class KDNSInfo {
+public:
+ KDNSInfo();
+ ~KDNSInfo();
+ TQString getDomainName();
+ TQString getMachineName();
+ TQStringList getNameServers();
+ TQStringList getSearchDomains();
+ void setNameServers(const TQStringList &nameServer);
+ void setSearchDomains(const TQStringList &searchDomains);
+ void setDomainName(const TQString &domain);
+ void setMachineName(const TQString &machine);
+ TQPtrList<KKnownHostInfo> getKnownHostsList();
+ void addKnownHost(KKnownHostInfo *host);
+ bool removeKnownHost(int index);
+ void setKnownHostsList(TQPtrList<KKnownHostInfo> hostsList);
+private: // Private attributes
+ TQStringList nameServers;
+ TQStringList searchDomains;
+ TQString domainName;
+ TQString machineName;
+ /** List of known hosts (/etc/hosts). */
+ TQPtrList<KKnownHostInfo> knownHosts;
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui b/knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui
new file mode 100644
index 0000000..37098be
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui
@@ -0,0 +1,104 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KInterfaceUpDownDlg</class>
+<widget class="KDialog">
+ <property name="name">
+ <cstring>KInterfaceUpDownDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>253</width>
+ <height>44</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Changing Interface State</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>pixmapLabel1</cstring>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>label</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Bringing up interface &lt;b&gt;eth0&lt;/b&gt;...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer14</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1012">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003bb49444154189595954f681d451cc73f9b6c9adf93973a0b0f794f3cf495886eeb9f1a5a685a7a48f0d25c84debd14415a4490209e8a781215052120855c04cf39a83c7a90f4505ac55a1525ddd204b7d092599b676724ebdb9f75dbf590e6352d49205f1866e630dff9f1fd0cbf09aaaa62330541c0cce733074f1c3f719650f61302258880eac659a05410a9d2a5e4fbce379d37cf7c786631dcd4f5819a8de6287569cf9df7c36e085a0d0380a90b5e1500e7335815a211cfd481f63e45f700db1b030382049d6b16ea6dc42acd8641011912bc5354057bcb72643462725403096510605b63a909bef414b9e0738b69b450cd1011b4542805e72d3e079b392823bcfab58ab633d65231a1c17b8bed2abe6b29146c572972b05d8be682bd69a104a70e236b716d5b7124115a2a2211da7538df42d52262f0a507155c9e4159c3ab47c226fa20fb702bfa7796efa0ca80840ccdbe13133da02f22747e4d98bb6c487388a4892b339af5e6c357b25ef14ee94fbed0a6f37b424bda386fa161d05021947ec6eb51ec88fed4f3caf431410cd468dd2bd62e0fb22cfd47905edf78a7f4b58cb0ded2ae4b75f546daf5d65ff4a5b7cebb24594c92feabd839fd8276a34d2451307978f2c9f89578989c2fe7cfcfcf4ebf3ddded1b3f425f1dce439659342fc8ba16f560bb1be8c3da2c42966783944436b7bbe267e3bb47278f56fd280a0a442244a0dd688108c6445016d4c216362f1ea75fd9d4fe9d2c26bfa02c24d792afd3c5f4b7b97373fdc61302d4c25aa0a52332069f2b2d13217545c2165a7a5a123d4eff5e9aa5b7b2cc7f611ae6eaf8c1a9c23413199f98cadf7def8d87155b67dd7838befad5a9f66e858a92809001cd154283cb951aadaa4fbf9b0e8ebd38f69c6dbacfcc48b482703feaca77977ebaf40150f48dd3a5f47267a8f3712451ecd4ed89f7c4c76af5da888482cb1d40f5f352f2afbfe9ff72a5134aeeab6a4ece8a2ffd1f5237f7d3a5e44fbfe21fedc10b97168293af9f1c9e3d3b3bb17c7df942ef76ef6eef76af5a1fcbd797abdeed5e71e5c72bdfce7c347368e2d589e18bf3170380aaaa361d0300fb8fecafe203f17fa66eb0b91dd65203af1e2d952ccfb6a5bf95828d9bd3a74e8fec1bdd7758eaf25a336abe1c35a29734574d57d2850df47f983b37b7ba7e66cb1f687df1c9a7b30311f29434e509cd74c495fee8d4f1a9b7ce5f985f4997d219d33057e367c68ae456b22aa174d7e96f65dc6f9bea5d4d9bd1fb712b3ee4467428169ea62cccc4a1f1bda66ef66e457f2bf58d931bc93de3a3d46676b720bb081511f194a05eef6c4b7f13fd0f228d8a497c524ca50000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="762">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000002c1494441541895ed9531885c451880bfbb1be53fd80bf3e08a3770c53d30920d415d63c08da4b80521ac08e6c4c2159b9c9da28556c6d280bd90ee62212798e813536c0ae1b6bb8045163de28be4e0ad26304f387c532cec5f3c588bdb88987b5a1c58f9373f33ffccc70fdffc0cfc1fb398ab2b7c75edce6fe15e98be75e98557e43c77ec6b80ce8ae6200940355b57b38d31d3d17b8c4d1d38dccfefd3884ec7e7e593ce87f193ce46f8a05889d1b0888409b764801550b548c3a263c55741317a61be0e9c0ed21b1607224b6f9fdb70dde596dbca9bee8322721b2b171dc3c4c92a2e58dcfa735de76ce23acfac3b0d9250f1746dc7bd97df37452811a4f204dc7293afcf0c111132fa9c7c3322d0e66ca3837c971074137fa6206a580ac25c2d5851ec2c47085a4514ab508e1545c9aa8ca671f80725e5c893579ef85c4219140cd35ab09588821c96047bcf232b2db643a035ee926b8e5b8ec943413b7e96a2a59c9426c8227de94305a6ce7eae3f3d0e118a2e44a3826d4d913826bb5992d90c7bbccda2e9908d6fe1071332c9e89ee8a27af04a4c9dfd42ae2c4d0aa1b7d27aea8d6a9b685f983c105ccb918f3decde46f736d0b52d26a7400d447723a421000b261da4372ebef8d1e987f6d5e77486813c02ff448fadcffb8ff1fa00af4aef448f61e1e9acb6d9dcfd82e2b3cb3ff20dbb18e6015252a89807f6cd91ecef87efd9e75dfe1c19e060e8a6e688f67fa16272987c7344fbbf3eecf01170d0128b452bc58d02db558a8d57c9af4fc86c46d45c03eaed533d0afd4bc7256260e7548295843cdce6ec858474ef32cd518fcc07c2f1c3edd7cdc1ac63405978d5c5507a5e5a694218b2b376898faf6f72f5d3c14de0f7c3ecd782e3289151c850cf78e3cad57102c6ab4c9d1182083ba30cf6b8067c7998fd3af05cfbf9f5b510f49dec6eff5ba0008efdedc202f033f0431de49fe21810fdcb99da4fe13f8d3f00866a861c3ad7f9ad0000000049454e44ae426082</data>
+ </image>
+</images>
+<includes>
+ <include location="local" impldecl="in implementation">kinterfaceupdowndlg.ui.h</include>
+</includes>
+<Q_SLOTS>
+ <slot>close()</slot>
+</Q_SLOTS>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kdialog.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui.h b/knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui.h
new file mode 100644
index 0000000..060c5cf
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kinterfaceupdowndlg.ui.h
@@ -0,0 +1,16 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** TQt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+
+
+
+void KInterfaceUpDownDlg::close()
+{
+ accept();
+}
diff --git a/knetwortdeconf/knetwortdeconf/kknownhostinfo.cpp b/knetwortdeconf/knetwortdeconf/kknownhostinfo.cpp
new file mode 100644
index 0000000..a83fc77
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kknownhostinfo.cpp
@@ -0,0 +1,42 @@
+/***************************************************************************
+ KKnownHostInfo.cpp - description
+ -------------------
+ begin : Sun May 11 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : juancho@linuxmail.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "kknownhostinfo.h"
+
+KKnownHostInfo::KKnownHostInfo(){
+}
+KKnownHostInfo::~KKnownHostInfo(){
+}
+/** No descriptions */
+TQString KKnownHostInfo::getIpAddress(){
+ return ipAddress;
+}
+
+TQStringList KKnownHostInfo::getAliases(){
+ return aliases;
+}
+void KKnownHostInfo::setIpAddress(TQString ipAddress){
+ KKnownHostInfo::ipAddress = ipAddress;
+}
+
+void KKnownHostInfo::addAlias(TQString alias){
+ KKnownHostInfo::aliases.append(alias);
+}
+
+void KKnownHostInfo::setAliases(TQStringList aliases){
+ KKnownHostInfo::aliases = aliases;
+}
diff --git a/knetwortdeconf/knetwortdeconf/kknownhostinfo.h b/knetwortdeconf/knetwortdeconf/kknownhostinfo.h
new file mode 100644
index 0000000..1023f59
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kknownhostinfo.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ KKnownHostInfo.h - description
+ -------------------
+ begin : Sun May 11 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : juancho@linuxmail.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KKNOWNHOSTINFO_H
+#define KKNOWNHOSTINFO_H
+
+#include <tqstring.h>
+#include <tqstringlist.h>
+
+/**Class that represents an entry in the /etc/hosts file.
+ *@author Juan Luis Baptiste
+ */
+
+class KKnownHostInfo {
+public:
+ KKnownHostInfo();
+ ~KKnownHostInfo();
+ TQStringList getAliases();
+ TQString getIpAddress();
+ void setAliases(TQStringList aliases);
+ void addAlias(TQString alias);
+ void setIpAddress(TQString ipAddress);
+private: // Private attributes
+ /** IP address of the known Host. */
+ TQString ipAddress;
+ /** Lists of aliases of the known host. */
+ TQStringList aliases;
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/knetworkinfo.cpp b/knetwortdeconf/knetwortdeconf/knetworkinfo.cpp
new file mode 100644
index 0000000..ccbf511
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetworkinfo.cpp
@@ -0,0 +1,76 @@
+/***************************************************************************
+ knetworkinfo.cpp - description
+ -------------------
+ begin : Fri Jan 17 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "knetworkinfo.h"
+
+KNetworkInfo::KNetworkInfo(){
+}
+KNetworkInfo::~KNetworkInfo(){
+}
+void KNetworkInfo::setDeviceList(TQPtrList<KNetworkInterface> deviceList){
+ KNetworkInfo::deviceList = deviceList;
+}
+void KNetworkInfo::setRoutingInfo(KRoutingInfo *routingInfo){
+ KNetworkInfo::routingInfo = routingInfo;
+}
+void KNetworkInfo::setDNSInfo(KDNSInfo *dnsInfo){
+ KNetworkInfo::dnsInfo = dnsInfo;
+
+}
+TQPtrList<KNetworkInterface> KNetworkInfo::getDeviceList(){
+ return deviceList;
+}
+KRoutingInfo * KNetworkInfo::getRoutingInfo(){
+ return routingInfo;
+}
+KDNSInfo * KNetworkInfo::getDNSInfo(){
+ return dnsInfo;
+}
+
+void KNetworkInfo::setNetworkScript(TQString script){
+ KNetworkInfo::networkScript = script;
+}
+TQString KNetworkInfo::getNetworkScript(){
+ return networkScript;
+}
+/** Returns the platform name KnetworkConf is running on. */
+TQString KNetworkInfo::getPlatformName(){
+ return platformName;
+}
+/** Sets the platform name KNetworkConf is running on. */
+void KNetworkInfo::setPlatformName(TQString name){
+ KNetworkInfo::platformName = name;
+}
+
+void KNetworkInfo::setProfilesList(TQPtrList<KNetworkInfo> profilesList){
+ KNetworkInfo::profilesList = profilesList;
+}
+
+TQPtrList<KNetworkInfo> KNetworkInfo::getProfilesList(){
+ return profilesList;
+}
+
+/** Returns the platform name KnetworkConf is running on. */
+TQString KNetworkInfo::getProfileName(){
+ return profileName;
+}
+/** Sets the platform name KNetworkConf is running on. */
+void KNetworkInfo::setProfileName(TQString profileName){
+ KNetworkInfo::profileName = profileName;
+}
+
+
diff --git a/knetwortdeconf/knetwortdeconf/knetworkinfo.h b/knetwortdeconf/knetwortdeconf/knetworkinfo.h
new file mode 100644
index 0000000..59c3dc0
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetworkinfo.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ knetworkinfo.h - description
+ -------------------
+ begin : Fri Jan 17 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNETWORKINFO_H
+#define KNETWORKINFO_H
+
+#include <tqstring.h>
+#include <tqptrlist.h>
+#include "knetworkinterface.h"
+#include "kwirelessinterface.h"
+#include "kaddressvalidator.h"
+#include "kroutinginfo.h"
+#include "kdnsinfo.h"
+
+/**Represents the network information
+ *@author Juan Luis Baptiste
+ */
+
+class KNetworkInfo {
+ public:
+ KNetworkInfo();
+ ~KNetworkInfo();
+ private: // Private attributes
+ TQPtrList<KNetworkInterface> deviceList;
+ KRoutingInfo *routingInfo;
+ /** Path to the network script that permits starting/stopping/reloading the
+ network. */
+ TQString networkScript;
+ KDNSInfo *dnsInfo;
+ /** Platform name. */
+ TQString platformName;
+ TQPtrList<KNetworkInfo> profilesList;
+ TQString profileName;
+
+ public: // Public attributes
+ void setDeviceList(TQPtrList<KNetworkInterface> deviceList);
+ void setRoutingInfo(KRoutingInfo *routingInfo);
+ void setDNSInfo(KDNSInfo *dnsInfo);
+ TQPtrList<KNetworkInterface> getDeviceList();
+ KRoutingInfo *getRoutingInfo();
+ KDNSInfo *getDNSInfo();
+ TQString getNetworkScript();
+ void setNetworkScript(TQString script);
+ /** Returns the platform name KnetworkConf is running on. */
+ TQString getPlatformName();
+ /** Sets the platform name KNetworkConf is running on. */
+ void setPlatformName(TQString name);
+ void setProfilesList(TQPtrList<KNetworkInfo> profilesList);
+ TQPtrList<KNetworkInfo> getProfilesList();
+ void setProfileName(TQString profileName);
+ TQString getProfileName();
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/knetworkinterface.cpp b/knetwortdeconf/knetwortdeconf/knetworkinterface.cpp
new file mode 100644
index 0000000..0a7fad5
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetworkinterface.cpp
@@ -0,0 +1,104 @@
+/***************************************************************************
+ knetworkinterface.cpp - description
+ -------------------
+ begin : Mon Jan 13 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "knetworkinterface.h"
+
+KNetworkInterface::KNetworkInterface(){
+}
+KNetworkInterface::~KNetworkInterface(){
+}
+
+TQString KNetworkInterface::getBootProto(){
+ return bootProto;
+}
+TQString KNetworkInterface::getBroadcast(){
+ return broadcast;
+}
+TQString KNetworkInterface::getDeviceName(){
+ return deviceName;
+}
+TQString KNetworkInterface::getIpAddress(){
+ return ipAddress;
+}
+TQString KNetworkInterface::getNetmask(){
+ return netmask;
+}
+TQString KNetworkInterface::getNetwork(){
+ return network;
+}
+TQString KNetworkInterface::getOnBoot(){
+ return onBoot;
+}
+TQString KNetworkInterface::getGateway(){
+ return gateway;
+}
+
+void KNetworkInterface::setBootProto(const TQString &bootProto){
+ KNetworkInterface::bootProto = bootProto;
+}
+void KNetworkInterface::setBroadcast(const TQString &broadcast){
+ KNetworkInterface::broadcast = broadcast;
+}
+void KNetworkInterface::setDeviceName(const TQString &deviceName){
+ KNetworkInterface::deviceName = deviceName;
+}
+void KNetworkInterface::setIpAddress(const TQString &ipAddress){
+ KNetworkInterface::ipAddress = ipAddress;
+}
+void KNetworkInterface::setNetmask(const TQString &netmask){
+ KNetworkInterface::netmask = netmask;
+}
+void KNetworkInterface::setNetwork(const TQString &network){
+ KNetworkInterface::network = network;
+}
+void KNetworkInterface::setOnBoot(const TQString &onBoot){
+ KNetworkInterface::onBoot = onBoot;
+}
+void KNetworkInterface::setGateway(const TQString &gateway){
+ KNetworkInterface::gateway = gateway;
+}
+bool KNetworkInterface::isActive(){
+ return active;
+}
+void KNetworkInterface::setActive(bool active){
+ KNetworkInterface::active = active;
+}
+/** No descriptions */
+TQString KNetworkInterface::getMacAddress(){
+ return hwAddress;
+}
+/** No descriptions */
+void KNetworkInterface::setMacAddress(const TQString &addr){
+ KNetworkInterface::hwAddress = addr;
+}
+/** No descriptions */
+TQString KNetworkInterface::getDescription(){
+ return description;
+}
+/** No descriptions */
+void KNetworkInterface::setDescription(const TQString &desc){
+ KNetworkInterface::description = desc;
+}
+
+/** No descriptions */
+TQString KNetworkInterface::getType(){
+ return type;
+}
+/** No descriptions */
+void KNetworkInterface::setType(const TQString &type){
+ KNetworkInterface::type = type;
+}
diff --git a/knetwortdeconf/knetwortdeconf/knetworkinterface.h b/knetwortdeconf/knetwortdeconf/knetworkinterface.h
new file mode 100644
index 0000000..65ccfc0
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetworkinterface.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ knetworkinterface.h - description
+ -------------------
+ begin : Mon Jan 13 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNETWORKINTERFACE_H
+#define KNETWORKINTERFACE_H
+
+#include <tqstring.h>
+
+/**This class has all the values associated with a network interface.
+ *@author Juan Luis Baptiste
+ */
+
+class KNetworkInterface {
+ public:
+ KNetworkInterface();
+ ~KNetworkInterface();
+
+ TQString getBootProto();
+ TQString getBroadcast();
+ TQString getDeviceName();
+ TQString getIpAddress();
+ TQString getNetmask();
+ TQString getNetwork();
+ TQString getOnBoot();
+ TQString getGateway();
+ void setBootProto(const TQString &bootProto);
+ void setBroadcast(const TQString &broadcast);
+ void setDeviceName(const TQString &deviceName);
+ void setIpAddress(const TQString &ipAddress);
+ void setNetmask(const TQString &netmask);
+ void setNetwork(const TQString &network);
+ void setOnBoot(const TQString &onBoot);
+ void setGateway(const TQString &gateway);
+ bool isActive();
+ void setActive(bool active);
+ void setMacAddress(const TQString &addr);
+ TQString getMacAddress();
+ void setDescription(const TQString &desc);
+ TQString getDescription();
+ void setType(const TQString &type);
+ TQString getType();
+
+ private: // Private attributes
+ /** Interface name (i.e. eth0, eth1, etc). */
+ TQString deviceName;
+ /** Boot protocol of the device (static, dhcp). */
+ TQString bootProto;
+ /** IPv4 address of the interface. */
+ TQString ipAddress;
+ /** The Netmask. */
+ TQString netmask;
+ /** The network. */
+ TQString network;
+ /** The broadcast. */
+ TQString broadcast;
+ /** thetermines if this device is configured at boot time. */
+ TQString onBoot;
+ /** default gateway for this device. */
+ TQString gateway;
+ bool active;
+ /** The MAC address. */
+ TQString hwAddress;
+ /** A little description about the network device. */
+ TQString description;
+ /** Type of interface (ethernet,wireless,loopback or modem)*/
+ TQString type;
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconf.cpp b/knetwortdeconf/knetwortdeconf/knetwortdeconf.cpp
new file mode 100644
index 0000000..3a01a60
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconf.cpp
@@ -0,0 +1,1186 @@
+/***************************************************************************
+ knetwortdeconf.cpp - description
+ -------------------
+ begin : Sun Jan 12 8:54:19 UTC 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <kiconloader.h>
+
+#include "knetwortdeconf.h"
+
+KNetworkConf::KNetworkConf(TQWidget *parent, const char *name) : DCOPObject("KNetworkConfIface"), KNetworkConfDlg(parent, name)
+{
+ netInfo = 0L;
+ makeButtonsResizeable();
+ config = new KNetworkConfigParser();
+ klvCardList->setAllColumnsShowFocus(true);
+ klvKnownHosts->setAllColumnsShowFocus(true);
+ klvProfilesList->setAllColumnsShowFocus(true);
+ klvProfilesList->setRenameable(0,true);
+ klvProfilesList->setRenameable(1,true);
+ TQToolTip::remove( static_cast<TQListView*>(klvProfilesList) );
+ tooltip = new KProfilesListViewToolTip(klvProfilesList);
+
+ //Connect signals emmitted by the backend to know when data is ready to be painted.
+ connect(config,TQT_SIGNAL(readyLoadingNetworkInfo()),this,TQT_SLOT(getNetworkInfoSlot()));
+ connect(config,TQT_SIGNAL(readyLoadingNetworkInfo()),this,TQT_SLOT(showMainWindow()));
+ connect(config,TQT_SIGNAL(readyLoadingNetworkInfo()),this,TQT_SLOT(enableSignals()));
+ connect(config, TQT_SIGNAL(setReadOnly(bool)),this,TQT_SLOT(setReadOnlySlot(bool)));
+ connect(klvCardList,
+ TQT_SIGNAL(contextMenu(KListView*,TQListViewItem*,const TQPoint&)),
+ this,
+ TQT_SLOT(showInterfaceContextMenuSlot(KListView*,TQListViewItem*, const TQPoint&)));
+
+ // Register with DCOP - No longer needed as now we are a kcontrol module?
+ if ( !kapp->dcopClient()->isRegistered() ) {
+ kapp->dcopClient()->registerAs( "knetwortdeconf" );
+ kapp->dcopClient()->setDefaultObject( objId() );
+ }
+
+ //Temporarly added while gst supports routing option.
+// cbEnableRouting->hide();
+}
+
+KNetworkConf::~KNetworkConf()
+{
+ delete config;
+}
+
+void KNetworkConf::getNetworkInfoSlot()
+{
+ netInfo = config->getNetworkInfo();
+ if (netInfo == NULL)
+ {
+ KMessageBox::error(this,
+ i18n("Could not load network configuration information."),
+ i18n("Error Reading Configuration File"));
+ //kapp->quit();
+ //exit(1);
+ }
+ else
+ {
+ //TQPtrList<KNetworkInterface> deviceList;
+ routingInfo = netInfo->getRoutingInfo();
+ dnsInfo = netInfo->getDNSInfo();
+ profilesList = netInfo->getProfilesList();
+
+ loadNetworkDevicesInfo();
+ loadRoutingInfo();
+ loadDNSInfo();
+ loadNetworkProfiles();
+ nameServersModified = false;
+ devicesModified = false;
+ modified = false;
+// kpbApply->setEnabled(false);
+ }
+
+}
+
+/**
+ Fill the Listview with the info of the network interfaces.
+*/
+void KNetworkConf::loadNetworkDevicesInfo()
+{
+ KNetworkInterface *device;
+ TQPixmap activeEthernetDeviceImg(locate("icon","hicolor/22x22/actions/network_connected_lan_knc.png"));
+ TQPixmap inactiveEthernetDeviceImg(locate("icon","hicolor/22x22/actions/network_disconnected_lan.png"));
+ TQPixmap activeWirelessDeviceImg(locate("icon","hicolor/22x22/actions/network_traffic_wlan.png"));
+ TQPixmap inactiveWirelessDeviceImg(locate("icon","hicolor/22x22/actions/network_disconnected_wlan.png"));
+
+ klvCardList->clear();
+ TQPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList();
+ for (device = deviceList.first(); device; device = deviceList.next())
+ {
+ if ( device->getType() != "loopback" )
+ {
+ if (klvCardList->findItem(device->getDeviceName(),0,CaseSensitive|ExactMatch) == 0)
+ {
+ TQListViewItem * item = new TQListViewItem( klvCardList, 0 );
+
+ if (device->isActive())
+ {
+ if (device->getType() == "ethernet")
+ item->setPixmap(0,activeEthernetDeviceImg);
+ else if (device->getType() == "wireless")
+ item->setPixmap(0,activeWirelessDeviceImg);
+
+ item->setText(3,i18n("Enabled"));
+ item->setPixmap(3,SmallIcon("ok"));
+ }
+ else
+ {
+ if (device->getType() == "ethernet")
+ item->setPixmap(0,inactiveEthernetDeviceImg);
+ else if (device->getType() == "wireless")
+ item->setPixmap(0,inactiveWirelessDeviceImg);
+
+ item->setText(3,i18n("Disabled"));
+ item->setPixmap(3,SmallIcon("stop"));
+ if (device->getBootProto().lower() == "dhcp")
+ item->setText(1,"");
+ }
+
+ item->setText(0,device->getDeviceName());
+ item->setText(1,device->getIpAddress());
+ if (device->getBootProto() == "none")
+ item->setText(2,i18n("Manual"));
+ else
+ item->setText(2,device->getBootProto());
+ item->setText(4,device->getDescription());
+ TQStringList l = deviceNamesList.grep(device->getDeviceName());
+ if (l.size() == 0)
+ deviceNamesList.append(device->getDeviceName());
+ }
+ }
+ }
+}
+
+
+/** Terminates the application
+ */
+void KNetworkConf::quitSlot(){
+ int code = 0;
+ connect( config, TQT_SIGNAL(readyLoadingNetworkInfo()), this, TQT_SLOT(quitSlot()) );
+ if (modified)
+ {
+ code = KMessageBox::warningYesNoCancel(this,
+ i18n("The new configuration has not been saved.\nDo you want to apply changes before quitting?"),
+ i18n("New Configuration Not Saved"),KStdGuiItem::apply(),KStdGuiItem::quit());
+ if (code == KMessageBox::Yes)
+ saveInfoSlot();
+ else if (code == KMessageBox::No)
+ kapp->quit();
+ }
+ else
+ kapp->quit();
+}
+/** Enables the configure and remove buttons. */
+void KNetworkConf::enableButtonsSlot(){
+ if (!readOnly)
+ {
+ kpbConfigureNetworkInterface->setEnabled(true);
+ TQListViewItem *item = klvCardList->currentItem();
+ TQString currentDevice = item->text(0);
+ KNetworkInterface *dev = getDeviceInfo(currentDevice);
+
+ if (dev->isActive())
+ {
+ kpbUpButton->setEnabled(false);
+ kpbDownButton->setEnabled(true);
+ }
+ else
+ {
+ kpbUpButton->setEnabled(true);
+ kpbDownButton->setEnabled(false);
+ }
+ }
+}
+/** opens the add server dialog. */
+void KNetworkConf::addServerSlot(){
+ KAddDNSServerDlg addDlg(this, 0);
+ addDlg.exec();
+ if(addDlg.modified())
+ {
+ klbDomainServerList->insertItem(addDlg.kleNewServer->text());
+ nameServersModified = true;
+ enableApplyButtonSlot();
+ }
+}
+/** opens the edit server dialog. */
+void KNetworkConf::editServerSlot(){
+ KAddDNSServerDlg dlg(this, 0);
+ if (klbDomainServerList->currentItem() >= 0)
+ {
+ int currentPos = klbDomainServerList->currentItem();
+ dlg.setCaption(i18n("Edit Server"));
+ TQListBoxItem *item = klbDomainServerList->item(currentPos);
+ TQString currentText = item->text();
+ dlg.kleNewServer->setText(currentText);
+ dlg.kpbAddServer->setText(i18n("&OK"));
+ dlg.exec();
+
+ if(dlg.modified())
+ {
+ klbDomainServerList->changeItem(dlg.kleNewServer->text(),currentPos);
+ nameServersModified = true;
+ enableApplyButtonSlot();
+ }
+ }
+}
+
+/** Pops up the window for adding a new interface. */
+void KNetworkConf::configureDeviceSlot(){
+ TQListViewItem *item = klvCardList->currentItem();
+ KWirelessInterface *wifiDev = NULL;
+
+ //KAddDeviceContainer *configDlg = new KAddDeviceContainer(this,0);
+ KAddDeviceContainer configDlg(this,0);
+
+ if (item != NULL)
+ {
+ TQString currentDevice = item->text(0);
+ configDlg.setCaption(i18n("Configure Device %1").arg(currentDevice));
+ KNetworkInterface *dev = getDeviceInfo(currentDevice);
+ KAddDeviceDlgExtension *advancedOptions = (KAddDeviceDlgExtension *)configDlg.extension();
+
+ if (dev->getBootProto() == "none")
+ {
+ configDlg.addDlg->rbBootProtoManual->setChecked(true);
+ configDlg.addDlg->rbBootProtoAuto->setChecked(false);
+ }
+ else if (dev->getBootProto().lower() == "dhcp")
+ {
+ configDlg.addDlg->kcbAutoBootProto->setCurrentItem(0);
+ configDlg.addDlg->rbBootProtoManual->setChecked(false);
+ configDlg.addDlg->rbBootProtoAuto->setChecked(true);
+ configDlg.addDlg->kleIPAddress->setEnabled(false);
+ configDlg.addDlg->kcbNetmask->setEnabled(false);
+ configDlg.kpbAdvanced->setEnabled(false);
+ }
+ else if (dev->getBootProto().lower() == "bootp")
+ {
+ configDlg.addDlg->kcbAutoBootProto->setCurrentItem(1);
+ configDlg.addDlg->rbBootProtoManual->setChecked(false);
+ configDlg.addDlg->rbBootProtoAuto->setChecked(true);
+ configDlg.kpbAdvanced->setEnabled(false);
+ }
+ if (dev->getOnBoot() == "yes")
+ configDlg.addDlg->kcbstartAtBoot->setChecked(true);
+ else
+ {
+ configDlg.addDlg->kcbstartAtBoot->setChecked(false);
+ }
+ configDlg.addDlg->kleIPAddress->setText(dev->getIpAddress());
+ advancedOptions->kleDescription->setText(dev->getDescription());
+ if (!dev->getBroadcast().isEmpty())
+ advancedOptions->kleBroadcast->setText(dev->getBroadcast());
+ else
+ advancedOptions->kleBroadcast->setText(KAddressValidator::calculateBroadcast(dev->getIpAddress(),dev->getNetmask()));
+
+ advancedOptions->kleGateway->setText(dev->getGateway());
+
+ if (!dev->getNetmask().isEmpty())
+ configDlg.addDlg->kcbNetmask->setCurrentText(dev->getNetmask());
+
+ if (readOnly)
+ {
+ configDlg.addDlg->kcbAutoBootProto->setEnabled(false);
+ configDlg.addDlg->kcbstartAtBoot->setEnabled(false);
+ advancedOptions->gbAdvancedDeviceInfo->setEnabled(false);
+ }
+
+ //If the interface is wireless, then add the wireless configuration widget
+ if (dev->getType() == WIRELESS_IFACE_TYPE){
+ wifiDev = static_cast<KWirelessInterface*>(dev);
+ configDlg.addWirelessWidget();
+ configDlg.extDlg->kleEssid->setText(wifiDev->getEssid());
+ configDlg.extDlg->kleWepKey->setText(wifiDev->getWepKey());
+ if (wifiDev->getKeyType() == WIRELESS_WEP_KEY_TYPE_ASCII)
+ configDlg.extDlg->qcbKeyType->setCurrentItem(0);
+ else if (wifiDev->getKeyType() == WIRELESS_WEP_KEY_TYPE_HEXADECIMAL)
+ configDlg.extDlg->qcbKeyType->setCurrentItem(1);
+ }
+
+ configDlg.addButtons();
+ //Disable Apply button so it only is enabled when a change is made
+ configDlg.kpbApply->setEnabled(false);
+ configDlg.exec();
+
+ if (configDlg.modified())
+ {
+ if(configDlg.addDlg->rbBootProtoManual->isChecked())
+ {
+ item->setText(2,i18n("Manual"));
+ dev->setBootProto("none");
+ }
+ //If the selected boot protocol is dhcp or bootp (Auto), then we don't need the
+ //past IP address, netmask, network and broadcast, as a new one will be assigned by
+ //the dhcp server.
+ else if (configDlg.addDlg->rbBootProtoAuto->isChecked())
+ {
+ if (configDlg.addDlg->kcbAutoBootProto->currentText() != dev->getBootProto())
+ {
+ dev->setIpAddress("");
+ configDlg.addDlg->kleIPAddress->setText("");
+ dev->setGateway("");
+ dev->setNetmask("");
+ dev->setNetwork("");
+ dev->setBroadcast("");
+ }
+ item->setText(2,configDlg.addDlg->kcbAutoBootProto->currentText());
+ dev->setBootProto(configDlg.addDlg->kcbAutoBootProto->currentText());
+ }
+ item->setText(1,configDlg.addDlg->kleIPAddress->text());
+ item->setText(4,advancedOptions->kleDescription->text());
+
+ if (valuesChanged(dev,
+ configDlg.addDlg->kcbAutoBootProto->currentText(),
+ configDlg.addDlg->kcbNetmask->currentText(),
+ configDlg.addDlg->kleIPAddress->text(),
+ advancedOptions->kleGateway->text(),
+ configDlg.addDlg->kcbstartAtBoot->isChecked(),
+ advancedOptions->kleDescription->text(),
+ advancedOptions->kleBroadcast->text()))
+ {
+ dev->setIpAddress(configDlg.addDlg->kleIPAddress->text().stripWhiteSpace());
+ dev->setGateway(advancedOptions->kleGateway->text().stripWhiteSpace());
+ dev->setNetmask(configDlg.addDlg->kcbNetmask->currentText().stripWhiteSpace());
+ TQString network = KAddressValidator::calculateNetwork(dev->getIpAddress().stripWhiteSpace(),dev->getNetmask().stripWhiteSpace());
+ dev->setNetwork(network);
+ TQString broadcast = advancedOptions->kleBroadcast->text().stripWhiteSpace();
+ if (broadcast.isEmpty())
+ broadcast = KAddressValidator::calculateBroadcast(dev->getIpAddress().stripWhiteSpace(),dev->getNetmask().stripWhiteSpace());
+ dev->setBroadcast(broadcast);
+ dev->setDescription(advancedOptions->kleDescription->text());
+
+ if (configDlg.addDlg->kcbstartAtBoot->isChecked())
+ dev->setOnBoot("yes");
+ else
+ dev->setOnBoot("no");
+ }
+ //If the interface is wireless, then save the wireless configuration options
+ if (dev->getType() == WIRELESS_IFACE_TYPE){
+ wifiDev->setEssid(configDlg.extDlg->kleEssid->text());
+ wifiDev->setWepKey(configDlg.extDlg->kleWepKey->password());
+ wifiDev->setKeyType(configDlg.extDlg->qcbKeyType->currentText());
+ dev = wifiDev;
+ }
+ devicesModified = true;
+ enableApplyButtonSlot();
+ }
+ }
+}
+
+/**Returns the info of the network device 'device or NULL if not found.'*/
+KNetworkInterface * KNetworkConf::getDeviceInfo(TQString device){
+ TQPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList();
+ TQPtrListIterator<KNetworkInterface> i(deviceList);
+ KNetworkInterface *temp;
+ while ((temp = i.current()) != 0)
+ {
+ if (temp->getDeviceName() == device)
+ {
+ return temp;
+ }
+ ++i;
+ }
+ return NULL;
+}
+
+/**Returns the name of the network device that corresponds to the IP address 'ipAddr' or NULL if not found.'*/
+TQString KNetworkConf::getDeviceName(TQString ipAddr){
+ TQPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList();
+ TQPtrListIterator<KNetworkInterface> i(deviceList);
+ KNetworkInterface *temp;
+ while ((temp = i.current()) != 0)
+ {
+ if (temp->getIpAddress().compare(ipAddr) == 0)
+ {
+ return temp->getDeviceName();
+ }
+ ++i;
+ }
+ return NULL;
+}
+
+
+/** Looks in the output returned by ifconfig to see if there are the devices up or down.*/
+void KNetworkConf::readFromStdout(){
+ commandOutput = "";
+ commandOutput += procUpdateDevice->readStdout();
+}
+
+/** Loads the info about the default gateway and host and domain names. */
+void KNetworkConf::loadRoutingInfo(){
+ //routingInfo = config->getNetworkInfoSlot();
+ if (!routingInfo->getGateway().isEmpty())
+ kleDefaultRoute->setText(routingInfo->getGateway());
+ else
+ {
+ //Take the default gateway from the gateway field of the default gateway interface
+ //because some platforms (Debian-like ones) seems that don't handle the concept of a default
+ //gateway, instead a gateway per interface.
+ KNetworkInterface *device;
+ TQString defaultGwDevice = routingInfo->getGatewayDevice();
+ TQPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList();
+ for (device = deviceList.first(); device; device = deviceList.next())
+ {
+ if ( device->getDeviceName() == defaultGwDevice )
+ {
+ if ( !device->getGateway().isEmpty() )
+ {
+ kleDefaultRoute->setText(device->getGateway());
+ }
+ }
+ }
+ }
+
+ kcbGwDevice->clear();
+ kcbGwDevice->insertStringList(deviceNamesList);
+ if (!routingInfo->getGatewayDevice().isEmpty())
+ kcbGwDevice->setCurrentText(routingInfo->getGatewayDevice());
+/* if (routingInfo->isForwardIPv4Enabled().compare("yes") == 0)
+ cbEnableRouting->setChecked(true);
+ else
+ cbEnableRouting->setChecked(false);*/
+}
+
+void KNetworkConf::loadDNSInfo(){
+ TQStringList nameServers;
+ if (dnsInfo == NULL)
+ KMessageBox::error(this,i18n("Could not open file '/etc/resolv.conf' for reading."),
+ i18n("Error Loading Config Files"));
+ else
+ {
+ kleHostName->setText(dnsInfo->getMachineName());
+ kleDomainName->setText(dnsInfo->getDomainName());
+ klbDomainServerList->clear();
+ nameServers = dnsInfo->getNameServers();
+ for ( TQStringList::Iterator it = nameServers.begin(); it != nameServers.end(); ++it)
+ {
+ klbDomainServerList->insertItem(*it);
+ }
+ klvKnownHosts->clear();
+ knownHostsList = dnsInfo->getKnownHostsList();
+ TQPtrListIterator<KKnownHostInfo> it(knownHostsList);
+ KKnownHostInfo *host;
+ while ((host = it.current()) != 0)
+ {
+ ++it;
+ if (!(host->getIpAddress().isEmpty()))
+ {
+ TQListViewItem * item = new TQListViewItem( klvKnownHosts, 0 );
+ item->setText(0,host->getIpAddress());
+ TQStringList aliasesList = host->getAliases();
+ TQString aliases;
+ for ( TQStringList::Iterator it = aliasesList.begin(); it != aliasesList.end(); ++it )
+ {
+ aliases += *it+" ";
+ }
+ item->setText(1,aliases);
+ }
+ }
+ }
+}
+
+void KNetworkConf::loadNetworkProfiles(){
+ TQPtrListIterator<KNetworkInfo> it(profilesList);
+ KNetworkInfo *profile = NULL;
+
+ klvProfilesList->clear();
+ while ((profile = it.current()) != 0)
+ {
+ ++it;
+ if (!profile->getProfileName().isEmpty())
+ {
+ TQListViewItem * item = new TQListViewItem( klvProfilesList, 0 );
+ item->setText(0,profile->getProfileName());
+ }
+ }
+}
+
+/** Shows the help browser. Hopefully some day it will be one :-). */
+void KNetworkConf::helpSlot(){
+ kapp->invokeHelp();
+}
+
+/** No descriptions */
+void KNetworkConf::aboutSlot(){
+ KAboutApplication *about = new KAboutApplication(kapp->aboutData(),0);
+
+ // about->setLogo(locate("icon","knetwortdeconf.png"));
+ //tqDebug("locate icon= %s",locate("icon","knetwortdeconf.png").latin1());
+
+ about->show();
+}
+/** No descriptions */
+void KNetworkConf::enableApplyButtonSlot(){
+ //if (!readOnly)
+ //kpbApply->setEnabled(true);
+ modified = true;
+ emit networkStateChanged(true);
+}
+/** Puts the application in read-only mode. This happens when the user runing
+the application t root. */
+void KNetworkConf::setReadOnly(bool state){
+ KNetworkConf::readOnly = state;
+}
+/** No descriptions */
+void KNetworkConf::enableApplyButtonSlot(const TQString &text){
+ enableApplyButtonSlot();
+}
+/** No descriptions */
+void KNetworkConf::enableApplyButtonSlot(bool){
+ enableApplyButtonSlot();
+}
+/** No descriptions */
+void KNetworkConf::removeServerSlot(){
+ if (klbDomainServerList->currentItem() >= 0)
+ {
+ klbDomainServerList->removeItem(klbDomainServerList->currentItem());
+ enableApplyButtonSlot();
+ }
+}
+void KNetworkConf::moveUpServerSlot(){
+ int curPos = klbDomainServerList->currentItem();
+ int antPos = klbDomainServerList->currentItem() - 1;
+
+ if (antPos >= 0)
+ {
+ TQListBoxItem *current = klbDomainServerList->item(curPos);
+ TQListBoxItem *ant = current->prev();
+ TQString antText = ant->text();
+ klbDomainServerList->removeItem(antPos);
+ klbDomainServerList->insertItem(antText,curPos);
+ enableApplyButtonSlot();
+ }
+}
+void KNetworkConf::moveDownServerSlot(){
+ int curPos = klbDomainServerList->currentItem();
+ unsigned nextPos = klbDomainServerList->currentItem() + 1;
+
+ if (curPos != -1)
+ {
+ if (klbDomainServerList->count() >= nextPos)
+ {
+ TQListBoxItem *current = klbDomainServerList->item(curPos);
+ TQString curText = current->text();
+ klbDomainServerList->removeItem(curPos);
+ klbDomainServerList->insertItem(curText,nextPos);
+ klbDomainServerList->setSelected(nextPos,true);
+ enableApplyButtonSlot();
+ }
+ }
+}
+/** Disables all buttons a line edit widgets when the user has read only access. */
+void KNetworkConf::disableAll(){
+ kleHostName->setReadOnly(true);
+ kleDomainName->setReadOnly(true);
+ tlDomainName->setEnabled(false);
+ tlHostName->setEnabled(false);
+ disconnect(klvCardList,TQT_SIGNAL(doubleClicked(TQListViewItem *)),this,TQT_SLOT(configureDeviceSlot()));
+ klvCardList->setEnabled(false);
+ kpbUpButton->setEnabled(false);
+ kpbDownButton->setEnabled(false);
+ kpbConfigureNetworkInterface->setEnabled(false);
+ gbDefaultGateway->setEnabled(false);
+ gbDNSServersList->setEnabled(false);
+ gbKnownHostsList->setEnabled(false);
+// gbNetworkOptions->setEnabled(false);
+}
+
+/** Saves all the modified info of devices, routes,etc. */
+void KNetworkConf::saveInfoSlot(){
+ config->setProgramVersion(getVersion());
+
+ if (!KAddressValidator::isValidIPAddress(kleDefaultRoute->text()) && (!(kleDefaultRoute->text().isEmpty())))
+ {
+ KMessageBox::error(this,i18n("The default Gateway IP address is invalid."),i18n("Invalid IP Address"));
+ }
+ else
+ {
+ //Update DNS info
+ routingInfo->setDomainName(kleDomainName->text());
+ routingInfo->setHostName(kleHostName->text());
+ dnsInfo->setDomainName(kleDomainName->text());
+ dnsInfo->setMachineName(kleHostName->text());
+ dnsInfo->setNameServers(getNamserversList(klbDomainServerList));
+ dnsInfo->setKnownHostsList(getKnownHostsList(klvKnownHosts));
+
+ //Update routing info
+ routingInfo->setGateway(kleDefaultRoute->text());
+ if (routingInfo->getGateway().isEmpty())
+ routingInfo->setGatewayDevice("");
+
+ if (!kleDefaultRoute->text().isEmpty())
+ routingInfo->setGatewayDevice(kcbGwDevice->currentText());
+
+ //Save all info
+ //netInfo->setDeviceList(deviceList);
+ netInfo->setRoutingInfo(routingInfo);
+ netInfo->setDNSInfo(dnsInfo);
+
+ //Add the default gateway to the gateway field of the default gateway interface
+ //because some platforms (Debian-like ones) get the default gateway from there
+ //instead from the default gateway field. funny huh?
+ KNetworkInterface *device;
+ TQString defaultGwDevice = routingInfo->getGatewayDevice();
+ TQString defaultGwAddress = routingInfo->getGateway();
+ TQPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList();
+ for (device = deviceList.first(); device; device = deviceList.next())
+ {
+ if ( device->getGateway().length() == 0 )
+ {
+ if ( device->getDeviceName() == defaultGwDevice )
+ {
+ device->setGateway(defaultGwAddress);
+ }
+ }
+ }
+
+ config->saveNetworkInfo(netInfo);
+ modified = false;
+ }
+}
+/** Creates a TQStringList with the IP addresses contained in the TQListBox of name servers. */
+TQStringList KNetworkConf::getNamserversList(KListBox * serverList){
+ TQStringList list;
+ for (unsigned i = 0; i < serverList->count(); i++)
+ {
+ list.append(serverList->text(i));
+ }
+ return list;
+}
+/** Creates a TQPtrList<KKownHostInfo> with the info contained in the KListView of name servers. */
+TQPtrList<KKnownHostInfo> KNetworkConf::getKnownHostsList(KListView * hostsList){
+ TQPtrList<KKnownHostInfo> list;
+ TQListViewItem *it = hostsList->firstChild();
+ for (int i = 0; i < hostsList->childCount(); i++)
+ {
+ KKnownHostInfo *host = new KKnownHostInfo();
+
+ if (!(it->text(0).isEmpty()))
+ {
+ host->setIpAddress(it->text(0));
+// host->setHostName(it->text(1));
+ host->setAliases(TQStringList::split(" ",it->text(1)));
+ it = it->nextSibling();
+ list.append(host);
+ }
+ }
+ return list;
+}
+
+TQString KNetworkConf::getVersion(){
+ return version;
+}
+void KNetworkConf::setVersion(TQString ver){
+ KNetworkConf::version = ver;
+}
+
+/** Changes the state of device 'dev' to DEVICE_UP or DEVICE_DOWN.
+Return true on success, false on failure. */
+void KNetworkConf::changeDeviceState(const TQString &dev, int state){
+ // If the text "Changing device state" is user visible it cannot be the
+ // name parameter to the constructor.
+ KInterfaceUpDownDlg* dialog = new KInterfaceUpDownDlg(this,"Changing device state");
+
+ if (state == DEVICE_UP)
+ dialog->label->setText(i18n("Enabling interface <b>%1</b>").arg(dev));
+ else
+ dialog->label->setText(i18n("Disabling interface <b>%1</b>").arg(dev));
+
+ dialog->setModal(true);
+ dialog->show();
+
+ procDeviceState = new TQProcess(TQT_TQOBJECT(this));
+ TQString cmd;
+ procDeviceState->addArgument( locate("data",BACKEND_PATH) );
+
+ //If the platform couldn't be autodetected specify it manually
+ if (netInfo->getPlatformName() != TQString())
+ {
+ procDeviceState->addArgument( "--platform" );
+ procDeviceState->addArgument( netInfo->getPlatformName() );
+ }
+ procDeviceState->addArgument( "-d" );
+
+ if (state == DEVICE_UP)
+ procDeviceState->addArgument("enable_iface::"+dev+"::1" );
+ else if (state == DEVICE_DOWN)
+ procDeviceState->addArgument("enable_iface::"+dev+"::0" );
+
+ connect( procDeviceState, TQT_SIGNAL(readyReadStdout()),this, TQT_SLOT(readFromStdoutUpDown()) );
+ connect( procDeviceState, TQT_SIGNAL(readyReadStderr()),this, TQT_SLOT(readFromStdErrUpDown()) );
+ connect( procDeviceState, TQT_SIGNAL(processExited()),this, TQT_SLOT(verifyDeviceStateChanged()) );
+ connect( procDeviceState, TQT_SIGNAL(processExited()), dialog, TQT_SLOT(close()) );
+
+ currentDevice = dev;
+ commandOutput = "";
+
+ if ( !procDeviceState->start() )
+ {
+ // error handling
+ KMessageBox::error(this,
+ i18n("Could not launch backend to change network device state. You will have to do it manually."),
+ i18n("Error"));
+ dialog->close();
+ }
+
+}
+void KNetworkConf::readFromStdoutUpDown(){
+ commandOutput.append(procDeviceState->readStdout());
+}
+
+void KNetworkConf::verifyDeviceStateChanged(){
+ KNetworkInterface *dev;
+ TQPixmap activeEthernetDeviceImg(BarIcon("network_connected_lan_knc"));
+ TQPixmap inactiveEthernetDeviceImg(BarIcon("network_disconnected_lan"));
+ TQPixmap activeWirelessDeviceImg(BarIcon("network_traffic_wlan"));
+ TQPixmap inactiveWirelessDeviceImg(BarIcon("network_disconnected_wlan"));
+
+ commandOutput = commandOutput.section('\n',1);
+ if (commandErrOutput.length() > 0)
+ {
+ KMessageBox::error(this,
+ i18n("There was an error changing the device's state. You will have to do it manually."),
+ i18n("Could Not Change Device State"));
+
+ }
+ else if (commandOutput == "\n<!-- GST: end of request -->")
+ {
+ TQListViewItem *item = klvCardList->findItem(currentDevice,0,ExactMatch);
+ if (item != NULL)
+ {
+ dev = getDeviceInfo(currentDevice);
+ if (!dev->isActive())
+ {
+ dev->setActive(true);
+ if (dev->getType() == "ethernet")
+ item->setPixmap(0,activeEthernetDeviceImg);
+ else if (dev->getType() == "wireless")
+ item->setPixmap(0,activeWirelessDeviceImg);
+
+ item->setText(3,i18n("Enabled"));
+ item->setPixmap(3,SmallIcon("ok"));
+// config->runDetectionScript(netInfo->getPlatformName());
+ config->listIfaces(netInfo->getPlatformName());
+// item->setText(1,dev->getIpAddress());
+ }
+ else
+ {
+ dev->setActive(false);
+ if (dev->getType() == "ethernet")
+ item->setPixmap(0,inactiveEthernetDeviceImg);
+ else if (dev->getType() == "wireless")
+ item->setPixmap(0,inactiveWirelessDeviceImg);
+
+ item->setText(3,i18n("Disabled"));
+ item->setPixmap(3,SmallIcon("stop"));
+ if (dev->getBootProto().lower() == "dhcp")
+ item->setText(1,"");
+ }
+ enableButtonsSlot();
+ }
+ }
+}
+/** Returns a list of strings of all the configured devices. */
+TQStringList KNetworkConf::getDeviceList(){
+ TQStringList list;
+ KNetworkInterface * device;
+ TQPtrList<KNetworkInterface> deviceList = netInfo->getDeviceList();
+ for (device = deviceList.first(); device; device = deviceList.next())
+ {
+ list.append(device->getDeviceName());
+ }
+ return list;
+}
+/** No descriptions */
+bool KNetworkConf::valuesChanged(KNetworkInterface *dev,
+ TQString bootProto,
+ TQString netmask,
+ TQString ipAddr,
+ TQString gateway,
+ bool onBoot,
+ TQString desc,
+ TQString broadcast){
+ if ((dev->getBootProto() != bootProto) ||
+ (dev->getNetmask() != netmask) ||
+ (dev->getIpAddress() != ipAddr) ||
+ (dev->getGateway() != gateway) ||
+ ((dev->getOnBoot() == "yes") && !(onBoot)) ||
+ ((dev->getOnBoot() == "no") && (onBoot)) ||
+ (dev->getDescription() != desc) ||
+ (dev->getBroadcast() != broadcast))
+ return true;
+ else
+ return false;
+}
+
+/** Sets the TQPushButton::autoResize() in true for all buttons. */
+void KNetworkConf::makeButtonsResizeable(){
+ kpbConfigureNetworkInterface->setAutoResize(true);
+ kcbGwDevice->setAutoResize(true);
+ kpbAddDomainServer->setAutoResize(true);
+ kpbEditDomainServer->setAutoResize(true);
+ kpbRemoveDomainServer->setAutoResize(true);
+ kpbUpButton->setAutoResize(true);
+ kpbDownButton->setAutoResize(true);
+ kpbAddKnownHost->setAutoResize(true);
+ kpbEditKnownHost->setAutoResize(true);
+ kpbRemoveKnownHost->setAutoResize(true);
+}
+
+void KNetworkConf::enableInterfaceSlot()
+{
+ if (modified) {
+ if (KMessageBox::warningContinueCancel(this,
+ i18n("The new configuration has not been saved.\nApply changes?"),
+ i18n("New Configuration Not Saved"),
+ KStdGuiItem::apply()) == KMessageBox::Continue)
+ saveInfoSlot();
+ else
+ return;
+ }
+
+ KNetworkInterface *dev = getDeviceInfo(klvCardList->currentItem()->text(0));
+ if (dev->isActive())
+ changeDeviceState(dev->getDeviceName(),DEVICE_DOWN);
+ else
+ changeDeviceState(dev->getDeviceName(),DEVICE_UP);
+}
+
+void KNetworkConf::disableInterfaceSlot()
+{
+ if (modified) {
+ if (KMessageBox::warningContinueCancel(this,
+ i18n("The new configuration has not been saved.\nApply changes?"),
+ i18n("New Configuration Not Saved"),
+ KStdGuiItem::apply()) == KMessageBox::Continue)
+ saveInfoSlot();
+ else
+ return;
+ }
+
+ KNetworkInterface *dev = getDeviceInfo(klvCardList->currentItem()->text(0));
+ if (dev->isActive())
+ changeDeviceState(dev->getDeviceName(),DEVICE_DOWN);
+ else
+ changeDeviceState(dev->getDeviceName(),DEVICE_UP);
+}
+
+/** Adds a new host to the KListView that has the known hosts. */
+void KNetworkConf::addKnownHostSlot(){
+ KAddKnownHostDlg dlg(this,0);
+ dlg.setCaption(i18n("Add New Static Host"));
+ TQString aliases;
+
+ dlg.exec();
+
+ if (!dlg.kleIpAddress->text().isEmpty() && dlg.klbAliases->firstItem() > 0 )
+ {
+ TQListViewItem * item = new TQListViewItem( klvKnownHosts, 0 );
+
+ item->setText(0,dlg.kleIpAddress->text());
+
+ for ( uint i = 0; i < dlg.klbAliases->count(); i++ )
+ aliases += dlg.klbAliases->text(i) + " ";
+
+ item->setText(1,aliases);
+ enableApplyButtonSlot();
+ }
+}
+
+/** Removes a known host from the list view */
+void KNetworkConf::removeKnownHostSlot()
+{
+ if (klvKnownHosts->currentItem() != 0)
+ {
+ klvKnownHosts->removeItem(klvKnownHosts->currentItem());
+ enableApplyButtonSlot();
+ }
+}
+
+/** Edits the info about a known host. */
+void KNetworkConf::editKnownHostSlot()
+{
+ KAddKnownHostDlg dlg(this,0);
+ dlg.setCaption(i18n("Edit Static Host"));
+ TQListViewItem *item = klvKnownHosts->currentItem();
+ dlg.kleIpAddress->setText(item->text(0));
+
+ TQStringList aliases = TQStringList::split( " ", item->text(1) );
+ int n = 0;
+ for ( TQStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it, ++n )
+ {
+ TQString alias = *it;
+ dlg.klbAliases->insertItem(alias,n);
+ }
+
+ dlg.exec();
+
+ TQString _aliases;
+ if (!dlg.kleIpAddress->text().isEmpty() && dlg.klbAliases->firstItem() > 0 )
+ {
+ TQListViewItem * item = klvKnownHosts->currentItem();
+
+ item->setText(0,dlg.kleIpAddress->text());
+
+ for ( uint i = 0; i < dlg.klbAliases->count(); i++ )
+ _aliases += dlg.klbAliases->text(i) + " ";
+
+ item->setText(1,_aliases);
+ enableApplyButtonSlot();
+ }
+
+}
+
+/** Shows the main window after the network info has been loaded. */
+void KNetworkConf::showMainWindow()
+{
+ show();
+}
+/** No descriptions */
+void KNetworkConf::readFromStdErrUpDown()
+{
+ commandErrOutput.append(procDeviceState->readStderr());
+}
+/** Sees if a device is active or not in the ifconfig output. Not very nice, but it works. Inthe future, this has to be managed by gst. */
+bool KNetworkConf::isDeviceActive(const TQString &device, const TQString &ifconfigOutput){
+ TQString temp = ifconfigOutput.section(device,1,1);
+ if (temp.isEmpty())
+ return false;
+ else
+ {
+ TQString temp2 = temp.section("UP",0,0); //two firts lines of the device info.
+ TQString temp3 = temp2.section("\n",0,0); //Link encap:Ethernet HWaddr 00:00:21:C5:99:A0
+ TQString temp4 = temp2.section("\n",1,1); //inet addr:192.168.1.1 Bcast:192.255.255.255 Mask:255.0.0.0
+ temp3 = temp3.stripWhiteSpace();
+ temp4 = temp4.stripWhiteSpace();
+ TQString temp5 = temp3.section(" ",4,4); //00:00:21:C5:99:A0
+ TQString temp6 = temp4.section(" ",1,1); // addr:192.168.1.1
+ temp6 = temp6.section(":",1,1); //192.168.1.1
+ TQString temp7 = temp4.section(" ",3,3); //Bcast:192.255.255.255
+ temp7 = temp7.section(":",1,1); //192.255.255.255
+ TQString temp8 = temp4.section(" ",5,5); // Mask:255.0.0.0
+ temp8 = temp8.section(":",1,1); //255.0.0.0
+
+ //If the ip address is empty it must be a dhcp interface, so fill these fields:
+ if (temp6.isEmpty())
+ return false;
+ }
+ return true;
+}
+void KNetworkConf::setReadOnlySlot(bool state)
+{
+ state = !state;
+ gbDefaultGateway->setEnabled(state);
+ kleDomainName->setEnabled(state);
+ kleHostName->setEnabled(state);
+ gbDNSServersList->setEnabled(state);
+ gbKnownHostsList->setEnabled(state);
+ klvCardList->setEnabled(state);
+ kpbUpButton->setEnabled(state);
+ kpbDownButton->setEnabled(state);
+ kpbConfigureNetworkInterface->setEnabled(state);
+}
+
+/*Shows a context menu when right-clicking in the interface list*/
+void KNetworkConf::showInterfaceContextMenuSlot(KListView* lv, TQListViewItem* lvi, const TQPoint& pt)
+{
+ KPopupMenu *context = new KPopupMenu( this );
+ TQ_CHECK_PTR( context );
+ context->insertItem( "&Enable Interface", this, TQT_SLOT(enableInterfaceSlot()));
+ context->insertItem( "&Disable Interface", this, TQT_SLOT(disableInterfaceSlot()));
+ TQListViewItem *item = klvCardList->currentItem();
+ TQString currentDevice = item->text(0);
+ KNetworkInterface *dev = getDeviceInfo(currentDevice);
+
+ if (dev->isActive())
+ {
+ context->setItemEnabled(0,false);
+ context->setItemEnabled(1,true);
+ }
+ else
+ {
+ context->setItemEnabled(0,true);
+ context->setItemEnabled(1,false);
+ }
+ context->insertSeparator(2);
+ context->insertItem( "&Configure Interface...", this, TQT_SLOT(configureDeviceSlot()));
+ context->popup(pt);
+ //context->insertItem( "About &TQt", this, TQT_SLOT(aboutTQt()) );
+}
+
+void KNetworkConf::enableSignals()
+{
+ tooltip->setProfiles(netInfo->getProfilesList());
+ connect(kleDefaultRoute,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(enableApplyButtonSlot(const TQString&)));
+ connect(kleDomainName,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(enableApplyButtonSlot(const TQString&)));
+ connect(kleHostName,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(enableApplyButtonSlot(const TQString&)));
+}
+
+void KNetworkConf::enableProfileSlot()
+{
+ //Get selected profile
+ TQListViewItem *item = klvProfilesList->currentItem();
+
+ if (item != NULL)
+ {
+ TQString selectedProfile = item->text(0);
+
+ //And search for it in the profiles list
+ KNetworkInfo *profile = getProfile(netInfo->getProfilesList(),selectedProfile);
+ if (profile != NULL)
+ {
+ profile->setProfilesList(netInfo->getProfilesList());
+ config->saveNetworkInfo(profile);
+ modified = false;
+ //connect( config, TQT_SIGNAL(readyLoadingNetworkInfo()), this, TQT_SLOT(showSelectedProfile(selectedProfile)) );
+ }
+ else
+ KMessageBox::error(this,
+ i18n("Could not load the selected Network Profile."),
+ i18n("Error Reading Profile"));
+ }
+}
+
+KNetworkInfo *KNetworkConf::getProfile(TQPtrList<KNetworkInfo> profilesList, TQString selectedProfile)
+{
+ TQPtrListIterator<KNetworkInfo> it(profilesList);
+ KNetworkInfo *net = NULL;
+
+ while ((net = it.current()) != 0)
+ {
+ ++it;
+ if (net->getProfileName() == selectedProfile)
+ break;
+ }
+ return net;
+}
+
+void KNetworkConf::createProfileSlot()
+{
+ if (!netInfo)
+ return;
+ bool ok;
+ TQString newProfileName = KInputDialog::getText(i18n("Create New Network Profile"),
+ i18n("Name of new profile:"),
+ TQString(), &ok, this );
+ if ( ok && !newProfileName.isEmpty() )
+ {
+ TQPtrList<KNetworkInfo> profiles = netInfo->getProfilesList();
+ KNetworkInfo *currentProfile = getProfile(profiles,newProfileName);
+ KNetworkInfo *newProfile = new KNetworkInfo();
+
+ //If there isn't a profile with the new name we add it to the list.
+ if (currentProfile == NULL)
+ {
+ TQListViewItem *newItem = new TQListViewItem( klvProfilesList,newProfileName);
+
+ //memcpy(newProfile,netInfo,sizeof(netInfo) + sizeof(KRoutingInfo) + sizeof(KDNSInfo));
+ //Is there a better way to copy an object? the above memcpy doesn't do the trick
+ newProfile->setProfileName(newProfileName);
+ newProfile->setDNSInfo(netInfo->getDNSInfo());
+ newProfile->setDeviceList(netInfo->getDeviceList());
+ newProfile->setNetworkScript(netInfo->getNetworkScript());
+ newProfile->setPlatformName(netInfo->getPlatformName());
+ newProfile->setProfilesList(netInfo->getProfilesList());
+ newProfile->setRoutingInfo(netInfo->getRoutingInfo());
+
+ profiles.append(newProfile);
+ netInfo->setProfilesList(profiles);
+ enableApplyButtonSlot();
+ }
+ else
+ KMessageBox::error(this,
+ i18n("There is already another profile with that name."),
+ i18n("Error"));
+ }
+
+}
+
+/*void KNetworkConf::updateProfileNameSlot(TQListViewItem *item)
+{
+ TQString newName = item->text(0);
+
+ if (newName.isEmpty())
+ KMessageBox::error(this,
+ i18n("The profile name can't be left blank."),
+ i18n("Error"));
+ else
+ {
+ KNetworkInfo *currentProfile = getProfile(netInfo->getProfilesList(),newName);
+ KNetworkInfo *newProfile = new KNetworkInfo();
+
+ //If there is a profile with that name we rename it to the new name.
+ if (currentProfile != NULL)
+ {
+ currentProfile->setProfileName(item->text(0));
+ modified = false;
+ enableApplyButtonSlot();
+ }
+ }
+}*/
+
+void KNetworkConf::removeProfileSlot()
+{
+ TQListViewItem *item= klvProfilesList->selectedItem();
+ if (item != NULL)
+ {
+/* if (KMessageBox::warningContinueCancel(this,
+ i18n("Are you sure you want to delete the selected network profile?"),
+ i18n("Delete Profile"),KStdGuiItem::del()) == KMessageBox::Continue)*/
+ {
+ TQString selectedProfile = item->text(0);
+ TQPtrList<KNetworkInfo> profiles = netInfo->getProfilesList();
+ KNetworkInfo *profileToDelete = NULL;
+
+ for ( profileToDelete = profiles.first(); profileToDelete; profileToDelete = profiles.next() )
+ {
+ TQString profileName = profileToDelete->getProfileName();
+ if (profileName == selectedProfile)
+ {
+ profiles.remove(profileToDelete);
+ netInfo->setProfilesList(profiles);
+ klvProfilesList->takeItem(item);
+ modified = false;
+ enableApplyButtonSlot();
+ break;
+ }
+ }
+ }
+ }
+}
+
+void KNetworkConf::updateProfileSlot()
+{
+ TQListViewItem *item= klvProfilesList->selectedItem();
+ if (item != NULL)
+ {
+ TQString selectedProfile = item->text(0);
+ TQPtrList<KNetworkInfo> profiles = netInfo->getProfilesList();
+ KNetworkInfo *profileToUpdate = NULL;
+ KNetworkInfo *newProfile = new KNetworkInfo();
+
+ for ( profileToUpdate = profiles.first(); profileToUpdate; profileToUpdate = profiles.next() )
+ {
+ TQString profileName = profileToUpdate->getProfileName();
+ if (profileName == selectedProfile)
+ {
+ tqDebug("profile updated");
+ newProfile->setProfileName(profileName);
+ newProfile->setDNSInfo(netInfo->getDNSInfo());
+ newProfile->setDeviceList(netInfo->getDeviceList());
+ newProfile->setNetworkScript(netInfo->getNetworkScript());
+ newProfile->setPlatformName(netInfo->getPlatformName());
+ newProfile->setProfilesList(netInfo->getProfilesList());
+ newProfile->setRoutingInfo(netInfo->getRoutingInfo());
+
+
+ profileToUpdate = netInfo;
+ int curPos = profiles.at();
+ // profileToUpdate->setProfileName(profileName);
+ profiles.remove();
+ profiles.insert(curPos,newProfile);
+ netInfo->setProfilesList(profiles);
+ modified = false;
+ enableApplyButtonSlot();
+ break;
+ }
+ }
+ }
+}
+
+#include "knetwortdeconf.moc"
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconf.desktop b/knetwortdeconf/knetwortdeconf/knetwortdeconf.desktop
new file mode 100644
index 0000000..7b24479
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconf.desktop
@@ -0,0 +1,127 @@
+[Desktop Entry]
+Type=Application
+Exec=tdesu knetwortdeconf -caption "%c" %i %m
+Icon=knetwortdeconf
+DocPath=knetwortdeconf/index.html
+Comment=Configure TCP/IP settings
+Comment[ar]=إعداد تعيينات ميÙاق التحكم بلنقل/ميÙاق الإنترنت
+Comment[be]=ÐаÑтавіць TCP/IP
+Comment[bg]=ÐаÑтройване наÑтройките на TCP/IP
+Comment[bn]=টিসিপি/আইপি মানসমূহ কনফিগার করে
+Comment[br]=Kefluniañ an dibarzhoù TCP/IP
+Comment[bs]=Podesi postavke TCP/IP
+Comment[ca]=Configura els paràmetres TCP/IP
+Comment[cs]=Nastavení TCP/IP
+Comment[da]=Indstil opsætning af TCP/IP
+Comment[de]=TCP/IP-Einstellungen einrichten
+Comment[el]=ΔιαμόÏφωση των Ïυθμίσεων TCP/IP
+Comment[es]=Configure los parámetros TCP/IP
+Comment[et]=TCP/IP seadistuste seadistamine
+Comment[eu]=Konfiguratu TCP/IP ezarpenak
+Comment[fa]=پیکربندی تنظیمات TCP/IP
+Comment[fi]=Aseta TCP/IP-asetukset
+Comment[fr]=Configuration des paramètres TCP/IP
+Comment[ga]=Cumraigh Socruithe TCP/IP
+Comment[gl]=Configuración de TCP/IP
+Comment[he]=שינוי הגדרות TCP/IP
+Comment[hr]=Konfiguriranje TCP/IP postavki
+Comment[hu]=A TCP/IP beállításai
+Comment[is]=Umsjón TCP/IP stillinga
+Comment[it]=Configura le impostazioni TCP/IP
+Comment[ja]=TCP/IP ã®è¨­å®š
+Comment[ka]=TCP/IP პáƒáƒ áƒáƒ›áƒ”ტრების კáƒáƒœáƒ¤áƒ˜áƒ’ურáƒáƒªáƒ˜áƒ
+Comment[kk]=TCP/IP параметрлерін баптау
+Comment[km]=កំណážáŸ‹â€‹ážšáž…នា​សម្ពáŸáž“្ធ​ការ​កំណážáŸ‹ TCP/IP
+Comment[ko]=TCP/IP 설정
+Comment[lt]=Konfigūruoti TCP/IP nustatymus
+Comment[mk]=Конфигурирајте поÑтавувања за TCP/IP
+Comment[nb]=Sett opp TCP/IP-innstillinger
+Comment[nds]=TCP/IP-Instellen fastleggen
+Comment[ne]=टीसीपी/आईपी सेटिङ कनà¥à¤«à¤¿à¤—र गरà¥à¤¨à¥à¤¹à¥‹à¤¸à¥
+Comment[nl]=TCP/IP instellen
+Comment[nn]=Set opp TCP/IP
+Comment[pa]=TCP/IP ਸਥਾਪਨ ਸੰਰਚਨਾ
+Comment[pl]=Konfiguracja ustawień TCP/IP
+Comment[pt]=Configurar opções TCP/IP
+Comment[pt_BR]=Configura os ajustes TCP/IP
+Comment[ro]=Configurează setările TCP/IP
+Comment[ru]=ÐаÑтройка параметров TCP/IP
+Comment[se]=Heivet TCP/IP:a
+Comment[sk]=Konfigurácia nastavení TCP/IP
+Comment[sl]=Nastavite TCP/IP nastavitve
+Comment[sr]=ПодеÑите TCP/IP поÑтавке
+Comment[sr@Latn]=Podesite TCP/IP postavke
+Comment[sv]=Anpassa TCP/IP-inställningar
+Comment[th]=ปรับà¹à¸•à¹ˆà¸‡à¸à¸²à¸£à¸•à¸±à¹‰à¸‡à¸„่า TCP/IP
+Comment[tr]=TCP /IP Ayarlarını Yapılandır
+Comment[uk]=Ðалаштувати параметри TCP/IP
+Comment[vi]=Cấu hình thiết lập TCP/IP
+Comment[wa]=Apontiaedjes TCP/IP
+Comment[zh_CN]=é…ç½® TCP/IP 设置
+Comment[zh_HK]=設定 TCP/IP 設置
+Comment[zh_TW]=設定 TCP/IP
+Terminal=false
+Name=KNetworkConf
+Name[ar]=برنامج KNetworkConf
+Name[bn]=কে-নেটওয়ারà§à¦•-কনà§à¦«
+Name[ne]=केडीई सञà¥à¤œà¤¾à¤² कनà¥à¤«à¤¿à¤—रेसन
+Name[pa]=ਕੇ-ਨੈੱਟਵਰਕ-ਸੰਰਚਨਾ
+Name[pt_BR]=KNetworkConf
+Name[sv]=Knetwortdeconf
+Name[th]=ปรับà¹à¸•à¹ˆà¸‡à¹€à¸„รือข่าย - K
+GenericName=Configure TCP/IP Settings
+GenericName[ar]=إعداد تعيينات ميÙاق التحكم بلنقل/ميÙاق الإنترنت
+GenericName[bg]=ÐаÑтройване на TCP/IP
+GenericName[bn]=টিসিপি/আইপি মানসমূহ কনফিগারেশন
+GenericName[br]=Kefluniañ an dibarzhoù TCP/IP
+GenericName[bs]=Podesi TCP/IP postavke
+GenericName[ca]=Configura els paràmetres TCP/IP
+GenericName[cs]=Nastavení TCP/IP možností
+GenericName[da]=Indstil opsætning af TCP/IP
+GenericName[de]=TCP/IP-Einstellungen einrichten
+GenericName[el]=ΔιαμοÏφώστε τις Ïυθμίσεις TCP/IP
+GenericName[es]=Configure los parámetros TCP/IP
+GenericName[et]=TCP/IP seadistuste seadistamine
+GenericName[eu]=Konfiguratu TCP/IP ezarpenak
+GenericName[fa]=پیکربندی تنظیمات TCP/IP
+GenericName[fi]=Aseta TCP/IP-asetukset
+GenericName[fr]=Configuration des paramètres TCP/IP
+GenericName[ga]=Cumraigh Socruithe TCP/IP
+GenericName[gl]=Configuración de TCP/IP
+GenericName[he]=שינוי הגדרות TCP/IP
+GenericName[hr]=Konfiguriranje TCP/IP postavki
+GenericName[hu]=TCP/IP-beállítások
+GenericName[is]=Umsjón TCP/IP stillinga
+GenericName[it]=Configura le impostazioni TCP/IP
+GenericName[ja]=TCP/IP ã®è¨­å®š
+GenericName[ka]=TCP/IP პáƒáƒ áƒáƒ›áƒ”ტრების კáƒáƒœáƒ¤áƒ˜áƒ’ურáƒáƒªáƒ˜áƒ
+GenericName[kk]=TCP/IP параметрлерін баптау
+GenericName[km]=កំណážáŸ‹â€‹ážšáž…នា​សម្ពáŸáž“្ធ​ការ​កំណážáŸ‹ TCP/IP
+GenericName[ko]=TCP/IP 설정
+GenericName[lt]=Konfigūruoti TCP/IP nustatymus
+GenericName[mk]=Конфигурирајте поÑтавувања за TCP/IP
+GenericName[nb]=Sett opp TCP/IP-innstillinger
+GenericName[nds]=TCP/IP-Instellen setten
+GenericName[ne]=टीसीपी/आईपी सेटिङ कनà¥à¤«à¤¿à¤—र गरà¥à¤¨à¥à¤¹à¥‹à¤¸à¥
+GenericName[nl]=TCP/IP instellen
+GenericName[nn]=Set opp TCP/IP
+GenericName[pa]=TCP/IP ਸਥਾਪਨ ਸੰਰਚਨਾ
+GenericName[pl]=Konfiguracja ustawień TCP/IP
+GenericName[pt]=Configurar opções TCP/IP
+GenericName[pt_BR]=Configura os ajustes TCP/IP
+GenericName[ro]=Configurează setările TCP/IP
+GenericName[ru]=ÐšÐ¾Ð½Ñ„Ð¸Ð³ÑƒÑ€Ð°Ñ†Ð¸Ñ TCP/IP
+GenericName[se]=Heivet TCP/IP:a
+GenericName[sk]=Konfigurácia nastavení TCP/IP
+GenericName[sl]=Nastavite TCP/IP nastavitve
+GenericName[sr]=ПодеÑи TCP/IP поÑтавке
+GenericName[sr@Latn]=Podesi TCP/IP postavke
+GenericName[sv]=Anpassa TCP/IP-inställningar
+GenericName[th]=ปรับà¹à¸•à¹ˆà¸‡à¸à¸²à¸£à¸•à¸±à¹‰à¸‡à¸„่า TCP/IP
+GenericName[tr]=TCP /IP Ayarları Yapılandırıcı
+GenericName[uk]=Ðалаштувати параметри TCP/IP
+GenericName[vi]=Cấu hình thiết lập TCP/IP
+GenericName[wa]=Apontiaedjes TCP/IP
+GenericName[zh_CN]=é…ç½® TCP/IP 设置
+GenericName[zh_HK]=設定 TCP/IP 設置
+GenericName[zh_TW]=設定 TCP/IP
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconf.h b/knetwortdeconf/knetwortdeconf/knetwortdeconf.h
new file mode 100644
index 0000000..ce1bf15
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconf.h
@@ -0,0 +1,212 @@
+/***************************************************************************
+ knetwortdeconf.h - description
+ -------------------
+ begin : Sun Jan 12 00:54:19 UTC 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNETWORKCONF_H
+#define KNETWORKCONF_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define DEVICE_UP 0
+#define DEVICE_DOWN 1
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <kapp.h>
+#include <tqwidget.h>
+#include <tqpixmap.h>
+#include <tqprocess.h>
+#include <tqptrlist.h>
+#include <tqstringlist.h>
+#include <tqstring.h>
+#include <tqcheckbox.h>
+#include <tqgroupbox.h>
+#include <tqlabel.h>
+#include <tqradiobutton.h>
+#include <tqlayout.h>
+#include <kdialog.h>
+#include <kinputdialog.h>
+#include <kpopupmenu.h>
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <klineedit.h>
+#include <klistbox.h>
+#include <kcombobox.h>
+#include <kmessagebox.h>
+#include <kaboutapplication.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kapplication.h>
+
+#include <dcopclient.h>
+
+#include "knetwortdeconfdlg.h"
+#include "kadddnsserverdlg.h"
+#include "kadddevicecontainer.h"
+#include "kadddevicedlg.h"
+#include "kadddevicewifiext.h"
+#include "knetworkinfo.h"
+#include "kroutinginfo.h"
+#include "knetwortdeconfigparser.h"
+#include "kdnsinfo.h"
+#include "kaddknownhostdlg.h"
+#include "kknownhostinfo.h"
+#include "knetworkinterface.h"
+#include "kadddevicedlgextension.h"
+#include "knetwortdeconfiface.h"
+#include "kprofileslistviewtooltip.h"
+
+/** KNetworkConf is the base class of the project */
+class KNetworkConf : public KNetworkConfDlg, virtual public KNetworkConfIface
+{
+ Q_OBJECT
+
+ public:
+ /** construtor */
+ KNetworkConf(TQWidget* parent=0, const char *name=0);
+ /** destructor */
+ ~KNetworkConf();
+ /** Puts the application in read-only mode. This happens when the user runing the application isn't root. */
+ void setReadOnly(bool state);
+ void setVersion(TQString ver);
+ TQString getVersion();
+ /** Disables all buttons a line edit widgets when the user has read only access. */
+ void disableAll();
+
+ /**
+ Fill the Listview with the info of the network interfaces.
+ */
+ void loadNetworkDevicesInfo();
+ void loadRoutingInfo();
+ void loadDNSInfo();
+ void loadNetworkProfiles();
+
+ private: // Private attributes
+ /** */
+ KNetworkConfigParser *config;
+ KNetworkInterface * getDeviceInfo(TQString device);
+ TQString getDeviceName(TQString ipAddr);
+ /** Creates a TQStringList with the IP addresses contained in the TQListBox of name servers. */
+ TQStringList getNamserversList(KListBox * serverList);
+/** Creates a TQPtrList<KKownHostInfo> with the info contained in the KListView of name servers. */
+ TQPtrList<KKnownHostInfo> getKnownHostsList(KListView * hostsList);
+ TQString currentDevice;
+ KRoutingInfo *routingInfo;
+ KDNSInfo *dnsInfo;
+ bool reloaded;
+ TQString commandOutput;
+ TQProcess *procUpdateDevice;
+ TQProcess *procDeviceState;
+ TQStringList deviceNamesList;
+ bool devicesModified;
+ bool readOnly;
+ TQPtrList<KKnownHostInfo> knownHostsList;
+ TQPtrList<KNetworkInfo> profilesList;
+ bool nameServersModified;
+ /** The program's version. */
+ TQString version;
+ bool modified;
+ bool devStateChanged;
+ /** */
+ KNetworkInfo * netInfo;
+ /** Has the errors throwed by GST when executed. */
+ TQString commandErrOutput;
+ /** Changes the state of device 'dev' to DEVICE_UP or DEVICE_DOWN.
+ Return true on success, false on failure. */
+ void changeDeviceState(const TQString &dev, int state);
+ KNetworkInfo *getProfile(TQPtrList<KNetworkInfo> profilesList, TQString selectedProfile);
+ void showSelectedProfile(TQString profile);
+ KProfilesListViewToolTip *tooltip;
+
+ public slots:
+ virtual void saveInfoSlot();
+/** Puts the application in read-only mode. This happens when the user runing the application isn't root. */
+ void setReadOnlySlot(bool state);
+
+ private slots:
+ /** Enables the configure and remove buttons. */
+ virtual void enableButtonsSlot();
+ /** opens the add server dialog. */
+ virtual void addServerSlot();
+ /** opens the edit server dialog. */
+ virtual void editServerSlot();
+ /** Terminates the application*/
+ virtual void quitSlot();
+ virtual void readFromStdout();
+ virtual void readFromStdoutUpDown();
+ virtual void enableInterfaceSlot();
+ virtual void disableInterfaceSlot();
+ /** Pops up the window for adding a new interface. */
+ virtual void configureDeviceSlot();
+ void enableApplyButtonSlot();
+ /** Shows the help browser. Hopefully some day it will be one :-). */
+ virtual void helpSlot();
+ virtual void enableApplyButtonSlot(bool);
+ virtual void enableApplyButtonSlot(const TQString &text);
+ /** Saves all the modified info of devices, routes,etc. */
+ virtual void moveDownServerSlot();
+ virtual void moveUpServerSlot();
+ virtual void removeServerSlot();
+ bool valuesChanged(KNetworkInterface *dev,
+ TQString bootProto,
+ TQString netmask,
+ TQString ipAddr,
+ TQString gateway,
+ bool onBoot,
+ TQString desc,
+ TQString broadcast);
+ /** Returns a list of strings of all the configured devices. */
+ TQStringList getDeviceList();
+ /** Sets the TQPushButton::autoResize() in true for all buttons. */
+ void makeButtonsResizeable();
+
+ /** Adds a new host to the KListView that has the known hosts. */
+ void addKnownHostSlot();
+ void aboutSlot();
+ /** Edits the info about a known host. */
+ void editKnownHostSlot();
+ /** Removes a known host from the list view */
+ void removeKnownHostSlot();
+ /** No descriptions */
+ void readFromStdErrUpDown();
+ void getNetworkInfoSlot();
+ /** Shows the main window after the network info has been loaded. */
+ void showMainWindow();
+ void verifyDeviceStateChanged();
+ /** Sees if a device is active or not in the ifconfig output. Not very nice, but it works. Inthe future, this has to be managed by gst. */
+ bool isDeviceActive(const TQString &device, const TQString &ifconfigOutput);
+
+ /*Shows a context menu when right-clicking in the interface list*/
+ void showInterfaceContextMenuSlot(KListView*, TQListViewItem*, const TQPoint&);
+
+ /** Enable some signals in the GUI that need to be enabled *after* the loading of the network info is done.*/
+ void enableSignals ();
+ virtual void enableProfileSlot();
+ virtual void createProfileSlot();
+ //virtual void updateProfileNameSlot(TQListViewItem *item);
+ virtual void removeProfileSlot();
+ virtual void updateProfileSlot();
+
+ signals:
+ //Signal used to tell kcontrol that the network configuration has been changed.
+ void networkStateChanged(bool);
+
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui b/knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui
new file mode 100644
index 0000000..4834ca4
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui
@@ -0,0 +1,1102 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KNetworkConfDlg</class>
+<widget class="TQWidget">
+ <property name="name">
+ <cstring>KNetworkConfDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>510</width>
+ <height>410</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>510</width>
+ <height>410</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Network Settings</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <property name="iconText">
+ <string>Configure your TCP/IP settings</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Change TCP/IP settings</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQTabWidget">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <property name="tabShape">
+ <enum>Rounded</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Network Interfaces</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Available Network Interfaces</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>301</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Interface</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>IP Address</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Protocol</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>State</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Comment</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>klvCardList</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>List of configured network devices</string>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbConfigureNetworkInterface</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Configure Interface...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Change the settings of the selected device</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbUpButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Enable Interface</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbDownButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Disable Interface</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer23</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>230</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Routes</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>gbDefaultGateway</cstring>
+ </property>
+ <property name="title">
+ <string>Default Gateway</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>IP address:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>181</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>Layout27</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>kleDefaultRoute</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Default Gateway IP address</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Device:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>kcbGwDevice</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>70</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Network device where to send packets</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>90</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Domain Name System</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQGroupBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>gbDNSServersList</cstring>
+ </property>
+ <property name="title">
+ <string>Domain Name Servers</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>klbDomainServerList</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout23</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbUpDomainServerList</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Move up the selected server on the list (higher priority)</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbDownDomainServerList</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image2</pixmap>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Move down the selected server on the list (less priority)</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout25</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbAddDomainServer</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbEditDomainServer</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbRemoveDomainServer</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer27_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQGroupBox" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>gbKnownHostsList</cstring>
+ </property>
+ <property name="title">
+ <string>Static Hosts</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>IP Address</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Aliases</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>klvKnownHosts</cstring>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbAddKnownHost</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbEditKnownHost</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbRemoveKnownHost</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>tlHostName</cstring>
+ </property>
+ <property name="text">
+ <string>Host name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>kleHostName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>kleDomainName</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>tlDomainName</cstring>
+ </property>
+ <property name="text">
+ <string>Domain name:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="TQWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Network Profiles</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup2</cstring>
+ </property>
+ <property name="title">
+ <string>Available Network Profiles</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView" row="0" column="0" rowspan="2" colspan="1">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>klvProfilesList</cstring>
+ </property>
+ <property name="itemsRenameable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout28</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbEnableProfile</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Load Selected</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbSaveProfile</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Save Selected</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbCreateProfile</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Create New...</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbDeleteProfile</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete Selected</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer25</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer18</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>150</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ </hbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="1108">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000041b49444154388d9d956148a3751cc7bff3ecb6bb149e8186c2f56290912b38f6908417058b043d7b9504a5f522f5459d16c8cda2d45e9441748b38721dd2f6227208ea2c74d338ce5d4c9ca0ee913aa671ca1ed263cfdcd69ee76ae9d2e9b717534f421df58387df9b872f9fe7fbf93fcf039238ee0280beeb7d4f930c31c20cc9cc897b8d19925ba160c8cf9bac008063430f82e9e6abd1682a4537f9c9508424e9f4a7723b90dbd7c622a49b748e454832d6f541574ddee011f7482349f572cf0c4373e4cbd7c954946c7693a938d9d84f867f21ab3b43dcbc4b72891bf4b316000a70ca34d435405e57b095be84d641096a1a78fd3b195a727f6b40eba0042d2da27550022a01dba40d79833db73c303d5a0e4df341794a849694d0556d829204b6aa4c509212baaa4428eb3ef43e27429a9760afb3e70f6ea86d80b2aec260a847e6471f544d44eb60109934101b0e22a389681df603d97ab44ffa215689e89eec7e10708afd6d920cdf656e72fe3830116238405a3ac9ca51b2ec952946032483ffeab8ada4ed3145514d9885be7758d6c304bdebb6aa87090fb9a655982b00fbb80ccc02ae71194d75223e9d0da2bc0410e625184b5e806d5a02aa1f74fcffecef3f4178892499a5c42cc9dda989a90827f83c00e800802936ca69c5d1f265b9a041825022e25ca10c83c1844c5606b226a89a044d13612993e0fe48846fd287faba7afac67df17aa57ec6917528aaa62e2fce2f0e8dfe309ac8110fe5882d6f7a59e6222d1d21ce04c8ea1ed21a202d9d217a4749e1252f237e32248573c839f2add05cc8cb3956595fb4ea49ea0e3bfecff62d6604a783400520cbf219b14a34768f779fadaca8dcd6e9743cecd83be66d24a95a3b66e81d222d1d39526b4f98a1e3edef718daad3e5f473895f5d7de76a4db8365c7cf4a8e63ade6493a2a97deddf1805392da15c106128926128cc759cc91ce9f88204f78762d6feb9fdd7584cfb58281196ba2fd8b67aef39fe3414b6253bdf3f423ce01eb84c728d71ee92cc32cadda3e776dffe1e25ee91e4d4cda93d6e727be0db9175a6287927a61628f1b3c6d79acf1d649e0100cb458b968827ee9b9f30ffe619f3fc6e7ec65c2e2fcb7a6385114b7796607eb2949eef3d7f9bef98e3f619fb8e1255fef207fcc9f67b6f6dd87eb2adc6e289a4cbdbbfa22592f32b9195ec213183d4455d51bdb3df692539cd78ee8d639c79ed9ff4752c0000dd251ddd9a7ba7a5a805d2a2a4472974caba029402b22ce7b79f6faebc7da598126b9cfdce3ec6394d3feff30f6e9c66ff2462ddc10dd7be7016d8d0f288bbcc73be29d6506ccf3a9eb5bdd7d6eef8da959057e5be93ec1ffc144e1cfaf9709fc37983e482778c3f739b89b014de219939cd7e5ee2c6379a0d82607cd72808177bd17db6b7b0f77183c1701e59c0a6d952b6ac2d622812f6e4d5e5052da1dd98b83591398df81f24eff65ce00de8ce0000000049454e44ae426082</data>
+ </image>
+ <image name="image1">
+ <data format="PNG" length="1263">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000004b649444154388d85954d6c1b4514c77f33bbb3b6d7b1e37c3504a81b407c9642e500559140080455698b10208400712b6a6fdce0c605a917aea887455c1122820387228a10a204041457e907a5a54de9874862278ed75fbbf6eece70709b1268cb93e630336f7ef39f376fde086e60a5bdb30acc18e8098c71c10026c0e805a51b959fbca77bd75b2b6e00dd0abc0c66338222426501d0dd0e26b908cc0a1d4f97cc47339ee725ff0b2eed9dbd03c45b58ead581ac5bb869342fc747d2dc3dda24a312ced606f8b3a259aa5675cd0f021d0733cab4de7bc07cfca3e779f135c1a5bdb31b40ecc7c96fdf7c7b86671fceb169bd615d4161c9beab01569a31730b1107ca21878eadd00b1a2753baf6f6fd66fac015b8f52fa51f0ce4f3db9edb3a28de7822c39d131629651125f0ed519fb3f32167e74326c7d38ce66d366d508c0f29ce55cc6823140f2d9bdbcadba73297cae5b259054f3cbc671f4eee951d8f14c4ae2985a324bdd8d08d0cbffed1e2f94747b87f32cb3deb337c55ae3398b531c670f3b022e72af1dba56424ec197533470e4e4d4d45565fedaf5b8595daf7e01df9f4f692424ae8459a30d29cf92b60d796611c25fbb11382fb36b87c7bd4277579f3e10149bb6773a11a4d5693f5b3e39c3c6795f61c56c05bb95ceef1a73667c5d0007423431819aa7ec4ce2dc3a41df99facb9ebd60c3f9f6a22108491c6b17acc2d6aa71dc69115fb876c600cd89ccf0fca423aa6d1bea20c763c32744d28806d095e7a6c94e9434b7c71748046e0d264406aea1b1ba25894c0044216477382a0a7a9b76284806d530532a9fe1544b15e038d13833106809d5b46d8f5408be54e0aec2c086b02cb294ac045a6b2ae8aa8b7358d8ee69952819c6b03506b447c3e535b039e9e69529eeba76cdae92bbf7d5d3ffec85446406ef59c8d50b1e84b2a0dc9f7273a00b402cdfb5f7439703cbd063cb792e7ddcf1433a7fafdaf8fc3827ff55108b4b4c104e86e67b19da19da4c1c099efe0c3ef029a3d076332d78cb31fc03b9f5ced0b01020349180a13776d8c5e002efa1d7d5b22326b161be40daac955b32d90402be882492a52b717a4d28d0a304bb7a6956570fed1525602c670f99ed698b234ae4a705542da4e70ec04d15bd636e1e982393f6fffe43ddd9b7af3c7e9a4ebbfae92ccd050ce5923521b701d01e456c746dd80f5f968d5af5f3f7ae870a59d49160f0e5a4b350950321fcde838f8b459af32e874187303c6b201636ec0783660d40d5869f52b63d0d3d8745997bdea33e87468d6abe89effcdddf2eb1f80a605502e97cdada5d7e6ba11f76a9d6cb865c4126e4a9052869432d8d270bed2a515688e9e0b383b1ff6e76c8320e2f485865eaef987479213fb0be2af13ab60801d25b5bc6c8a87fdc0ded8e8c4933957319cb37194c4b105bdd8305f8ba8b7131c5ba02c58f2238ecdf92c541b87c7e223fb8ab2fc0bb0e4795eb20a2e97cb66fb945b5b369347fcc072ab7e34d9ecc44eda8e453663634b8914604cc2f24a9be37f76f4ef179aad7abdf1e5487262ff6568c5f3bc08ae914cbb77ef9640f6182f3e19cb8117346aa394622297b13200cd200975a22b36e1e974b278f0724c1781fa757f907fc005e05492c94243148b584e51404ea0a5307157eaf642c19c9f1fb4966a4013083ccf5b5350fe06921b426409a129130000000049454e44ae426082</data>
+ </image>
+ <image name="image2">
+ <data format="PNG" length="1307">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000004e249444154388d7d95cb8f54c71587bfaa7bebf6fbc134031910ed314f29c0003d42161bcb8ae507360bdbb1bcf0228a8488c22e59c4fe0312894d36368abc18291252a444082b96220b145b4a64cb181b3c68cccb1e07ccf09a999e999ee9db7dfbdeee7bab2a8b060f0d89cfae54a7bef3ab737ed211fc48d48e4e29b0c36046b0360b16b021d6cc29e3d7c738d99b9898f89f6fc58f400f006f80dd8ba08a5039004cb783d5b7812961925335fbe7cf00fd6881c7c0b5a3535b40fc0647bd99cf65cb3f595b94eb2b6976ac6d91519aeb8d3c37eb86c58505d36886a149c2cf946dff61ccfef573207950c07d04fa0488e378c5837b376778697f81dd9b2cebca0e8e5c03f49bb1dc4ab831b74e9e9e8c729f5e5a7ebe178a4d97cdeb6fefb2a74e03c980e2fb4a8fe78bc5175edc5f92876a1e43050721047162b831dba51d6ad60f2936563c84100491e6ecb50e7ffb77c3d69756bef374e3f06ede3f0b988714dbdfe1150e3e572bf1f23e857205add000102786bd5b73acc9bbdc988df03b1a210460d9bf2d439c0c89131f9bed9d96fe159629a0edf4d57e754038a9637bb614d3076b0a29a1171ba2d8d08d0de5bccb868a07c09a82cbad7a97a86b88624b2fb10ce52541cfe5d6423cbaa0374dade7daf76eedd71714d6be91cfa58bb52d1eda189a811d18682eed0c9c9b8126d1ab39da58768c68bebe9e2a3496f2afd5e3d1732e300cec2d164bb29c4ef003f998f5d6e407668cdfd1c489416bcb9d86e6d25c193fccd2222f0d2b3b7d51adbac0084256d7160461cf10f60c9d9e248a052965c979864e590f2a6e2744b1a11148a6eee6b8e3a7fb17ae0bc219c1f1aa12c82253b9ac8a59090c8bbea554c8f0fc788975435956028893c1d64ccf3b7c7133cb819f96f9eda12c1bfa4eec0f54a632020a3ffcdb8f14f34d492aa5f8e5b305f66df678f3e93ca31b4b4c2fa407c0d79b150e3f57e4995d1e4f6d7378f71720c4aa770546ba60434cb7331f6408749a7a24f87cda70607bbfe62b4f65b87677b0e76f1d82dae8eaf9d4977d3058d051246cd295583387d5b79b1d43b39be69e9fe2f77f877f5ded3f520e8c5507c10fa0610ffef8217c700194845eaf0b56d7a509e6a4327e1d98a2db30cab1788e052c7ffaa7e6dc77e651830cc4894f0c1f7dad518ec67335a2b7645ca2e9b29d99755e1a4feb39f60416fb6a29e7662a79435ec57832e6caed1eeb8b828d95411f7763cbc9b3119f5e8dc8ab989c8ae94501ade58576269e796fa37379ca999c9ce4504ddeb9c7d893c226e3d56197622a21e7257822e1dbbb5d360c390c9756bdfc8f2f7dce7f1b9055093995e08a98dbb34b7483e533bbc5072780fa836ced98ce3bad96d83a738f67c636e7a5a75641a7cf3711c0868ae2fc74c0d5990ec54c7f56bd3861fa56dbb4fde6571573ed2f48e681d001989c9ce4e59a5a5ab2d50bcdd0dde97792d14256315470f1944408f8cfbd2e17af77985f49508e4039b0d88cb974a3c9dc827f6138b978ac2a27cf038b80fea179e3e3e3761ddf3496ece8c566e864179af168ab9378693711b98c8b2b255280b59aa5e580cb373be69b5badf6ca8a7fa6a2afbc771f5a07e2898989c737c89123472490bbc4cf7f96c8fc6b06b5534a3152c838198056a823a34ddd259a4eebf98f76c88fcf02f3c00aff6f83dc0f03b477f3fe997a3c7ace17d52a8e57156d0a0223cb36e94a13cc95edcc6cc9596c002d2004ccc37befbfd9ff4e6a193004b40000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>kpbDownButton</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>disableInterfaceSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbUpButton</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>enableInterfaceSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbConfigureNetworkInterface</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>configureDeviceSlot()</slot>
+ </connection>
+ <connection>
+ <sender>klvCardList</sender>
+ <signal>rightButtonClicked(TQListViewItem*,const QPoint&amp;,int)</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>showInterfaceContextMenuSlot()</slot>
+ </connection>
+ <connection>
+ <sender>klvCardList</sender>
+ <signal>doubleClicked(TQListViewItem*)</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>configureDeviceSlot()</slot>
+ </connection>
+ <connection>
+ <sender>klvCardList</sender>
+ <signal>selectionChanged()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>enableButtonsSlot()</slot>
+ </connection>
+ <connection>
+ <sender>klbDomainServerList</sender>
+ <signal>doubleClicked(TQListBoxItem*)</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>editServerSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbEditDomainServer</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>editServerSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbUpDomainServerList</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>moveUpServerSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbRemoveKnownHost</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>removeKnownHostSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbRemoveDomainServer</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>removeServerSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbEditKnownHost</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>editKnownHostSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbDownDomainServerList</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>moveDownServerSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbAddKnownHost</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>addKnownHostSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbAddDomainServer</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>addServerSlot()</slot>
+ </connection>
+ <connection>
+ <sender>klvKnownHosts</sender>
+ <signal>doubleClicked(TQListViewItem*)</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>editKnownHostSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kcbGwDevice</sender>
+ <signal>activated(const TQString&amp;)</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>enableApplyButtonSlot(const TQString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>klvProfilesList</sender>
+ <signal>itemRenamed(TQListViewItem*)</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>updateProfileNameSlot(TQListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>kpbCreateProfile</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>createProfileSlot()</slot>
+ </connection>
+ <connection>
+ <sender>klvProfilesList</sender>
+ <signal>itemRenamed(TQListViewItem*)</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>updateProfileNameSlot(TQListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>kpbDeleteProfile</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>removeProfileSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbEnableProfile</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>enableProfileSlot()</slot>
+ </connection>
+ <connection>
+ <sender>kpbSaveProfile</sender>
+ <signal>clicked()</signal>
+ <receiver>KNetworkConfDlg</receiver>
+ <slot>updateProfileSlot()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">knetwortdeconfdlg.ui.h</include>
+ <include location="local" impldecl="in declaration">tqlistview.h</include>
+</includes>
+<Q_SLOTS>
+ <slot access="private">enableButtonsSlot()</slot>
+ <slot access="private">quitSlot()</slot>
+ <slot access="private">moveUpServerSlot()</slot>
+ <slot access="private">moveDownServerSlot()</slot>
+ <slot>helpSlot()</slot>
+ <slot access="private">configureDeviceSlot()</slot>
+ <slot access="private">enableApplyButtonSlot( bool )</slot>
+ <slot access="private">enableApplyButtonSlot( const TQString &amp; )</slot>
+ <slot>aboutSlot()</slot>
+ <slot access="private">addServerSlot()</slot>
+ <slot access="private">removeServerSlot()</slot>
+ <slot access="private">saveInfoSlot()</slot>
+ <slot access="private">upDownInterfaceSlot()</slot>
+ <slot access="private">addKnownHostSlot()</slot>
+ <slot access="private">removeKnownHostSlot()</slot>
+ <slot access="private">editKnownHostSlot()</slot>
+ <slot access="private">startNetworkSlot()</slot>
+ <slot access="private">stopNetworkSlot()</slot>
+ <slot access="private">enableInterfaceSlot()</slot>
+ <slot access="private">disableInterfaceSlot()</slot>
+ <slot access="private">editServerSlot()</slot>
+ <slot access="private">showInterfaceContextMenuSlot()</slot>
+ <slot access="private">enableProfileSlot()</slot>
+ <slot access="private">createProfileSlot()</slot>
+ <slot>updateProfileNameSlot()</slot>
+ <slot access="private">updateProfileNameSlot(TQListViewItem *item)</slot>
+ <slot access="private">removeProfileSlot()</slot>
+ <slot access="private">updateProfileSlot()</slot>
+</Q_SLOTS>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistview.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klistview.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui.h b/knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui.h
new file mode 100644
index 0000000..4d77089
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconfdlg.ui.h
@@ -0,0 +1,168 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename slots use TQt Designer which will
+** update this file, preserving your code. Create an init() slot in place of
+** a constructor, and a destroy() slot in place of a destructor.
+*****************************************************************************/
+
+
+void KNetworkConfDlg::enableButtonsSlot()
+{
+
+}
+
+void KNetworkConfDlg::quitSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::moveUpServerSlot()
+{
+
+}
+
+void KNetworkConfDlg::moveDownServerSlot()
+{
+
+}
+
+void KNetworkConfDlg::helpSlot()
+{
+
+}
+
+void KNetworkConfDlg::configureDeviceSlot()
+{
+
+}
+
+void KNetworkConfDlg::enableApplyButtonSlot( bool )
+{
+
+}
+
+void KNetworkConfDlg::enableApplyButtonSlot( const TQString & )
+{
+
+}
+
+void KNetworkConfDlg::aboutSlot()
+{
+
+}
+
+void KNetworkConfDlg::addServerSlot()
+{
+
+}
+
+void KNetworkConfDlg::removeServerSlot()
+{
+
+}
+
+void KNetworkConfDlg::saveInfoSlot()
+{
+
+}
+
+
+
+
+
+
+void KNetworkConfDlg::upDownInterfaceSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::addKnownHostSlot()
+{
+
+}
+
+void KNetworkConfDlg::removeKnownHostSlot()
+{
+
+}
+
+void KNetworkConfDlg::editKnownHostSlot()
+{
+
+}
+
+
+
+void KNetworkConfDlg::startNetworkSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::stopNetworkSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::enableInterfaceSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::disableInterfaceSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::editServerSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::showInterfaceContextMenuSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::enableProfileSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::createProfileSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::updateProfileNameSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::updateProfileNameSlot( TQListViewItem *item )
+{
+
+}
+
+
+void KNetworkConfDlg::removeProfileSlot()
+{
+
+}
+
+
+void KNetworkConfDlg::updateProfileSlot()
+{
+
+}
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconfiface.h b/knetwortdeconf/knetwortdeconf/knetwortdeconfiface.h
new file mode 100644
index 0000000..e1dc2c9
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconfiface.h
@@ -0,0 +1,34 @@
+/* -*- c++ -*-
+ *
+ * knetwortdeconfiface.h
+ *
+ * Copyright (C) 2004 Juan Luis Baptiste <juan.baptiste@kdemail.net>
+ *
+ * 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.
+ *
+ */
+
+#ifndef knetwortdeconf_iface_h
+#define knetwortdeconf_iface_h
+
+#include <dcopobject.h>
+
+class KNetworkConfIface: virtual public DCOPObject
+{
+ K_DCOP
+ k_dcop:
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.cpp b/knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.cpp
new file mode 100644
index 0000000..a9fa230
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.cpp
@@ -0,0 +1,1239 @@
+/***************************************************************************
+ knetwortdeconfigparser.cpp - description
+ -------------------
+ begin : Mon Jan 13 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "knetwortdeconfigparser.h"
+#include "knetwortdeconfigparser.moc"
+
+KNetworkConfigParser::KNetworkConfigParser(){
+ networkInfo = new KNetworkInfo();
+
+ TQString platform;
+ bool askAgain = readAskAgain(platform);
+
+ if (!askAgain || platform.length() > 0)
+ runDetectionScript(platform);
+ else
+ runDetectionScript(TQString());
+}
+/** Runs the gst backend to get network values. You can pass to the script a specific platform to load using the platform parameter. */
+void KNetworkConfigParser::runDetectionScript(TQString platform){
+ KDetectDistroDlg* dialog = new KDetectDistroDlg(0, 0);
+ dialog->show();
+ procDetect = new TQProcess(this);
+ TQString pathToProgram = locate("data",BACKEND_PATH);
+ if (pathToProgram.isEmpty())
+ {
+ KMessageBox::error(0,
+ i18n("Could not find the backend script for the network configuration detection. Something is wrong with your installation.\n Please check that \n{TDE_PATH}/%1 \nfile is present.").arg(BACKEND_PATH),
+ i18n("Could Not Find Network Configuration Backend Script"));
+ dialog->close();
+ //kapp->quit();
+ }
+ else
+ {
+ procDetect->addArgument( pathToProgram );
+ if (platform != TQString())
+ {
+ procDetect->addArgument( "--platform" );
+ procDetect->addArgument( platform );
+ }
+ procDetect->addArgument( "--get" );
+ connect( this, TQT_SIGNAL(readyLoadingNetworkInfo()), dialog, TQT_SLOT(close()) );
+ connect( this, TQT_SIGNAL(errorDetectingPlatform()), dialog, TQT_SLOT(close()) );
+ connect( procDetect, TQT_SIGNAL(processExited()), this, TQT_SLOT(readNetworkInfo()) );
+ connect( procDetect, TQT_SIGNAL(readyReadStdout()),this, TQT_SLOT(concatXMLOutputSlot()));
+ connect( procDetect, TQT_SIGNAL(readyReadStderr()),this, TQT_SLOT(readXMLErrSlot()));
+
+ if ( !procDetect->start() )
+ {
+ // error handling
+ KMessageBox::error(0,
+ i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."),
+ i18n("Could Not Launch Network Configuration Backend Script"));
+ dialog->close();
+ }
+ }
+}
+/** runs gst to find out the state of network devices.It runs the command:
+$knetwortdeconf_home/backends/networtdeconf [--platform platform] -d list_ifaces. */
+void KNetworkConfigParser::listIfaces(const TQString &platform){
+ procDetect = new TQProcess(this);
+ procDetect->addArgument( locate("data",BACKEND_PATH) );
+ if (platform != TQString())
+ {
+ procDetect->addArgument( "--platform" );
+ procDetect->addArgument( platform );
+ }
+ //procDetect->addArgument( "--get" );
+ procDetect->addArgument( "-d" );
+ procDetect->addArgument( "list_ifaces" );
+
+ connect( procDetect, TQT_SIGNAL(processExited()), this, TQT_SLOT(readListIfacesSlot()) );
+ connect( procDetect, TQT_SIGNAL(readyReadStdout()),this, TQT_SLOT(concatXMLOutputSlot()));
+ connect( procDetect, TQT_SIGNAL(readyReadStderr()),this, TQT_SLOT(readXMLErrSlot()));
+
+ xmlOuput = "";
+ xmlErr = "";
+ if ( !procDetect->start() )
+ {
+// error handling
+ KMessageBox::error(0,
+ i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."),
+ i18n("Could Not Launch Network Configuration Backend Script"));
+ }
+}
+
+void KNetworkConfigParser::readListIfacesSlot(){
+ TQPtrList<KNetworkInterface> tempDeviceList;
+
+ //The gst backend puts a \n at the beginning of the xml output, so
+ //we have to erase it first before we parse it.
+ xmlOuput = xmlOuput.section('\n',1);
+ tqDebug("XML -d list_ifaces: %s",xmlOuput.latin1());
+ TQString err;
+ int x,y;
+ TQDomDocument doc( "network-ifaces");
+ if ( !doc.setContent( xmlOuput.utf8(),false,&err,&x,&y ) )
+ {
+ KMessageBox::error(0,
+ i18n("Could not parse the XML output from the network configuration backend."),
+ i18n("Error While Listing Network Interfaces"));
+// tqDebug("error: %s %d,%d",err.latin1(),x,y);
+ }
+ TQDomElement root = doc.documentElement();
+ TQDomNode node = root.firstChild();
+
+ while( !node.isNull() )
+ {
+ if ( node.isElement() && node.nodeName() == "interface" )
+ {
+ TQDomElement interface = node.toElement();
+ KNetworkInterface *tempDevice = new KNetworkInterface();
+ tempDevice = getInterfaceInfo(interface,TQString());
+
+ if (tempDevice->getType().lower() != LOOPBACK_IFACE_TYPE)
+ {
+ KNetworkInterface *originalDevice = getDeviceInfo(tempDevice->getDeviceName());
+ if (originalDevice == NULL)
+ {
+ node = node.nextSibling();
+ continue;
+ }
+ originalDevice->setActive(tempDevice->isActive());
+ if (!tempDevice->getBroadcast().isEmpty())
+ originalDevice->setBroadcast(tempDevice->getBroadcast());
+ if (!tempDevice->getDescription().isEmpty())
+ originalDevice->setDescription(tempDevice->getDescription());
+ if (!tempDevice->getIpAddress().isEmpty())
+ originalDevice->setIpAddress(tempDevice->getIpAddress());
+ if (!tempDevice->getMacAddress().isEmpty())
+ originalDevice->setMacAddress(tempDevice->getMacAddress());
+ if (!tempDevice->getNetmask().isEmpty())
+ originalDevice->setNetmask(tempDevice->getNetmask());
+ if (!tempDevice->getNetwork().isEmpty())
+ originalDevice->setNetwork(tempDevice->getNetwork());
+ }
+ }
+ node = node.nextSibling();
+ }
+ //networkInfo->setDeviceList(deviceList);
+ //Tell to interested parties when the network info is ready.
+ emit readyLoadingNetworkInfo();
+}
+
+KNetworkConfigParser::~KNetworkConfigParser(){
+}
+
+/** return tyhe number of configured devices. */
+unsigned KNetworkConfigParser::numDevices(){
+ return _numDevices;
+}
+
+void KNetworkConfigParser::setProgramVersion(TQString ver)
+{
+ KNetworkConfigParser::programVersion = ver;
+}
+
+
+void KNetworkConfigParser::readIfconfigOutput(){
+ TQString s = proc->readStdout();
+ ifconfigOutput = s;
+}
+
+/**
+ Reads /proc/net/route looking for the default gateway.
+
+ NOTE:We should use the gateway reported by gst, but if there's a
+ gw in a config file and one of the network interfaces is
+ configured to use dhcp, gst returns the value of the config
+ file instead of the gw configured by dhcp.
+*/
+void KNetworkConfigParser::loadRoutingInfo( KRoutingInfo *routingInfo){
+#ifndef Q_OS_FREEBSD
+ TQFile f( "/proc/net/route");
+ if ( !f.open(IO_ReadOnly) )
+ {
+ KMessageBox::error(0,
+ i18n("Could not open file /proc/net/route."),
+ i18n("Could Not Open File"));
+ }
+ else
+ {
+ TQTextStream t( &f ); // use a text stream
+ TQString s;
+ while (!t.eof())
+ {
+ s = t.readLine(); // line of text excluding '\n'
+ TQString interface = s.section('\t',0,0);
+ TQString destination = s.section('\t',1,1);
+ TQString gw = s.section('\t',2,2);
+
+ if (destination == "00000000")
+ {
+ routingInfo->setGateway(hexIPv4ToDecIPv4(gw));
+ routingInfo->setGatewayDevice(interface);
+ }
+ }
+ }
+ f.close();
+#endif
+}
+TQString
+KNetworkConfigParser::hexIPv4ToDecIPv4(const TQString &hex)
+{
+ bool ok;
+ TQString dec = "";
+ TQString dec2 = "";
+ TQString temp = "";
+ TQString temp2 = "";
+
+#if Q_BYTE_ORDER == TQ_LITTLE_ENDIAN
+ temp = hex.mid(6,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+ dec.append('.');
+ temp = hex.mid(4,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+ dec.append('.');
+ temp = hex.mid(2,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+ dec.append('.');
+ temp = hex.mid(0,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+#else
+ temp = hex.mid(0,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+ dec.append('.');
+ temp = hex.mid(2,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+ dec.append('.');
+ temp = hex.mid(4,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+ dec.append('.');
+ temp = hex.mid(6,2);
+ temp2 = temp2.setNum(temp.toInt(&ok,16));
+ dec.append(temp2);
+#endif
+
+ dec2 = dec;
+ if (ok)
+ return dec2;
+ else
+ return "";
+}
+
+void KNetworkConfigParser::saveNetworkInfo(KNetworkInfo *networkInfo)
+{
+ this->networkInfo = networkInfo;
+ TQPtrList<KNetworkInterface> devList = networkInfo->getDeviceList();
+ TQPtrList<KNetworkInfo> profileList = networkInfo->getProfilesList();
+ dnsInfo = networkInfo->getDNSInfo();
+ routingInfo = networkInfo->getRoutingInfo();
+
+ //Start xml file
+ TQDomDocument doc( "network []" );
+ TQDomProcessingInstruction instr = doc.createProcessingInstruction("xml","version=\"1.0\" ");
+ doc.appendChild(instr);
+ TQDomElement root = doc.createElement( "network" );
+ doc.appendChild( root );
+
+ addRoutingInfoToXMLDoc(&doc, &root, routingInfo);
+ addDNSInfoToXMLDoc(&doc, &root, dnsInfo);
+ addNetworkInterfacesToXMLDoc(&doc, &root, devList);
+ addNetworkProfilesToXMLDoc(&doc, &root, profileList);
+
+ //If we don't add this comment to the end of the xml file, the gst process never exits!
+ TQDomComment endComment = doc.createComment(" GST: end of request ");
+ doc.appendChild( endComment );
+
+ TQString xml = doc.toString();
+ tqDebug("--set XML:\n%s",xml.latin1());
+ procSaveNetworkInfo = new TQProcess(this);
+ procSaveNetworkInfo->addArgument( locate("data",BACKEND_PATH) );
+
+ if (!networkInfo->getPlatformName().isEmpty())
+ {
+ procSaveNetworkInfo->addArgument( "--platform" );
+ procSaveNetworkInfo->addArgument( networkInfo->getPlatformName() );
+ }
+ procSaveNetworkInfo->addArgument( "--set" );
+
+// KDetectDistroDlg* dialog = new KDetectDistroDlg(0, 0, true,TQDialog::WStyle_Customize|TQDialog::WStyle_NormalBorder|TQDialog::WStyle_Title|TQDialog::WStyle_SysMenu); //made it semi-modal
+ KDetectDistroDlg* dialog = new KDetectDistroDlg((TQWidget*)parent(), 0, true);
+ dialog->setCaption(i18n("Reloading Network"));
+ dialog->text->setText(i18n("%1Please wait while saving the network settings...%2").arg("<center>").arg("</center>"));
+ dialog->show();
+
+ xmlOuput = "";
+
+ connect( this, TQT_SIGNAL(readyLoadingNetworkInfo()), dialog, TQT_SLOT(close()) );
+ connect(procSaveNetworkInfo,TQT_SIGNAL(readyReadStdout()),this,TQT_SLOT(readFromStdoutSaveNetworkInfo()));
+ connect(procSaveNetworkInfo,TQT_SIGNAL(wroteToStdin()),this,TQT_SLOT(sendNetworkInfoSavedSignalSlot()));
+ connect(procSaveNetworkInfo,TQT_SIGNAL(processExited()),this,TQT_SLOT(listIfacesSlot()));
+
+ processRunning = true;
+ connect( procSaveNetworkInfo, TQT_SIGNAL(processExited()), this, TQT_SLOT(processExitedSlot()) );
+
+ if ( !procSaveNetworkInfo->start() )
+ {
+ KMessageBox::error(0,
+ i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."),
+ i18n("Could Not Launch Network Configuration Backend Script"));
+ }
+
+ procSaveNetworkInfo->writeToStdin(xml);
+
+ //wait around until the process has finished, otherwise it becomes a zombie
+ while (processRunning) {
+ kapp->processEvents();
+ }
+}
+
+void KNetworkConfigParser::processExitedSlot() {
+ processRunning = false;
+}
+
+void KNetworkConfigParser::addNetworkProfilesToXMLDoc(TQDomDocument *doc, TQDomNode *root, TQPtrList<KNetworkInfo> profileList)
+{
+ TQPtrListIterator<KNetworkInfo> profileIt(profileList);
+ KNetworkInfo *profile;
+ TQDomElement tag = doc->createElement( "profiledb" );
+ root->appendChild( tag );
+
+ while ( (profile = profileIt.current()) != 0)
+ {
+ ++profileIt;
+ TQPtrList<KNetworkInterface> devList = profile->getDeviceList();
+ KDNSInfo *dnsInfo = profile->getDNSInfo();
+ KRoutingInfo *routingInfo = profile->getRoutingInfo();
+
+ TQDomElement profileTag = doc->createElement( "profile" );
+ tag.appendChild( profileTag );
+ TQDomElement innerTag = doc->createElement( "name" );
+ profileTag.appendChild( innerTag );
+ TQDomText t = doc->createTextNode( profile->getProfileName() );
+ innerTag.appendChild( t );
+
+ addRoutingInfoToXMLDoc(doc, &profileTag, routingInfo);
+ addDNSInfoToXMLDoc(doc, &profileTag, dnsInfo);
+ addNetworkInterfacesToXMLDoc(doc, &profileTag, devList);
+ }
+}
+
+void KNetworkConfigParser::addNetworkInterfacesToXMLDoc(TQDomDocument *doc, TQDomNode *root, TQPtrList<KNetworkInterface> devList)
+{
+ KNetworkInterface *device;
+ TQPtrListIterator<KNetworkInterface> devIt(devList);
+
+ //Save in the configuration file the description of the interfaces as
+ //the backend no longer handles this
+ KSimpleConfig cfg("knetwortdeconfrc");
+ cfg.setGroup("Interfaces");
+
+ //Add the network interfaces list
+ while ( (device = devIt.current()) != 0 )
+ {
+ ++devIt;
+ // if protocol is not specified, then should not have entry in config
+ if (device->getBootProto().isEmpty())
+ continue;
+
+ TQDomElement tag = doc->createElement( "interface" );
+ tag.setAttribute("type",device->getType());
+ root->appendChild( tag );
+ TQDomElement configurationTag;
+ configurationTag = doc->createElement( "configuration" );
+ tag.appendChild( configurationTag );
+
+ TQDomElement innerTag;
+ TQDomText t;
+ if ((device->getBootProto().lower() != "dhcp") && (device->getBootProto().lower() != "bootp"))
+ {
+ if (!device->getIpAddress().isEmpty())
+ {
+ innerTag = doc->createElement( "address" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( device->getIpAddress() );
+ innerTag.appendChild( t );
+ }
+ if (!device->getGateway().isEmpty())
+ {
+ innerTag = doc->createElement( "gateway" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( device->getGateway() );
+ innerTag.appendChild( t );
+ }
+ if (!device->getBroadcast().isEmpty())
+ {
+ innerTag = doc->createElement( "broadcast" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( device->getBroadcast() );
+ innerTag.appendChild( t );
+ }
+ if (!device->getNetmask().isEmpty())
+ {
+ innerTag = doc->createElement( "netmask" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( device->getNetmask() );
+ innerTag.appendChild( t );
+ }
+ if (!device->getNetwork().isEmpty())
+ {
+ innerTag = doc->createElement( "network" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( device->getNetwork() );
+ innerTag.appendChild( t );
+ }
+ }
+ innerTag = doc->createElement( "auto" );
+ configurationTag.appendChild( innerTag );
+
+ if (device->getOnBoot().lower() == "yes")
+ t = doc->createTextNode( "1" );
+ else
+ t = doc->createTextNode( "0" );
+
+ innerTag.appendChild( t );
+
+ innerTag = doc->createElement( "bootproto" );
+ configurationTag.appendChild( innerTag );
+ if (device->getBootProto().lower() == "manual")
+ t = doc->createTextNode( "none" );
+ else
+ t = doc->createTextNode( device->getBootProto().lower() );
+ innerTag.appendChild( t );
+
+ innerTag = doc->createElement( "file" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( device->getDeviceName() );
+ innerTag.appendChild( t );
+
+ innerTag = doc->createElement( "dev" );
+ tag.appendChild( innerTag );
+ t = doc->createTextNode( device->getDeviceName() );
+ innerTag.appendChild( t );
+
+ innerTag = doc->createElement( "enabled" );
+ tag.appendChild( innerTag );
+ if (device->isActive())
+ t = doc->createTextNode( "1" );
+ else
+ t = doc->createTextNode( "0" );
+ innerTag.appendChild( t );
+
+ innerTag = doc->createElement( "hwaddr" );
+ tag.appendChild( innerTag );
+ t = doc->createTextNode( device->getMacAddress() );
+ innerTag.appendChild( t );
+
+ //Wireless settings
+
+ if (device->getType() == WIRELESS_IFACE_TYPE)
+ {
+ KWirelessInterface *wifiDev = static_cast<KWirelessInterface*>(device);
+
+ if (!wifiDev->getEssid().isEmpty())
+ {
+ innerTag = doc->createElement( "essid" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( wifiDev->getEssid() );
+ innerTag.appendChild( t );
+ }
+ if (!wifiDev->getWepKey().isEmpty())
+ {
+ innerTag = doc->createElement( "key" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( wifiDev->getWepKey() );
+ innerTag.appendChild( t );
+ }
+ if (!wifiDev->getKeyType().isEmpty())
+ {
+ innerTag = doc->createElement( "key_type" );
+ configurationTag.appendChild( innerTag );
+ t = doc->createTextNode( wifiDev->getKeyType().lower() );
+ innerTag.appendChild( t );
+ }
+
+ }
+ if (!device->getDescription().isEmpty() && device->getDeviceName()!= "lo")
+ cfg.writeEntry(device->getDeviceName(),device->getDescription());
+
+ cfg.sync();
+ }
+}
+
+void KNetworkConfigParser::addDNSInfoToXMLDoc(TQDomDocument *doc, TQDomNode *root, KDNSInfo *dnsInfo)
+{
+ TQStringList nameServerList = dnsInfo->getNameServers();
+ TQPtrList<KKnownHostInfo> knownHostsList = dnsInfo->getKnownHostsList();
+ TQPtrListIterator<KKnownHostInfo> knownHostsIt(knownHostsList);
+ KKnownHostInfo *host;
+
+ TQDomElement tag = doc->createElement( "hostname" );
+ root->appendChild( tag );
+ TQDomText t = doc->createTextNode( dnsInfo->getMachineName() );
+ tag.appendChild( t );
+ tag = doc->createElement( "domain" );
+ root->appendChild( tag );
+ t = doc->createTextNode( dnsInfo->getDomainName() );
+ tag.appendChild( t );
+
+ //Add the list of name servers
+ for ( TQStringList::Iterator it = nameServerList.begin(); it != nameServerList.end(); ++it ) {
+ tag = doc->createElement( "nameserver" );
+ root->appendChild( tag );
+ t = doc->createTextNode( *it );
+ tag.appendChild( t );
+ }
+
+ //Add the list of static hosts
+ while ( (host = knownHostsIt.current()) != 0 )
+ {
+ ++knownHostsIt;
+ tag = doc->createElement( "statichost" );
+ root->appendChild( tag );
+ TQDomElement innerTag;
+ if (!host->getIpAddress().isEmpty())
+ {
+ innerTag = doc->createElement( "ip" );
+ tag.appendChild( innerTag );
+ t = doc->createTextNode( host->getIpAddress() );
+ innerTag.appendChild( t );
+ }
+ TQStringList aliases = host->getAliases();
+
+ for ( TQStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it )
+ {
+ innerTag = doc->createElement( "alias" );
+ tag.appendChild( innerTag );
+ t = doc->createTextNode( *it );
+ innerTag.appendChild( t );
+ }
+ }
+}
+
+void KNetworkConfigParser::addRoutingInfoToXMLDoc(TQDomDocument *doc, TQDomNode *root, KRoutingInfo *routingInfo)
+{
+ TQDomElement tag = doc->createElement( "gateway" );
+ root->appendChild( tag );
+ TQDomText t = doc->createTextNode( routingInfo->getGateway() );
+ tag.appendChild( t );
+
+ tag = doc->createElement( "gatewaydev" );
+ root->appendChild( tag );
+ t = doc->createTextNode( routingInfo->getGatewayDevice() );
+ tag.appendChild( t );
+}
+/** Loads the network info from a xml file generated by the gnome system tools
+network backends that are included with this app. */
+KNetworkInfo * KNetworkConfigParser::getNetworkInfo(){
+
+ return networkInfo;
+}
+
+/** Parses all of the <interface>...</interface> entries in the xml configuration file. Returns a KWirelessInterface
+ object that contains all the info of the wireless interface. */
+KWirelessInterface * KNetworkConfigParser::getWirelessInterfaceInfo(TQDomElement interface, const TQString &type){
+ KWirelessInterface *wifiDevice = new KWirelessInterface();
+ KNetworkInterface *tempDevice = NULL;
+
+ //first we get the standard network information
+ tempDevice = getInterfaceInfo(interface,type);
+ //Then we copy the network interface info to the wireless object. I don't
+ //know why it doesn't work with static_cast, after doing the cast, I can't
+ //write to the KWirelessInterface memebers.
+ memcpy(wifiDevice,tempDevice,sizeof(KNetworkInterface));
+ //wifiDevice = static_cast<KWirelessInterface*>(tempDevice);
+
+ TQDomNode node = interface.firstChild();
+
+ while ( !node.isNull() )
+ {
+ if ( node.isElement() )
+ {
+ TQString nodeName =node.nodeName();
+
+ //Parsing --get interfaces configuration
+ if ( node.isElement() && node.nodeName() == "configuration" )
+ {
+ TQDomNode configNode = node.firstChild();
+ while ( !configNode.isNull() )
+ {
+ if ( configNode.isElement() )
+ {
+ TQString configNodeName =configNode.nodeName();
+
+ if ( configNodeName == "key" )
+ {
+ TQDomElement e = configNode.toElement();
+ wifiDevice->setWepKey(e.text());
+ }
+ else if ( configNodeName == "essid" )
+ {
+ TQDomElement e = configNode.toElement();
+ wifiDevice->setEssid(e.text());
+ }
+ else if ( configNodeName == "key_type" )
+ {
+ TQDomElement e = configNode.toElement();
+ wifiDevice->setKeyType(e.text());
+ }
+ configNode = configNode.nextSibling();
+ }
+ }
+ }
+ }
+ node = node.nextSibling();
+ }
+
+ return wifiDevice;
+}
+
+/** Parses all of the <interface>...</interface> entries in the xml configuration file. Returns a KNetworkInterface
+ object with all the info of the interface.*/
+KNetworkInterface * KNetworkConfigParser::getInterfaceInfo(TQDomElement interface, const TQString &type){
+ TQDomNode node = interface.firstChild();
+ KNetworkInterface *tempDevice = new KNetworkInterface();
+ //tempDevice->setDescription(i18n("Ethernet Network Device"));
+
+ while ( !node.isNull() )
+ {
+ if ( node.isElement() )
+ {
+ TQString nodeName =node.nodeName();
+
+ //Parsing --get interfaces configuration
+ if ( node.isElement() && node.nodeName() == "configuration" )
+ {
+ TQDomNode configNode = node.firstChild();
+ while ( !configNode.isNull() )
+ {
+ if ( configNode.isElement() )
+ {
+ TQString configNodeName =configNode.nodeName();
+
+ if ( configNodeName == "auto" )
+ {
+ TQDomElement e = configNode.toElement();
+ if (e.text() == "1")
+ tempDevice->setOnBoot("yes");
+ else
+ tempDevice->setOnBoot("no");
+ }
+ else if ( configNodeName == "bootproto" )
+ {
+ TQDomElement e = configNode.toElement();
+ tempDevice->setBootProto(e.text());
+ }
+ if ( configNodeName == "address" || configNodeName == "addr")
+ {
+ TQDomElement e = configNode.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setIpAddress(e.text());
+ }
+ else if ( configNodeName == "gateway")
+ {
+ TQDomElement e = configNode.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setGateway(e.text());
+ }
+ else if ( configNodeName == "netmask" || configNodeName == "mask")
+ {
+ TQDomElement e = configNode.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setNetmask(e.text());
+ }
+ else if ( configNodeName == "network" )
+ {
+ TQDomElement e = configNode.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setNetwork(e.text());
+ }
+ else if ( configNodeName == "broadcast" || configNodeName == "bdcast")
+ {
+ TQDomElement e = configNode.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setBroadcast(e.text());
+ }
+ configNode = configNode.nextSibling();
+ }
+ }
+ }
+
+ //Parse -d list_ifaces interfaces configuration
+ if ( nodeName == "addr")
+ {
+ TQDomElement e = node.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setIpAddress(e.text());
+ }
+ else if ( nodeName == "mask")
+ {
+ TQDomElement e = node.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setNetmask(e.text());
+ }
+ else if ( nodeName == "bdcast")
+ {
+ TQDomElement e = node.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setBroadcast(e.text());
+ }
+
+
+ //These ones are common for both --get and -d list_ifaces
+ else if ( nodeName == "dev" )
+ {
+ TQDomElement e = node.toElement();
+ tempDevice->setDeviceName(e.text());
+ }
+ //we had to add the OR because the xml sintax when listing the interfaces
+ //is different than when loading the network info. ie.: enabled->active
+ //address->addr, etc...
+ else if ( nodeName == "enabled" || nodeName == "active")
+ {
+ TQDomElement e = node.toElement();
+ if (e.text() == "1")
+ tempDevice->setActive(true);
+ else
+ tempDevice->setActive(false);
+ }
+ else if ( nodeName == "hwaddr" )
+ {
+ TQDomElement e = node.toElement();
+ if (!e.text().isEmpty())
+ tempDevice->setMacAddress(e.text());
+ }
+ }
+ node = node.nextSibling();
+ }
+ if (type != TQString())
+ tempDevice->setType(type);
+
+ TQString description;
+ KSimpleConfig cfg("knetwortdeconfrc");
+ cfg.setGroup("Interfaces");
+ description = cfg.readEntry(tempDevice->getDeviceName());
+ if (!description.isEmpty())
+ tempDevice->setDescription(description);
+ else
+ {
+ if (tempDevice->getType() == ETHERNET_IFACE_TYPE)
+ tempDevice->setDescription(i18n("Ethernet Network Device"));
+ else if (tempDevice->getType() == WIRELESS_IFACE_TYPE)
+ tempDevice->setDescription(i18n("Wireless Network Device"));
+ }
+
+ //Clear IP address settings if boot protocol is dhcp or bootp, in case that they are
+ //setted in the config files.
+ if ((tempDevice->getBootProto().lower() == "dhcp") || (tempDevice->getBootProto().lower() == "bootp"))
+ {
+ tempDevice->setIpAddress("");
+ tempDevice->setNetmask("");
+ tempDevice->setNetwork("");
+ tempDevice->setBroadcast("");
+ }
+
+ return tempDevice;
+}
+
+/** Parses all of the <statichost>...</statichost> entries in the xml configuration file. */
+KKnownHostInfo * KNetworkConfigParser::getStaticHostInfo(TQDomElement host)
+{
+ TQDomNode node = host.firstChild();
+ KKnownHostInfo *tempHost = new KKnownHostInfo();
+
+ while ( !node.isNull() )
+ {
+ if ( node.isElement() )
+ {
+ TQString nodeName =node.nodeName();
+
+ if ( nodeName == "ip")
+ {
+ TQDomElement e = node.toElement();
+ if (!e.text().isEmpty())
+ tempHost->setIpAddress(e.text());
+ }
+ else if ( nodeName == "alias")
+ {
+ TQDomElement e = node.toElement();
+ if (!e.text().isEmpty())
+ tempHost->addAlias(e.text());
+ }
+ }
+ node = node.nextSibling();
+ }
+
+ return tempHost;
+}
+
+/** Reads the xml with the network info. */
+void KNetworkConfigParser::readNetworkInfo()
+{
+ TQPtrList<KNetworkInfo> profilesList;
+ //deviceList.clear();
+ //The gst backend puts a \n at the beginning of the xml output, so
+ //we have to erase it first before we can parse it.
+ xmlOuput = xmlOuput.section('\n',1);
+ tqDebug("--get XML:\n%s",xmlOuput.latin1());
+
+ //If the platform where knetwortdeconf is running isn't supported, show the
+ //user a dialog with all the supported platforms to choose.
+ if (xmlErr.contains("platform_unsup::"))
+ {
+ connect( this, TQT_SIGNAL(readyLoadingSupportedPlatforms()), this, TQT_SLOT(showSupportedPlatformsDialogSlot()) );
+ loadSupportedPlatforms();
+ emit errorDetectingPlatform();
+ }
+ else //parse the XML file
+ {
+ TQString err;
+ int x,y;
+ TQDomDocument doc( "network");
+ if ( !doc.setContent( xmlOuput.utf8(),false,&err,&x,&y ) )
+ {
+ KMessageBox::error(0,
+ i18n("Could not parse the XML output from the network configuration backend."),
+ i18n("Error Loading The Network Configuration"));
+// tqDebug("error: %s %d,%d",err.latin1(),x,y);
+ }
+
+ TQDomElement root = doc.documentElement();
+ TQDomNode node = root.firstChild();
+
+ //Load first the network information
+ parseNetworkInfo(node, networkInfo, false);
+
+ //Then, load the network profiles
+ node = root.firstChild();
+ while( !node.isNull() )
+ {
+ if ( node.isElement())
+ {
+ TQString nodeName = node.nodeName();
+
+ if ( nodeName == "profiledb" )
+ {
+ TQDomNode profileNode = node.firstChild();
+
+ while( !profileNode.isNull() )
+ {
+ if ( profileNode.isElement())
+ {
+ TQString profileName = profileNode.nodeName();
+
+ if (profileNode.isElement() && profileName == "profile")
+ {
+ KNetworkInfo * networkProfile = new KNetworkInfo();
+ TQDomNode profileConfigurationNode = profileNode.firstChild();
+ parseNetworkInfo(profileConfigurationNode, networkProfile, true);
+ profilesList.append(networkProfile);
+ }
+ }
+ profileNode = profileNode.nextSibling();
+ }
+ }
+ }
+ node = node.nextSibling();
+ }
+ networkInfo->setProfilesList(profilesList);
+ }
+}
+
+void KNetworkConfigParser::parseNetworkInfo(TQDomNode node, KNetworkInfo *_networkInfo, bool isProfile){
+ TQPtrList<KNetworkInterface> deviceList;
+ KDNSInfo *_dnsInfo = new KDNSInfo();
+ KRoutingInfo *_routingInfo = new KRoutingInfo();
+ TQStringList serverList;
+ TQPtrList<KNetworkInterface> tempDeviceList;
+ TQPtrList<KKnownHostInfo> knownHostsList;
+
+ while( !node.isNull() )
+ {
+ if ( node.isElement())
+ {
+ TQString nodeName = node.nodeName();
+
+ //Get the gatway
+ if ( nodeName == "gateway" )
+ {
+ TQDomElement gateway = node.toElement();
+ _routingInfo->setGateway(gateway.text());
+ }
+ else if ( nodeName == "gatewaydev" )
+ {
+ TQDomElement gatewaydev = node.toElement();
+ _routingInfo->setGatewayDevice(gatewaydev.text());
+ }
+ //The name of the profile, in the case it's a profile ;)
+ else if ( nodeName == "name" && isProfile)
+ {
+ TQDomElement profileName = node.toElement();
+ _networkInfo->setProfileName(profileName.text());
+ }
+
+ //Get the network interfaces
+ else if ( nodeName == "interface" )
+ {
+ TQDomElement interface = node.toElement();
+
+ TQString attr = interface.attribute("type").lower();
+ //We have hardcoded to load only the supported interface types,
+ //for now, ethernet, loopback and wireless, thus loopback interfaces
+ //aren't shown.
+ if ( attr == ETHERNET_IFACE_TYPE || attr == LOOPBACK_IFACE_TYPE )
+ {
+ KNetworkInterface *tempDevice = NULL;
+ tempDevice = getInterfaceInfo(interface,attr);
+ deviceList.append(tempDevice);
+ }
+ else if (attr == WIRELESS_IFACE_TYPE)
+ {
+ KWirelessInterface *wifiDevice = NULL;
+ wifiDevice = getWirelessInterfaceInfo(interface,attr);
+ deviceList.append(wifiDevice);
+ }
+ }
+
+ //Get domain and host names
+ else if ( nodeName == "hostname" )
+ {
+ TQDomElement hostname = node.toElement();
+ _dnsInfo->setMachineName(hostname.text());
+ }
+ else if ( nodeName == "domain" )
+ {
+ TQDomElement domainname = node.toElement();
+ _dnsInfo->setDomainName(domainname.text());
+ }
+
+ //Get the nameServers
+ else if ( nodeName == "nameserver" )
+ {
+ TQDomElement nameserver = node.toElement();
+ serverList.append(nameserver.text());
+ }
+
+ //Get the static hosts
+ else if ( nodeName == "statichost" )
+ {
+ TQDomElement host = node.toElement();
+ KKnownHostInfo *tempHost = getStaticHostInfo(host);
+ knownHostsList.append(tempHost);
+ }
+ }
+ node = node.nextSibling();
+ }
+ _dnsInfo->setNameServers(serverList);
+ _dnsInfo->setKnownHostsList(knownHostsList);
+
+ _networkInfo->setDeviceList(deviceList);
+ loadRoutingInfo(_routingInfo);
+ _networkInfo->setRoutingInfo(_routingInfo);
+ _networkInfo->setDNSInfo(_dnsInfo);
+
+ //if we are loading a profile, don't try to find the IP address of DHCP
+ //interfaces and their states
+ if (!isProfile)
+ {
+ listIfaces(_networkInfo->getPlatformName());
+ }
+ //return _networkInfo;
+}
+void KNetworkConfigParser::readFromStdoutReloadScript(){
+ TQString s = procReloadNetwork->readStdout();
+ reloadScriptOutput.append(s);
+}
+/** emits a signal when the network changes have benn saved. */
+void KNetworkConfigParser::sendNetworkInfoSavedSignalSlot(){
+ procSaveNetworkInfo->closeStdin();
+}
+
+/** Concatenates into a TQString the xml output of the network backend. */
+void KNetworkConfigParser::concatXMLOutputSlot(){
+ xmlOuput.append(procDetect->readStdout());
+}
+
+void KNetworkConfigParser::readXMLErrSlot(){
+ xmlErr.append(procDetect->readStderr());
+}
+/** lists all platforms supported by GST. */
+void KNetworkConfigParser::loadSupportedPlatforms(){
+ procDetect = new TQProcess(this);
+ procDetect->addArgument( locate("data",BACKEND_PATH) );
+ procDetect->addArgument( "-d" );
+ procDetect->addArgument( "platforms" );
+ connect( procDetect, TQT_SIGNAL(processExited()), this, TQT_SLOT(readSupportedPlatformsSlot()) );
+ xmlOuput = "";
+ connect( procDetect, TQT_SIGNAL(readyReadStdout()),this, TQT_SLOT(concatXMLOutputSlot()));
+// connect( procDetect, TQT_SIGNAL(readyReadStderr()),this, TQT_SLOT(readXMLErrSlot()));
+
+ if ( !procDetect->start() )
+ {
+// error handling
+ KMessageBox::error(0,
+ i18n("Could not execute backend script for the network configuration detection. Something is wrong with your installation."),
+ i18n("Could Not Launch Network Configuration Backend Script"));
+ }
+
+}
+/** Parses the xml ouput generated by GST that has all the supported platforms. */
+void KNetworkConfigParser::readSupportedPlatformsSlot(){
+ //The gst backend puts a \n at the beginning of the xml output, so
+ //we have to erase it first before we parse it.
+ xmlOuput = xmlOuput.section('\n',1);
+ TQDomDocument doc( "platforms" );
+ if ( !doc.setContent( xmlOuput.utf8() ) )
+ {
+ KMessageBox::error(0,
+ i18n("Could not parse the list of supported platforms from the network configuration backend."),
+ i18n("Error Obtaining Supported Platforms List"));
+ }
+ TQDomElement root = doc.documentElement();
+ TQDomNode node = root.firstChild();
+ TQString s;
+ while( !node.isNull() )
+ {
+ if ( node.isElement() && node.nodeName() == "platform" )
+ {
+ TQDomElement platform = node.toElement();
+ s = getPlatformInfo(platform);
+ }
+ supportedPlatformsList << s;
+ node = node.nextSibling();
+ }
+ emit readyLoadingSupportedPlatforms();
+}
+/** Returns the info of a platform in the form of 'key:value' . */
+TQString KNetworkConfigParser::getPlatformInfo(TQDomElement platform){
+ TQDomNode node = platform.firstChild();
+ TQString s;
+ while ( !node.isNull() )
+ {
+ if ( node.isElement() )
+ {
+ if ( node.nodeName() == "key" )
+ {
+ TQDomElement e = node.toElement();
+ s += e.text();
+ s += ":";
+ }
+ else if ( node.nodeName() == "name" )
+ {
+ TQDomElement e = node.toElement();
+ s += e.text();
+ }
+
+ }
+ node = node.nextSibling();
+ }
+
+ return s;
+}
+/** Shows the dialog with all the supported platforms by GST. */
+void KNetworkConfigParser::showSupportedPlatformsDialogSlot(){
+ KSelectDistroDlg* dialog = new KSelectDistroDlg(0, 0);
+
+ for ( TQStringList::Iterator it = supportedPlatformsList.begin(); it != supportedPlatformsList.end(); ++it )
+ {
+ TQString key = (*it);
+ key = key.section(":",0,0);
+ TQString name = (*it);
+ name = name.section(":",1,1);
+ if (key.contains("debian"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/debian.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("mandriva"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/mandriva.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("conectiva"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/conectiva.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("pld"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/pld.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("redhat"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/redhat.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("suse"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/suse.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("turbolinux"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/turbolinux.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("fedora"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/fedora.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("openna"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/openna.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("slackware"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/slackware.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("freebsd"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/freebsd.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("gentoo"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/gentoo.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("blackpanther"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/blackpanther.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("rpath"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/rpath.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("vine"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/vine.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("ubuntu"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/kubuntu.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("yoper"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/yoper.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ else if (key.contains("ark"))
+ {
+ TQPixmap distroImg(locate("data","knetwortdeconf/pixmaps/ark.png"));
+ dialog->klbDistroList->insertItem(distroImg, name);
+ }
+ }
+
+ if (!dialog->exec())
+ emit setReadOnly(true);
+ else
+ {
+ int i = 0;
+ TQStringList::Iterator it = supportedPlatformsList.begin();
+ while (i < dialog->klbDistroList->currentItem())
+ {
+ i++;
+ ++it;
+ }
+ TQString key = (*it);
+ key = key.section(":",0,0);
+ //clean variables and run again the detection script but now don't
+ //auto-detect.
+ xmlErr = "";
+ xmlOuput = "";
+ networkInfo->setPlatformName(key);
+ runDetectionScript(key);
+ if (dialog->cbAskAgain->isChecked())
+ saveAskAgain(key,!dialog->cbAskAgain->isChecked());
+ }
+}
+
+void KNetworkConfigParser::saveAskAgain(const TQString &platform, bool askAgain)
+{
+ KSimpleConfig cfg("knetwortdeconfrc");
+ cfg.setGroup("General");
+ cfg.writeEntry("detectedPlatform",platform);
+ cfg.writeEntry("askAgainPlatform",askAgain);
+ cfg.sync();
+}
+
+bool KNetworkConfigParser::readAskAgain(TQString &platform)
+{
+ KSimpleConfig cfg("knetwortdeconfrc");
+ cfg.setGroup("General");
+ platform = cfg.readEntry("detectedPlatform");
+ return cfg.readBoolEntry("askAgainPlatform");
+}
+
+/** No descriptions */
+void KNetworkConfigParser::readFromStdoutSaveNetworkInfo(){
+ xmlOuput.append(procSaveNetworkInfo->readStdout());
+}
+/** Calls runDetectionScript(). */
+void KNetworkConfigParser::listIfacesSlot(){
+ listIfaces(networkInfo->getPlatformName());
+}
+/**Returns the info of the network device 'device or NULL if not found.'*/
+KNetworkInterface * KNetworkConfigParser::getDeviceInfo(TQString device){
+ TQPtrList<KNetworkInterface> deviceList = networkInfo->getDeviceList();
+ TQPtrListIterator<KNetworkInterface> i(deviceList);
+ KNetworkInterface *temp;
+ while ((temp = i.current()) != 0)
+ {
+ if (temp->getDeviceName() == device)
+ {
+ return temp;
+ }
+ ++i;
+ }
+ return NULL;
+}
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.h b/knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.h
new file mode 100644
index 0000000..8161da5
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconfigparser.h
@@ -0,0 +1,182 @@
+/***************************************************************************
+ knetwortdeconfigparser.h - description
+ -------------------
+ begin : Mon Jan 13 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNETWORKCONFIGPARSER_H
+#define KNETWORKCONFIGPARSER_H
+
+#define BACKEND_PATH "knetwortdeconf/backends/network-conf"
+#define ETHERNET_IFACE_TYPE "ethernet"
+#define WIRELESS_IFACE_TYPE "wireless"
+#define LOOPBACK_IFACE_TYPE "loopback"
+
+#define WIRELESS_WEP_KEY_TYPE_ASCII "ascii"
+#define WIRELESS_WEP_KEY_TYPE_HEXADECIMAL "hexadecimal"
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <kapp.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <tqobject.h>
+#include <tqdir.h>
+#include <tqfile.h>
+#include <tqstring.h>
+#include <tqprocess.h>
+#include <tqdom.h>
+#include <tqlabel.h>
+#include <tqcheckbox.h>
+
+#include <klistbox.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+
+#include "knetworkinfo.h"
+#include "kdetectdistrodlg.h"
+#include "kreloadnetworkdlg.h"
+#include "kinterfaceupdowndlg.h"
+#include "kselectdistrodlg.h"
+
+/**
+ *@author Juan Luis Baptiste
+ */
+
+class KNetworkConfigParser : public TQObject {
+ Q_OBJECT
+
+ public:
+ KNetworkConfigParser();
+ ~KNetworkConfigParser();
+ /** return tyhe number of configured devices. */
+ unsigned numDevices();
+ void setProgramVersion(TQString ver);
+ /** Reads /proc/net/route looking for the default gateway. */
+ void loadRoutingInfo(KRoutingInfo *routingInfo);
+ /** Saves the new network configuration. */
+ void saveNetworkInfo(KNetworkInfo *networkInfo);
+ /** Loads the network info from a xml file generated by the gnome system tools
+ network backends that are included with this app. */
+ KNetworkInfo * getNetworkInfo();
+ TQProcess * proc;
+ TQProcess * procDetect;
+ TQProcess * procSaveNetworkInfo;
+ /** Variable to know if there is an dhcp device configured, so we can know if we need to save the defauilt gw info or not. */
+ bool dhcpDevice;
+ KNetworkInterface * getDeviceInfo(TQString device);
+
+
+ public slots:
+ /** runs gst to find out the state of network devices.It runs the command:
+ $knetwortdeconf_home/backends/networtdeconf [--platform platform] -d list_ifaces */
+ void listIfaces(const TQString &platform);
+
+ private slots:
+ /** Runs the gst backend to get network values. You can pass to the script a specific platform to load using the platform parameter. */
+ void runDetectionScript(TQString platform);
+ void readIfconfigOutput();
+ void readNetworkInfo();
+ void readFromStdoutReloadScript();
+ /** emits a signal when the network changes have benn saved. */
+ void sendNetworkInfoSavedSignalSlot();
+ /** Concatenates into a TQString the xml output of the network backend. */
+ void concatXMLOutputSlot();
+ void readXMLErrSlot();
+ /** Shows the dialog with all the supported platforms by GST. */
+ void showSupportedPlatformsDialogSlot();
+ /** Parses the xml ouput generated by GST that has all the supported platforms. */
+ void readSupportedPlatformsSlot();
+ /** No descriptions */
+ void readListIfacesSlot();
+ void readFromStdoutSaveNetworkInfo();
+ /** Calls runDetectionScript(). */
+ void listIfacesSlot();
+ /** save process has exited */
+ void processExitedSlot();
+
+ private:
+ //TQPtrList<KNetworkInterface> deviceList;
+ TQPtrList<KNetworkInterface> tempList;
+ KNetworkInterface *newDevice;
+ bool isUp;
+ /** Counts the number of configured devices that had been found. */
+ unsigned _numDevices;
+ KRoutingInfo *routingInfo;
+ KDNSInfo *dnsInfo;
+ TQString programVersion;
+ /** The output of ifconfig command that needs to be parsed in readIfconfigOutput()*/
+ TQString ifconfigOutput;
+ KNetworkInfo * networkInfo;
+ TQPtrList<KKnownHostInfo> knownHostsList;
+ TQString hexIPv4ToDecIPv4(const TQString &hex);
+ /** lists all platforms supported by GST. */
+ void loadSupportedPlatforms();
+ /** Returns the info of a platform in the form of 'key:value' . */
+ TQString getPlatformInfo(TQDomElement platform);
+ /** save process is running */
+ bool processRunning;
+
+ /** Shows a progress dialog while the networl is being reloaded. */
+ KInterfaceUpDownDlg * kpdReloadStatusDlg;
+ TQProcess *procReloadNetwork;
+ TQString reloadScriptOutput;
+ /** Contains the network configuration en xml format. */
+ /** List of supported platforms. */
+ TQStringList supportedPlatformsList;
+ TQString xmlOuput;
+ TQString xmlErr;
+ /** Temporal device list to be used when loading the dhcp devices info */
+ TQPtrList<KNetworkInterface> tempDevList;
+ /** Parses all of the <statichost>...</statichost> entries in the xml configuration file. */
+ KKnownHostInfo * getStaticHostInfo(TQDomElement host);
+ /** Saves the option to show again or not the platform using KSimpleConfig*/
+ void saveAskAgain(const TQString &platform, bool askAgain);
+ /**Returns if the show platform should be shown again or not and the saved platform*/
+ bool readAskAgain(TQString &platform);
+ void parseNetworkInfo(TQDomNode node, KNetworkInfo *networkInfo, bool isProfile);
+ void addRoutingInfoToXMLDoc(TQDomDocument *doc, TQDomNode *root, KRoutingInfo *routingInfo);
+ void addDNSInfoToXMLDoc(TQDomDocument *doc, TQDomNode *root, KDNSInfo *dnsInfo);
+ void addNetworkInterfacesToXMLDoc(TQDomDocument *doc, TQDomNode *root, TQPtrList<KNetworkInterface> devList);
+ void addNetworkProfilesToXMLDoc(TQDomDocument *doc, TQDomNode *root, TQPtrList<KNetworkInfo> profileList);
+
+ protected: // Protected methods
+ /** Parses all of the <interface>...</interface> entries in the xml configuration file. */
+ virtual KNetworkInterface *getInterfaceInfo(TQDomElement interface, const TQString &type);
+ /** Parses all of the <interface>...</interface> entries in the xml configuration file. Returns a KWirelessInterface
+ object that contains all the info of the wireless interface. */
+ virtual KWirelessInterface *getWirelessInterfaceInfo(TQDomElement interface, const TQString &type);
+
+ signals: // Signals
+ /** emmited when the xml file is finished reading. */
+ void readyLoadingNetworkInfo();
+
+ /** emmited when the xml file saved and the backend has finished executing. */
+// void readySavingNetworkInfo();
+
+ /** Signal that is sent when fillDevices() has finished fllind the dhcp devices. */
+ void readyIfconfigOutputSignal();
+ /** Signal emmited when the platform can't be auto-detected. */
+ void errorDetectingPlatform();
+ /** signal emmited when the parsing of the xml of the supported platform list. */
+ void readyLoadingSupportedPlatforms();
+ /** signal emmited when the config parser needs to set read only the GUI because
+ some error in the parsing, or the platform isn't supported.*/
+ void setReadOnly(bool);
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.cpp b/knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.cpp
new file mode 100644
index 0000000..0982379
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.cpp
@@ -0,0 +1,118 @@
+/***************************************************************************
+ knetwortdeconfmodule.cpp - description
+ -------------------
+ begin : Tue Apr 1 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : juancho@linuxmail.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include <klocale.h>
+#include <tdecmodule.h>
+#include <tqlayout.h>
+#include <version.h>
+#include "knetwortdeconfmodule.h"
+
+
+
+KNetworkConfModule::KNetworkConfModule(TQWidget* parent, const char *name/*, TQStringList list*/)
+ : TDECModule(parent,name)
+{
+ TQVBoxLayout *top = new TQVBoxLayout(this);
+
+ conf = new KNetworkConf(this);
+ conf->setVersion(TQString(VERSION));
+ conf->setReadOnly(false);
+
+ top->addWidget(conf);
+
+ if (getuid() != 0){
+ conf->setReadOnlySlot(true);
+ conf->setReadOnly(true);
+ }
+
+ connect(conf,TQT_SIGNAL(networkStateChanged(bool)),TQT_SLOT(configChanged(bool)));
+ setButtons(TDECModule::Apply|TDECModule::Help);
+}
+
+KNetworkConfModule::~KNetworkConfModule()
+{
+}
+
+void KNetworkConfModule::configChanged(bool b)
+{
+ emit changed(b);
+}
+
+void KNetworkConfModule::load()
+{
+ // conf->loadNetworkDevicesInfo();
+ //conf->loadRoutingAndDNSInfo();
+ //conf->loadDNSInfoTab();
+}
+
+void KNetworkConfModule::save()
+{
+ conf->saveInfoSlot();
+}
+/*
+int KNetworkConfModule::buttons()
+{
+ return TDECModule::Ok|TDECModule::Apply|TDECModule::Help;
+}
+*/
+bool KNetworkConfModule::useRootOnlyMsg() const
+{
+ return true;
+}
+
+TQString KNetworkConfModule::rootOnlyMsg() const
+{
+ return "Changing the network configuration requires root access";
+}
+
+TDEAboutData* KNetworkConfModule::aboutData() const
+{
+ /*TDEAboutData* data = new TDEAboutData( "knetwortdeconf", I18N_NOOP("KNetworkConf"),
+ VERSION, description, TDEAboutData::License_GPL,
+ "(c) 2003, Juan Luis Baptiste", 0, "http://www.merlinux.org/knetwortdeconf/", "jbaptiste@merlinux.org");
+ data->addAuthor("Juan Luis Baptiste",I18N_NOOP("Lead Developer"),
+ "jbaptiste@merlinux.org");
+ data->addCredit("David Sansome",I18N_NOOP("Various bugfixes and features"),
+ "me@davidsansome.com");
+
+ return data; // Memory leak, oh well...*/
+
+TDEAboutData *aboutData = new TDEAboutData( "knetwortdeconf", I18N_NOOP("KNetworkConf"),
+ VERSION, description, TDEAboutData::License_GPL,
+ "(c) 2003 - 2005, Juan Luis Baptiste", 0, "http://www.merlinux.org/knetwortdeconf/", "juan.baptiste@kdemail.net");
+ aboutData->addAuthor("Juan Luis Baptiste",I18N_NOOP("Lead Developer"),
+ "juan.baptiste@kdemail.net");
+ aboutData->addCredit("Carlos Garnacho and the Gnome System Tools Team",I18N_NOOP("Provided the Network backend which KNetworkConf relies on."),
+ "garnacho@tuxerver.net","http://www.gnome.org/projects/gst/");
+ aboutData->addCredit("Helio Chissini de Castro",I18N_NOOP("Conectiva Linux Support"),
+ "helio@conectiva.com.br");
+ aboutData->addCredit("Christoph Eckert",I18N_NOOP("Documentation maintainer, and German translator"),
+ "mchristoph.eckert@t-online.de ");
+ aboutData->addCredit("David Sansome",I18N_NOOP("Various bugfixes and features"),
+ "me@davidsansome.com");
+ aboutData->addCredit("Gustavo Pichorim Boiko",I18N_NOOP("Various bugfixes and Brazilian Portuguese translator"),"gustavo.boiko@kdemail.net");
+ return aboutData;// Memory leak, oh well...
+}
+
+TQString KNetworkConfModule::quickHelp() const
+{
+ return i18n("%1Network configuration%2This module allows you to configure your TCP/IP settings.%3").arg("<h1>").arg("</h1><p>").arg("</p>");
+}
+
+//#include "knetwortdeconfmodule.moc"
+
+#include "knetwortdeconfmodule.moc"
diff --git a/knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.h b/knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.h
new file mode 100644
index 0000000..e4321b9
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/knetwortdeconfmodule.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ knetwortdeconfmodule.h - description
+ -------------------
+ begin : Tue Apr 1 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : juancho@linuxmail.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KNETWORKCONFMODULE_H
+#define KNETWORKCONFMODULE_H
+
+#include "knetwortdeconf.h"
+#include <kaboutdata.h>
+#include <tdecmodule.h>
+
+class KNetworkConfModule : public TDECModule
+{
+ Q_OBJECT
+
+
+public:
+ KNetworkConfModule(TQWidget* parent, const char *name/*, TQStringList list*/);
+ ~KNetworkConfModule();
+
+ void load();
+ void save();
+ int buttons();
+
+ bool useRootOnlyMsg() const;
+ TQString rootOnlyMsg() const;
+ TDEAboutData* aboutData() const;
+ TQString quickHelp() const;
+
+private slots:
+ void configChanged(bool);
+
+private:
+ KNetworkConf* conf;
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.cpp b/knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.cpp
new file mode 100644
index 0000000..a326e23
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.cpp
@@ -0,0 +1,16 @@
+//
+// C++ Implementation: %{MODULE}
+//
+// Description:
+//
+//
+// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "kprofileslistviewtooltip.h"
+
+KProfilesListViewToolTip::~KProfilesListViewToolTip()
+{
+}
diff --git a/knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.h b/knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.h
new file mode 100644
index 0000000..deec161
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kprofileslistviewtooltip.h
@@ -0,0 +1,139 @@
+/***************************************************************************
+ kprofileslistviewtooltip.h - description
+ -------------------
+ begin : Wed Aug 24 2005
+ copyright : (C) 2005 by Juan Luis Baptiste
+ email : juan.baptiste@kdemail.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef KPROFILESLISTVIEWTOOLTIP_H
+#define KPROFILESLISTVIEWTOOLTIP_H
+
+#include <tqtooltip.h>
+#include <tqlistview.h>
+#include <tqheader.h>
+#include <tqptrlist.h>
+
+#include "knetworkinfo.h"
+#include "knetwortdeconfigparser.h"
+
+class KProfilesListViewToolTip : public TQToolTip
+{
+public:
+ KProfilesListViewToolTip(TQListView* parent);
+ void setProfiles(TQPtrList<KNetworkInfo> profiles_);
+ ~KProfilesListViewToolTip();
+
+protected:
+ void maybeTip( const TQPoint& p );
+ KNetworkInfo *getProfile(TQPtrList<KNetworkInfo> profilesList, TQString selectedProfile);
+private:
+ TQListView* listView;
+ //KNetworkConf* conf;
+ TQPtrList<KNetworkInfo> profiles;
+
+};
+
+inline void KProfilesListViewToolTip::setProfiles(TQPtrList<KNetworkInfo> profiles_)
+{
+ profiles = profiles_;
+}
+
+inline KProfilesListViewToolTip::KProfilesListViewToolTip( TQListView* parent ):TQToolTip( parent->viewport() ), listView( parent ) {}
+
+inline void KProfilesListViewToolTip::maybeTip( const TQPoint& p )
+{
+
+ if ( !listView )
+ return;
+
+ const TQListViewItem* item = listView->itemAt( p );
+
+ if ( !item )
+ return;
+
+ const TQRect itemRect = listView->itemRect( item );
+
+ if ( !itemRect.isValid() )
+ return;
+
+ const int col = listView->header()->sectionAt( p.x() );
+
+ if ( col == -1 )
+ return;
+
+ const TQRect headerRect = listView->header()->sectionRect( col );
+
+ if ( !headerRect.isValid() )
+ return;
+
+ const TQRect cellRect( headerRect.left(), itemRect.top(),headerRect.width() + 60, itemRect.height() );
+
+ TQString tipStr;
+
+ if( col == 0 )
+ {
+ tipStr = TQString(i18n("<b>Network Configuration of this Profile:</b>" ));
+ KNetworkInfo *profile = getProfile(profiles,item->text(0));
+ if (profile != NULL)
+ {
+ TQPtrList<KNetworkInterface> devices = profile->getDeviceList();
+ KNetworkInterface *device = NULL;
+ for (device = devices.first(); device; device = devices.next())
+ {
+ if (device->getType() != LOOPBACK_IFACE_TYPE)
+ {
+ tipStr.append(i18n("<p><b>Interface:</b> %1").arg(device->getDeviceName().latin1()));
+ tipStr.append(i18n("<br><b>Type:</b> %1").arg(device->getType()));
+ TQString bootProto;
+ if (device->getBootProto() == "none")
+ bootProto = "Manual";
+ else
+ bootProto = device->getBootProto();
+ tipStr.append(i18n("<br><b>Boot Protocol:</b> %1").arg(bootProto));
+ if (bootProto != "dhcp")
+ {
+ tipStr.append(i18n("<br><b>IP Address:</b> %1").arg(device->getIpAddress()));
+ tipStr.append(i18n("<br><b>Broadcast Address:</b> %1").arg(device->getBroadcast()));
+ }
+ tipStr.append(i18n("<br><b>On Boot:</b> %1").arg(device->getOnBoot()));
+ }
+ }
+ KRoutingInfo *route = profile->getRoutingInfo();
+ tipStr.append(i18n("</p><p><b>Default Gateway:</b> %1").arg(route->getGateway()));
+ KDNSInfo *dns = profile->getDNSInfo();
+ tipStr.append(i18n("<br><b>Domain Name:</b> %1").arg(dns->getDomainName()));
+ tipStr.append(i18n("<br><b>Machine Name:</b> %1").arg(dns->getMachineName()));
+ TQStringList nameServers = dns->getNameServers();
+ for ( TQStringList::Iterator it = nameServers.begin(); it != nameServers.end(); ++it)
+ {
+ tipStr.append(i18n("<br><b>DNS Name Server:</b> %1").arg((*it)));
+ }
+ }
+ }
+ tip( cellRect, tipStr );
+}
+
+inline KNetworkInfo *KProfilesListViewToolTip::getProfile(TQPtrList<KNetworkInfo> profilesList, TQString selectedProfile)
+{
+ TQPtrListIterator<KNetworkInfo> it(profilesList);
+ KNetworkInfo *net = NULL;
+
+ while ((net = it.current()) != 0)
+ {
+ ++it;
+ if (net->getProfileName() == selectedProfile)
+ break;
+ }
+ return net;
+}
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/kreloadnetworkdlg.ui b/knetwortdeconf/knetwortdeconf/kreloadnetworkdlg.ui
new file mode 100644
index 0000000..705396e
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kreloadnetworkdlg.ui
@@ -0,0 +1,137 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>KReloadNetworkDlg</class>
+<widget class="KDialog">
+ <property name="name">
+ <cstring>KReloadNetworkDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>2</x>
+ <y>0</y>
+ <width>342</width>
+ <height>130</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>342</width>
+ <height>130</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>342</width>
+ <height>130</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Reloading Network</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>tlNetworkStatus</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>40</x>
+ <y>72</y>
+ <width>273</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>kpbOk</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>139</x>
+ <y>96</y>
+ <width>58</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoResize">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>PixmapLabel1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>40</width>
+ <height>40</height>
+ </rect>
+ </property>
+ <property name="pixmap">
+ <pixmap>image1</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>73</x>
+ <y>20</y>
+ <width>291</width>
+ <height>46</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Please wait while the network is reloaded so
+the changes can take effect.</string>
+ </property>
+ </widget>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="8846">789cedd8596f23b91107f0f7fd1483e1db22e04a2d75ab1b411e7cdff7ed200f7550be0fd996652bc8774f8bf52fcd6633bb3b405e331e60fc1b36c962f1684abffcfce57c7fe7cbcfbffcf4fa466f37f245aee9e5cbcf3a7e78f8fcfb3ffef6cf9fbef68a2feddf7eb7ffa5f8fa979fbe1ebc7d912fbb4f8f6906aa5a844efe3333776031cbe6dcf5cc71dd3c5029670e1b66ae86c35cae664d6659300f876635d7f3fe2ee07e373b8de0dafa4b7730fa971b73b763e67518cf478bbf1e944d3f8f2fd76f4b3b858d67df3cfbc9f5afcc45dfca696a2e1b8b2f26f33cfe9d998b4ea76fe57a6eee623cfa08633cbc060bfabf35178887d05ed1b77868d7dcc3f371c33c24f49ff353346dbc4d6e7fd5ddcb4e6fb0a0fcdcddeb663f9b7b5ebe64aebb66da9eb9d79db7a7708dfa2bb0f4b3b534f7fa562e57735bfb5d18fdc5a9b9eff3b1067bfbcbb058fdc0e6b263e5f1186e10efc85c299ecff9e8353e1f6cf59ba263f1ca078cf6e9d2dc43fbfc34772e9737779f723ebcbc8ff676e01ae35518f98927e63ed657b870e37981519f3ae612fdd32d5c9a756c1e74b1be97ccbe3e25e7afdff5f8f9d66df1f0238cf84263ee77b01fc85de6f1c62318e30d4b708df6a6ee321f2e7a3777ae4f7bb0207f8f6e2be70573595a7b74012bfa5373d5c08bb0cf37e21da09c7ae6baa19c9f78062b49f6b9799eaf836c6ae733c72387b0603c7d731ff32f2b6e8b3fbdc3a81fc45c22dfa1823dde64ae4a3c3f86d54c9fe601c62f23b7c54336bfd4746d7ce1c69c70fe6ace4f59f46a9c1f0b73db7a2acdbebed2d88df11670698e87e6aa6be30da8eff90e6fe6ba8b78cfdd03cef50fe006ed2d9ba914cdf5afe0a4f97d42d65e9bdf2a3f2feb70bfb2fe0730d61b6dbaad9cb761ac3749e612f345fb6e6b9f0ee0d2cc616e9bdf09dca07ed76dcfc74f18f393d2dc168fcd07555edff24903cf6734d75d8ce71946fbe1de4c5dcef9a23e4c9adfdf71094ec8e79a990bf801aecc11f16b81f592df375551e07d96a2b98ff390c6e6365f16ff03dc0c7af9f96b18e3a57b379e3f73d7f979be33fb7ad22537c6bbe2b6f66908fb7aab61b5f5c5886780fcf1b51bf3f939b79d67886f80fd2727b0cfcf861bf15f996b9c4f710fc67c33ea37180f217f4dc9763e239ea6b1fea29813d97a171bff7c3dc92aac18ff87d9f3131f60bc0fd2d48d781760c4cf43b7b5271b30da677880f54f4f6eec5ff45f7b3e0fdd563f7cc2a81fd07fad7030371eff9b993c5f182f119ecff10e7a25cedbb00c37160f1d9bab12eb29c24d9dcbc339ece32bcd3eff3c7263fd0a5c223f9f73e7f6e4d5dde4f707ddc0982ffe30d7bebed01f91c51776e064fb372e9a7d7ff29b59fd7eb762f6f71359ffecfb497ae6aab4fcc991dbfa936d18eb996fdc584f8f6ebb3f6817f6fd94dc964fb9300f709ea70f18f9a1018cf9119b1ff6f38c37dde8ff1cf6f576eac6fb0cf1d41eef96dbe289964f6ed05f1cc3c84fdc3793cf47e5b6fc68ce4fddf3f1f0115cda799716ddc8e7c45c7b7d85514e276edc2f6ad8e35f3737a81f0ad8d7ef018c7c47f447fefebc857d7d2eba6d3d09c309eb7f646e27d8ce1f9433d9e7b57803276b5fd1be909d57e1da3cbf1fe5f74dddae07acb78e7980fdcd369e76feb05eae61df8fa85f637da9b8ad9cefcd8daf2f86fdfe7607a33e356eb46ff967c2fe0c5b6eecb76d9890cf7737e6e3d5cc15fc31b78da7326b61f949397f4ddfdf47fa60f6f345a76eac9fdaecf9d0037383fb7be8c1d88ff1d46deb890a5871feac9809eb270ee6b67c5cbad15e0327ab1f9fcced7ab0f583fea4b2724de6f9e7ddbcff1be9fbe75d32fb7a50eb4f067eff2b60ac7f3d83fdfd3f36fb79905e611fdf9ab969b0df96dd562e258cf6b463f6fb911ec378ffc65d3317964f41fc4c582f2fe6f6e36936231ef5ef337a30f247c19c8a6195dbc3f88615eeafb9bdf63aeae76b03fb793a343738eff818c6fb2a4ccd84fbbd3ec164f1f33e8c78c29eb97d9fd8febe8231bff1024ef8bee6d0ecf31dfb6eecb72db312fc684eb82fcac03c447e388f9fdaf9407c3b66c2fae67737c613619c973481d11f5fc2c9cab572dbfc865d335736bf7a0de3fce25338e13cdb364b81f3600857767f0e4f30fa0ffb6edcaf6d3ec5bf7f4979feb93f28f1792a99fdbc123113ee3bf40e633da60518f1a54f33e37cd12bd8c7378131fff2ecb6727934cfe76fd56deb31ac9be7fb39af17d6c6cfa30d73db9f7dbe588409fbe9c82c95ad1f79715bfbfa0a63bd8503b326cb1f9179de7f3e0fa5f4f7b7bc9bfdfdc43d18eb55d7cde2f7a5018c78f5d08dfe6fdd88ef1e46bea89e3b3f9f866ed43f36abe7ffc68d7c6ec2ed27eeec2373427be1d13cf4f97c8131fe94f321eaf7115137d64f6366e45b8730d68baeb9311fddb9ed3cdf327b3e640f46791cb96d3c3c312bce0f798291df18cca948793ed5e6a79d4f9cafd76e9c0ff97dd8be1c70bec99dd9cf5ffd304b81f14f617c1ed25518eb273e9bb5302bc3d8bfe90af6f9c0f3a932c7c23c1c22fe7c3eb4a77983ef2befdd781f4fcc8cfd1fdecd52587b5cc3c88fec9a3dbef40c233e0d3059ffe905f6fd71644e783ebe9a3ddec86eec9fbcfe52c515eeaf7b66cf5fe8c0685fdfcc1e1f57b0e77be0c6f85e60d4e72db3cf7f7a70dbfb2f9cc29eef1518dfffc735f3d0bf6fc8f7b594c4cfe73bf33cbe06f6fbc9a51bf37b0627eb5f9fcdf3f5f90e57660970b2fabaefc6e7abbcff86957f7f96ee61c2fb3dc2e82f6e9ae7f391f3331c6a81fbf02eecf7ed4b7342fc24e621f2c7fdb9adbd4f18efa374eb463ce3b92dbf04239e83b7ffede7ff6dfc771b31448af4a33566cfb63f1c256a4cf33686f1aafddfeb1faa4bf126dec6bb781f1fe2a3d5c96d3cc5e7388a2f7f52ff35bec5717c8f93f8113fe3342ec4c5b814156d2cc795b81ad7e27adcf86eedcdb815b7e34edc8d7b713f1ec4c378148fe3493c8d67f1dc73da8eee225ec64eecfe26f222f6623f96b18a8358c726c41002050e1234a4300c57e1dadb0837e136dc85fbf0e0a30e8fe1293c87517809afe12d8cc37b98848ff019a661212c86a5b01c56c26a580bebf33636c266d80adb6127ec86bdb01f0ec261380ac7e1249c86b3701e2ec265e8846e28422ff44319aa30087568669d7d5b1fedddb3bd7e507bc4d090aee89a6ee896ee82d23d3dd0233dd1338de8855ee98dc6f44e13faa04f9ad2022dfeaa8d255a8ea7b442abb446ebb4419bb445dbb443bbb447fb7440877444c77442a774d6d63ca70bbaa44efbd62fbeb511957aedcdbea48a065453c391437b0f63169ebdff877cc5d77c430b7ccb777ccf0ffcc84ffccc237ef9551bd7fcca6f3ce6f7483ce10ffee4292ff0222ff132aff02aafcd4adab275de085ddee4adac6dde99cfedccbb7193f76c56789f0ff8908ff8984ff894cff89c2ff8329774b8dbde5b7bf9f73e975c7d6b8307dc7e488f2471562aa1bd5fb1c8ecde913d942bb9cebfddc8ad451489166c9f791b7227f7d2ae0e7a97477992679ac8485ee455de667dca58de6592dbf8904f6b41a66deeaa6f7b5f16c2baed4659942559961559953559a74dd9904dbe932d5a90ed5c734776f3bf7bb2ff7be74758a77d399043399263399153399373b9903617d299ef5c92aec7f0dd36aedb9b6c4ffaf9c63a68efcd75fbd1296a7bc268aead9cdb186b9b2a556be9b76db4efe6a15ee9b5dee8added9f3dcd3fbb676de4bfaa84ff9df671db56513d9fade59a82ffaaa6d96754c95e619d0897ee8a74ef3ef0bba184ef36f5197e2912e7fb78d155dd5b57686665f283fb731aceb866eea96e69cea8eeeea9eeee7bd7ddeb671f0bd36a2eaa11ef9f94aedbd4a8ff5444ff52cb771ae177aa939bfe154bb5a7c378e9ee51eeae7fbe1406b6d66ff9b620a69f6017290d55e8dfefcddd0de50c669186ed355ba9e8d2edda45bde928d74a7a3ff5c637fd0c67d9e9b771d259c71e9313da5e7bcd67fb00d1ee9527b1bde4f7769945ed26b7a4bed7ca5f734491f3f1cc747fae44276da7a5369f77b9af2e3ec8c490b61fa7bebf40f5a5be4914cdafcecfcb6e4ebbffefad3bf0156bfa7ba</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="8910">789cedd9c992e4b61106e0bb9e6262705338a02a56914586c387def77d6f870f8904d8fbbeb7c3ef6e16fe3f39b23c9226c2576ba498f9064422b1126cfdf2f397e3ed8d2f3ffff2d3d3b33c5fe8173d97c72f3fc7979b9b8fbfffe36ffffce9eba8f8d2fd3b1ed65f8aaf7ff9e9ebcef317fdb279779ba690b2831be47fa60e035a615ded5d4fed97e1ba8ce5d48e0ea96d737984232d433855b07ec26d0bc799ecba6fff841e0fb3d3035da3fd7449331f3d878703382cd37cde9fc293b219e77cf2f35de9a040ffb6e1e9af5cbf858b31cae50dae86c8cf27b8cf7f63ea623018a33c1ec143f627ded2ec4f58a495ed5fc005f391357a8c7c641d1ef179bf02b7c2f6f3f8144d976f93e32f9847d9e99956961f9b47c3ec3b7864e5b3703d8425cfff6868f1c23cade35c3f8ee1d118f1b4ed8de78734e3fb4f786ce3bf44d7cc678e56d47702970394fb3db8b2fc6ee9c8e773ff478d8d7f40fda618205f3986478c176e7be7faba41d7cc5f69f6d7efc363ae0f776cc6f37202978c27677409c717783214ac478c4763eb29e5fd331e1635dad379d8f24b7334f371353c1e70fd3a732539df5d7acce76769c60f1fe6321f0ef1d28cfab241eb383bdd9acbecf0099725c7f7888e6c4fe1aaa167e009c7c331df09cba580eb06e3e30fe9289acdf8365e9af7e7580ae6a7cff06880fcd21d3d46ff7497567a011edbf3aff418f142a06bd8d125d7932b695b7f983fa94a3ecf7caa080be34f383efa60463e82f191661872ffdd396ce767c8e7455974fdc37ccdd235cf8799de58bf3734fb2b63d8d6677a3133de902e61c7e76d7ef408ae879390dbdba61b3edfc2a14a557e7e277b3afeb9ff7104db78eb323dc67a7315cdf52856cef518d6699bef08978c279be60af5b7e8120ebe37e6fb8d6e58ffd48ce7fd07cdf949a937f2c1784b65f5311e3219c2be81eb21c767110e85c6ec6bba82fd9c39e6f7b31fc0d1cefbdcbfaa28f8bee95ef5d925f7bb5cd2cd6494f33da799af1c98eb5c1ef87cc57ce39c19fd77f366c413a5b91efc8e99f337a1639dd747b88627ec7f3833733ede7b23bf25dae23dc1b5b5c7fed79c0fd7c04da9f93e22896eb03e3cf397c4f164fe6d81f52979ff55dd7a44ff14fdefe75f17e988728ffe74fb9bfb67c6ccfcdf69e61f9299f15768c60bf484eb53aecddc5f8c57db78ed9a51df5939ebbb4f3ad21e6e585f6ecceccf332c9c7f99a785f5afcc589f32824391f278c63cfe93d1d8cec30477e723e25dc015fb23bb66ac3f7744db788c615b0fe1deccf5ac74c9f17cef9de3eb93b9c1fbe28ab6fdfa06d7b6de22cdf5140ee086f3e7998f08f2f5b370bf7fd769eedfc0f6fbfdba00dbfb4ad09f5046c4d702ae4a8eff0b6dfb77968ee85f427f83f5572aba61fff7613b6fc2aa99fbd7ca4bbc5fdd80667bb262c6fef5e85f6818df33bf86f9bbbc5fea5135c4f3711d9ef0fd208d19f311b769cebfb4b0e5a7af669447a5f9bc9fd096ef22dcf07937a4f9bccec252863c3f2a70a890afbb37f3fbc0d182f3c49fd309fd8917b00adfcf67707f1f41ff83bd0fe280e679a87b66b417103f4c98bf5c99313f21d25ccf7a4c737ef494e67e4f1f6694cb216ce7839ed1ac1f03cde713c6a79b6fdebf2e69ae3fa9cd5c1f252c43f4c7edd325ef6b5bb470fdbc9a395f8f70371f982fc68b1cff94c7bb19dbfb26dec0763ea4459adf77618fe6fd4ae8dae67f42b3ffae809b86f33f6b46fe32a023cf933758b8de7d45978c7762663e3bbd519ffd91c4f55c9b597e07079eb77a006bc5f9cfe76fa315cfb388f67432e4f9cb729bcf5098513f5cc18dcdffbc99f1c734ef0711e3a7ddfec1fcae9a795f598343c1f5e868413cf7465bff984fa4c5c3a968f3fb38e6f79774f38bf18b356cfd893bb0adcfb04ff3fd911660e1fef10766ccbfccd19c9f78470be63b6cd396ef196cf3e18fe984f5e9988fcd8f5f85a3a07dade096f7f71869fbf901e2e9d87e7ee0609b5f1dc2139e77f190b6fbdb336ce7677aa2f9bd24188fe97ce3f90dd8f66b783123df786ae6fa6b68ee67617bc2fe057b3ea1dc317ea8b05ee219cdf3d26ff4c6fb92fd0989eb6b0dd602e5ee96667beea137dadb32e37e171e61fbf993327edbe2be97f27a0bdd79c19f1fdcc10dfbaf89e67ad7008bdd873f68f6277dc2a1607fdf68e6a77766f66fd38c9f9fe90dac15d7eb88e678789627de277406b6f513f27db93b2ef9bd188e683befeee13ebf92e67d253ec16aebbba513ee77fe11eeef2f793cba8f7fb6274f34f7439a87bbf8d9b1a5591e9761e5fd295474857ce3ae99f95dd336dead99f92ed209f3ebf6e0c8f5e7566861f912dcefbfbc7eb41b3fde4ff07cecf2c579f1015bbecae795e5fec1ccf97c34a3bdf00ac782f7090727de9fdd365d71bc6fe13ebffcbeea0e03be6fd2356ceb278c686bff05d6028e5774c59fd75ed0cc4f183fb27f51687e7fa6339ae317cf691bef5db8b5fbf00dcdf7777ca4ad3ff93cee4eff863f2f54d8d65372b4f07c4eb09d0f5a9bd9df41ef9cafaec16abe8523e72b3d9a511e0bb86db9df8299fb2d8f77aac4dabf84edfc8aefb0f23ea31f668ed7221c6d7eef6981c31adcaf87039a3f3f717774c2fbd10fe13ebf3cbf29d9fdc5bdc281f1dd0bac82fa6142db78209f64f9859ab6fbc7a699df7b1eeeded7380f76683b2f9ee07ebef3fbb0ad4285fb5fd8826d7cdc296cedc767dadaabccccbf8413bfdf5330a33cddf4c6f9f8405bff1adac673a137feffc512dcb2becbf3ddb6d1be77f7693bdfd668e1f7eba619e57a62e6fd06f15bcbcf1dd2763fb8a7edfbf195b6fc18afb5fe5ef5c67af074c5f63e68be3f45cc8c67e67ced3cff6fbffe1fe3bf6378e7c5cb8fd6983edbfd0a5e7df4a98fd1fab3e9dffe505df1e7fec25ffa2b7fed6ffc6d1fe3cedffb07fff827f59ffcb37ff1affecdbffb0fffe967fcac9ff39131e6fd825ff44b7ed9affc4eebab7ecdaffb0dbfe9b7fcb6dff1bb7ecfeffb037fe88f6c4cbb368efd893ff583dfd41dfac28ffcd897bef2135ffbc679e79cb8e0d445975cebce2c863b7717eed25db96bebb5bb71b7eeceddbb07f7e89edcb37b71afeecdbdbb0ff7e966dcac9b73f36ec12dbaa53ec6b25b71ab6ecdadbb0db7e9b6dcb6db71bb6ecfedbb0377e88edcb13b71a76ee086ae70233776a5abdcc4d5ae11ff6d7df85b7122ee50ba8f04e90e2e69e54cce9dca855cca955ccb8ddcca9ddccb833cca933ccb8bbcca9bbccbc7b718f22933322b73322f0bb2284bb22c2bb22a6bb22e1bb2295bb22d3bb22b7bb22f075dcd4339926339915319fc2ac6500a194dbf6da49289d4d2041f5cf7a60a41bb1b5f0a6d380be7f21e2ec265b80ad7e126dc86bb701f1e7edd97f0189ec27378f1125ec35b780f1fe133cc84d93017e6c342580c4bd3b10ecb61c50dc26a58cb5a0f1bfddc4ebdd9fdb7855909db6127ec86bdb01f0ec261380ac7e1249ce692411876f7d2d1f4cfd3fb7428bfc5e8be1f26a1ee7e6fa6a5eab51b4e0daa1ab393b67a96ff74ae17d35c738c77ec338ba1977aa5ddea9027bdd15bbdd37b7dd0477dd2e7699bdd05fd455f738c377d4704fde8c6aefcb6f7f55367b0277456e7745e17745197745996754557c3a5aec9bbaee79a1bba997fdfd2eddf3b3fdc926cea8eeeea9eee87373dd0433dd2633de96a9df63b577460397c37c6990ebbbbe848c7f9ceac3ad1bafb58f75e623e6522a3c46ec2a322d26f63c4d8dd7eda7816cfe345bcc4e8c7abd88d54bcc9756fe35dfefd3e3e74f9bceadaf7cec2f8189f6237caf145ca98c731bec5f7f8113ff39f67e2ac3bc8b37c14e7fc6e9cff6e8c85b8a8dd2c4ff38c4b5d0ecb7125aec6b598c7346ec4cdb8c5d8db5d8c9defc59061dced4e359eafdd778fc6bdb81f0fe261ae77148fe349cce3eb0ee2200ebf9b478151a346719c6fc0dd47768ed1249f5ceaae80534daf967ffe6e48a97bb27517e92c9d4f7b972eba9158d39574191ffe738dfd418cabdcde757c4837c82fdda6bb749f67ec076384fb3817c7ba9d2ed3437a4c4fe93975f3955ed35b7affe13c3ed2672874a3ab37a3dd7e4fb3696e7ac6a4f9b4f07bebf40fa22d867b7ded6ea01bbf2df9faafbffef46f0190bec5</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>kpbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KReloadNetworkDlg</receiver>
+ <slot>close()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kdialog.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kroutinginfo.cpp b/knetwortdeconf/knetwortdeconf/kroutinginfo.cpp
new file mode 100644
index 0000000..9695fa0
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kroutinginfo.cpp
@@ -0,0 +1,60 @@
+/***************************************************************************
+ kroutinginfo.cpp - description
+ -------------------
+ begin : Mon Mar 3 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : juancho@linuxmail.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "kroutinginfo.h"
+
+KRoutingInfo::KRoutingInfo(){
+}
+KRoutingInfo::~KRoutingInfo(){
+}
+TQString KRoutingInfo::isNetworkingEnabled(){
+ return networking;
+}
+TQString KRoutingInfo::isForwardIPv4Enabled(){
+ return forwardIPv4;
+}
+TQString KRoutingInfo::getHostName(){
+ return hostName;
+}
+TQString KRoutingInfo::getDomainName(){
+ return domainName;
+}
+TQString KRoutingInfo::getGateway(){
+ return gateway;
+}
+TQString KRoutingInfo::getGatewayDevice(){
+ return gatewayDevice;
+}
+void KRoutingInfo::setNetworkingEnabled(const TQString &networking){
+ KRoutingInfo::networking = networking;
+}
+void KRoutingInfo::setForwardIPv4Enabled(const TQString &forwardIPv4){
+ KRoutingInfo::forwardIPv4 = forwardIPv4;
+}
+void KRoutingInfo::setHostName(const TQString &hostName){
+ KRoutingInfo::hostName = hostName;
+}
+void KRoutingInfo::setDomainName(const TQString &domainName){
+ KRoutingInfo::domainName = domainName;
+}
+void KRoutingInfo::setGateway(const TQString &gateway){
+ KRoutingInfo::gateway = gateway;
+}
+void KRoutingInfo::setGatewayDevice(const TQString &gatewayDevice){
+ KRoutingInfo::gatewayDevice = gatewayDevice;
+}
+
diff --git a/knetwortdeconf/knetwortdeconf/kroutinginfo.h b/knetwortdeconf/knetwortdeconf/kroutinginfo.h
new file mode 100644
index 0000000..febcd18
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kroutinginfo.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ kroutinginfo.h - description
+ -------------------
+ begin : Mon Mar 3 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : juancho@linuxmail.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef KROUTINGINFO_H
+#define KROUTINGINFO_H
+
+#include <tqstring.h>
+
+
+/**Has all the routing info of the machine, like default gateway, default gateway device,
+ routes to other hosts and networks, etc.
+
+ *@author Juan Luis Baptiste
+ */
+
+class KRoutingInfo {
+public:
+ KRoutingInfo();
+ ~KRoutingInfo();
+private: // Private attributes
+ TQString networking;
+ TQString forwardIPv4;
+ TQString hostName;
+ TQString domainName;
+ TQString gateway;
+ TQString gatewayDevice;
+
+public: // Public attributes
+ TQString isNetworkingEnabled();
+ TQString isForwardIPv4Enabled();
+ TQString getHostName();
+ TQString getGatewayDevice();
+ TQString getGateway();
+ TQString getDomainName();
+ void setNetworkingEnabled(const TQString &networking);
+ void setForwardIPv4Enabled(const TQString &forwardIPv4);
+ void setHostName(const TQString &hostName);
+ void setDomainName(const TQString &domainName);
+ void setGateway(const TQString &gateway);
+ void setGatewayDevice(const TQString &gatewayDevice);
+
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/kselectdistrodlg.ui b/knetwortdeconf/knetwortdeconf/kselectdistrodlg.ui
new file mode 100644
index 0000000..d1d04ee
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kselectdistrodlg.ui
@@ -0,0 +1,142 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KSelectDistroDlg</class>
+<widget class="KDialog">
+ <property name="name">
+ <cstring>KSelectDistroDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>372</width>
+ <height>499</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Unsupported Platform</string>
+ </property>
+ <property name="icon">
+ <pixmap>image0</pixmap>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox" row="2" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>klbDistroList</cstring>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="3" column="2">
+ <property name="name">
+ <cstring>kpbOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="3" column="3">
+ <property name="name">
+ <cstring>kpbCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>cbAskAgain</cstring>
+ </property>
+ <property name="text">
+ <string>Do not ask again</string>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>130</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="0" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;font size="+1"&gt;&lt;p align="center"&gt;&lt;b&gt;Your Platform is Not Supported&lt;/b&gt;&lt;/p&gt;&lt;/font&gt;</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="1" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>You may choose one of the following supported platforms if you are &lt;b&gt;sure&lt;/b&gt; your platform behaves the same as the chosen one. Please be sure, because your current network configuration could be damaged.</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<images>
+ <image name="image0">
+ <data format="PNG" length="983">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000039e4944415418959595cd6b1d5518c67f934e9a776452cf40948e74915b2af6aa2897a6602a2e6e6a5d74e3dafe03d28f8d0b71292eba312808052964e34297154442119b2e44234aaca8ed151332c586ccd85cef1cc9e8bcd6938e8b9b7b136b6e4b5e18e683f33ef39ce77738c7abaa8a9dcaf33c2ebc7761e2e48993171179aaf75d7c50b7fd2e80822f557a3399bff4f1a557cf4f9f5ff47754dd2c33660e8931b50fafa6233a1c1019417c41a42baa4e290b8bae433caa4c3d1d3f89cf38707f6141867078577fb6941210858a31029b5d5a802d20cf721ae3c2e4213c600ff4870ca8615094b2005be44084aaed3bc6416e736ca1d876371175ca8385bbaeb13627d5a0eb3214284000ab8a1690decaa99b685be60f10ee0d1209d0a224b742a08a88609d82425e28b89e5301d7edf507d15ffd7515750c810ecfbc5627d8a42fbe30f753c247f342aa10f942eec088e9c6b369d587ddd39f3c1c33fb6302614ceee75da7b209747bc6bba53f7518ce4e8219035cb4a1ae048767dbd99f38fedaca7897f44b85bcc89150aa74256d6769f6a53a4d739bb7922469010cfd8f7e66b1ed9cbc2849db25a52d49db39d676e9ab2aea203631511879c7268e3ddc6834464a5b7e3077756ee6ec99b3edad28764bdf29eaba20adda3daa1a59b57beb8fd7ef1c7fe978b515850ff88288101b4142c184d29f8b55bd977e952c267fb4165bd7b4d0ebc952f2496bb1f5c3ece5d9fec6d35bc71e289111ac0fb18990b03b13754aa0c1bdf437d276ba9265f67d33666e34269aa5d95f9366f364f1fa1be7b61cdb759b0baccf9caeed5347d5fd1143aadd455faa828baa3e7d9beda9d7eb4fc4fbf55d09644dc2e0ae647c7eedfbefde02cabe70b2947c3b373cf7b6f85257a7e3b503b51722138d0294ae449d56c9cde4efec56f67be94ac17157550b2d744d9d2e4b68ee264baddfec9afdef1ebcf0d58277ea9553233317679acb3796bfe8dceedce9ac76aaceed4ed559ed54cbbf2c579dd54eb9f0cdc2a7d3e7a78f365f6c8e5cf9ec8a075055d58ed710c0916347aac644e31f09855cf31155f5d429aa8a557b5ffa83cadbfe72e6f499d1da78edb9c8442f9bd03c1bc5d133a52d35cbb3ebdbe87f3d7b7976bdd733f004ea3d4cbf333314c0a366bf79c86676b474fafcd489e6b9f9f9f9b56429b960c6cc8dda817a99acdc5c179f768ffe20e1feb669db69101c88df8c1f898f9ad16838f0794cc04c361a074d680e0ea23fa8fac2c94ab291173649b3741fb0577c10118b036b6de7bef477a87f018b9f681dd4db618a0000000049454e44ae426082</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>kpbOk</sender>
+ <signal>clicked()</signal>
+ <receiver>KSelectDistroDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>kpbCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>KSelectDistroDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>klbDistroList</sender>
+ <signal>doubleClicked(TQListBoxItem*)</signal>
+ <receiver>KSelectDistroDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<Q_SLOTS>
+ <slot>exitSlot()</slot>
+</Q_SLOTS>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kdialog.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/knetwortdeconf/knetwortdeconf/kwirelessinterface.cpp b/knetwortdeconf/knetwortdeconf/kwirelessinterface.cpp
new file mode 100644
index 0000000..08d2b29
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kwirelessinterface.cpp
@@ -0,0 +1,55 @@
+/***************************************************************************
+ kwirelessinterface - description
+ -------------------
+ begin : Thu oct 21 2004
+ copyright : (C) 2004 by Juan Luis Baptiste
+ email : juan.baptiste@kdemail.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#include "kwirelessinterface.h"
+
+KWirelessInterface::KWirelessInterface()
+ : KNetworkInterface()
+{
+}
+
+KWirelessInterface::~KWirelessInterface()
+{
+}
+
+TQString KWirelessInterface::getEssid()
+{
+ return essid;
+}
+
+TQString KWirelessInterface::getWepKey()
+{
+ return wepKey;
+}
+
+void KWirelessInterface::setWepKey(TQString newKey)
+{
+ wepKey = newKey;
+}
+void KWirelessInterface::setEssid(TQString newEssid)
+{
+ essid = newEssid;
+}
+
+TQString KWirelessInterface::getKeyType()
+{
+ return keyType;
+}
+
+void KWirelessInterface::setKeyType(TQString type)
+{
+ keyType = type;
+}
diff --git a/knetwortdeconf/knetwortdeconf/kwirelessinterface.h b/knetwortdeconf/knetwortdeconf/kwirelessinterface.h
new file mode 100644
index 0000000..25549b9
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/kwirelessinterface.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ kwirelessinterface - description
+ -------------------
+ begin : jue oct 21 2004
+ copyright : (C) 2004 by Juan Luis Baptiste
+ email : juan.baptiste@kdemail.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef KWIRELESSINTERFACE_H
+#define KWIRELESSINTERFACE_H
+
+#include <knetworkinterface.h>
+#include <tqstring.h>
+
+/**
+Class that represents a wireless network interface. It inherits from KNetworkInterface.
+
+@author Juan Luis Baptiste
+*/
+class KWirelessInterface : public KNetworkInterface
+{
+ public:
+ KWirelessInterface();
+
+ ~KWirelessInterface();
+
+ TQString getEssid();
+ TQString getWepKey();
+ void setEssid(TQString newEssid);
+ void setWepKey(TQString newKey);
+ TQString getKeyType();
+ void setKeyType(TQString type);
+
+ private:
+ TQString essid;
+ TQString wepKey;
+ TQString keyType;
+};
+
+#endif
diff --git a/knetwortdeconf/knetwortdeconf/main.cpp b/knetwortdeconf/knetwortdeconf/main.cpp
new file mode 100644
index 0000000..d7cded7
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/main.cpp
@@ -0,0 +1,49 @@
+/***************************************************************************
+ main.cpp - description
+ -------------------
+ begin : Sun Jan 12 00:54:19 UTC 2003
+ copyright : (C) 2003 by Juan Luis Baptiste
+ email : jbaptiste@merlinux.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#include <unistd.h>
+#include <sys/types.h>
+#include <kmessagebox.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <klocale.h>
+#include <kuniqueapplication.h>
+#include <dcopclient.h>
+#include <kglobal.h>
+#include <kgenericfactory.h>
+
+//#include "knetwortdeconf.h"
+#include "knetwortdeconfmodule.h"
+#include "version.h"
+
+
+static KCmdLineOptions options[] =
+{
+ { 0, 0, 0 }
+ // INSERT YOUR COMMANDLINE OPTIONS HERE
+};
+/*typedef KGenericFactory<KNetworkConfModule> KDEDFactory;
+K_EXPORT_COMPONENT_FACTORY( knetwortdeconfmodule, KDEDFactory( "kcm_knetwortdeconfmodule" ) ); */
+
+extern "C"
+{
+ KDE_EXPORT TDECModule *create_knetwortdeconfmodule(TQWidget *parent, const char *name)
+ {
+ TDEGlobal::locale()->insertCatalogue("knetwortdeconf");
+ return new KNetworkConfModule(parent, name);
+ }
+}
+
diff --git a/knetwortdeconf/knetwortdeconf/version.h b/knetwortdeconf/knetwortdeconf/version.h
new file mode 100644
index 0000000..f4900dc
--- /dev/null
+++ b/knetwortdeconf/knetwortdeconf/version.h
@@ -0,0 +1,6 @@
+#ifndef KNETWORKVERSION_H
+#define KNETWORKVERSION_H
+
+static const char *description =
+ I18N_NOOP("KNetworkConf - A TDE Control Center module to configure TCP/IP settings.");
+#endif
diff --git a/knetwortdeconf/pasosRelease.txt b/knetwortdeconf/pasosRelease.txt
new file mode 100644
index 0000000..2fce150
--- /dev/null
+++ b/knetwortdeconf/pasosRelease.txt
@@ -0,0 +1,14 @@
+PASOS PARA HACER RELEASE DE KNETWORKCONF:
+
+1. Actualizar archivos README, LEAME y ChangeLog
+2. Generar distribucion .bz2
+3. Etiquetar CVS con la version actual
+4. Generar paquetes (rpm y deb)
+5. Subir archivos a sf
+6. Subir rpms a contribs de Mandrake
+7. Actualizar la pagina
+8. Colocar noticia en la pagina de Merlinux
+9. Hacer anuncio en kde-apps.org y freshmeat.net
+10. Hacer anuncios en listas de correo:
+- Merlinux, Colibri y Linux Anuncio en espaniol
+- kde-announce, knetwortdeconf-announce, kde-debian en ingles \ No newline at end of file
diff --git a/knetwortdeconf/pixmaps/Makefile.am b/knetwortdeconf/pixmaps/Makefile.am
new file mode 100644
index 0000000..0e0e1d8
--- /dev/null
+++ b/knetwortdeconf/pixmaps/Makefile.am
@@ -0,0 +1,7 @@
+iconsdir = $(kde_datadir)/knetwortdeconf/pixmaps/
+icons_DATA = ark.png debian.png mandriva.png blackpanther.png pld.png \
+ redhat.png suse.png turbolinux.png conectiva.png fedora.png openna.png \
+ slackware.png freebsd.png gentoo.png vine.png kubuntu.png yoper.png rpath.png
+
+# Install the icons into the global KDE directories
+KDE_ICON = network_connected_lan_knc network_disconnected_lan network_disconnected_wlan network_traffic_wlan
diff --git a/knetwortdeconf/pixmaps/ark.png b/knetwortdeconf/pixmaps/ark.png
new file mode 100644
index 0000000..efc7bb9
--- /dev/null
+++ b/knetwortdeconf/pixmaps/ark.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/blackpanther.png b/knetwortdeconf/pixmaps/blackpanther.png
new file mode 100644
index 0000000..1028639
--- /dev/null
+++ b/knetwortdeconf/pixmaps/blackpanther.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/conectiva.png b/knetwortdeconf/pixmaps/conectiva.png
new file mode 100644
index 0000000..3452ee2
--- /dev/null
+++ b/knetwortdeconf/pixmaps/conectiva.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/debian.png b/knetwortdeconf/pixmaps/debian.png
new file mode 100644
index 0000000..130a9ea
--- /dev/null
+++ b/knetwortdeconf/pixmaps/debian.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/fedora.png b/knetwortdeconf/pixmaps/fedora.png
new file mode 100644
index 0000000..651b92c
--- /dev/null
+++ b/knetwortdeconf/pixmaps/fedora.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/freebsd.png b/knetwortdeconf/pixmaps/freebsd.png
new file mode 100644
index 0000000..d91e38e
--- /dev/null
+++ b/knetwortdeconf/pixmaps/freebsd.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/gentoo.png b/knetwortdeconf/pixmaps/gentoo.png
new file mode 100644
index 0000000..e283d92
--- /dev/null
+++ b/knetwortdeconf/pixmaps/gentoo.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/hi22-action-network_connected_lan_knc.png b/knetwortdeconf/pixmaps/hi22-action-network_connected_lan_knc.png
new file mode 100644
index 0000000..6fb9882
--- /dev/null
+++ b/knetwortdeconf/pixmaps/hi22-action-network_connected_lan_knc.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/hi22-action-network_disconnected_lan.png b/knetwortdeconf/pixmaps/hi22-action-network_disconnected_lan.png
new file mode 100644
index 0000000..90a2d69
--- /dev/null
+++ b/knetwortdeconf/pixmaps/hi22-action-network_disconnected_lan.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/hi22-action-network_disconnected_wlan.png b/knetwortdeconf/pixmaps/hi22-action-network_disconnected_wlan.png
new file mode 100644
index 0000000..6791d49
--- /dev/null
+++ b/knetwortdeconf/pixmaps/hi22-action-network_disconnected_wlan.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/hi22-action-network_traffic_wlan.png b/knetwortdeconf/pixmaps/hi22-action-network_traffic_wlan.png
new file mode 100644
index 0000000..b912cd3
--- /dev/null
+++ b/knetwortdeconf/pixmaps/hi22-action-network_traffic_wlan.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/kubuntu.png b/knetwortdeconf/pixmaps/kubuntu.png
new file mode 100644
index 0000000..f9a39ad
--- /dev/null
+++ b/knetwortdeconf/pixmaps/kubuntu.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/mandriva.png b/knetwortdeconf/pixmaps/mandriva.png
new file mode 100644
index 0000000..96af9a4
--- /dev/null
+++ b/knetwortdeconf/pixmaps/mandriva.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/openna.png b/knetwortdeconf/pixmaps/openna.png
new file mode 100644
index 0000000..d7873a4
--- /dev/null
+++ b/knetwortdeconf/pixmaps/openna.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/pld.png b/knetwortdeconf/pixmaps/pld.png
new file mode 100644
index 0000000..e6a9018
--- /dev/null
+++ b/knetwortdeconf/pixmaps/pld.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/redhat.png b/knetwortdeconf/pixmaps/redhat.png
new file mode 100644
index 0000000..bb2b3bd
--- /dev/null
+++ b/knetwortdeconf/pixmaps/redhat.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/rpath.png b/knetwortdeconf/pixmaps/rpath.png
new file mode 100644
index 0000000..a440015
--- /dev/null
+++ b/knetwortdeconf/pixmaps/rpath.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/slackware.png b/knetwortdeconf/pixmaps/slackware.png
new file mode 100644
index 0000000..c095571
--- /dev/null
+++ b/knetwortdeconf/pixmaps/slackware.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/suse.png b/knetwortdeconf/pixmaps/suse.png
new file mode 100644
index 0000000..6cf9f22
--- /dev/null
+++ b/knetwortdeconf/pixmaps/suse.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/turbolinux.png b/knetwortdeconf/pixmaps/turbolinux.png
new file mode 100644
index 0000000..91d8ce4
--- /dev/null
+++ b/knetwortdeconf/pixmaps/turbolinux.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/vine.png b/knetwortdeconf/pixmaps/vine.png
new file mode 100644
index 0000000..5c230b7
--- /dev/null
+++ b/knetwortdeconf/pixmaps/vine.png
Binary files differ
diff --git a/knetwortdeconf/pixmaps/yoper.png b/knetwortdeconf/pixmaps/yoper.png
new file mode 100644
index 0000000..f9ce326
--- /dev/null
+++ b/knetwortdeconf/pixmaps/yoper.png
Binary files differ
diff --git a/knetwortdeconf/update_backends.sh b/knetwortdeconf/update_backends.sh
new file mode 100755
index 0000000..9b77d13
--- /dev/null
+++ b/knetwortdeconf/update_backends.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+echo 'Network backend updating script of KNetworkConf'
+echo
+
+if [ $# -eq 0 ]
+then
+ echo "Use: $0 src_path dest_path"
+ echo
+ exit 1
+fi
+
+if [ "$1" = "" ]
+then
+ echo 'You have to specify the source directory of the new scripts'
+ echo
+ exit 1
+elif [ "$2" = "" ]
+then
+ echo 'You have to specify the destination directory for the new scripts'
+ echo
+ exit 1
+fi
+
+if [ ! -d $1 ]
+then
+ echo "$1 Isn't a directory"
+ echo
+ exit 1
+elif [ ! -d $2 ]
+then
+ echo "$2 Isn't a directory"
+ echo
+ exit 1
+fi
+
+diractual=`pwd`
+cd $1;
+cp -f AUTHORS debug.pl.in file.pl.in general.pl.in guess_system.sh mkinstalldirs network-conf.in network.pl.in NEWS parse.pl.in platform.pl.in README replace.pl.in report.pl.in service-list.pl.in service.pl.in system-tools-backends.pc.in type1inst util.pl.in xml.pl.in process.pl.in $2
+
+echo
+echo 'Ready, dont forget to check configure.in.in or Makefile.am to see if they need further updating.'
+echo