hrev48837 adds 4 changesets to branch 'master' old head: 1e3c19ec2f76349c459e78f12970d2cf7233b576 new head: 5940aaf69c0dc63239ca74b7a2d92e8e157f4038 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=5940aaf69c0d+%5E1e3c19ec2f76 ---------------------------------------------------------------------------- c86c9e29d38a: ScrollView docs: make parameter name match the header file. aed7654fff37: atftpd: remove from tree. Not included in the build, and I've just pushed a recipe for it to HaikuPorts. 56d52e342623: AboutSystem software credits: updates & cleanup. All the packages I delete from here are not included in the tree and not included in the "default packages" list. * Use HTTPS rather than HTTP for sites that support it * GDB was removed in hrev48791 * FFmpeg is spelled as "FFmpeg", not "FFMpeg" * atftp was removed from the tree in the previous commit * acipca was updated to a version from 2014 recently * CannaIM was removed in hrev48034 & hrev48035 * libxml2 & friends were removed in hrev48798 * Cleaned up ifdef __INTEL__ lines -- no need to have more than one 5940aaf69c0d: AboutSystem Credits: clean up current maintainers. All the people I've moved off this list have not committed anything since (at least) before 2012-01-01, with the exception of Andrew Lindesay who never recieved commit access (AFAICT, he only contributed some patches.) [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ] ---------------------------------------------------------------------------- 28 files changed, 22 insertions(+), 6464 deletions(-) docs/user/interface/ScrollView.dox | 2 +- src/apps/aboutsystem/AboutSystem.cpp | 63 +- src/apps/aboutsystem/Credits.h | 16 +- src/bin/network/Jamfile | 1 - src/bin/network/atftpd/Jamfile | 19 - src/bin/network/atftpd/LICENSE | 340 --------- src/bin/network/atftpd/argz.c | 132 ---- src/bin/network/atftpd/argz.h | 211 ------ src/bin/network/atftpd/config.h | 7 - src/bin/network/atftpd/logger.c | 137 ---- src/bin/network/atftpd/logger.h | 26 - src/bin/network/atftpd/options.c | 356 --------- src/bin/network/atftpd/options.h | 50 -- src/bin/network/atftpd/stats.c | 180 ----- src/bin/network/atftpd/stats.h | 62 -- src/bin/network/atftpd/tftp_def.c | 183 ----- src/bin/network/atftpd/tftp_def.h | 55 -- src/bin/network/atftpd/tftp_io.c | 492 ------------- src/bin/network/atftpd/tftp_io.h | 59 -- src/bin/network/atftpd/tftpd.c | 1149 ------------------------------ src/bin/network/atftpd/tftpd.h | 114 --- src/bin/network/atftpd/tftpd_file.c | 980 ------------------------- src/bin/network/atftpd/tftpd_list.c | 350 --------- src/bin/network/atftpd/tftpd_mcast.c | 351 --------- src/bin/network/atftpd/tftpd_mtftp.c | 678 ------------------ src/bin/network/atftpd/tftpd_mtftp.h | 85 --- src/bin/network/atftpd/tftpd_pcre.c | 315 -------- src/bin/network/atftpd/tftpd_pcre.h | 73 -- ############################################################################ Commit: c86c9e29d38aa6eea42a19d20adc8a7f8896aa69 URL: http://cgit.haiku-os.org/haiku/commit/?id=c86c9e29d38a Author: Augustin Cavalier <waddlesplash@xxxxxxxxx> Date: Fri Feb 27 04:59:06 2015 UTC ScrollView docs: make parameter name match the header file. ---------------------------------------------------------------------------- diff --git a/docs/user/interface/ScrollView.dox b/docs/user/interface/ScrollView.dox index 6c90930..13f3d70 100644 --- a/docs/user/interface/ScrollView.dox +++ b/docs/user/interface/ScrollView.dox @@ -317,7 +317,7 @@ /*! - \fn BScrollBar* BScrollView::ScrollBar(orientation direction) const + \fn BScrollBar* BScrollView::ScrollBar(orientation posture) const \brief Returns the BScrollBar object at the given \a direction. \param direction The \a direction of the scroll bar to get. ############################################################################ Commit: aed7654fff370673e0e04c2a223c029f615b3af2 URL: http://cgit.haiku-os.org/haiku/commit/?id=aed7654fff37 Author: Augustin Cavalier <waddlesplash@xxxxxxxxx> Date: Fri Feb 27 07:16:11 2015 UTC atftpd: remove from tree. Not included in the build, and I've just pushed a recipe for it to HaikuPorts. ---------------------------------------------------------------------------- diff --git a/src/bin/network/Jamfile b/src/bin/network/Jamfile index 44948ec..92a245b 100644 --- a/src/bin/network/Jamfile +++ b/src/bin/network/Jamfile @@ -5,7 +5,6 @@ StdBinCommands : network : $(haiku-utils_rsrc) ; SubInclude HAIKU_TOP src bin network arp ; -SubInclude HAIKU_TOP src bin network atftpd ; SubInclude HAIKU_TOP src bin network ftp ; SubInclude HAIKU_TOP src bin network ftpd ; SubInclude HAIKU_TOP src bin network ifconfig ; diff --git a/src/bin/network/atftpd/Jamfile b/src/bin/network/atftpd/Jamfile deleted file mode 100644 index 28cf9f5..0000000 --- a/src/bin/network/atftpd/Jamfile +++ /dev/null @@ -1,19 +0,0 @@ -SubDir HAIKU_TOP src bin network atftpd ; - -UseHeaders [ FDirName $(HAIKU_TOP) headers compatibility bsd ] : true ; - -BinCommand atftpd : - argz.c - logger.c - options.c - stats.c - tftp_def.c - tftp_io.c - tftpd.c - tftpd_file.c - tftpd_list.c - tftpd_mcast.c - tftpd_mtftp.c - tftpd_pcre.c - : libbsd.so $(TARGET_NETWORK_LIBS) -; diff --git a/src/bin/network/atftpd/LICENSE b/src/bin/network/atftpd/LICENSE deleted file mode 100644 index d60c31a..0000000 --- a/src/bin/network/atftpd/LICENSE +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/src/bin/network/atftpd/argz.c b/src/bin/network/atftpd/argz.c deleted file mode 100644 index 033d6a8..0000000 --- a/src/bin/network/atftpd/argz.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * argz.h - * The functions below are "borrowed" from glibc-2.2.3 (argz-next.c). - * This has been done to make atftp compile with uclibc, BSD, Solaris - * and other platform without glic - * - * - * $Id: argz.c,v 1.1 2003/01/21 01:38:35 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 HAVE_ARGZ - -/* Routines for dealing with '\0' separated arg vectors. - Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <stdlib.h> -#include "argz.h" - -char * argz_next (const char *argz, size_t argz_len, const char *entry) -{ - if (entry) - { - if (entry < argz + argz_len) - entry = strchr (entry, '\0') + 1; - - return entry >= argz + argz_len ? NULL : (char *) entry; - } - else - if (argz_len > 0) - return (char *) argz; - else - return NULL; -} - -error_t argz_create_sep (const char *string, int delim, char **argz, size_t *len) -{ - size_t nlen = strlen (string) + 1; - - if (nlen > 1) - { - const char *rp; - char *wp; - - *argz = (char *) malloc (nlen); - if (*argz == NULL) - return ENOMEM; - - rp = string; - wp = *argz; - do - if (*rp == delim) - { - if (wp > *argz && wp[-1] != '\0') - *wp++ = '\0'; - else - --nlen; - } - else - *wp++ = *rp; - while (*rp++ != '\0'); - - if (nlen == 0) - { - free (*argz); - *argz = NULL; - *len = 0; - } - - *len = nlen; - } - else - { - *argz = NULL; - *len = 0; - } - - return 0; -} - -size_t argz_count (const char *argz, size_t len) -{ - size_t count = 0; - while (len > 0) - { - size_t part_len = strlen(argz); - argz += part_len + 1; - len -= part_len + 1; - count++; - } - return count; -} - -/* Puts pointers to each string in ARGZ, plus a terminating 0 element, into - ARGV, which must be large enough to hold them all. */ -void argz_extract (const char *argz, size_t len, char **argv) -{ - while (len > 0) - { - size_t part_len = strlen (argz); - *argv++ = (char *) argz; - argz += part_len + 1; - len -= part_len + 1; - } - *argv = 0; -} - -#endif diff --git a/src/bin/network/atftpd/argz.h b/src/bin/network/atftpd/argz.h deleted file mode 100644 index b3e7366..0000000 --- a/src/bin/network/atftpd/argz.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * argz.h - * Source file borrowed from glibc-2.2.3. This has been done to make - * atftp compile with uclibc, BSD, Solaris and other platform without - * glic - * - * $Id: argz.h,v 1.1 2003/01/21 01:38:35 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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. - * - */ - -/* Routines for dealing with '\0' separated arg vectors. - Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _ARGZ_H -#define _ARGZ_H 1 - -//#include <features.h> - -#include <sys/cdefs.h> - -#define __need_error_t -#include <errno.h> -#include <string.h> /* Need size_t, and strchr is called below. */ - -#ifndef __const -# define __const const -#endif - -#ifndef __error_t_defined -typedef int error_t; -#endif - -#define __THROW -#define __restrict -#define __attribute_pure__ -#define __BEGIN_DECLS - -__BEGIN_DECLS - -/* Make a '\0' separated arg vector from a unix argv vector, returning it in - ARGZ, and the total length in LEN. If a memory allocation error occurs, - ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ -extern error_t __argz_create (char *__const __argv[], char **__restrict __argz, - size_t *__restrict __len) __THROW; -extern error_t argz_create (char *__const __argv[], char **__restrict __argz, - size_t *__restrict __len) __THROW; - -/* Make a '\0' separated arg vector from a SEP separated list in - STRING, returning it in ARGZ, and the total length in LEN. If a - memory allocation error occurs, ENOMEM is returned, otherwise 0. - The result can be destroyed using free. */ -extern error_t __argz_create_sep (__const char *__restrict __string, - int __sep, char **__restrict __argz, - size_t *__restrict __len) __THROW; -extern error_t argz_create_sep (__const char *__restrict __string, - int __sep, char **__restrict __argz, - size_t *__restrict __len) __THROW; - -/* Returns the number of strings in ARGZ. */ -extern size_t __argz_count (__const char *__argz, size_t __len) - __THROW __attribute_pure__; -extern size_t argz_count (__const char *__argz, size_t __len) - __THROW __attribute_pure__; - -/* Puts pointers to each string in ARGZ into ARGV, which must be large enough - to hold them all. */ -extern void __argz_extract (__const char *__restrict __argz, size_t __len, - char **__restrict __argv) __THROW; -extern void argz_extract (__const char *__restrict __argz, size_t __len, - char **__restrict __argv) __THROW; - -/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's - except the last into the character SEP. */ -extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW; -extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW; - -/* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ -extern error_t __argz_append (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __buf, size_t _buf_len) - __THROW; -extern error_t argz_append (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __buf, size_t __buf_len) - __THROW; - -/* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ -extern error_t __argz_add (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __str) __THROW; -extern error_t argz_add (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __str) __THROW; - -/* Append SEP separated list in STRING to the argz vector in ARGZ & - ARGZ_LEN. */ -extern error_t __argz_add_sep (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __string, int __delim) - __THROW; -extern error_t argz_add_sep (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __string, int __delim) - __THROW; - -/* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ -extern void __argz_delete (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __entry) __THROW; -extern void argz_delete (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __entry) __THROW; - -/* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an - existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. - Since ARGZ's first entry is the same as ARGZ, argz_insert (ARGZ, ARGZ_LEN, - ARGZ, ENTRY) will insert ENTRY at the beginning of ARGZ. If BEFORE is not - in ARGZ, EINVAL is returned, else if memory can't be allocated for the new - ARGZ, ENOMEM is returned, else 0. */ -extern error_t __argz_insert (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __before, - __const char *__restrict __entry) __THROW; -extern error_t argz_insert (char **__restrict __argz, - size_t *__restrict __argz_len, - char *__restrict __before, - __const char *__restrict __entry) __THROW; - -/* Replace any occurrences of the string STR in ARGZ with WITH, reallocating - ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be - incremented by number of replacements performed. */ -extern error_t __argz_replace (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __str, - __const char *__restrict __with, - unsigned int *__restrict __replace_count); -extern error_t argz_replace (char **__restrict __argz, - size_t *__restrict __argz_len, - __const char *__restrict __str, - __const char *__restrict __with, - unsigned int *__restrict __replace_count); - -/* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there - are no more. If entry is NULL, then the first entry is returned. This - behavior allows two convenient iteration styles: - - char *entry = 0; - while ((entry = argz_next (argz, argz_len, entry))) - ...; - - or - - char *entry; - for (entry = argz; entry; entry = argz_next (argz, argz_len, entry)) - ...; -*/ -extern char *__argz_next (__const char *__restrict __argz, size_t __argz_len, - __const char *__restrict __entry) __THROW; -extern char *argz_next (__const char *__restrict __argz, size_t __argz_len, - __const char *__restrict __entry) __THROW; - -#ifdef __USE_EXTERN_INLINES -extern inline char * -__argz_next (__const char *__argz, size_t __argz_len, - __const char *__entry) __THROW -{ - if (__entry) - { - if (__entry < __argz + __argz_len) - __entry = strchr (__entry, '\0') + 1; - - return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry; - } - else - return __argz_len > 0 ? (char *) __argz : 0; -} -extern inline char * -argz_next (__const char *__argz, size_t __argz_len, - __const char *__entry) __THROW -{ - return __argz_next (__argz, __argz_len, __entry); -} -#endif /* Use extern inlines. */ - -__END_DECLS - -#endif /* argz.h */ diff --git a/src/bin/network/atftpd/config.h b/src/bin/network/atftpd/config.h deleted file mode 100644 index ea3160a..0000000 --- a/src/bin/network/atftpd/config.h +++ /dev/null @@ -1,7 +0,0 @@ -#include <pthread.h> - -#define HAVE_MTFTP 1 -//#undef HAVE_PCRE -//#undef HAVE_WRAP - -#define VERSION "0.7" diff --git a/src/bin/network/atftpd/logger.c b/src/bin/network/atftpd/logger.c deleted file mode 100644 index c4ed9bf..0000000 --- a/src/bin/network/atftpd/logger.c +++ /dev/null @@ -1,137 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * logger.c - * functions for logging messages. - * - * $Id: logger.c,v 1.12 2004/02/27 02:05:26 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <fcntl.h> -#include <stdarg.h> -#include <string.h> -#include <time.h> -#include <unistd.h> -#include <netdb.h> -#include "logger.h" - -#define MAXLEN 128 - -static int log_syslog_is_open = 0; -static int log_priority = 0; -static char *log_filename = NULL; -static int log_fd; -static FILE *log_fp = NULL; -static char *log_ident; - -/* - * Open a file for logging. If filename is NULL, then use - * stderr for the client or the syslog for the server. Log - * only message less or equal to priority. - */ -void open_logger(char *ident, char *filename, int priority) -{ - close_logger(); /* make sure we initialise variables and close - previously opened log. */ - - log_priority = priority; - - if (ident) - log_ident = strdup(ident); - else - log_ident = "unset"; - - if (filename) - log_filename = strdup(filename); - else - { - openlog(log_ident, LOG_PID, LOG_DAEMON); - log_syslog_is_open = 1; - } - - if (log_filename) - { - if ((log_fd = open(log_filename, O_WRONLY | O_APPEND)) < 0) - { - openlog(log_ident, LOG_PID, LOG_DAEMON); - log_syslog_is_open = 1; - logger(LOG_CRIT, "Unable to open %s for logging, " - "reverting to syslog", log_filename); - } - else - log_fp = fdopen(log_fd, "a"); - } -} - -/* - * Same as syslog but allow to format a string, like printf, when logging to - * file. This fonction will either call syslog or fprintf depending of the - * previous call to open_logger(). - */ -void logger(int severity, const char *fmt, ...) -{ - char message[MAXLEN]; - char time_buf[MAXLEN]; - char hostname[MAXLEN]; - time_t t; - struct tm *tm; - - - va_list args; - va_start(args, fmt); - - time(&t); - tm = localtime(&t); - strftime(time_buf, MAXLEN, "%b %d %H:%M:%S", tm); - gethostname(hostname, MAXLEN); - - if (severity <= log_priority) - { - vsnprintf(message, sizeof(message), fmt, args); - - if (log_fp) - { - fprintf(log_fp, "%s %s %s[%d.%d]: %s\n", time_buf, hostname, - log_ident, getpid(), pthread_self(), message); - fflush(log_fp); - } - else if (log_syslog_is_open) - syslog(severity, "%s", message); - else - fprintf(stderr, "%s %s %s[%d.%d]: %s\n", time_buf, hostname, - log_ident, getpid(), pthread_self(), message); - } - va_end(args); -} - -/* - * Close the file or syslog. Initialise variables. - */ -void close_logger(void) -{ - log_priority = 0; - if (log_syslog_is_open) - closelog(); - log_syslog_is_open = 0; - if (log_fp) - fclose(log_fp); - log_fp = NULL; - if (log_filename) - free(log_filename); - log_filename = NULL; - if (log_ident) - free(log_ident); -} diff --git a/src/bin/network/atftpd/logger.h b/src/bin/network/atftpd/logger.h deleted file mode 100644 index cddc91e..0000000 --- a/src/bin/network/atftpd/logger.h +++ /dev/null @@ -1,26 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * logger.h - * - * $Id: logger.h,v 1.6 2000/12/27 00:57:16 remi Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 logger_h -#define logger_h - -#include <syslog.h> - -void open_logger(char *ident, char *filename, int priority); -void logger(int severity, const char *fmt, ...); -void close_logger(void); - -#endif diff --git a/src/bin/network/atftpd/options.c b/src/bin/network/atftpd/options.c deleted file mode 100644 index 4a2841b..0000000 --- a/src/bin/network/atftpd/options.c +++ /dev/null @@ -1,356 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * options.c - * Set of functions to deal with the options structure and for parsing - * options in TFTP data buffer. - * - * $Id: options.c,v 1.16 2003/04/25 00:16:18 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <syslog.h> - -#if HAVE_ARGZ -#include <argz.h> -#else -#include "argz.h" -#endif - -#include <arpa/tftp.h> -#include <string.h> -#include "options.h" - -/* - * Fill a structure with the request packet of the client. - */ -int opt_parse_request(char *data, int data_size, struct tftp_opt *options) -{ - char *entry = NULL; - char *tmp; - struct tftphdr *tftp_data = (struct tftphdr *)data; - size_t size = data_size - sizeof(tftp_data->th_opcode); - - /* read filename */ - entry = argz_next(tftp_data->th_stuff, size, entry); - if (!entry) - return ERR; - else - opt_set_options(options, "filename", entry); - /* read mode */ - entry = argz_next(tftp_data->th_stuff, size, entry); - if (!entry) - return ERR; - else - opt_set_options(options, "mode", entry); - /* scan for options */ - // FIXME: we should use opt_parse_options() here - while ((entry = argz_next(tftp_data->th_stuff, size, entry))) - { - tmp = entry; - entry = argz_next(tftp_data->th_stuff, size, entry); - if (!entry) - return ERR; - else - opt_set_options(options, tmp, entry); - } - return OK; -} - -/* - * Fill a structure looking only at TFTP options. - */ -int opt_parse_options(char *data, int data_size, struct tftp_opt *options) -{ - char *entry = NULL; - char *tmp; - struct tftphdr *tftp_data = (struct tftphdr *)data; - size_t size = data_size - sizeof(tftp_data->th_opcode); - - while ((entry = argz_next(tftp_data->th_stuff, size, entry))) - { - tmp = entry; - entry = argz_next(tftp_data->th_stuff, size, entry); - if (!entry) - return ERR; - else - opt_set_options(options, tmp, entry); - } - return OK; -} - -/* - * Set an option by name in the structure. - * name is the name of the option as in tftp_def.c. - * name is it's new value, that must comply with the rfc's. - * When setting an option, it is marked as specified. - * - */ -int opt_set_options(struct tftp_opt *options, char *name, char *value) -{ - int i; - - for (i = 0; i < OPT_NUMBER; i++) - { - if (strncasecmp(name, options[i].option, OPT_SIZE) == 0) - { - options[i].specified = 1; - if (value) - Strncpy(options[i].value, value, VAL_SIZE); - else - Strncpy(options[i].value, tftp_default_options[i].value, - VAL_SIZE); - return OK; - } - } - return ERR; -} - -/* - * Return "value" for a given option name in the given option - * structure. - */ -int opt_get_options(struct tftp_opt *options, char *name, char *value) -{ - int i; - - for (i = 0; i < OPT_NUMBER; i++) - { - if (strncasecmp(name, options[i].option, OPT_SIZE) == 0) - { - if (options[i].enabled) - Strncpy(value, options[i].value, VAL_SIZE); - else - return ERR; - return OK; - } - } - return ERR; -} - -/* - * Disable an option by name. - */ -int opt_disable_options(struct tftp_opt *options, char *name) -{ - int i; - - for (i = 2; i < OPT_NUMBER; i++) - { - if (name == NULL) - options[i].specified = 0; - else - { - if (strncasecmp(name, options[i].option, OPT_SIZE) == 0) - { - options[i].specified = 0; - return OK; - } - } - } - if (name == NULL) - return OK; - return ERR; -} - - -/* - * Return 1 if one or more options are specified in the options structure. - */ -int opt_support_options(struct tftp_opt *options) -{ - int i; - int support = 0; - - for (i = 2; i < OPT_NUMBER; i++) - { - if (options[i].specified) - support = 1; - } - return support; -} - -/* - * The next few functions deal with TFTP options. Function's name are self - * explicative. - */ - -int opt_get_tsize(struct tftp_opt *options) -{ - int tsize; - if (options[OPT_TSIZE].enabled && options[OPT_TSIZE].specified) - { - tsize = atoi(options[OPT_TSIZE].value); - return tsize; - } - return ERR; -} - -int opt_get_timeout(struct tftp_opt *options) -{ - int timeout; - if (options[OPT_TIMEOUT].enabled && options[OPT_TIMEOUT].specified) - { - timeout = atoi(options[OPT_TIMEOUT].value); - return timeout; - } - return ERR; -} - -int opt_get_blksize(struct tftp_opt *options) -{ - int blksize; - if (options[OPT_BLKSIZE].enabled && options[OPT_BLKSIZE].specified) - { - blksize = atoi(options[OPT_BLKSIZE].value); - return blksize; - } - return ERR; -} - -int opt_get_multicast(struct tftp_opt *options, char *addr, int *port, int *mc) -{ - char *token = NULL; - char *string = NULL; - char *temp = NULL; - - if (options[OPT_MULTICAST].enabled && options[OPT_MULTICAST].specified) - { - string = strdup(options[OPT_MULTICAST].value); - /* get first argument */ - if ((token = strtok_r(string, ",", &temp)) == NULL) - { - free(string); - return ERR; - } - else - Strncpy(addr, token, IPADDRLEN); - /* get second argument */ - if ((token = strtok_r(NULL, ",", &temp)) == NULL) - { - free(string); - return ERR; - } - else - { - *port = atoi(token); - if ((*port < 0) || (*port > 65536)) - { - free(string); - return ERR; - } - } - /* get third (last) argument */ - if ((token = strtok_r(NULL, ",", &temp)) == NULL) - { - free(string); - return ERR; - } - else - { - *mc = atoi(token); - if ((*mc != 0) && (*mc != 1)) - { - free(string); - return ERR; - } - } - free(string); - return *mc; - } - return ERR; -} - -void opt_set_tsize(int tsize, struct tftp_opt *options) -{ - snprintf(options[OPT_TSIZE].value, VAL_SIZE, "%d", tsize); -} - -void opt_set_timeout(int timeout, struct tftp_opt *options) -{ - snprintf(options[OPT_TIMEOUT].value, VAL_SIZE, "%d", timeout); -} - -void opt_set_blksize(int blksize, struct tftp_opt *options) -{ - snprintf(options[OPT_BLKSIZE].value, VAL_SIZE, "%d", blksize); -} - -void opt_set_multicast(struct tftp_opt *options, char *addr, int port, int mc) -{ - snprintf(options[OPT_MULTICAST].value, VAL_SIZE, "%s,%d,%d", addr, port, - mc); -} - -/* - * Format the content of the options structure (this is the content of a - * read or write request) to a string. - */ -void opt_request_to_string(struct tftp_opt *options, char *string, int len) -{ - int i, index = 0; - - for (i = 0; i < 2; i++) - { - if ((index + strlen(options[i].option) + 2) < len) - { - Strncpy(string + index, options[i].option, len - index); - index += strlen(options[i].option); - Strncpy(string + index, ": ", len - index); - index += 2; - } - if ((index + strlen(options[i].value) + 2) < len) - { - Strncpy(string + index, options[i].value, len - index); - index += strlen(options[i].value); - Strncpy(string + index, ", ", len - index); - index += 2; - } - } - opt_options_to_string(options, string + index, len - index); -} - -/* - * Convert the options structure to a string. - */ -void opt_options_to_string(struct tftp_opt *options, char *string, int len) -{ - int i, index = 0; - - for (i = 2; i < OPT_NUMBER; i++) - { - if (options[i].specified && options[i].enabled) - { - if ((index + strlen(options[i].option) + 2) < len) - { - Strncpy(string + index, options[i].option, len - index); - index += strlen(options[i].option); - Strncpy(string + index, ": ", len - index); - index += 2; - } - if ((index + strlen(options[i].value) + 2) < len) - { - Strncpy(string + index, options[i].value, len - index); - index += strlen(options[i].value); - Strncpy(string + index, ", ", len - index); - index += 2; - } - } - } - if (index > 0) - string[index - 2] = 0; - else - string[0] = 0; -} diff --git a/src/bin/network/atftpd/options.h b/src/bin/network/atftpd/options.h deleted file mode 100644 index c26eb19..0000000 --- a/src/bin/network/atftpd/options.h +++ /dev/null @@ -1,50 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * options.h - * - * $Id: options.h,v 1.7 2001/07/06 23:35:18 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 options_h -#define options_h - -#include "tftp_def.h" - -/* Structure definition for tftp options. */ -struct tftp_opt { - char option[OPT_SIZE]; - char value[VAL_SIZE]; - int specified; /* specified by the client (for tftp server) */ - int enabled; /* enabled for use by server or client */ -}; - -extern struct tftp_opt tftp_default_options[OPT_NUMBER]; - -int opt_parse_request(char *data, int data_size, struct tftp_opt *options); -int opt_parse_options(char *data, int data_size, struct tftp_opt *options); -int opt_set_options(struct tftp_opt *options, char *name, char *value); -int opt_get_options(struct tftp_opt *options, char *name, char *value); -int opt_disable_options(struct tftp_opt *options, char *name); -int opt_support_options(struct tftp_opt *options); -int opt_get_tsize(struct tftp_opt *options); -int opt_get_timeout(struct tftp_opt *options); -int opt_get_blksize(struct tftp_opt *options); -int opt_get_multicast(struct tftp_opt *options, char *addr, int *port, int *mc); -void opt_set_tsize(int tsize, struct tftp_opt *options); -void opt_set_timeout(int timeout, struct tftp_opt *options); -void opt_set_blksize(int blksize, struct tftp_opt *options); -void opt_set_multicast(struct tftp_opt *options, char *addr, int port, int mc); -void opt_request_to_string(struct tftp_opt *options, char *string, int len); -void opt_options_to_string(struct tftp_opt *options, char *string, int len); - -#endif - diff --git a/src/bin/network/atftpd/stats.c b/src/bin/network/atftpd/stats.c deleted file mode 100644 index 4acea5d..0000000 --- a/src/bin/network/atftpd/stats.c +++ /dev/null @@ -1,180 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * stats.c - * some functions to collect statistics - * - * $Id: stats.c,v 1.6 2002/03/27 03:02:12 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 "config.h" - -#include <limits.h> -#include <string.h> -#include "tftp_def.h" -#include "stats.h" -#include "logger.h" - -/* - * That structure allows global statistic to be collected. See stats.h. - */ -struct server_stats s_stats; - -/* - * Must be called to initilise stats structure and record the - * start time. - */ -void stats_start(void) -{ - /* stats struct initialisation */ - memset(&s_stats, 0, sizeof(s_stats)); - s_stats.min_time.tv_sec = LONG_MAX; - pthread_mutex_init(&s_stats.mutex, NULL); - - gettimeofday(&s_stats.start_time, NULL); -} - -/* - * Called when execution is finnished, before calling stats_print. - */ -void stats_end(void) -{ - gettimeofday(&s_stats.end_time, NULL); -} - -/* - * Called by server threads each time a file is sent succesfully. - * Be aware that a mutex is locked in there. - */ -void stats_send_locked(void) -{ - pthread_mutex_lock(&s_stats.mutex); - s_stats.number_of_server++; - s_stats.num_file_send++; - pthread_mutex_unlock(&s_stats.mutex); -} - -/* - * Called by verver threads each time a file is received. - */ -void stats_recv_locked(void) -{ - pthread_mutex_lock(&s_stats.mutex); - s_stats.number_of_server++; - s_stats.num_file_recv++; - pthread_mutex_unlock(&s_stats.mutex); -} - -/* - * Called by server threads each time tftpd_send_file or tftpd_recv_file - * return with error. - */ -void stats_err_locked(void) -{ - pthread_mutex_lock(&s_stats.mutex); - s_stats.number_of_err++; - pthread_mutex_unlock(&s_stats.mutex); -} - -/* - * Called by server threads when the maximum number of threads is reached. - */ -void stats_abort_locked(void) -{ - pthread_mutex_lock(&s_stats.mutex); - s_stats.number_of_abort++; - pthread_mutex_unlock(&s_stats.mutex); -} - -/* - * Called by main thread only (in fact in tftpd_receive_request(), but - * before stdin_mutex is released) every time a new thread is created. - * We record the number of thread, the number of simultaeous thread, the - * between threads. - */ -void stats_new_thread(int number_of_thread) -{ - struct timeval tmp; - - if (number_of_thread > s_stats.max_simul_threads) - s_stats.max_simul_threads = number_of_thread; - - /* calculate the arrival time of this thread */ - if (s_stats.prev_time.tv_sec != 0) - { - gettimeofday(&s_stats.curr_time, NULL); - timeval_diff(&s_stats.diff_time, &s_stats.curr_time, - &s_stats.prev_time); - if (timeval_diff(&tmp, &s_stats.diff_time, - &s_stats.min_time) < 0) - memcpy(&s_stats.min_time, &s_stats.diff_time, - sizeof(struct timeval)); - if (timeval_diff(&tmp, &s_stats.diff_time, - &s_stats.max_time) > 0) - memcpy(&s_stats.max_time, &s_stats.diff_time, - sizeof(struct timeval)); - memcpy(&s_stats.prev_time, &s_stats.curr_time, - sizeof(struct timeval)); - } - else - gettimeofday(&s_stats.prev_time, NULL); -} - -/* - * Called by server threads when the finnished to add CPU ressources - * information. - */ -void stats_thread_usage_locked(void) -{ - struct tms tms_tmp; - - times(&tms_tmp); - pthread_mutex_lock(&s_stats.mutex); - s_stats.tms_thread.tms_utime += tms_tmp.tms_utime; - s_stats.tms_thread.tms_stime += tms_tmp.tms_stime; - pthread_mutex_unlock(&s_stats.mutex); -} - -/* - * Called at the end of the main thread, when no other threads are - * running, to print the final statistics. - */ -void stats_print(void) -{ - struct timeval tmp; - - timeval_diff(&tmp, &s_stats.end_time, &s_stats.start_time); - times(&s_stats.tms); - s_stats.tms.tms_utime += s_stats.tms_thread.tms_utime; - s_stats.tms.tms_stime += s_stats.tms_thread.tms_stime; - - logger(LOG_INFO, " Load measurements:"); - logger(LOG_INFO, " User: %8.3fs Sys:%8.3fs", - (double)(s_stats.tms.tms_utime) / CLK_TCK, - (double)(s_stats.tms.tms_stime) / CLK_TCK); - logger(LOG_INFO, " Total:%8.3fs CPU:%8.3f%%", - (double)(tmp.tv_sec + tmp.tv_usec * 1e-6), - (double)(s_stats.tms.tms_utime + s_stats.tms.tms_stime) / - (double)(tmp.tv_sec + tmp.tv_usec * 1e-6)); - logger(LOG_INFO, " Time between connections:"); - if (s_stats.min_time.tv_sec == LONG_MAX) - logger(LOG_INFO, " Min: ----- Max: -----"); - else - logger(LOG_INFO, " Min: %.3fs Max: %.3fs", - (double)(s_stats.min_time.tv_sec + s_stats.min_time.tv_usec * 1e-6), - (double)(s_stats.max_time.tv_sec + s_stats.max_time.tv_usec * 1e-6)); - logger(LOG_INFO, " Thread stats:"); - logger(LOG_INFO, " simultaneous threads: %d", s_stats.max_simul_threads); - logger(LOG_INFO, " number of servers: %d", s_stats.number_of_server); - logger(LOG_INFO, " number of aborts: %d", s_stats.number_of_abort); - logger(LOG_INFO, " number of errors: %d", s_stats.number_of_err); - logger(LOG_INFO, " number of files sent: %d", s_stats.num_file_send); - logger(LOG_INFO, " number of files received: %d", s_stats.num_file_recv); -} diff --git a/src/bin/network/atftpd/stats.h b/src/bin/network/atftpd/stats.h deleted file mode 100644 index 2f99620..0000000 --- a/src/bin/network/atftpd/stats.h +++ /dev/null @@ -1,62 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * stats.h - * - * $Id: stats.h,v 1.3 2000/12/27 17:02:23 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 stats_h -#define stats_h - -#include <pthread.h> -#include <sys/time.h> -#include <sys/times.h> - -/* structure to collect some stats */ -struct server_stats { - /* updated by main thread */ - struct timeval start_time; - struct timeval end_time; - struct tms tms; - - /* connection statistics, updated by main thread */ - int max_simul_threads; /* maximum number of simultaneous server */ - struct timeval min_time; /* time between connection stats */ - struct timeval max_time; - struct timeval curr_time; /* temporary usage for calculation */ - struct timeval prev_time; - struct timeval diff_time; - - /* updated by server thread */ - pthread_mutex_t mutex; - struct tms tms_thread; - int number_of_server; /* number of server that return successfully */ - int number_of_abort; /* when number max of client is reached */ - int number_of_err; /* send or receive that return with error */ - int num_file_send; - int num_file_recv; - int byte_send; /* total byte transfered to client (file) */ - int byte_recv; /* total byte read from client (file) */ -}; - -/* Functions defined in stats.c */ -void stats_start(void); -void stats_end(void); -void stats_send_locked(void); -void stats_recv_locked(void); -void stats_err_locked(void); -void stats_abort_locked(void); -void stats_new_thread(int number_of_thread); -void stats_thread_usage_locked(void); -void stats_print(void); - -#endif diff --git a/src/bin/network/atftpd/tftp_def.c b/src/bin/network/atftpd/tftp_def.c deleted file mode 100644 index 7e9b223..0000000 --- a/src/bin/network/atftpd/tftp_def.c +++ /dev/null @@ -1,183 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * tftp_def.c - * - * $Id: tftp_def.c,v 1.15 2004/02/13 03:16:09 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 "config.h" - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include "tftp_def.h" -#include "options.h" -#include "logger.h" - -/* - * This is the default option structure, that must be used - * for initialisation. - */ - -// FIXME: is there a way to use TIMEOUT and SEGSIZE here? -struct tftp_opt tftp_default_options[OPT_NUMBER] = { - { "filename", "", 0, 1}, /* file to transfer */ - { "mode", "octet", 0, 1}, /* mode for transfer */ - { "tsize", "0", 0, 1 }, /* RFC1350 options. See RFC2347, */ - { "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */ - { "blksize", "512", 0, 1 }, /* This is the default option */ - { "multicast", "", 0, 1 }, /* structure */ - { "", "", 0, 0} -}; - -/* Error message defined in RFC1350. */ -char *tftp_errmsg[9] = { - "Undefined error code", - "File not found", - "Access violation", - "Disk full or allocation exceeded", - "Illegal TFTP operation", - "Unknown transfer ID", - "File already exists", - "No such user", - "Failure to negotiate RFC1782 options", -}; - - -/* - * Compute the difference of two timeval structs handling wrap around. - * The result is retruned in *res. - * Return value are: - * 1 if t1 > t0 - * 0 if t1 = t0 - * -1 if t1 < t0 - */ -int timeval_diff(struct timeval *res, struct timeval *t1, struct timeval *t0) -{ - res->tv_sec = t1->tv_sec - t0->tv_sec; - res->tv_usec = t1->tv_usec - t0->tv_usec; - - if (res->tv_sec > 0) - { - if (res->tv_usec >= 0) - { - return 1; - } - else - { - res->tv_sec -= 1; - res->tv_usec += 1000000; - return 1; - } - } - else if (res->tv_sec < 0) - { - if (res->tv_usec > 0) - { - res->tv_sec += 1; - res->tv_usec -= 1000000; - return -1; - } - else if (res->tv_usec <= 0); - { - return -1; - } - } - else - { - if (res->tv_usec > 0) - return 1; - else if (res->tv_usec < 0) - return -1; - else - return 0; - } -} - -/* - * Print a string in engineering notation. - * - * IN: - * value: value to print - * string: if NULL, the function print to stdout, else if print - * to the string. - * format: format string for printf. - */ -int print_eng(double value, char *string, int size, char *format) -{ - char suffix[] = {'f', 'p', 'n', 'u', 'm', 0, 'k', 'M', 'G', 'T', 'P'}; - double tmp; - double div = 1e-15; - int i; - - - for (i = 0; i < 11; i++) - { - tmp = value / div; - if ((tmp > 1.0) && (tmp < 1000.0)) - break; - div *= 1000.0; - } - if (string) - snprintf(string, size, format, tmp, suffix[i]); - else - printf(format, tmp, suffix[i]); - return OK; -} - -/* - * This is a strncpy function that take care of string NULL termination - */ -inline char *Strncpy(char *to, const char *from, size_t size) -{ - to[size-1] = '\000'; - return strncpy(to, from, size - 1); -} - - -/* - * gethostbyname replacement that is reentrant. This function is copyied - * from the libc manual. - */ -int Gethostbyname(char *addr, struct hostent *host) -{ - struct hostent *hp; - char *tmpbuf; - size_t tmpbuflen; - int herr; - - tmpbuflen = 1024; - - if ((tmpbuf = (char *)malloc(tmpbuflen)) == NULL) - return ERR; - - hp = gethostbyname_r(addr, host, tmpbuf, tmpbuflen, &herr); - - free(tmpbuf); - - /* Check for errors. */ - if (hp == NULL) - { - logger(LOG_ERR, "%s: %d: gethostbyname_r: %s", - __FILE__, __LINE__, strerror(herr)); - return ERR; - } - if (hp != host) - { - logger(LOG_ERR, "%s: %d: abnormal return value", - __FILE__, __LINE__); - return ERR; - } - - return OK; -} diff --git a/src/bin/network/atftpd/tftp_def.h b/src/bin/network/atftpd/tftp_def.h deleted file mode 100644 index 3f3be0d..0000000 --- a/src/bin/network/atftpd/tftp_def.h +++ /dev/null @@ -1,55 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * tftp_def.h - * - * $Id: tftp_def.h,v 1.17 2004/02/13 03:16:09 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 tftp_def_h -#define tftp_def_h - -#include <sys/time.h> -#include <sys/times.h> -#include <netdb.h> - -/* standard return value */ -#define OK 0 -#define ERR -1 -#define ABORT -2 -#define QUIT -10 - -#define MAXLEN 256 /* For file names and such */ -#define IPADDRLEN 24 /* For IPv4 and IPv6 address string */ -#define TIMEOUT 5 /* Client timeout */ -#define S_TIMEOUT 5 /* Server timout. */ -#define NB_OF_RETRY 5 - -/* definition to use tftp_options structure */ -#define OPT_FILENAME 0 -#define OPT_MODE 1 -#define OPT_TSIZE 2 -#define OPT_TIMEOUT 3 -#define OPT_BLKSIZE 4 -#define OPT_MULTICAST 5 -#define OPT_NUMBER 7 - -#define OPT_SIZE 12 -#define VAL_SIZE MAXLEN - -extern char *tftp_errmsg[9]; - -int timeval_diff(struct timeval *res, struct timeval *t1, struct timeval *t0); -int print_eng(double value, char *string, int size, char *format); -inline char *Strncpy(char *to, const char *from, size_t size); -int Gethostbyname(char *addr, struct hostent *host); - -#endif diff --git a/src/bin/network/atftpd/tftp_io.c b/src/bin/network/atftpd/tftp_io.c deleted file mode 100644 index 3e39891..0000000 --- a/src/bin/network/atftpd/tftp_io.c +++ /dev/null @@ -1,492 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * tftp_io.c - * I/O operation routines common to both client and server - * - * $Id: tftp_io.c,v 1.24 2004/02/19 01:30:00 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <unistd.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <arpa/tftp.h> -#include <errno.h> -#include "string.h" -#include "tftp_io.h" -#include "logger.h" - -/* - * 2 bytes string 1 byte string 1 byte string 1 byte string - * ---------------------------------------------------------------------> - *| Opcode | Filename | 0 | Mode | 0 | Opt1 | 0 | Value1 < - * ---------------------------------------------------------------------> - * - * string 1 byte string 1 byte - * >-------------------------------- - * < OptN | 0 | ValueN | 0 | - * >-------------------------------- - */ -int tftp_send_request(int socket, struct sockaddr_in *sa, short type, - char *data_buffer, int data_buffer_size, - struct tftp_opt *tftp_options) -{ - int i; - int result; - int buf_index = 0; - struct tftphdr *tftphdr = (struct tftphdr *)data_buffer; - char *filename = tftp_options[OPT_FILENAME].value; - char *mode = tftp_options[OPT_MODE].value; - - /* write the opcode */ - tftphdr->th_opcode = htons(type); - buf_index += 2; - /* write file name */ - Strncpy(data_buffer + buf_index, filename, data_buffer_size - buf_index); - buf_index += strlen(filename); - buf_index++; - Strncpy(data_buffer + buf_index, mode, data_buffer_size - buf_index); - buf_index += strlen(mode); - buf_index++; - - for (i = 2; ; i++) - { - if (strlen(tftp_options[i].option) == 0) - break; - if (tftp_options[i].enabled && tftp_options[i].specified) - { - Strncpy(data_buffer + buf_index, tftp_options[i].option, - data_buffer_size - buf_index); - buf_index += strlen(tftp_options[i].option); - buf_index++; - Strncpy(data_buffer + buf_index, tftp_options[i].value, - data_buffer_size - buf_index); - buf_index += strlen(tftp_options[i].value); - buf_index++; - } - } - /* send the buffer */ - result = sendto(socket, data_buffer, buf_index, 0, - (struct sockaddr *)sa, sizeof(*sa)); - if (result < 0) - return ERR; - return OK; -} - -/* - * 2 bytes 2 bytes - * ------------------- - *| Opcode | Block # | - * ------------------- - */ -int tftp_send_ack(int socket, struct sockaddr_in *sa, short block_number) -{ - struct tftphdr tftphdr; - int result; - - tftphdr.th_opcode = htons(ACK); - tftphdr.th_block = htons(block_number); - - result = sendto(socket, &tftphdr, 4, 0, (struct sockaddr *)sa, - sizeof(*sa)); - if (result < 0) - return ERR; - return OK; -} - -/* - * 2 bytes string 1 byte string 1 byte string 1 byte string 1 byte - * --------------------------------------------------------------------------- - *| Opcode | Opt1 | 0 | Value1 | 0 | OptN | 0 | ValueN | 0 | - * --------------------------------------------------------------------------- - */ -int tftp_send_oack(int socket, struct sockaddr_in *sa, struct tftp_opt *tftp_options, - char *buffer, int buffer_size) -{ - - int i; - int result; - int index = 0; - struct tftphdr *tftphdr = (struct tftphdr *)buffer; - - /* write the opcode */ - tftphdr->th_opcode = htons(OACK); - index += 2; - - for (i = 2; i < OPT_NUMBER; i++) - { - if (tftp_options[i].enabled && tftp_options[i].specified) - { - Strncpy(buffer + index, tftp_options[i].option, buffer_size - index); - index += strlen(tftp_options[i].option); - index++; - Strncpy(buffer + index, tftp_options[i].value, buffer_size - index); - index += strlen(tftp_options[i].value); - index++; - } - } - /* send the buffer */ - result = sendto(socket, buffer, index, 0, (struct sockaddr *)sa, - sizeof(*sa)); - if (result < 0) - return ERR; - return OK; -} - -/* - * 2 bytes 2 bytes string 1 byte - * --------------------------------------- - *| Opcode | ErrorCode | ErrMsg | 0 | - * --------------------------------------- - */ -int tftp_send_error(int socket, struct sockaddr_in *sa, short err_code, - char *buffer, int buffer_size) -{ - int size; - int result; - struct tftphdr *tftphdr = (struct tftphdr *)buffer; - - if (err_code > EOPTNEG) - return ERR; - tftphdr->th_opcode = htons(ERROR); - tftphdr->th_code = htons(err_code); - Strncpy(tftphdr->th_msg, tftp_errmsg[err_code], buffer_size - 4); - - size = 4 + strlen(tftp_errmsg[err_code]) + 1; - - result = sendto(socket, tftphdr, size, 0, (struct sockaddr *)sa, - sizeof(*sa)); - if (result < 0) - return ERR; - return OK; -} - -/* - * 2 bytes 2 bytes N bytes - * ---------------------------- - *| Opcode | Block # | Data | - * ---------------------------- - */ -int tftp_send_data(int socket, struct sockaddr_in *sa, short block_number, - int size, char *data) -{ - struct tftphdr *tftphdr = (struct tftphdr *)data; - int result; - - tftphdr->th_opcode = htons(DATA); - tftphdr->th_block = htons(block_number); - - result = sendto(socket, data, size, 0, (struct sockaddr *)sa, - sizeof(*sa)); - if (result < 0) - return ERR; - return OK; -} - -/* - * Wait for a packet. This function can listen on 2 sockets. This is - * needed by the multicast tftp client. - */ -int tftp_get_packet(int sock1, int sock2, int *sock, struct sockaddr_in *sa, - struct sockaddr_in *sa_from, struct sockaddr_in *sa_to, - int timeout, int *size, char *data) -{ - int result; - struct timeval tv; - fd_set rfds; - struct sockaddr_in from; - struct tftphdr *tftphdr = (struct tftphdr *)data; - - struct msghdr msg; /* used to get client's packet info */ - struct cmsghdr *cmsg; - struct iovec iov; - char cbuf[1024]; - - /* initialise structure */ - memset(&from, 0, sizeof(from)); - iov.iov_base = data; - iov.iov_len = *size; - msg.msg_name = &from; - msg.msg_namelen = sizeof(from); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - msg.msg_control = cbuf; - msg.msg_controllen = sizeof(cbuf); - - /* Wait up to five seconds. */ - tv.tv_sec = timeout; - tv.tv_usec = 0; - - /* Watch socket to see when it has input. */ - FD_ZERO(&rfds); - FD_SET(sock1, &rfds); - if (sock2 > -1) - FD_SET(sock2, &rfds); - - /* wait for data on sockets */ - result = select(FD_SETSIZE, &rfds, NULL, NULL, &tv); - - switch (result) - { - case -1: - logger(LOG_ERR, "select: %s", strerror(errno)); - return ERR; - case 0: - return GET_TIMEOUT; - break; - case 1: - case 2: - result = 0; - - if (FD_ISSET(sock1, &rfds)) - { - result = recvmsg(sock1, &msg, 0); - if (sock) - *sock = sock1; - } - else - { - if ((sock2 > -1) && (FD_ISSET(sock2, &rfds))) - { - result = recvmsg(sock2, &msg, 0); - if (sock) - *sock = sock2; - } - } - if (result == 0) - return ERR; - if (result == -1) - { - logger(LOG_ERR, "recvmsg: %s", strerror(errno)); - return ERR; - } - - /* if needed read data from message control */ - if (sa_to) - { - for (cmsg = CMSG_FIRSTHDR(&msg); - cmsg != NULL && cmsg->cmsg_len >= sizeof(*cmsg); - cmsg = CMSG_NXTHDR(&msg, cmsg)) - { -#ifndef __HAIKU__ - if (cmsg->cmsg_level == SOL_IP - && cmsg->cmsg_type == IP_PKTINFO) - { - struct in_pktinfo *pktinfo; - pktinfo = (struct in_pktinfo *)CMSG_DATA(cmsg); - sa_to->sin_addr = pktinfo->ipi_addr; - } -#else // !__HAIKU__ - if (cmsg->cmsg_level == IPPROTO_IP - && cmsg->cmsg_type == IP_RECVDSTADDR) - { - struct in_addr *addr = (struct in_addr *)CMSG_DATA(cmsg); - sa_to->sin_addr = *addr; - } -#endif - break; - } - } - - /* return the size to the caller */ - *size = result; - - /* return the peer address/port to the caller */ - if (sa_from != NULL) - memcpy(sa_from, &from, sizeof(from)); - - /* if sa as never been initialised, sa->sin_port is still 0 */ - if (sa->sin_port == htons(0)) - memcpy(sa, &from, sizeof(from)); - - - switch (ntohs(tftphdr->th_opcode)) - { - case RRQ: - return GET_RRQ; - case WRQ: - return GET_WRQ; - case ACK: - return GET_ACK; - case OACK: - return GET_OACK; - case ERROR: - return GET_ERROR; - case DATA: - return GET_DATA; - default: - return GET_DISCARD; - } - break; - default: - return ERR; - } -} - -/* - * Read from file and do netascii conversion if needed - */ -int tftp_file_read(FILE *fp, char *data_buffer, int data_buffer_size, int block_number, - int convert, int *prev_block_number, int *prev_file_pos, int *temp) -{ - int i; - int c; - char prevchar = *temp & 0xff; - char newline = (*temp & 0xff00) >> 8; - int data_size; - - if (!convert) - { - /* In this case, just read the requested data block. - Anyway, in the multicast case it can be in random - order. */ - fseek(fp, block_number * data_buffer_size, SEEK_SET); - data_size = fread(data_buffer, 1, data_buffer_size, fp); - return data_size; - } - else - { - /* - * When converting data, it become impossible to seek in - * the file based on the block number. So we must always - * remeber the position in the file from were to read the - * data requested by the client. Client can only request data - * for the same block or the next, but we cannot assume this - * block number will increase at every ACK since it can be - * lost in transmission. - * - * The stategy is to remeber the file position as well as - * the block number from the current call to this function. - * If the client request a block number different from that - * we return ERR. - * - * If the client request many time the same block, the - * netascii conversion is done each time. Since this is not - * a normal condition it should not be a problem for system - * performance. - * - */ - if ((block_number != *prev_block_number) && (block_number != *prev_block_number + 1)) - return ERR; - if (block_number == *prev_block_number) - fseek(fp, *prev_file_pos, SEEK_SET); - - *prev_block_number = block_number; - *prev_file_pos = ftell(fp); - - /* - * convert to netascii, based on netkit-tftp-0.17 routine in tftpsubs.c - * i index output buffer - */ - for (i = 0; i < data_buffer_size; i++) - { - if (newline) - { - if (prevchar == '\n') - c = '\n'; /* lf to cr,lf */ - else - c = '\0'; /* cr to cr,nul */ - newline = 0; - } - else - { - c = fgetc(fp); - if (c == EOF) - break; - if (c == '\n' || c == '\r') - { - prevchar = c; - c = '\r'; - newline = 1; - } - } - data_buffer[i] = c; - } - /* save state */ - *temp = (newline << 8) | prevchar; - - return i; - } -} - -/* - * Write to file and do netascii conversion if needed - */ -int tftp_file_write(FILE *fp, char *data_buffer, int data_buffer_size, int block_number, int data_size, - int convert, int *prev_block_number, int *temp) -{ - int i; - int c; - char prevchar = *temp; - - if (!convert) - { - /* Simple case, just seek and write */ - fseek(fp, (block_number - 1) * data_buffer_size, SEEK_SET); - data_size = fwrite(data_buffer, 1, data_size, fp); - return data_size; - } - else - { - /* - * Same principle than for reading, but simpler since when client - * send same block twice there is no need to rewrite it to the - * file - */ - if ((block_number != *prev_block_number) && (block_number != *prev_block_number + 1)) - return ERR; - if (block_number == *prev_block_number) - return data_size; - - *prev_block_number = block_number; - - /* - * convert to netascii, based on netkit-tftp-0.17 routine in tftpsubs.c - * i index input buffer - */ - for (i = 0; i < data_size; i++) - { - c = data_buffer[i]; - if (prevchar == '\r') - { - if (c == '\n') - { - fseek(fp, -1, SEEK_CUR); /* cr,lf to lf */ - if (fputc(c, fp) == EOF) - break; - } - else if (c != '\0') /* cr,nul to cr */ - { - if (fputc(c, fp) == EOF) - break; - } - } - else - { - if (fputc(c, fp) == EOF) - break; - } - prevchar = c; - } - - /* save state */ - *temp = prevchar; - - return i; - } -} diff --git a/src/bin/network/atftpd/tftp_io.h b/src/bin/network/atftpd/tftp_io.h deleted file mode 100644 index ffa043c..0000000 --- a/src/bin/network/atftpd/tftp_io.h +++ /dev/null @@ -1,59 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * tftp_io.h - * - * $Id: tftp_io.h,v 1.18 2004/02/13 03:16:09 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 tftp_io_h -#define tftp_io_h - -#include <arpa/tftp.h> -#include <sys/socket.h> -#include "tftp_def.h" -#include "options.h" - -/* missing from <arpa/tftp.h> */ -/* new opcode */ -#define OACK 06 -/* new error code */ -#define EOPTNEG 8 /* error in option negociation */ - -/* return value of tftp_get_packet */ -#define GET_DISCARD 0 -#define GET_TIMEOUT 1 -#define GET_RRQ 2 -#define GET_WRQ 3 -#define GET_ACK 4 -#define GET_OACK 5 -#define GET_ERROR 6 -#define GET_DATA 7 - -/* functions prototype */ -int tftp_send_request(int socket, struct sockaddr_in *s_inn, short type, - char *data_buffer, int data_buffer_size, - struct tftp_opt *tftp_options); -int tftp_send_ack(int socket, struct sockaddr_in *s_inn, short block_number); -int tftp_send_oack(int socket, struct sockaddr_in *s_inn, struct tftp_opt *tftp_options, - char *buffer, int buffer_size); -int tftp_send_error(int socket, struct sockaddr_in *s_inn, short err_code, - char *buffer, int buffer_size); -int tftp_send_data(int socket, struct sockaddr_in *s_inn, short block_number, - int size, char *data); -int tftp_get_packet(int sock1, int sock2, int *sock, struct sockaddr_in *sa, - struct sockaddr_in *from, struct sockaddr_in *to, - int timeout, int *size, char *data); -int tftp_file_read(FILE *fp, char *buffer, int buffer_size, int block_number, int convert, - int *prev_block_number, int *prev_file_pos, int *temp); -int tftp_file_write(FILE *fp, char *data_buffer, int data_buffer_size, int block_number, - int data_size, int convert, int *prev_block_number, int *temp); -#endif diff --git a/src/bin/network/atftpd/tftpd.c b/src/bin/network/atftpd/tftpd.c deleted file mode 100644 index 3f10fb7..0000000 --- a/src/bin/network/atftpd/tftpd.c +++ /dev/null @@ -1,1149 +0,0 @@ -/* hey emacs! -*- Mode: C; c-file-style: "k&r"; indent-tabs-mode: nil -*- */ -/* - * tftpd.c - * main server file - * - * $Id: tftpd.c,v 1.61 2004/02/27 02:05:26 jp Exp $ - * - * Copyright (c) 2000 Jean-Pierre Lefebvre <helix@xxxxxxxxxxxxxxx> - * and Remi Lefebvre <remi@xxxxxxxxxx> - * - * atftp is free software; you can redistribute them and/or modify them - * 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 "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <netdb.h> -#include <getopt.h> -#include <unistd.h> -#include <errno.h> -#include <signal.h> -#include <pthread.h> -#include <string.h> -#include <pwd.h> -#include <grp.h> -#ifdef HAVE_WRAP -#include <tcpd.h> -#endif -#include "tftpd.h" -#include "tftp_io.h" -#include "tftp_def.h" -#include "logger.h" -#include "options.h" -#include "stats.h" -#ifdef HAVE_PCRE -#include "tftpd_pcre.h" -#endif -#ifdef HAVE_MTFTP -#include "tftpd_mtftp.h" -#endif - -#undef RATE_CONTROL - -/* - * Global variables set by main when starting. Read-only for threads - */ -int tftpd_max_thread = 100; /* number of concurent thread allowed */ -int tftpd_timeout = 300; /* number of second of inactivity - before exiting */ -char directory[MAXLEN] = "/tftpboot/"; -int retry_timeout = S_TIMEOUT; - -int tftpd_daemon = 0; /* By default we are started by inetd */ -int tftpd_daemon_no_fork = 0; /* For who want a false daemon mode */ -short tftpd_port = 0; /* Port atftpd listen to */ -char tftpd_addr[MAXLEN] = ""; /* IP address atftpd binds to */ - -int tftpd_cancel = 0; /* When true, thread must exit. pthread - cancellation point are not used because - thread id are not tracked. */ [ *** diff truncated: 4073 lines dropped *** ] ############################################################################ Commit: 56d52e342623bc9bc8e4f0fb6ef45bff1d7af502 URL: http://cgit.haiku-os.org/haiku/commit/?id=56d52e342623 Author: Augustin Cavalier <waddlesplash@xxxxxxxxx> Date: Fri Feb 27 07:17:24 2015 UTC AboutSystem software credits: updates & cleanup. All the packages I delete from here are not included in the tree and not included in the "default packages" list. * Use HTTPS rather than HTTP for sites that support it * GDB was removed in hrev48791 * FFmpeg is spelled as "FFmpeg", not "FFMpeg" * atftp was removed from the tree in the previous commit * acipca was updated to a version from 2014 recently * CannaIM was removed in hrev48034 & hrev48035 * libxml2 & friends were removed in hrev48798 * Cleaned up ifdef __INTEL__ lines -- no need to have more than one ---------------------------------------------------------------------------- ############################################################################ Revision: hrev48837 Commit: 5940aaf69c0dc63239ca74b7a2d92e8e157f4038 URL: http://cgit.haiku-os.org/haiku/commit/?id=5940aaf69c0d Author: Augustin Cavalier <waddlesplash@xxxxxxxxx> Date: Fri Feb 27 07:34:14 2015 UTC AboutSystem Credits: clean up current maintainers. All the people I've moved off this list have not committed anything since (at least) before 2012-01-01, with the exception of Andrew Lindesay who never recieved commit access (AFAICT, he only contributed some patches.) ----------------------------------------------------------------------------