pax_global_header00006660000000000000000000000064141456204300014511gustar00rootroot0000000000000052 comment=f540cb92f524e48fb5cd36115ef7be2ab9b6c4af gensio-2.3.5/000077500000000000000000000000001414562043000130045ustar00rootroot00000000000000gensio-2.3.5/.gitignore000066400000000000000000000003661414562043000150010ustar00rootroot00000000000000config.* configure Makefile Makefile.in tags ser2net.spec missing aclocal.m4 libtool ltmain.sh depcomp install-sh /.deps/ /autom4te.cache/ m4/lt*.m4 m4/libtool.m4 *.o *~ *.pyc *.cmd .tmp_versions Module.* modules.* *.ko *.mod.c *.ur-safe ser2net gensio-2.3.5/AUTHORS000066400000000000000000000001041414562043000140470ustar00rootroot00000000000000Corey Minyard - Original (and still only) author. gensio-2.3.5/CMakeLists.txt000066400000000000000000000152321414562043000155470ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.10) cmake_policy(SET CMP0078 NEW) # For swig project(gensio VERSION 2.3.5) set (gensio_VERSION_STRING "${gensio_VERSION_MAJOR}.${gensio_VERSION_MINOR}.${gensio_VERSION_PATCH}") include_directories("${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include" ) include(CheckLibraryExists) include(CheckIncludeFile) include(CheckSymbolExists) include(CheckCSourceCompiles) include(GNUInstallDirs) include(FindPkgConfig) include(FindTCL) if (WIN32) # Suppress packing error warnings, as they are ubiquitous and don't matter. set (CMAKE_C_FLAGS "/wd4820") set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/output") else() set (CMAKE_C_FLAGS "-Wall") endif() option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(ALSOSTATIC "When buiding a shared library, build a static one, too") option(ENABLE_TCP_WRAPPERS "Enable tcpwrappers support" ON) if(ENABLE_TCP_WRAPPERS) CHECK_INCLUDE_FILE(tcpd.h HAVE_TCPD_H) if(HAVE_TCPD_H) list(APPEND EXTRA_LIBS wrap) endif() endif() option(ENABLE_PTHREADS "Enable pthreads" ON) set(USE_PTHREADS 0) if(ENABLE_PTHREADS) CHECK_LIBRARY_EXISTS(pthread "pthread_create" "" PTHREAD_LIB_FOUND) CHECK_INCLUDE_FILE(pthread.h PTHREAD_INC_FOUND) if(PTHREAD_LIB_FOUND AND PTHREAD_INC_FOUND) set(USE_PTHREADS 1) list(APPEND EXTRA_LIBS pthread) endif() endif() option(ENABLE_EPOLL "Enable epoll support" ON) if(ENABLE_EPOLL) CHECK_INCLUDE_FILE(sys/epoll.h HAVE_EPOLL_PWAIT) endif() option(ENABLE_GLIB "Enable GLIB support" UNIX) if(ENABLE_GLIB) pkg_check_modules(GLIB glib-2.0) if(GLIB_FOUND) set(HAVE_GLIB ON) set(GLIB_LIB gensioglib) endif() endif() set(TCL_LIBS ) option(ENABLE_TCL "Enable TCL support" UNIX) if(ENABLE_TCL) if(TCL_FOUND) set(HAVE_TCL ON) set(TCL_LIB gensiotcl) set(TCL_LIBS ${TCL_LIBRARY}) endif() endif() option(ENABLE_OPENIPMI "Enable OpenIPMI serial over LAN support" ON) if(ENABLE_OPENIPMI) CHECK_LIBRARY_EXISTS(OpenIPMI "ipmi_alloc_os_handler" "" OPENIPMI_LIB_FOUND) CHECK_INCLUDE_FILE(OpenIPMI/ipmiif.h OPENIPMI_INC_FOUND) if(OPENIPMI_LIB_FOUND AND OPENIPMI_INC_FOUND) set(HAVE_OPENIPMI 1) if(USE_PTHREADS) list(APPEND EXTRA_LIBS OpenIPMI OpenIPMIpthread OpenIPMIutils) else() list(APPEND EXTRA_LIBS OpenIPMI OpenIPMIposix OpenIPMIutils) endif() endif() endif() option(ENABLE_OPENSSL "Enable openssl" ON) set(HAVE_OPENSSL 0) if(ENABLE_OPENSSL) CHECK_LIBRARY_EXISTS(ssl "SSL_connect" "" SSL_LIB_FOUND) CHECK_LIBRARY_EXISTS(crypto "X509_verify_cert" "" CRYPTO_LIB_FOUND) CHECK_INCLUDE_FILE(openssl/ssl.h SSL_INC_FOUND) CHECK_INCLUDE_FILE(openssl/x509.h CRYPTO_INC_FOUND) if(SSL_LIB_FOUND AND SSL_INC_FOUND AND CRYPTO_LIB_FOUND AND CRYPTO_INC_FOUND) set(HAVE_OPENSSL 1) list(APPEND EXTRA_LIBS ssl crypto) endif() endif() option(ENABLE_MDNS "Enable MDNS" ON) set(HAVE_AVAHI 0) if(ENABLE_MDNS) CHECK_LIBRARY_EXISTS(avahi-client "avahi_client_new" "" AVAHI_CLI_LIB_FOUND) CHECK_LIBRARY_EXISTS(avahi-common "avahi_malloc" "" AVAHI_COM_LIB_FOUND) CHECK_INCLUDE_FILE(avahi-client/client.h AVAHI_CLI_INC_FOUND) CHECK_INCLUDE_FILE(avahi-common/malloc.h AVAHI_COM_INC_FOUND) if(AVAHI_CLI_LIB_FOUND AND AVAHI_CLI_INC_FOUND AND AVAHI_COM_LIB_FOUND AND AVAHI_COM_INC_FOUND) set(HAVE_AVAHI 1) list(APPEND EXTRA_LIBS avahi-client avahi-common) endif() endif() option(ENABLE_SWIG "Enable swig support" ON) if(ENABLE_SWIG) find_package(SWIG) endif() option(ENABLE_PYTHON "Enable python support" ON) if(ENABLE_PYTHON) set (Python_ADDITIONAL_VERSIONS 3 2) find_package(PythonInterp) find_package(PythonLibs) # FIXME - we are assuming this for now. option(PYTHON_HAS_THREADS "Support threading in python" ON) endif() option(ENABLE_SCTP "Enable SCTP support" ON) if(ENABLE_SCTP) CHECK_LIBRARY_EXISTS(sctp "sctp_bindx" "" HAVE_LIBSCTP) if (HAVE_LIBSCTP) list(APPEND EXTRA_LIBS sctp) endif() endif() if(HAVE_LIBSCTP) CHECK_LIBRARY_EXISTS(sctp "sctp_sendv" "" HAVE_SCTP_SENDV) endif() string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_NAME}" "Linux" HAVE_WORKING_PORT0) CHECK_LIBRARY_EXISTS(pam "pam_start" "" HAVE_PAM) check_symbol_exists(TIOCSRS485 sys/ioctl.h HAVE_DECL_TIOCSRS485) CHECK_INCLUDE_FILE(sys/un.h HAVE_UNIX) option(USE_FILE_STDIO "Use stdio instead of unix files for the file gensio" ${MSVC}) option(ENABLE_INTERNAL_TRACE "Enable internal trace tools, required for oomtest" OFF) set (prefix "${CMAKE_INSTALL_PREFIX}") set (exec_prefix "${CMAKE_INSTALL_PREFIX}") set (libdir "${CMAKE_INSTALL_FULL_LIBDIR}") set (includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") set (VERSION "${PROJECT_VERSION}") check_c_source_compiles("int main() { static int counter = 0; int val; __atomic_load(&counter, &val, __ATOMIC_SEQ_CST); return val; }" HAVE_GCC_ATOMICS) check_symbol_exists(sendmsg sys/socket.h HAVE_SENDMSG) check_symbol_exists(isatty unistd.h HAVE_ISATTY) check_symbol_exists(strcasecmp string.h HAVE_STRCASECMP) check_symbol_exists(strncasecmp string.h HAVE_STRNCASECMP) check_symbol_exists(prctl sys/prctl.h HAVE_PRCTL) check_symbol_exists(getrandom sys/random.h HAVE_GETRANDOM_FUNC) set (CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") check_symbol_exists(ptsname_r "stdlib.h" HAVE_PTSNAME_R) check_symbol_exists(cfmakeraw "termios.h" HAVE_CFMAKERAW) check_symbol_exists(signalfd "signalfd.h" HAVE_SIGNALFD) check_symbol_exists(regexec "regex.h" HAVE_REGEXEC) check_symbol_exists(fnmatch "fnmatch.h" HAVE_FNMATCH) if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") set(APPLE ON) else() set(APPLE OFF) endif() if (${UNIX}) if (${APPLE}) set(DEF_UUCP_LOCKING OFF) else() set(DEF_UUCP_LOCKING ON) endif() else() set(DEF_UUCP_LOCKING OFF) endif() if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") set(UUCP_LOCK_DIR "/var/lock") else() set(UUCP_LOCK_DIR "/var/spool/lock") endif() option(USE_UUCP_LOCKING "Enable UUCP lock file handling for devices" ${DEF_UUCP_LOCKING}) if(UNIX) set(HAVE_PTY 1) else() set(HAVE_PTY 0) list(APPEND EXTRA_LIBS ws2_32 bcrypt) endif() configure_file(config.h.cmake config.h) add_subdirectory(lib) add_subdirectory(c++) if(HAVE_GLIB) add_subdirectory(glib) endif() if(HAVE_TCL) add_subdirectory(tcl) endif() add_subdirectory(include) add_subdirectory(tools) add_subdirectory(examples) if(SWIG_FOUND) add_subdirectory(swig) endif() add_subdirectory(man) add_subdirectory(tests) set(CPACK_SOURCE_GENERATOR "TGZ") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${gensio_VERSION_MAJOR}.${gensio_VERSION_MINOR}.${gensio_VERSION_PATCH}") set(CPACK_SOURCE_IGNORE_FILES "/.git/;/Z.*/;~$;${CPACK_SOURCE_IGNORE_FILES}") include(CPack) add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) gensio-2.3.5/COPYING000066400000000000000000000431321414562043000140420ustar00rootroot00000000000000 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. Copyright (C) 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. , 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. gensio-2.3.5/COPYING.LIB000066400000000000000000000636421414562043000144570ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 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. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! gensio-2.3.5/ChangeLog000066400000000000000000000537621414562043000145730ustar00rootroot000000000000002014-01-24 Corey Minyard * ser2net.h, Makefile.am: Move some things into a new ser2net.h file. * devcfg.c, controller.c, dataxfer.c, ser2net.c, utils.c: Add the ser2net.h include file. * dataxfer.c: Fix some EAGAIN handling. 2014-01-23 Corey Minyard * utils.h, readconfig.c, dataxfer.c: Rework the find_xxx functions to return a strdup of the string. * dataxfer.c, dataxfer.h, devcfg.h: Remove the dinfo structure and move the contents into the port structure, and remove the now empty devcfg.h. * configure.ac: Minor rework. 2014-01-22 Corey Minyard * io.h, devcfg.h, devcfg.c, dataxfer.c, buffer.c, buffer.h: Abstract the device I/O operations. * utils.c, utils.h, controller.h, controller.c: Fix some const correctness issues * controller.c, controller.h: Add printf-style output. * dataxfer.h, dataxfer.c, devcfg.h, devcfg.c, io.h, readconfig: Rework the error and output handling to make it more flexible, so errors can be output with useful information from the lower levels. 2013-08-08 Corey Minyard * utils.c, utils.h, dataxfer.c, controller.c: Rework the handling of addresses to work properly with all the return values of getaddrinfo, and to prefer IPV6 over IPV4 when opening the socket. This means if you specify a number, it will open the IPV6 ::,port address first. This was a big cleanup, and moved a lot of the base socket handling into utils.h. * dataxfer.c: Rework the stdio handling so it doesn't rely on the port number in the address, since that is now gone. * dataxfer.c: Set port->closestr to NULL when freeing it to avoid a double-free. * readconfig.c, ser2net.8: Rework the input handling so an IPV6 can be specified as part of the portnum parameter. This was hard because IPV6 addresses have ':' in them. Basically, if there is a "," in the port specification, assume that everything from the beginning of the line to the ':' after the ',' is the port number. * utils.c, utils.h, dataxfer.c, controller.c: Modified address handling so that ser2net opens all the addresses returned by getaddrinfo, not just the first one. That should make things work correctly in a lot more cases. 2013-08-07 Corey Minyard * utils.c, controller.c, dataxfer.c: Return an errno from scan_tcp_port() so it can return an out of memory error. * controller.c, controller.h, ser2net.c: Add an out of memory return code from controller_init(). 2013-07-31 Longshine * utils.c: Copy input string to a temporary buffer before calling strtok_r in scan_tcp_port. 2013-07-28 Corey Minyard * configure.ac: Move to version 2.9.1. There was an issue with the configure setup. So autoreconf and redistribute. 2013-07-26 Corey Minyard * dataxfer.c: Fix a bug in format strings where hex element (\x) would have the wrong values for a-f. Pointed out by Galen Seitz. 2013-07-26 Corey Minyard * configure.ac: Version 2.9. 2013-07-25 Yegor Yefremov * Make RFC2217 signature configurable: Add '-s' option to configure default signature, that can be requested via RFC2217 protocol (option 0). Add per port signature via SIGNATURE keyword. 2013-06-29 Yegor Yefremov * dataxfer.c: The baudrate, that will be sent to the client, was converted twice: first with htonl() and then via copying to the buffer. As result 38400 was transferred as 6500960000 instead of 6500009600. 2013-05-07 Corey Minyard * buffer.c: Add a buffer wrap that was missed, identified by Brian Rzycki. 2013-03-01 Corey Minyard * Makefile.am: Added 'ACLOCAL_AMFLAGS = -I m4' as suggested by libtoolize. * configure.in -> configure.ac * configure.ac: Add 'AC_CONFIG_MACRO_DIR([m4])' as suggested by libtoolize. * configure.ac: Version 2.8. 2013-02-28 Corey Minyard * dataxfer.c, readconfig.c: Properly handle an empty string passed as a banner, openstr, or closestr. 2013-01-29 Corey Minyard * utils.h, utils.c: Have scan_tcp_port() take the domain. * dataxfer.c, controller.c: If the socket open fails with EAFNOSUPPORT, retry the address with IF_INET (IPV4-only). This way the call will still work even if IPV6 is disabled. 2012-12-19 Corey Minyard * README: Add info on how to generate configure and friends. 2012-12-13 Jordi Riera-Babures , Corey Minyard * devcfg.c: Add support for a bunch of high-speed baud rates. 2012-12-07 Corey Minyard * utils.c: Change hints.ai_family from AF_INET6 to AF_UNSPEC. That way it won't force IPV6, but it will return either. I think that's right. 2012-12-04 Corey Minyard * utils.c, utils.h: Modify scan_tcp_port to return the length of the socket info returned by getaddrinfo(). * controller.c, dataxfer.c: Use the length returned by scan_tcp_port(), not the size of sockaddr_storage, for the length of the socket information. 2012-09-26 Corey Minyard * configure.in: Move to 2.8-rc3 * dataxfer.c, dataxfer.h, selector.c, selector.h, ser2net.c: Add clean shutdown handling so locks are properly removed when the program is killed with SIGINT. * dataxfer.c: Modify the lock files to be Linux FHS compliant. 2012-09-10 Corey Minyard * dataxfer.c: Fix a bug reported by Jan-Benedict Glaw, where port->dinfo.openstr may be NULL, but srdup is called on it without checking. Add a check. 2012-07-23 qchats lee * dataxfer.c: My change for this did not match Qchats' change, so fix that. * utils.c: Fix the write_full() function to handle the return result properly; the parenthesis in the if statement ended in the wrong place. 2012-07-22 qchats lee * dataxfer.c: Add a missing ")" after the "OPEN(..." when header tracing. 2012-04-18 Corey Minyard * buffer.c, buffer.h, Makefile.am: Added a new type and set of operations for buffer handling. This simplifies and allows abstraction of other parts of the code. * dataxfer.c, telnet.c, telnet.h, controller.c: Switch out_telnet_cmd and associated parts to be the new buffer type. * dataxfer.c: Switch the banner over to the new buffer type. * dataxfer.c: Consolidate banner and filename string handling. Note that there was an issue with \s, as it was something different in banners and filenames. Added new options, \S (for seconds) and \B (for serial port parameters) to resolve this issue, and \s is backwards compatible but deprecated. * ser2net.8, ser2net.conf: Since the consolidated banner/filename processing allows all the \ options to be available for both banners and filenames, rework the documentation. * dataxfer.c: Convert the main I/O buffers for data transfer to the new buffer type. * devcfg.h, devcfg.c, readconfig.c, utils.h: Added a new OPENSTR and CLOSESTR option for the configuration file. These are strings that will be transmitted to the device when a port is opened and/or closed. * ser2net.8, ser2net.conf: Added docs for the OPENSTR and CLOSESTR options. * dataxfer.c: Handle the new OPENSTR and CLOSESTR options. This required adding a new state, PORT_CLOSING, for the tcp_to_dev_state to say that the port is closing but data is going out, and splitting up the shutdown handling. * utils.c: Fixed a bug that cause the "port in use" error on the TCP connection to be printed strangely. * dataxfer.c: Since the banner handling no longer depends on being able to put the whole banner in the output buffer, reduce the port buffer sizes to 64 bytes to reduce memory usage * selector.c: maxfd was not initialized for a selector, fix that. * configure.in: Move to 2.8-rc2. 2012-04-04 Corey Minyard * dataxfer.c: Turn on the tcp write handler at first for raw sockets, otherwise the banner won't come out till some data comes in on the port. 2012-04-03 Corey Minyard * devcfg.c: Add 600 baud. 2012-03-27 Corey Minyard * ser2net.c, readconfig.c, ser2net.h, controller.c, ser2net.conf: Add a method to specify the control port in the ser2net config file. * dataxfer.c, controller.c: Add SO_KEEPALIVE to socket connections so the connection will drop if the other end just goes away. * configure.in: Move to 2.8-rc1. 2011-08-12 Corey Minyard * dataxfer.c: Fix some unaligned write issues in telnet options. * dataxfer.c: Fix some signed/unsigned comparison issues and a typo. 2011-06-22 Corey Minyard * utils.h, utils.c, controller.c, dataxfer.c: Fix some warnings about the write() return value not being checked. These were almost all cases where a failure didn't matter (tracing), except for writing the pid file, where it should have been a handled failure. * dataxfer.c: Cleaned up some style issues in the UUCP locking code. * ser2net.c: Fixed a warning about not checking the chdir() return code, and added some improved logging information to syslog. 2010-03-11 Mats Erik Andersson , Corey Minyard * controller.c, dataxfer.c, utils.c, utils.h: Add IPV6 address compatibility. 2009-11-12 Corey Minyard * ser2net.spec, ser2net.spec.in: Fix the version in the spec file to be updated automatically. 2009-11-12 Philip Gwyn * dataxfer.c, devcfg.c, devcfg.h, ser2net.8: Add the ability to dump trace files in a binary format with timestamps. 2009-11-03 Corey Minyard * configure.in: Move version to 2.7 for release. 2009-10-23 Corey Minyard * configure.in: Move to 2.7-rc3. * dataxfer.c, devcfg.c, devcfg.h, ser2net.h: Modified the tb= directive to work separately from tw= and tr=, so you can do all three at the same time independently. * readconfig.c: Improved an error report. 2009-10-22 Corey Minyard * ser2net.c: Set up routing errors to stderr before reading the config so config errors come out properly to stdout. * ser2net.8, ser2net.conf: Fix the documentation, it's tw=, not tw: for the tracefile stuff. * configure.in: Move to 2.7-rc2. 2009-10-15 Corey Minyard * dataxfer.c, devcfg.c, readconfig.c, ser2net.8, ser2net.conf: Add the ability to trace data read written to trace files. 2009-07-19 Geoff Simmons * ser2net.conf: Some documentation cleanup, added missing docs for the timeout parameter. * README - Minor doc cleanup. 2009-07-15 Corey Minyard * configure.in: Move to version 2.6. 2009-06-30 Corey Minyard * dataxfer.c, devcfg.c, devcfg.h, readconfig.h, utils.h: Add the a TRACEFILE option to trace all I/O to a file., and separate out the defconfig into a separate structure to avoid passing a boatload of things to the config. 2009-06-30 Sebastian Andrzej Siewior * controller.c: Fix use after free in controller The controller will use its dynamically allocated data after it got free() in error path. What we see in syslog is: Jun 30 10:26:38 consrv3 ser2net[3073]: read error for controller port: Connection reset by peer Jun 30 10:26:39 consrv3 ser2net[3073]: The tcp write for controller had error: Bad file descriptor The first error is "legal" because the destination decided to close its socket a little to early than expected. The second error is already bad because it tries to use already deallocated fd. Later we segfault. 2007-11-16 Corey Minyard * configure.in: Move to version 2.5. 2007-11-16 Harry Flick, Corey Minyard * devcfg.c, devcfg.h, dataxfer.c, ser2net.conf, ser2net.8: Allow a "NOBREAK" option to disable automatically messing with the break operations on the serial port. Useful for systems with a broken break. 2007-11-16 Robert Edmonds ,Corey Minyard * ser2net.c, ser2net.8: Add a '-P' option to specific that a pidfile be created. 2007-05-03 Corey Minyard * dataxfer.c: Change the rfc2217 signature response code from 0 to 100. Best guess on what this should be, as the RFC doesn't give the correct value and says "text". 2007-04-26 Corey Minyard * dataxfer.c: Disable the Nagle algorithm (enable TCP_NODELAY) on the TCP ports to avoid long delays on short pieces of data. * configure.in: Move to version 2.4. 2007-03-19 Corey Minyard * dataxfer.c: Use the proper value for modem data notifies sent to the client, it was 7, use 107 instead. 2006-12-01 Corey Minyard * readconfig.c: Handle an ending banner that does not have a '\n' in the last line. 2006-01-16 Corey Minyard * ser2net.8: Fix the documentation for control ports. 2006-01-09 Corey Minyard * dataxfer.c: Don't kill the session if TIOCCBRK doesn't work. 2005-12-29 Corey Minyard * dataxfer.c, devcfg.c, devcfg.h, ser2net.conf, ser2net.8: Added a '\s' banner token for printing out the serial parameters. * ser2net.conf: Cleaned up the ugly banner3. * Makefile.am: Add ser2net.init to EXTRA_DIST. * configure.in: Move to version 2.3. 2005-12-29 Aurelien Jarno * devcfg.c: Don't include "termio.h", but do include "sys/ioctl.h". 2005-10-20 Corey Minyard * dataxfer.c: Fixed a problem with rfc2217 stop bit size setting. It was interpreting the value of "3" as 2 stop bits, but 3 is for 1.5 stop bits, and 2 is for 2 stop bits. * controller.c: Fixed some warnings dealing with char/unsigned char problems. * dataxfer.c: ditto * telnet.c: ditto 2005-08-25 Corey Minyard * dataxfer.c: Fix a problem with EAGAIN just returning and not retrying the operation on writing data that has just been read. Thanks to Shinlun Hsieh for pointing this out. 2005-07-07 G Goodwill * dataxfer.c, devcfg.c: Added support for cygwin. 2005-07-07 Rajiv Aaron Manglani * configure.in: Make the use of tcp wrappers optional. 2005-06-13 Yura Kalinichenko * controller.c, devcfg.c, ser2net.8, ser2net.conf: Added 57600 baud support. * dataxfer.c: Don't to breaks on printer lines. 2005-02-12 Corey Minyard * configure.in: Move to version 2.2. 2005-02-11 Corey Minyard * dataxfer.c: Add a missing break statement after case 7 in the com_port_handler() function. 2004-11-29 Corey Minyard * dataxfer.c: Remove UUCP lock if the setup of the device fails. 2004-05-08 Marc Haber * ser2net.h: Set the man page section to the right value. 2004-01-24 Corey Minyard * dataxfer.c: Don't attempt to disconnect an unconnected port. 2003-12-20 Corey Minyard * dataxfer.c, ser2net.8: Added the ability to have port 0 mean use standard in/out. This way, you can invoke ser2net from inetd. * devcfg.c: Allow "," to be used as an option separator. * readconfig.c: Fix handling of lines coming from "-C". * ser2net.c: Move creation of the selector to before the option processing, for support of "-C'. 2003-12-19 Corey Minyard * dataxfer.c: Handle receive IACs from the terminal to the TCP port, duplicating them so they will come through right. * telnet.c: Reset the telnet protocol state after two IACs are received. * readconfig.c, readconfig.h, ser2net.c, ser2net.8: Added a way to specify individual config lines on the command line so that no config file is necessary. 2003-12-04 Corey Minyard * dataxfer.c: Add responses for all the telnet com port control commands that we handle. * telnet.c: Fixed IAC processing in suboption to be able to handle a stream of IACs properly. 2003-12-04 Corey Minyard * configure.in: Moved to version 2.1. * dataxfer.c: Have the telnet option responses use the 1xx responses to the com port control options. I believe this is wrong, but it is consistent with other products already in the field. * dataxfer.c, ser2net.c, telnet.h: Added support for setting the use of Cisco IOS baud rates instead of RFC 2217 ones, by command option. * selector.c, ser2net.c: Cleaned up some compile warnings. 2003-10-14 Corey Minyard * configure.in: Moved to version 2.0. * datafer.c, devcfg.c, devcfg.h, readconfig.c, utils.h: Added banner support. * ser2net.h, ser2net.conf: Added documentation for banner support. * dataxfer.c, telnet.c, telnet.h: Created a more generic telnet command handler and split it off from dataxfer.c * controller.c: Moved to the new telnet command handler. * dataxfer.c: Added watching the CD, RI, etc. lines. 2003-10-13 Corey Minyard * dataxfer.c: Added a lot of the com port control handling. 2003-10-12 Corey Minyard * dataxfer.c: Added real telnet option processing infrastructure, getting read for com port control handling. 2003-04-22 Corey Minyard * configure.in, ser2net.spec: Move to version 1.9. * selector.c: Turned off debugging code that accidentally got left on. 2003-02-14 Corey Minyard * configure.in, ser2net.spec: Move to version 1.8. * dataxfer.c: Do a tcflush(fd, TCOFLUSH) before closing the serial device, this avoids blocking on close. 2002-11-29 Corey Minyard * selector.c: More timer heap bugs. 2002-10-01 Corey Minyard * selector.c: Fixed bugs in the timer heaps. 2002-09-23 Corey Minyard * selector.c: Fixed a bug in the timer heaps. 2002-09-09 Corey Minyard * all: Reworked the selector code to make timers more general. 2002-07-24 Corey Minyard * dataxfer.c: Fixed a bug with handling config errors, when an error occurs in the wrong place it will segv. 2002-04-04 Corey Minyard * util.c: added the final return value to scan_tcp_port. 2002-02-20 Corey Minyard * controller.c, dataxfer.c, dataxfer.h, ser2net.8: Added a "short" display, where each port is shown on one line. * dataxfer.c, dataxfer.h, readconfig.c, selector.c, selector.h, ser2net.8, ser2net.c: Added the ability to reread the configuration file on a SIGHUP. * configure.in, ser2net.spec: Moved to version 1.6 2002-02-20 Przemyslaw Czerpak (druzus@polbox.com), Corey Minyard * dataxfer.c, dataxfer.h, configure.in, ser2net.c, ser2net.8: Added UUCP-style locking for ports. 2002-02-19 Corey Minyard * controller.c, controller.h, dataxfer.c, devcfg.c, ser2net.c, ser2net.conf, ser2net.8, utils.c utils.h: Added support for specifying the IP address with the port to bind to specific interfaces. * dataxfer.c: Added counting the input and output bytes. 2002-02-19 Przemyslaw Czerpak (druzus@polbox.com) * controller.c, dataxfer.c, devcfg.c, ser2net.c, ser2net.conf, ser2net.8: Added support for turning on/off RTS/CTS, XON/XOFF, and LOCAL. Also added support for raw LP devices. 2001-10-05 Przemyslaw Czerpak (druzus@polbox.com) * controller.c, dataxfer.c, devcfg.c, ser2net.init, ser2net.spec: Added an init, and cleaned up a bunch of type warnings. * devcfg.c, ser2net.8, ser2net.conf: Added support for RTS/CTS. 2001-08-11 Corey Minyard * devcfg.h, devcfg.c, controller.c, dataxfer.c, dataxfer.h, ser2net.8: Ben Adams sent a patch to control the DTR and RTS lines, I rewrote it to make a new command to do this (instead of using devconfig, which didn't really match the devconfig's operation). * configure.in, ser2net.spec: Updated to version 1.5 2001-07-26 Corey Minyard * devcfg.c - Added CREAD to the cflags so the serial port will work, patch from Andreas Pfaller. * dataxfer.c - Added binary transmission to the list of telnet opeions, again from Andreas Pfaller. 2001-07-23 Corey Minyard * devcfg.c, ser2net.8, ser2net.conf - Added a patch from Martin Boese to add CLOCAL and XON/XOFF support as serial port options. 2001-07-03 Corey Minyard * Makefile.am, ser2net.1, ser2net.8, ser2net.spec - Moved ser2net to /usr/sbin, renamed the makefile to have a .8 extension and put it in /usr/share/man. * controller.c - Fixed problems with telnet handling in the control interface. * Updated to version 1.4 2001-06-29 Corey Minyard * ser2net.spec - Actually put the changed version number in the file, set the prefix to '/usr'. * configure.in - Added libnsl for Redhat systems, changed to AC_CHECK_LIB. * all - changed to version 1.3. 2001-06-28 Corey Minyard * dataxfer.c - Added the ability to convert a telnet break to a serial port break. * configure.in - Updated to version 1.3 * ser2net.spec - Added this file for RPM building, from Ivan Francolin Martinez. * dataxfer.c - Added a tcp_wrappers implementation, from Ivan Francolin Martinez. However, some configure work needs to be done to make it actually work properly. * dataxfer.c, controller.c, configure.in, ser2net.1 - Fixed the tcp_wrappers stuff to work properly, did the config stuff for it, and added it to the control port as well. 2001-06-15 Corey Minyard * controller.c - Made sure the monitor port was set to null when the port exited. * ser2net.c, ser2net.1 - Added a "-d" option to send debug output to the console and modified "-n" to just not detach. 2001-06-05 Corey Minyard * ser2net.c, controller.c - added a way to query the version from the command line and from the controller port. * controller.c, controller.h, dataxfer.c, dataxfer.h - added monitoring of data flowing into a port. It's somewhat primitive yet, but still useful * controller.c, dataxfer.c, dataxfer.h - added a way to disconnect a port from the control port. 2001-06-04 Corey Minyard * Initial creation. gensio-2.3.5/FAQ.rst000066400000000000000000000065101414562043000141470ustar00rootroot00000000000000========== gensio FAQ ========== Here are some answer to questions about gensio. * Why did you create gensio? Originally gensio was part of ser2net (https://sourceforge.net/projects/ser2net). I was rewriting ser2net to add in encryption and authentication, and I needed some sort of layered protocol handling to do this. I realized that I had a fairly general purpose library that I couldn't find anything else like (except maybe System V Streams? remember those?), so it made sense to split it out into it's own thing. It then grew to add things on I needed for other reasons, or to provide proof of concept. * Why don't you have ssh support? I would dearly love to have ssh support. However, I can't find a library that is really suitable. The openssh and libssh2 code only lets you have a single connection at a time and uses tons of global variables. Obviously not suitable. libssh might work, but it is not nicely layered where I could split it out and provide just a protocol layer without sockets underneath. It might be possible to integrate libssh as a base gensio, but I didn't like that very much. libwebsockets has a client implementation that might work, but it's only a client implementation. If anyone knows of a suitable library, I'd be happy to hear about it. * You wrote a mux implementation. Why didn't you use websockets? That was my first inclination. However, websockets has no mechanism for flow control. I almost didn't believe it at first. The websocket description talks about the user implementing their own flow control. Take the hardest part of the problem and pass it to the user. The design of gensio is all about flow-control. If I used websockets, I'd have to write a flow-control implementation on top of it, and that would be non-standard anyway. * Why did you write gtlssh and gtlsshd? Isn't ssh good enough? Well, ssh is fine, I use it all the time. gtlssh and gtlsshd were written more as a proof of concept to make sure I got all the pieces necessary to implement proper authentication with a reasonable amount of flexibility. With that said, they provide about everything that ssh can do except for X11 forwarding, which is kind of a pain. And they are only about 1500 LOC each. The only really annoying thing about them is that keys expire, since they are based on SSL. Which is probably a good thing, since keys need to be replaced every once in a while. gtlssh will warn you if you key expires in less than 30 days. If that's too much of a problem, make keys that expire in 100 years. * What's the deal with SCTP? SCTP is a nice protocol for a number of reasons. It has multi-homing, meaning that both sides communicate all the IP addresses that they have, and communicate when they change, and use all of them. So you could have a connection stay up even if a server transitions over to new IP addresses. It has better protection agains SYN attacks. A few other things. That said, the current implementations of SCTP (at least the one on Linux) leave something to be desired. There are performance issues and some unimplemented features. * Is IPv6 supported? Of course. Full support. The documentation describes how to use it. The library tries to make unsurprising decisions, but everything can be overridden. gensio-2.3.5/Makefile.am000066400000000000000000000011531414562043000150400ustar00rootroot00000000000000 ACLOCAL_AMFLAGS = -I m4 SUBDIRS = lib $(CPLUSPLUS_DIR) include $(SWIG_DIR) $(GLIB_DIR) $(TCL_DIR) \ tests tools examples if INSTALL_DOC SUBDIRS += man endif DIST_SUBDIRS = lib c++ include swig glib tcl tests tools examples man EXTRA_DIST = README.rst reconf CMakeLists.txt config.h.cmake # Set distcheck up so python files get installed someplace that will # work, and enable internal trace so oomtest will work. AM_DISTCHECK_CONFIGURE_FLAGS=--enable-internal-trace \ --with-pythoninstall=$(abs_top_builddir)/$(distdir)/_inst/lib/python \ --with-pythoninstalllib=$(abs_top_builddir)/$(distdir)/_inst/lib/python gensio-2.3.5/NEWS000066400000000000000000000000251414562043000135000ustar00rootroot00000000000000No news is good news gensio-2.3.5/README000066400000000000000000000000171414562043000136620ustar00rootroot00000000000000See README.rst gensio-2.3.5/README.rst000066400000000000000000001007731414562043000145030ustar00rootroot00000000000000=========================== gensio - General Stream I/O =========================== This is gensio (pronounced gen'-see-oh), a framework for giving a consistent view of various stream (and packet) I/O types. You create a gensio object (or a gensio), and you can use that gensio without having to know too much about what is going on underneath. You can stack gensio on top of another one to add protocol funcionality. For instance, you can create a TCP gensio, stack SSL on top of that, and stack Telnet on top of that. It supports a number of network I/O and serial ports. gensios that stack on other gensios are called filters. You can do the same thing with receiving ports. You can set up a gensio accepter (accepter) to accept connections in a stack. So in our previous example, you can setup TCP to listen on a specific port and automatically stack SSL and Telnet on top when the connection comes in, and you are not informed until everything is ready. A *very* important feature of gensio is that it makes establishing encrypted and authenticated connections much easier than without it. Beyond basic key management, it's really no harder than TCP or anything else. It offers extended flexibility for controlling the authentication process if needed. It's really easy to use. Note that the gensio(5) man page has more details on individual gensio types. Building ======== This is a normal autoconf system, nothing special. Note that if you get this directly from git, you won't have the build infrastructure included. There is a script named "reconf" in the main directory that will create it for you. If you don't know about autoconf, the INSTALL file has some info, or google it. To fully build gensio, you need the following: * swig - For python bindings * python dev libraries - For python bindings * openssl dev libraries and executable - For all the crypto * openipmi dev libraries - For IPMI serial over lan, if you want that. Note that you need a pretty recent one, really 2.0.31 or newer. * libsctp dev library - For sctp support * pkgconfig - If you want gensio to install its pkgconfig files. * avahi dev - If you want gensio to have mdns support. * pam dev - For support of logins with gtlsshd * libwrap - for tcpd * glib dev - for the glib os funcs * tcl dev - for the tcl os funcs The following sets everything except openipmi up on ubuntu 20.04: sudo apt install gcc g++ git swig python3-dev libssl-dev pkg-config \ libavahi-client-dev avahi-daemon libtool autoconf automake make \ libsctp-dev libpam-dev libwrap0-dev libglib2.0-dev tcl-dev \ Handling python installation configuration is a bit of a pain. By default the build scripts will put it wherever the python program expects installed python programs to be. A normal user generally doesn't have write access to that directory. To override this, you can use the --with-pythoninstall and --with-pythoninstalllib configure options or you can set the pythoninstalldir and pythoninstalllibdir environment variables to where you want the libraries and modules to go. gensio tools ============ A couple of tools are available that use gensios, both as an example and for trying things out. These are: gensiot A tool for making basic gensio connections. You can create any arbitrary gensio setup you like. See gensiot(1) for details. gtlsshd An sshd-like daemon that uses certauth, ssl, and SCTP or TCP gensios for making connections. It uses standard PAM authentication and uses ptys. See gtlsshd(8) for details. gtlssh An ssh-like program that can connect to gtlsshd. It can also be used with ser2net to make establishing encrypted and authenticated connections easier. See gtlssh(1) for details. Available gensios ================= The following gensios are available in the library: sctp Normal SCTP communication. Streams and out of bound data are supported. End of message demarcation is not supported because it doesn't currently work on Linux. tcp Normal TCP communication. Out of bound data is supported. udp Sort-of connection oriented UDP. stdio Access to either the calling program's stdio, or the ability to run a program and connect to its stdin, stdout, and stderr. NOTE: Do not use this for file I/O. Use the file gensio. file Used for accessing files. Allows both input and output file, and streams the data to/from the files. No accepter available. pty Run a program in a PTY and use the gensio to communicate with its tty. No accepter available. serialdev Connect to a device. It can hook to termios type devices, more than just serial ports. It also has a write-only option for talking to printer ports. No accepter available. ipmisol Connect to a remote over IPMI SOL. Full serial port capabilities are available. No accepter available, unfortunately. dummy An accepter that doesn't do anything except look like an accepter to the user. Useful in some situations where an accepter is expected but you don't need to do anything. echo A gensio that echos everything that is sent to it. Useful for testing. No accepter available. telnet A filter gensio that implements the telnet protocol. It can do full serial support with RFC2217. ssl Implement SSL/TLS as a gensio filter. It supports client authentication, too. certauth A user authentication protocol implemented as a gensio filter. mux A channel multiplexer. You can create channels on top of it using open_channel(). Channels work as normal gensio, so you can have a number of gensios running on top of a single gensio. It also has end-of-message demarcation and obviously full flow-control capability individually on each channel. If you just need a gensio with end-of-message demarcation, you can use this as without creating channels. msgdelim Converts an unreliable stream interface into an unreliable packet interface. This is primarily so a reliable packet interface like relpkt can run over a serial port. It does not support streaming of data, so it's not very useful by itself. relpkt Converts an unreliable packet interface to a reliable packet interface (that also supports streaming). Made for running over msgdelim. It will run over UDP, but it's not ideal for that because it doesn't do all the internet-friendly flow control and such that SCTP and TCP do. trace A transparent gensio that allows the data read and/or written to be sent to a file, either as raw data or as human-readable hex data. It can also be used to block data flowing in one or both directions. perf A gensio that can send/receive data on top of a stack of gensios and measure the throughput on the channel. The received data from perf is information about the channel throughput. conacc A gensio accepter that takes a gensio stack string as a parameter. This lets you use a gensio as an accepter. When conacc is started, it opens the gensio, and when the gensio opens it reports a new child for the accepter. When the child closes it attempts to open the child again and go through the process again (unless accepts have been disabled on conacc). Why would you want to use this? Say in ser2net you wanted to connect one serial port to another. You could have a connection like: .. code-block:: yaml connection: &con0 accepter: conacc,serialdev,/dev/ttyS1,115200 connector: serialdev,/dev/ttyS2,115200 And it would connect /dev/ttyS1 to /dev/ttyS2. Without conacc, you could not use serialdev as an accepter. It would also let you use gtlsshd on a serial port if you wanted encrypted authenticated logins over a serial port. If you ran gtlsshd with the following: .. code-block:: bash gtlsshd --notcp --nosctp --oneshot --nodaemon --other_acc 'conacc,relpkt(mode=server),msgdelim,/dev/ttyUSB1,115200n81' You could connect with: .. code-block:: bash gtlssh --transport 'relpkt,msgdelim,/dev/ttyUSB2,115200n81' USB2 This creates a reliable packet transport over a serial port. The mode=server is required to make relpkt run as the server, since it would normally run as a client since it is not being started as an accepter. The ssl gensio (which runs over the transport) requires reliable communication, so it won't run directly over a serial port. mdns This gensio uses mDNS to lookup a service (protocol type, network type, port, address) and then connect to that service. If you have a program like ser2net that advertise mDNS service, you don't have to worry about finding port numbers and such, it's all handled for you. These are all documented in detail in gensio(5). Unless otherwise stated, these all are available as accepters or connecting gensios. You can create your own gensios and register them with the library and stack them along with the other gensios. mDNS support ============ The mdns gensio has already been discussed, but the gensio library provides an easy to use mDNS interface. The include file for it is in gensio_mdns.h, and you can use the gensio_mdns(3) man page to get more information on it. To make an mdns connection using gensiot, say you have ser2net set up with mdns enabled like: .. code-block:: yaml connection: &my-port accepter: telnet(rfc2217),tcp,3001 connector: serialdev,/dev/ttyUSB1,115200N81 options: mdns: true then you can connection to it with gensiot: .. code-block:: bash gensiot 'mdns,my-port' gensiot will find the server, port, and whether telnet and rfc2217 are enabled and make the connection. In addition, there is an gmdns tool that lets you do queries and advertising, and gtlssh can do mDNS queries to find services. If you have secure authenticated logins for ser2net, and you enable mdns on ser2net, like: .. code-block:: yaml connection: &access-console accepter: telnet(rfc2217),mux,certauth(),ssl,tcp,3001 connector: serialdev,/dev/ttyUSBaccess,115200N81 options: mdns: true it makes the setup very convenient, as you can just do: .. code-block:: bash gtlssh -m access-console That's right, you can just directly use the connection name, no need to know the host, whether telnet or rfc2217 is enabled, or what the port is. You still have to set up the keys and such on the ser2net server, of course, per those instructions. General Concepts ================ gensio has an object oriented interface that is event-driven. Synchronous interfaces are also available. You deal with two main objects in gensio: a gensio and a gensio accepter. A gensio provides a communication interface where you can connect, disconnect, write, receive, etc. A gensio accepter lets you receive incoming connections. If a connection comes in, it gives you a gensio. The interface is event-driven because it is, for the most part, completely non-blocking. If you open a gensio, you give it a callback that will be called when the connection is up, or the connection fails. Same for close. A write will return the number of bytes accepted, but it may not take all the bytes (or even any of the bytes) and the caller must account for that. The open and close interfaces have a secondary blocking interface for convenience. These end in _s. This is for convenience, but it's not necessary and use of these must be careful because you can't really use them from callbacks. Speaking of callbacks, data and information coming from gensio to the user is done with a function callback. Read data, and when the gensio is ready for write data comes back in a callback. A similar interface is used for calling from the user to the gensio layer, but it is hidden from the user. This sort of interface is easily extensible, new operations can be easily added without breaking old interfaces. The library provides several ways to create a gensio or gensio accepter. The main way is str_to_gensio() and str_to_gensio_accepter(). These provide a way to specify a stack of gensios or accepters as a string and build. In general, you should use this interface if you can. In general, interfaces that are not performance sensitive are string based. You will see this in gensio_control, and in auxiliary data in the read and write interface to control certain aspects of the write. The library also provides ways to set up your gensios by individually creating each one. In some situations this might be necessary, but it limits the ability to use new features of the gensio library as it gets extended. If a gensio supports multiple streams (like SCTP), stream numbers are passed in the auxdata with "stream=n". Streams are not individually flow controlled. Channels, on the other hand, are separate flows of data over the same connection. Channels are represented as separate gensios, and they can be individually flow controlled. Include Files ============= There are a few include files you might need to deal with when using gensios: gensio.h The main include files for gensios and gensio accepters. sergensio.h Serial port handling gensios and gensio accepters. gensio_os_funcs.h The definition for an OS handler. argvutils.h Many gensio functions take an argv array, this is utilities for dealing with argvs. gensio_selector.h A definition for a default OS handler. These are for the most part documented in the man pages. For creating your own gensios, the following include files are available for you: gensio_class.h The main include file for creating your own gensio. sergensio_class.h The main include file for creating your own serial port gensio. gensio_base.h This handles a lot of the boiler plate for a gensio. Most of the standard gensios use this. It splits the gensio function into an optional filter, and a lower layer interface called an ll. gensio_ll_fd.h An ll that provides most of the boilerplate for dealing with a file descriptor. gensio_ll_gensio.h An ll that provides all that is necessary for stacking a gensio on top of another gensio. The filter gensios (telnet, ssl, etc.) use this as the ll. Each include file has lots of documentation about the individual calls and handlers. Errors ====== gensio has it's own set of errors to abstract it from the OS errors (named GE_xxx) and provide more flexibility in error reporting. These are in the gensio_err.h include file (automatically included from gensio.h) and may be translated from numbers to a meaningful string with gensio_err_to_str(). Zero is defined to be not an error. If an unrecongnized operating system error occurs, GE_OSERR is returned and a log is reported through the OS handler log interface. OS Handler ========== One slightly annoying thing about gensio is that it requires you to provide an OS handler (struct gensio_os_funcs) to handle OS-type functions like memory allocation, mutexes, the ability to handle file descriptors, timers and time, and a few other things. The library does provide several OS handlers. The get the default one for your system (POSIX or Windows) call gensio_default_os_hnd(). You can see that man page for more details. This will generally be the best performing option you have for your system. For POSIX systems, OS handlers for glib and TCL are available, allocated with gensio_glib_funcs_alloc() and gensio_tcl_funcs_alloc(). These really don't work very well, especially from a performance point of view, the APIs for glib and TCL are not well designed for what gensio does. TCL can only support single-threaded operation. glib multithreaded operation only has one thread at a time waiting for I/O. But they do work, and the tests are run with them. These are not available on Windows because of poor abstractions on glib and because of lack of motivation on TCL. But if you are using something else like X Windows, etc that has it's own event loop, you may need to adapt one for your needs. But the good thing is that you can do this, and integrate gensio with pretty much anything. There is also a waiter interface that provides a convenient way to wait for things to occur while running the event loop. This is how you generally enter the event loop, because it provides a convenient way to signal when you are done and need to leave the loop. Documentation for this is in:: include/gensio/gensio_os_funcs.h Creating a gensio ================= Connecting gensios ------------------ To create a gensio, the general way to do this is to call ``str_to_gensio()`` with a properly formatted string. The string is formatted like so:: [([