├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── INSTALL ├── NEWS ├── README ├── THANKS ├── TODO ├── cmake ├── build_configurations │ └── everything.cmake ├── cpack_config.cmake ├── maintainer_mode.cmake └── modules │ ├── COPYING-CMAKE-SCRIPTS │ ├── FindASan.cmake │ ├── FindEPOLL.cmake │ ├── FindGperftools.cmake │ ├── FindJeMalloc.cmake │ ├── FindKrb5.cmake │ ├── FindLTTng.cmake │ ├── FindMSan.cmake │ ├── FindNSL.cmake │ ├── FindNTIRPC.cmake │ ├── FindRDMA.cmake │ ├── FindSanitizers.cmake │ ├── FindTSan.cmake │ ├── FindTcMalloc.cmake │ ├── FindUBSan.cmake │ ├── FindWBclient.cmake │ ├── GetGitRevisionDescription.cmake │ ├── GetGitRevisionDescription.cmake.in │ ├── LibFindMacros.cmake │ └── sanitize-helpers.cmake ├── config-h.in.cmake ├── libntirpc.pc.in.cmake ├── libntirpc.spec-in.cmake ├── man ├── bindresvport.3t ├── des_crypt.3t ├── getnetconfig.3t ├── getnetpath.3t ├── getrpcent.3t ├── netconfig.5 ├── publickey.3t ├── publickey.5 ├── rpc.3t ├── rpc.5 ├── rpc_clnt_auth.3t ├── rpc_clnt_calls.3t ├── rpc_clnt_create.3t ├── rpc_secure.3t ├── rpc_soc.3t ├── rpc_svc_calls.3t ├── rpc_svc_create.3t ├── rpc_svc_err.3t ├── rpc_svc_reg.3t ├── rpc_xdr.3t └── rpcbind.3t ├── ntirpc ├── fpmath.h ├── getpeereid.h ├── intrinsic.h ├── libc_private.h ├── lttng │ ├── rpcping.h │ └── xprt.h ├── misc │ ├── abstract_atomic.h │ ├── bsd_epoll.h │ ├── city.h │ ├── citycrc.h │ ├── event.h │ ├── opr.h │ ├── opr_queue.h │ ├── os_epoll.h │ ├── portable.h │ ├── queue.h │ ├── rbtree.h │ ├── rbtree_x.h │ ├── socket.h │ ├── stdint.h │ ├── stdio.h │ ├── timespec.h │ ├── wait_queue.h │ └── winpthreads.h ├── namespace.h ├── netconfig.h ├── reentrant.h ├── rpc │ ├── auth.h │ ├── auth_gss.h │ ├── auth_inline.h │ ├── auth_stat.h │ ├── auth_unix.h │ ├── clnt.h │ ├── clnt_stat.h │ ├── des.h │ ├── des_crypt.h │ ├── gss_internal.h │ ├── nettype.h │ ├── pmap_prot.h │ ├── pmap_rmt.h │ ├── pool_queue.h │ ├── rpc.h │ ├── rpc_cksum.h │ ├── rpc_com.h │ ├── rpc_err.h │ ├── rpc_msg.h │ ├── rpcb_clnt.h │ ├── rpcb_prot.h │ ├── rpcb_prot.x │ ├── rpcent.h │ ├── svc.h │ ├── svc_auth.h │ ├── svc_rqst.h │ ├── tirpc_compat.h │ ├── types.h │ ├── work_pool.h │ ├── xdr.h │ ├── xdr_inline.h │ └── xdr_ioq.h ├── rpcsvc │ └── crypt.h └── un-namespace.h ├── src ├── CMakeLists.txt ├── auth_gss.c ├── auth_none.c ├── auth_unix.c ├── authgss_hash.c ├── authgss_prot.c ├── authunix_prot.c ├── bindresvport.c ├── bsd_epoll.c ├── city-test.c ├── city.c ├── citycrc.h ├── clnt_bcast.c ├── clnt_dg.c ├── clnt_generic.c ├── clnt_internal.h ├── clnt_perror.c ├── clnt_raw.c ├── clnt_rdma.c ├── clnt_simple.c ├── clnt_vc.c ├── des_crypt.c ├── des_soft.c ├── getnetconfig.c ├── getnetpath.c ├── getpeereid.c ├── getpublickey.c ├── getrpcent.c ├── key_call.c ├── key_prot_xdr.c ├── libntirpc.map.in.cmake ├── lttng │ ├── CMakeLists.txt │ ├── main.c │ ├── rpcping.c │ └── xprt.c ├── mt_misc.c ├── netname.c ├── netnamer.c ├── ntmakefile ├── pmap_prot.c ├── pmap_prot2.c ├── pmap_rmt.c ├── portable.c ├── rbtree.c ├── rbtree_x.c ├── rpc_callmsg.c ├── rpc_com.h ├── rpc_commondata.c ├── rpc_crc32.c ├── rpc_dplx_internal.h ├── rpc_dplx_msg.c ├── rpc_dtablesize.c ├── rpc_generic.c ├── rpc_prot.c ├── rpc_raw.h ├── rpc_rdma.c ├── rpc_rdma.h ├── rpcb_clnt.c ├── rpcb_prot.c ├── rpcb_st_xdr.c ├── rpcdname.c ├── strlcat.c ├── strlcpy.c ├── svc.c ├── svc_auth.c ├── svc_auth_gss.c ├── svc_auth_none.c ├── svc_auth_unix.c ├── svc_dg.c ├── svc_generic.c ├── svc_internal.h ├── svc_ioq.c ├── svc_ioq.h ├── svc_raw.c ├── svc_rdma.c ├── svc_rqst.c ├── svc_simple.c ├── svc_vc.c ├── svc_xprt.c ├── svc_xprt.h ├── work_pool.c ├── xdr.c ├── xdr_float.c ├── xdr_ioq.c ├── xdr_mem.c ├── xdr_rdma.c └── xdr_reference.c ├── tests ├── CMakeLists.txt └── rpcping.c └── version-h.in.cmake /.gitignore: -------------------------------------------------------------------------------- 1 | # files generated by autoconf, automake, autoheader and libtoolize 2 | aclocal.m4 3 | autom4te.cache 4 | compile 5 | config.guess 6 | config.log 7 | config.sub 8 | configure 9 | depcomp 10 | install-sh 11 | libtool 12 | ltmain.sh 13 | Makefile.in 14 | missing 15 | config.h.in 16 | m4/* 17 | # files generated by configure 18 | confdefs.h 19 | config.status 20 | conftest 21 | conftest.c 22 | conftest.cpp 23 | conftest.er1 24 | conftest.err 25 | .deps 26 | Makefile 27 | config.h 28 | stamp-h1 29 | libtirpc.pc 30 | libntirpc.spec 31 | # file generated during compilation 32 | *.o 33 | *.lo 34 | .libs 35 | lib*.a 36 | src/libtirpc.la 37 | src/libtirpc_la-*.lo 38 | libntirpc.pc 39 | *.la 40 | # 41 | # generic editor backup et al 42 | *~ 43 | # cscope database files 44 | cscope.* 45 | # files generated by patches 46 | *.rej 47 | *.orig 48 | # files generated by debugging 49 | .gdb_history 50 | .gdbinit 51 | core 52 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Gilles Quillard 2 | Antoine Fraticelli 3 | Matt Benjamin 4 | 5 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Copyright (c) Bull S.A. 2005 All Rights Reserved. 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * 1. Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * 2. Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * 3. The name of the author may not be used to endorse or promote products 12 | * derived from this software without specific prior written permission. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | New in 0.1: 2 | * Portage from FreeBSD 5.2.1 (security part to be completed) 3 | * Use autoconf/automake 4 | 5 | New in 0.7: 6 | * Renamed to libntirpc for now 7 | 8 | New in 0.8 9 | * Added README.CONTRIBUTING 10 | * See git history. -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | NTIRPC - Transport-independent RPC (TI-RPC) 2 | 3 | To use this in a CMake-based project, copy cmake/modules/FindNTIRPC.cmake into 4 | your project, and add: 5 | 6 | find_package(NTIRPC [] [REQUIRED]) 7 | 8 | where is the minimum version needed (e.g. 1.3.0) and REQUIRED is 9 | added if ntirpc is not optional. 10 | 11 | 12 | 13 | 14 | LIBTIRPC 0.1 FROM SUN'S TIRPCSRC 2.3 29 Aug 1994 15 | 16 | This package contains SunLib's implementation of transport-independent 17 | RPC (TI-RPC) documentation. This library forms a piece of the base of Open Network 18 | Computing (ONC), and is derived directly from the Solaris 2.3 source. 19 | 20 | TI-RPC is an enhanced version of TS-RPC that requires the UNIX System V 21 | Transport Layer Interface (TLI) or an equivalent X/Open Transport Interface 22 | (XTI). TI-RPC is on-the-wire compatible with the TS-RPC, which is supported 23 | by almost 70 vendors on all major operating systems. TS-RPC source code 24 | (RPCSRC 4.0) remains available from several internet sites. 25 | 26 | This release was a native source release, compatible for 27 | building on Solaris 2.3. It had been ported from FreeBSD 5.2.1 to GNU/Linux 28 | in 2004. 29 | 30 | Applications linked with this release's librpc must link with the United 31 | States domestic version of libcrypt in order to resolve the cbc_crypt() and 32 | ecb_crypt() functions. These routines are used with Secure RPC however all 33 | RPC programs that link with this release's librpc will need to link with the 34 | domestic libcrypt. 35 | 36 | WHAT'S NEW IN THIS RELEASE: TIRPCSRC 2.3 FROM SUN 37 | 38 | The previous release was TIRPCSRC 2.0. 39 | 40 | 1. This release is based on Solaris 2.3. The previous release was 41 | based on Solaris 2.0. This release contains a siginificant number of 42 | bug fixes and other enhancements over TIRPCSRC 2.0. 43 | 44 | 2. The RPC library is thread safe for all client-side interfaces 45 | (clnt_create, clnt_call, etc.). The server-side interfaces 46 | (svc_create, svc_run, etc.) are not thread safe in this release. The 47 | server-side interfaces will be made thread safe in the next release of 48 | TIRPCSRC. Please see the manual pages for details about which 49 | interfaces are thread safe. 50 | 51 | 3. As part of the work to make the RPC library thread-safe, rpcgen has 52 | been enhanced to generate thread-safe RPC stubs (the -M option). Note 53 | that this modifies the call-signature for the stub functions; the 54 | procedure calling the RPC stub must now pass to the stub a pointer to 55 | an allocated structure where results will be placed by the stub. See 56 | the rpcgen manual page and the rpcgen Programming Guide for details. 57 | 58 | What's New in ntirpc 59 | 60 | Non-cosmetic changes introduced in the ntirpc library include 61 | 62 | 1. Bi-directional operation 63 | 2. Full-duplex operation on the TCP (vc) transport 64 | 3. Thread-safe operating modes 65 | 3.1 new locking primitives and lock callouts (interface change) 66 | 3.2 stateless send/recv on the TCP transport (interface change) 67 | 4. Flexible server integration support 68 | 5. Event channels (remove static arrays of xprt handles, new EPOLL/KEVENT 69 | integration) 70 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | Thanks to for 2 | 3 | Aurelien Charbon TI-RPC portage from NetBSD 4 | 5 | BSD Communauty TI-RPC improvement from Sun implementation 6 | 7 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | * Support of DES & other security part 2 | * Provide tests 3 | * rpcgen command missing 4 | -------------------------------------------------------------------------------- /cmake/build_configurations/everything.cmake: -------------------------------------------------------------------------------- 1 | # Turn on everything in the options for a complete build 2 | 3 | #set(USE_TIRPC_IPV6 ON) # exports.c is broken here... 4 | set(_HANDLE_MAPPING ON) 5 | set(_NO_XATTRD OFF) 6 | set(USE_DBUS ON) 7 | 8 | message(STATUS "Building everything") 9 | -------------------------------------------------------------------------------- /cmake/cpack_config.cmake: -------------------------------------------------------------------------------- 1 | # A few CPack related variables 2 | set(CPACK_PACKAGE_NAME "ntirpc" ) 3 | set(CPACK_PACKAGE_VERSION "${PACKNAME}" ) 4 | set(CPACK_PACKAGE_VENDOR "NFS-Ganesha Project") 5 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Updated, multithreaded TiRPC library") 6 | 7 | # CPack's debian stuff 8 | SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "mbenjamin@redhat.com") 9 | 10 | set(CPACK_RPM_COMPONENT_INSTALL OFF) 11 | set(CPACK_COMPONENTS_IGNORE_GROUPS "IGNORE") 12 | 13 | # Tell CPack the kind of packages to be generated 14 | set(CPACK_GENERATOR "TGZ") 15 | set(CPACK_SOURCE_GENERATOR "TGZ") 16 | 17 | set(CPACK_SOURCE_IGNORE_FILES 18 | "/.git/;/.gitignore/;/.bzr/;~$;${CPACK_SOURCE_IGNORE_FILES}") 19 | 20 | set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") 21 | -------------------------------------------------------------------------------- /cmake/maintainer_mode.cmake: -------------------------------------------------------------------------------- 1 | SET( CMAKE_CXX_FLAGS_MAINTAINER "-Wall -Wabi" CACHE STRING 2 | "Flags used by the C++ compiler during maintainer builds." 3 | FORCE ) 4 | SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -Wall -Wimplicit -Wformat -Wmissing-braces -Wreturn-type -Wunused-variable -Wuninitialized -Wno-pointer-sign" 5 | CACHE STRING 6 | "Flags used by the C compiler during maintainer builds." 7 | FORCE ) 8 | SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER 9 | "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING 10 | "Flags used for linking binaries during maintainer builds." 11 | FORCE ) 12 | SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER 13 | "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING 14 | "Flags used by the shared libraries linker during maintainer builds." 15 | FORCE ) 16 | MARK_AS_ADVANCED( 17 | CMAKE_CXX_FLAGS_MAINTAINER 18 | CMAKE_C_FLAGS_MAINTAINER 19 | CMAKE_EXE_LINKER_FLAGS_MAINTAINER 20 | CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) 21 | # Update the documentation string of CMAKE_BUILD_TYPE for GUIs 22 | SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING 23 | "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Maintainer." 24 | FORCE ) 25 | -------------------------------------------------------------------------------- /cmake/modules/COPYING-CMAKE-SCRIPTS: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | 1. Redistributions of source code must retain the copyright 6 | notice, this list of conditions and the following disclaimer. 7 | 2. Redistributions in binary form must reproduce the copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | 3. The name of the author may not be used to endorse or promote products 11 | derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | -------------------------------------------------------------------------------- /cmake/modules/FindASan.cmake: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | # 3 | # Copyright (c) 4 | # 2013 Matthew Arsenault 5 | # 2015-2016 RWTH Aachen University, Federal Republic of Germany 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in all 15 | # copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # SOFTWARE. 24 | 25 | option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off) 26 | 27 | set(FLAG_CANDIDATES 28 | # Clang 3.2+ use this version. The no-omit-frame-pointer option is optional. 29 | "-g -fsanitize=address -fno-omit-frame-pointer" 30 | "-g -fsanitize=address" 31 | 32 | # Older deprecated flag for ASan 33 | "-g -faddress-sanitizer" 34 | ) 35 | 36 | 37 | if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY)) 38 | message(FATAL_ERROR "AddressSanitizer is not compatible with " 39 | "ThreadSanitizer or MemorySanitizer.") 40 | endif () 41 | 42 | 43 | include(sanitize-helpers) 44 | 45 | if (SANITIZE_ADDRESS) 46 | sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer" 47 | "ASan") 48 | 49 | find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH}) 50 | mark_as_advanced(ASan_WRAPPER) 51 | endif () 52 | 53 | function (add_sanitize_address TARGET) 54 | if (NOT SANITIZE_ADDRESS) 55 | return() 56 | endif () 57 | 58 | saitizer_add_flags(${TARGET} "AddressSanitizer" "ASan") 59 | endfunction () 60 | -------------------------------------------------------------------------------- /cmake/modules/FindEPOLL.cmake: -------------------------------------------------------------------------------- 1 | # - Find EPOLL 2 | # 3 | # This module defines the following variables: 4 | # EPOLL_FOUND = Was EPOLL found or not? 5 | # 6 | # On can set EPOLL_PATH_HINT before using find_package(EPOLL) and the 7 | # module with use the PATH as a hint to find EPOLL. 8 | # 9 | # The hint can be given on the command line too: 10 | # cmake -DEPOLL_PATH_HINT=/DATA/ERIC/EPOLL /path/to/source 11 | 12 | if (FREEBSD) 13 | set (EPOLL_FOUND ON) 14 | return () 15 | endif (FREEBSD) 16 | 17 | include(CheckIncludeFiles) 18 | include(CheckFunctionExists) 19 | 20 | check_include_files("sys/epoll.h" EPOLL_HEADER) 21 | check_function_exists(epoll_create EPOLL_FUNC) 22 | 23 | # handle the QUIETLY and REQUIRED arguments and set PRELUDE_FOUND to TRUE if 24 | # all listed variables are TRUE 25 | include(FindPackageHandleStandardArgs) 26 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(EPOLL REQUIRED_VARS EPOLL_HEADER EPOLL_FUNC) 27 | 28 | -------------------------------------------------------------------------------- /cmake/modules/FindGperftools.cmake: -------------------------------------------------------------------------------- 1 | # Tries to find Gperftools. 2 | # 3 | # Usage of this module as follows: 4 | # 5 | # find_package(Gperftools) 6 | # 7 | # Variables used by this module, they can change the default behaviour and need 8 | # to be set before calling find_package: 9 | # 10 | # Gperftools_ROOT_DIR Set this variable to the root installation of 11 | # Gperftools if the module has problems finding 12 | # the proper installation path. 13 | # 14 | # Variables defined by this module: 15 | # 16 | # GPERFTOOLS_FOUND System has Gperftools libs/headers 17 | # GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler) 18 | # GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers 19 | 20 | find_library(GPERFTOOLS_PROFILER 21 | NAMES profiler 22 | HINTS ${Gperftools_ROOT_DIR}/lib) 23 | 24 | find_path(GPERFTOOLS_INCLUDE_DIR 25 | NAMES gperftools/heap-profiler.h 26 | HINTS ${Gperftools_ROOT_DIR}/include) 27 | 28 | set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_PROFILER}) 29 | 30 | include(FindPackageHandleStandardArgs) 31 | find_package_handle_standard_args( 32 | Gperftools 33 | DEFAULT_MSG 34 | GPERFTOOLS_LIBRARIES 35 | GPERFTOOLS_INCLUDE_DIR) 36 | 37 | mark_as_advanced( 38 | Gperftools_ROOT_DIR 39 | GPERFTOOLS_PROFILER 40 | GPERFTOOLS_LIBRARIES 41 | GPERFTOOLS_INCLUDE_DIR) 42 | -------------------------------------------------------------------------------- /cmake/modules/FindJeMalloc.cmake: -------------------------------------------------------------------------------- 1 | # - Find JeMalloc library 2 | # Find the native JeMalloc includes and library 3 | # This module defines 4 | # JEMALLOC_INCLUDE_DIRS, where to find jemalloc.h, Set when 5 | # JEMALLOC_INCLUDE_DIR is found. 6 | # JEMALLOC_LIBRARIES, libraries to link against to use JeMalloc. 7 | # JEMALLOC_ROOT_DIR, The base directory to search for JeMalloc. 8 | # This can also be an environment variable. 9 | # JEMALLOC_FOUND, If false, do not try to use JeMalloc. 10 | # 11 | # also defined, but not for general use are 12 | # JEMALLOC_LIBRARY, where to find the JeMalloc library. 13 | 14 | #============================================================================= 15 | # Copyright 2011 Blender Foundation. 16 | # 17 | # Distributed under the OSI-approved BSD License (the "License"); 18 | # see accompanying file Copyright.txt for details. 19 | # 20 | # This software is distributed WITHOUT ANY WARRANTY; without even the 21 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 22 | # See the License for more information. 23 | #============================================================================= 24 | 25 | # If JEMALLOC_ROOT_DIR was defined in the environment, use it. 26 | IF(NOT JEMALLOC_ROOT_DIR AND NOT $ENV{JEMALLOC_ROOT_DIR} STREQUAL "") 27 | SET(JEMALLOC_ROOT_DIR $ENV{JEMALLOC_ROOT_DIR}) 28 | ENDIF() 29 | 30 | SET(_jemalloc_SEARCH_DIRS 31 | ${JEMALLOC_ROOT_DIR} 32 | /usr/local 33 | /sw # Fink 34 | /opt/local # DarwinPorts 35 | /opt/csw # Blastwave 36 | ) 37 | 38 | FIND_PATH(JEMALLOC_INCLUDE_DIR 39 | NAMES 40 | jemalloc.h 41 | HINTS 42 | ${_jemalloc_SEARCH_DIRS} 43 | PATH_SUFFIXES 44 | include/jemalloc 45 | ) 46 | 47 | FIND_LIBRARY(JEMALLOC_LIBRARY 48 | NAMES 49 | jemalloc 50 | HINTS 51 | ${_jemalloc_SEARCH_DIRS} 52 | PATH_SUFFIXES 53 | lib64 lib 54 | ) 55 | 56 | # handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if 57 | # all listed variables are TRUE 58 | INCLUDE(FindPackageHandleStandardArgs) 59 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG 60 | JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR) 61 | 62 | IF(JEMALLOC_FOUND) 63 | SET(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY}) 64 | SET(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR}) 65 | ENDIF(JEMALLOC_FOUND) 66 | 67 | MARK_AS_ADVANCED( 68 | JEMALLOC_INCLUDE_DIR 69 | JEMALLOC_LIBRARY 70 | ) 71 | -------------------------------------------------------------------------------- /cmake/modules/FindLTTng.cmake: -------------------------------------------------------------------------------- 1 | # - Find LTTng 2 | # Find the Linux Trace Toolkit - next generation with associated includes path. 3 | # See http://lttng.org/ 4 | # 5 | # This module accepts the following optional variables: 6 | # LTTNG_PATH_HINT = A hint on LTTNG install path. 7 | # 8 | # This module defines the following variables: 9 | # LTTNG_FOUND = Was LTTng found or not? 10 | # LTTNG_EXECUTABLE = The path to lttng command 11 | # LTTNG_LIBRARIES = The list of libraries to link to when using LTTng 12 | # LTTNG_INCLUDE_DIR = The path to LTTng include directory 13 | # 14 | # On can set LTTNG_PATH_HINT before using find_package(LTTng) and the 15 | # module with use the PATH as a hint to find LTTng. 16 | # 17 | # The hint can be given on the command line too: 18 | # cmake -DLTTNG_PATH_HINT=/DATA/ERIC/LTTng /path/to/source 19 | 20 | if(LTTNG_PATH_HINT) 21 | message(STATUS "FindLTTng: using PATH HINT: ${LTTNG_PATH_HINT}") 22 | else() 23 | set(LTTNG_PATH_HINT) 24 | endif() 25 | 26 | #One can add his/her own builtin PATH. 27 | #FILE(TO_CMAKE_PATH "/DATA/ERIC/LTTng" MYPATH) 28 | #list(APPEND LTTNG_PATH_HINT ${MYPATH}) 29 | 30 | find_path(LTTNG_INCLUDE_DIR 31 | NAMES lttng/tracepoint.h 32 | PATHS ${LTTNG_PATH_HINT} 33 | PATH_SUFFIXES include 34 | DOC "The LTTng include headers") 35 | 36 | find_path(LTTNG_LIBRARY_DIR 37 | NAMES liblttng-ust.so 38 | PATHS ${LTTNG_PATH_HINT} 39 | PATH_SUFFIXES lib lib64 40 | DOC "The LTTng libraries") 41 | 42 | find_library(LTTNG_UST_LIBRARY lttng-ust PATHS ${LTTNG_LIBRARY_DIR}) 43 | find_library(URCU_LIBRARY urcu-bp PATHS ${LTTNG_LIBRARY_DIR}) 44 | find_library(UUID_LIBRARY uuid) 45 | 46 | set(LTTNG_LIBRARIES ${LTTNG_UST_LIBRARY} ${URCU_LIBRARY} ${UUID_LIBRARY}) 47 | 48 | find_path(LTTNG_CTL_INCLUDE_DIR 49 | NAMES lttng/lttng.h 50 | PATHS ${LTTNG_PATH_HINT} 51 | PATH_SUFFIXES include 52 | DOC "The LTTng CTL include headers") 53 | 54 | find_path(LTTNG_CTL_LIBRARY_DIR 55 | NAMES liblttng-ctl.so 56 | PATHS ${LTTNG_PATH_HINT} 57 | PATH_SUFFIXES lib lib64 58 | DOC "The LTTng libraries") 59 | 60 | find_library(LTTNG_CTL_LIBRARY lttng-ctl PATHS ${LTTNG_CTL_LIBRARY_DIR}) 61 | 62 | set(LTTNG_CTL_LIBRARIES ${LTTNG_CTL_LIBRARY}) 63 | 64 | message(STATUS "Looking for lttng executable...") 65 | set(LTTNG_NAMES "lttng;lttng-ctl") 66 | # FIND_PROGRAM twice using NO_DEFAULT_PATH on first shot 67 | find_program(LTTNG_EXECUTABLE 68 | NAMES ${LTTNG_NAMES} 69 | PATHS ${LTTNG_PATH_HINT}/bin 70 | NO_DEFAULT_PATH 71 | DOC "The LTTNG command line tool") 72 | find_program(LEX_PROGRAM 73 | NAMES ${LTTNG_NAMES} 74 | PATHS ${LTTNG_PATH_HINT}/bin 75 | DOC "The LTTNG command line tool") 76 | 77 | # handle the QUIETLY and REQUIRED arguments and set PRELUDE_FOUND to TRUE if 78 | # all listed variables are TRUE 79 | include(FindPackageHandleStandardArgs) 80 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LTTNG 81 | REQUIRED_VARS LTTNG_INCLUDE_DIR LTTNG_LIBRARY_DIR) 82 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LTTNG_CTL 83 | REQUIRED_VARS LTTNG_CTL_INCLUDE_DIR LTTNG_CTL_LIBRARY_DIR) 84 | # VERSION FPHSA options not handled by CMake version < 2.8.2) 85 | # VERSION_VAR) 86 | mark_as_advanced(LTTNG_INCLUDE_DIR) 87 | mark_as_advanced(LTTNG_LIBRARY_DIR) 88 | -------------------------------------------------------------------------------- /cmake/modules/FindMSan.cmake: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | # 3 | # Copyright (c) 4 | # 2013 Matthew Arsenault 5 | # 2015-2016 RWTH Aachen University, Federal Republic of Germany 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in all 15 | # copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # SOFTWARE. 24 | 25 | option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off) 26 | 27 | set(FLAG_CANDIDATES 28 | "-g -fsanitize=memory" 29 | ) 30 | 31 | 32 | include(sanitize-helpers) 33 | 34 | if (SANITIZE_MEMORY) 35 | if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 36 | message(WARNING "MemorySanitizer disabled for target ${TARGET} because " 37 | "MemorySanitizer is supported for Linux systems only.") 38 | set(SANITIZE_MEMORY Off CACHE BOOL 39 | "Enable MemorySanitizer for sanitized targets." FORCE) 40 | elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8) 41 | message(WARNING "MemorySanitizer disabled for target ${TARGET} because " 42 | "MemorySanitizer is supported for 64bit systems only.") 43 | set(SANITIZE_MEMORY Off CACHE BOOL 44 | "Enable MemorySanitizer for sanitized targets." FORCE) 45 | else () 46 | sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer" 47 | "MSan") 48 | endif () 49 | endif () 50 | 51 | function (add_sanitize_memory TARGET) 52 | if (NOT SANITIZE_MEMORY) 53 | return() 54 | endif () 55 | 56 | saitizer_add_flags(${TARGET} "MemorySanitizer" "MSan") 57 | endfunction () 58 | -------------------------------------------------------------------------------- /cmake/modules/FindNSL.cmake: -------------------------------------------------------------------------------- 1 | # - Find NSL 2 | # 3 | # This module defines the following variables: 4 | # NSL_FOUND = Was NSL found or not? 5 | # 6 | # On can set NSL_PATH_HINT before using find_package(NSL) and the 7 | # module with use the PATH as a hint to find NSL. 8 | # 9 | # The hint can be given on the command line too: 10 | # cmake -DNSL_PATH_HINT=/DATA/ERIC/NSL /path/to/source 11 | 12 | #find_path(NSL_INCLUDE_DIR 13 | #NAMES yp.h 14 | #PATHS ${NSL_HINT_PATH} 15 | #PATH_SUFFIXES nsl/rpcsvc 16 | #DOC "The NSL include headers") 17 | 18 | find_library(NSL_LIBRARY nsl PATH_SUFFIXES nsl) 19 | 20 | # handle the QUIETLY and REQUIRED arguments and set PRELUDE_FOUND to TRUE if 21 | # all listed variables are TRUE 22 | include(FindPackageHandleStandardArgs) 23 | #FIND_PACKAGE_HANDLE_STANDARD_ARGS(NSL REQUIRED_VARS NSL_INCLUDE_DIR NSL_LIBRARY) 24 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(NSL REQUIRED_VARS NSL_LIBRARY) 25 | 26 | mark_as_advanced(NSL_INCLUDE_DIR) 27 | mark_as_advanced(NSL_LIBRARY) 28 | -------------------------------------------------------------------------------- /cmake/modules/FindNTIRPC.cmake: -------------------------------------------------------------------------------- 1 | # - Find NTIRPC 2 | # Find the New TIRPC RPC library 3 | # 4 | # This module accepts the following optional variables: 5 | # NTIRPC_PATH_HINT = A hint on NTIRPC install path. 6 | # 7 | # This module defines the following variables: 8 | # NTIRPC_FOUND = Was NTIRPC found or not? 9 | # NTIRPC_LIBRARY = The list of libraries to link to when using NTIRPC 10 | # NTIRPC_INCLUDE_DIR = The path to NTIRPC include directory(s) 11 | # 12 | # On can set NTIRPC_PATH_HINT before using find_package(NTIRPC) and the 13 | # module with use the PATH as a hint to find NTIRPC. 14 | # 15 | # The hint can be given on the command line too: 16 | # cmake -DNTIRPC_PATH_HINT=/DATA/ERIC/NTIRPC /path/to/source 17 | 18 | include(LibFindMacros) 19 | 20 | libfind_pkg_detect(NTIRPC libntirpc FIND_PATH netconfig.h PATH_SUFFIXES ntirpc FIND_LIBRARY ntirpc) 21 | 22 | if (NTIRPC_LIBRARY) 23 | libfind_version_header(NTIRPC version.h NTIRPC_VERSION) 24 | endif (NTIRPC_LIBRARY) 25 | 26 | # handle the QUIETLY and REQUIRED arguments and set PRELUDE_FOUND to TRUE if 27 | # all listed variables are TRUE 28 | include(FindPackageHandleStandardArgs) 29 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(NTIRPC 30 | REQUIRED_VARS NTIRPC_INCLUDE_DIR NTIRPC_LIBRARY 31 | VERSION_VAR NTIRPC_VERSION) 32 | # VERSION FPHSA options not handled by CMake version < 2.8.2) 33 | # VERSION_VAR) 34 | mark_as_advanced(NTIRPC_INCLUDE_DIR) 35 | mark_as_advanced(NTIRPC_LIBRARY) 36 | -------------------------------------------------------------------------------- /cmake/modules/FindRDMA.cmake: -------------------------------------------------------------------------------- 1 | # - Find RDMA 2 | # Find the New TIRPC RPC library 3 | # 4 | # This module accepts the following optional variables: 5 | # RDMA_PATH_HINT = A hint on RDMA install path. 6 | # 7 | # This module defines the following variables: 8 | # RDMA_FOUND = Was RDMA found or not? 9 | # RDMA_LIBRARY = The list of libraries to link to when using RDMA 10 | # RDMA_INCLUDE_DIR = The path to RDMA include directory(s) 11 | # 12 | # One can set RDMA_PATH_HINT before using find_package(RDMA) and the 13 | # module with use the PATH as a hint to find RDMA. 14 | # Alternatively, one can set LIBIBVERBS_PREFIX and LIBRDMACM_PREFIX to the individual 15 | # hints for those libraries. 16 | # 17 | # The hint can be given on the command line too: 18 | # cmake -DRDMA_PATH_HINT=/DATA/ERIC/RDMA /path/to/source 19 | 20 | include(LibFindMacros) 21 | 22 | # ibverbs 23 | if (LIBIBVERBS_PREFIX) 24 | set(IBVERBS_PKGCONF_INCLUDE_DIRS ${LIBIBVERBS_PREFIX}/include) 25 | set(IBVERBS_PKGCONF_LIBRARY_DIRS ${LIBIBVERBS_PREFIX}/lib64 ${LIBIBVERBS_PREFIX}/lib) 26 | else (LIBIBVERBS_PREFIX) 27 | set(IBVERBS_PKGCONF_INCLUDE_DIRS ${RDMA_PATH_HINT}/include) 28 | set(IBVERBS_PKGCONF_LIBRARY_DIRS ${RDMA_PATH_HINT}/lib64 ${RDMA_PATH_HINT}/lib) 29 | endif (LIBIBVERBS_PREFIX) 30 | libfind_pkg_detect(IBVERBS libibverbs FIND_PATH verbs.h PATH_SUFFIXES infiniband FIND_LIBRARY ibverbs) 31 | libfind_process(IBVERBS) 32 | 33 | # rdmacm 34 | if (LIBRDMACM_PREFIX) 35 | set(RDMACM_PKGCONF_INCLUDE_DIRS ${LIBRDMACM_PREFIX}/include) 36 | set(RDMACM_PKGCONF_LIBRARY_DIRS ${LIBRDMACM_PREFIX}/lib64 ${LIBRDMACM_PREFIX}/lib) 37 | else (LIBRDMACM_PREFIX) 38 | set(RDMACM_PKGCONF_INCLUDE_DIRS ${RDMA_PATH_HINT}/include) 39 | set(RDMACM_PKGCONF_LIBRARY_DIRS ${RDMA_PATH_HINT}/lib64 ${RDMA_PATH_HINT}/lib) 40 | endif (LIBRDMACM_PREFIX) 41 | libfind_pkg_detect(RDMACM librdmacm FIND_PATH rdma_cma.h PATH_SUFFIXES rdma FIND_LIBRARY rdmacm) 42 | libfind_process(RDMACM) 43 | 44 | if (IBVERBS_FOUND AND RDMACM_FOUND) 45 | set(RDMA_FOUND true) 46 | set(RDMA_LIBRARY ${IBVERBS_LIBRARY} ${RDMACM_LIBRARY}) 47 | set(RDMA_INCLUDE_DIR ${IBVERBS_INCLUDE_DIR} ${RDMACM_INCLUDE_DIR}) 48 | else (IBVERBS_FOUND AND RDMACM_FOUND) 49 | set(RDMA_NOTFOUND true) 50 | endif (IBVERBS_FOUND AND RDMACM_FOUND) 51 | 52 | #if (RDMA_LIBRARY) 53 | #libfind_version_header(RDMA version.h RDMA_VERSION) 54 | #endif (RDMA_LIBRARY) 55 | 56 | # handle the QUIETLY and REQUIRED arguments and set PRELUDE_FOUND to TRUE if 57 | # all listed variables are TRUE 58 | include(FindPackageHandleStandardArgs) 59 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(RDMA 60 | REQUIRED_VARS RDMA_INCLUDE_DIR RDMA_LIBRARY 61 | VERSION_VAR RDMA_VERSION) 62 | # VERSION FPHSA options not handled by CMake version < 2.8.2) 63 | # VERSION_VAR) 64 | mark_as_advanced(RDMA_INCLUDE_DIR) 65 | mark_as_advanced(RDMA_LIBRARY) 66 | -------------------------------------------------------------------------------- /cmake/modules/FindSanitizers.cmake: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | # 3 | # Copyright (c) 4 | # 2013 Matthew Arsenault 5 | # 2015-2016 RWTH Aachen University, Federal Republic of Germany 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in all 15 | # copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # SOFTWARE. 24 | 25 | # If any of the used compiler is a GNU compiler, add a second option to static 26 | # link against the sanitizers. 27 | option(SANITIZE_LINK_STATIC "Try to link static against sanitizers." Off) 28 | 29 | 30 | 31 | 32 | set(FIND_QUIETLY_FLAG "") 33 | if (DEFINED Sanitizers_FIND_QUIETLY) 34 | set(FIND_QUIETLY_FLAG "QUIET") 35 | endif () 36 | 37 | find_package(ASan ${FIND_QUIETLY_FLAG}) 38 | find_package(TSan ${FIND_QUIETLY_FLAG}) 39 | find_package(MSan ${FIND_QUIETLY_FLAG}) 40 | find_package(UBSan ${FIND_QUIETLY_FLAG}) 41 | 42 | 43 | 44 | 45 | function(sanitizer_add_blacklist_file FILE) 46 | if(NOT IS_ABSOLUTE ${FILE}) 47 | set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}") 48 | endif() 49 | get_filename_component(FILE "${FILE}" REALPATH) 50 | 51 | sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}" 52 | "SanitizerBlacklist" "SanBlist") 53 | endfunction() 54 | 55 | function(add_sanitizers ...) 56 | foreach (TARGET ${ARGV}) 57 | add_sanitize_address(${TARGET}) 58 | add_sanitize_thread(${TARGET}) 59 | add_sanitize_memory(${TARGET}) 60 | add_sanitize_undefined(${TARGET}) 61 | endforeach () 62 | endfunction(add_sanitizers) 63 | -------------------------------------------------------------------------------- /cmake/modules/FindTSan.cmake: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | # 3 | # Copyright (c) 4 | # 2013 Matthew Arsenault 5 | # 2015-2016 RWTH Aachen University, Federal Republic of Germany 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in all 15 | # copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # SOFTWARE. 24 | 25 | option(SANITIZE_THREAD "Enable ThreadSanitizer for sanitized targets." Off) 26 | 27 | set(FLAG_CANDIDATES 28 | "-g -fsanitize=thread" 29 | ) 30 | 31 | 32 | # ThreadSanitizer is not compatible with MemorySanitizer. 33 | if (SANITIZE_THREAD AND SANITIZE_MEMORY) 34 | message(FATAL_ERROR "ThreadSanitizer is not compatible with " 35 | "MemorySanitizer.") 36 | endif () 37 | 38 | 39 | include(sanitize-helpers) 40 | 41 | if (SANITIZE_THREAD) 42 | if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 43 | message(WARNING "ThreadSanitizer disabled for target ${TARGET} because " 44 | "ThreadSanitizer is supported for Linux systems only.") 45 | set(SANITIZE_THREAD Off CACHE BOOL 46 | "Enable ThreadSanitizer for sanitized targets." FORCE) 47 | elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8) 48 | message(WARNING "ThreadSanitizer disabled for target ${TARGET} because " 49 | "ThreadSanitizer is supported for 64bit systems only.") 50 | set(SANITIZE_THREAD Off CACHE BOOL 51 | "Enable ThreadSanitizer for sanitized targets." FORCE) 52 | else () 53 | sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ThreadSanitizer" 54 | "TSan") 55 | endif () 56 | endif () 57 | 58 | function (add_sanitize_thread TARGET) 59 | if (NOT SANITIZE_THREAD) 60 | return() 61 | endif () 62 | 63 | saitizer_add_flags(${TARGET} "ThreadSanitizer" "TSan") 64 | endfunction () 65 | -------------------------------------------------------------------------------- /cmake/modules/FindTcMalloc.cmake: -------------------------------------------------------------------------------- 1 | # - Find Tcmalloc library 2 | # Find the native Tcmalloc includes and library 3 | # This module defines 4 | # TCMALLOC_INCLUDE_DIRS, where to find tcmalloc.h, Set when 5 | # TCMALLOC_INCLUDE_DIR is found. 6 | # TCMALLOC_LIBRARIES, libraries to link against to use Tcmalloc. 7 | # TCMALLOC_ROOT_DIR, The base directory to search for Tcmalloc. 8 | # This can also be an environment variable. 9 | # TCMALLOC_FOUND, If false, do not try to use Tcmalloc. 10 | # 11 | # also defined, but not for general use are 12 | # TCMALLOC_LIBRARY, where to find the Tcmalloc library. 13 | 14 | #============================================================================= 15 | # Copyright 2011 Blender Foundation. 16 | # 17 | # Distributed under the OSI-approved BSD License (the "License"); 18 | # see accompanying file Copyright.txt for details. 19 | # 20 | # This software is distributed WITHOUT ANY WARRANTY; without even the 21 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 22 | # See the License for more information. 23 | #============================================================================= 24 | 25 | # If TCMALLOC_ROOT_DIR was defined in the environment, use it. 26 | IF(NOT TCMALLOC_ROOT_DIR AND NOT $ENV{TCMALLOC_ROOT_DIR} STREQUAL "") 27 | SET(TCMALLOC_ROOT_DIR $ENV{TCMALLOC_ROOT_DIR}) 28 | ENDIF() 29 | 30 | SET(_tcmalloc_SEARCH_DIRS 31 | ${TCMALLOC_ROOT_DIR} 32 | /usr/local 33 | /sw # Fink 34 | /opt/local # DarwinPorts 35 | /opt/csw # Blastwave 36 | /usr/include/google # Debain tcmalloc minimal 37 | /usr/include/gperftools # Debian gperftools 38 | ) 39 | 40 | FIND_PATH(TCMALLOC_INCLUDE_DIR 41 | NAMES 42 | tcmalloc.h 43 | HINTS 44 | ${_tcmalloc_SEARCH_DIRS} 45 | PATH_SUFFIXES 46 | include/tcmalloc 47 | ) 48 | 49 | FIND_LIBRARY(TCMALLOC_LIBRARY 50 | NAMES 51 | tcmalloc 52 | HINTS 53 | ${_tcmalloc_SEARCH_DIRS} 54 | PATH_SUFFIXES 55 | lib64 lib 56 | ) 57 | 58 | # handle the QUIETLY and REQUIRED arguments and set TCMALLOC_FOUND to TRUE if 59 | # all listed variables are TRUE 60 | INCLUDE(FindPackageHandleStandardArgs) 61 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tcmalloc DEFAULT_MSG 62 | TCMALLOC_LIBRARY TCMALLOC_INCLUDE_DIR) 63 | 64 | IF(TCMALLOC_FOUND) 65 | SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY}) 66 | SET(TCMALLOC_INCLUDE_DIRS ${TCMALLOC_INCLUDE_DIR}) 67 | ENDIF(TCMALLOC_FOUND) 68 | 69 | MARK_AS_ADVANCED( 70 | TCMALLOC_INCLUDE_DIR 71 | TCMALLOC_LIBRARY 72 | ) 73 | -------------------------------------------------------------------------------- /cmake/modules/FindUBSan.cmake: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | # 3 | # Copyright (c) 4 | # 2013 Matthew Arsenault 5 | # 2015-2016 RWTH Aachen University, Federal Republic of Germany 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in all 15 | # copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | # SOFTWARE. 24 | 25 | option(SANITIZE_UNDEFINED 26 | "Enable UndefinedBehaviorSanitizer for sanitized targets." Off) 27 | 28 | set(FLAG_CANDIDATES 29 | "-g -fsanitize=undefined" 30 | ) 31 | 32 | 33 | include(sanitize-helpers) 34 | 35 | if (SANITIZE_UNDEFINED) 36 | sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" 37 | "UndefinedBehaviorSanitizer" "UBSan") 38 | endif () 39 | 40 | function (add_sanitize_undefined TARGET) 41 | if (NOT SANITIZE_UNDEFINED) 42 | return() 43 | endif () 44 | 45 | saitizer_add_flags(${TARGET} "UndefinedBehaviorSanitizer" "UBSan") 46 | endfunction () 47 | -------------------------------------------------------------------------------- /cmake/modules/FindWBclient.cmake: -------------------------------------------------------------------------------- 1 | # Try to find a sufficiently recent wbclient 2 | 3 | if(SAMBA4_PREFIX) 4 | set(SAMBA4_INCLUDE_DIRS ${SAMBA4_PREFIX}/include) 5 | set(SAMBA4_LIBRARIES ${SAMBA4_PREFIX}/lib${LIB_SUFFIX}) 6 | endif() 7 | 8 | if(NOT WIN32) 9 | find_package(PkgConfig) 10 | if(PKG_CONFIG_FOUND) 11 | pkg_check_modules(_WBCLIENT_PC QUIET wbclient) 12 | endif(PKG_CONFIG_FOUND) 13 | endif(NOT WIN32) 14 | 15 | find_path(WBCLIENT_INCLUDE_DIR wbclient.h 16 | ${_WBCLIENT_PC_INCLUDE_DIRS} 17 | ${SAMBA4_INCLUDE_DIRS} 18 | /usr/include 19 | /usr/local/include 20 | ) 21 | 22 | set(CMAKE_REQUIRED_INCLUDES ${WBCLIENT_INCLUDE_DIR}) 23 | 24 | find_library(WBCLIENT_LIBRARIES NAMES wbclient 25 | PATHS 26 | ${_WBCLIENT_PC_LIBDIR} 27 | ) 28 | 29 | check_library_exists( 30 | wbclient 31 | wbcLookupSids 32 | ${WBCLIENT_LIBRARIES} 33 | WBCLIENT_LIB_OK 34 | ) 35 | 36 | # the stdint and stdbool includes are required (silly Cmake) 37 | check_include_files("stdint.h;stdbool.h;wbclient.h" WBCLIENT_H) 38 | 39 | # XXX this check is doing the heavy lifting 40 | set(CMAKE_REQUIRED_LIBRARIES ${WBCLIENT_LIBRARIES}) 41 | if(WBCLIENT_H) 42 | check_c_source_compiles(" 43 | /* do the enum */ 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | int main(void) 50 | { 51 | enum wbcAuthUserLevel level = WBC_AUTH_USER_LEVEL_PAC; 52 | return (0); 53 | }" WBCLIENT4_H) 54 | endif(WBCLIENT_H) 55 | 56 | if(WBCLIENT_LIB_OK AND WBCLIENT4_H) 57 | set(WBCLIENT_FOUND 1) 58 | message(STATUS "Found Winbind4 client: ${WBCLIENT_LIB}") 59 | else(WBCLIENT_LIB_OK AND WBCLIENT4_H) 60 | message(STATUS "Winbind4 client not found ${SAMBA4_PREFIX}/lib") 61 | endif(WBCLIENT_LIB_OK AND WBCLIENT4_H) 62 | -------------------------------------------------------------------------------- /cmake/modules/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | 18 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 19 | 20 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 21 | if(HEAD_CONTENTS MATCHES "ref") 22 | # named branch 23 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 24 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 25 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 26 | elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") 27 | configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 28 | set(HEAD_HASH "${HEAD_REF}") 29 | endif() 30 | else() 31 | # detached HEAD 32 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 33 | endif() 34 | 35 | if(NOT HEAD_HASH) 36 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 37 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 38 | endif() 39 | -------------------------------------------------------------------------------- /config-h.in.cmake: -------------------------------------------------------------------------------- 1 | /* config.h file expanded by Cmake for build */ 2 | 3 | #include "ntirpc/version.h" 4 | 5 | #ifndef CONFIG_H 6 | #define CONFIG_H 7 | 8 | /* Build controls */ 9 | 10 | #cmakedefine _MSPAC_SUPPORT 1 11 | #cmakedefine HAVE_STDBOOL_H 1 12 | #cmakedefine HAVE_KRB5 1 13 | #cmakedefine LINUX 1 14 | #cmakedefine FREEBSD 1 15 | #cmakedefine _HAVE_GSSAPI 1 16 | #cmakedefine HAVE_STRING_H 1 17 | #cmakedefine HAVE_STRINGS_H 1 18 | #cmakedefine LITTLEEND 1 19 | #cmakedefine BIGEND 1 20 | #cmakedefine TIRPC_EPOLL 1 21 | #cmakedefine USE_RPC_RDMA 1 22 | #cmakedefine USE_LTTNG_NTIRPC 1 23 | 24 | /* Package stuff */ 25 | #define PACKAGE "libntirpc" 26 | #define PACKAGE_BUGREPORT "" 27 | #define PACKAGE_NAME "libntirpc" 28 | #define PACKAGE_STRING "libntirpc ${NTIRPC_VERSION_MAJOR}.${NTIRPC_VERSION_MINOR}.${NTIRPC_PATCH_LEVEL}" 29 | #define PACKAGE_TARNAME "libntirpc" 30 | #define PACKAGE_URL "" 31 | #define PACKAGE_VERSION "${NTIRPC_VERSION_MAJOR}.${NTIRPC_VERSION_MINOR}.${NTIRPC_PATCH_LEVEL}" 32 | 33 | #endif /* CONFIG_H */ 34 | -------------------------------------------------------------------------------- /libntirpc.pc.in.cmake: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | libdir=${prefix}/@LIB_INSTALL_DIR@ 4 | includedir=${prefix}/include/ntirpc 5 | 6 | Name: libntirpc 7 | Description: New Transport Independent RPC Library 8 | Requires: 9 | Version: @NTIRPC_VERSION@ 10 | Libs: -lntirpc 11 | Cflags: -I${prefix}/include/ntirpc 12 | -------------------------------------------------------------------------------- /libntirpc.spec-in.cmake: -------------------------------------------------------------------------------- 1 | 2 | %undefine _hardened_build 3 | 4 | Name: libntirpc 5 | Version: @NTIRPC_VERSION@ 6 | Release: 1%{?dev:%{dev}}%{?dist} 7 | Summary: New Transport Independent RPC Library 8 | Group: System Environment/Libraries 9 | License: BSD 10 | Url: https://github.com/nfs-ganesha/ntirpc 11 | 12 | Source0: https://github.com/nfs-ganesha/ntirpc/archive/v%{version}/ntirpc-%{version}.tar.gz 13 | 14 | BuildRequires: cmake 15 | BuildRequires: krb5-devel 16 | # libtirpc has /etc/netconfig, most machines probably have it anyway 17 | # for NFS client 18 | Requires: libtirpc 19 | 20 | %description 21 | This package contains a new implementation of the original libtirpc, 22 | transport-independent RPC (TI-RPC) library for NFS-Ganesha. It has 23 | the following features not found in libtirpc: 24 | 1. Bi-directional operation 25 | 2. Full-duplex operation on the TCP (vc) transport 26 | 3. Thread-safe operating modes 27 | 3.1 new locking primitives and lock callouts (interface change) 28 | 3.2 stateless send/recv on the TCP transport (interface change) 29 | 4. Flexible server integration support 30 | 5. Event channels (remove static arrays of xprt handles, new EPOLL/KEVENT 31 | integration) 32 | 33 | %package devel 34 | Summary: Development headers for %{name} 35 | Requires: %{name}%{?_isa} = %{version} 36 | 37 | %description devel 38 | Development headers and auxiliary files for developing with %{name}. 39 | 40 | %prep 41 | %setup -q -n ntirpc-%{version} 42 | 43 | %build 44 | %cmake . -DOVERRIDE_INSTALL_PREFIX=/usr -DTIRPC_EPOLL=1 -DUSE_GSS=ON "-GUnix Makefiles" 45 | 46 | make %{?_smp_mflags} 47 | 48 | %install 49 | ## make install is broken in various ways 50 | ## make install DESTDIR=%%{buildroot} 51 | mkdir -p %{buildroot}%{_libdir}/pkgconfig 52 | install -p -m 0755 src/%{name}.so.%{version} %{buildroot}%{_libdir}/ 53 | ln -s %{name}.so.%{version} %{buildroot}%{_libdir}/%{name}.so.1 54 | ln -s %{name}.so.%{version} %{buildroot}%{_libdir}/%{name}.so 55 | mkdir -p %{buildroot}%{_includedir}/ntirpc 56 | cp -a ntirpc %{buildroot}%{_includedir}/ 57 | install -p -m 644 libntirpc.pc %{buildroot}%{_libdir}/pkgconfig/ 58 | 59 | %post -p /sbin/ldconfig 60 | 61 | %postun -p /sbin/ldconfig 62 | 63 | %files 64 | %{_libdir}/libntirpc.so.* 65 | %{!?_licensedir:%global license %%doc} 66 | %license COPYING 67 | %doc NEWS README 68 | 69 | %files devel 70 | %{_libdir}/libntirpc.so 71 | %dir %{_includedir}/ntirpc 72 | %{_includedir}/ntirpc/* 73 | %{_libdir}/pkgconfig/libntirpc.pc 74 | 75 | %changelog 76 | * Wed Jul 19 2017 Daniel Gryniewicz 1.6.0-1 77 | - Upstream spec file 78 | -------------------------------------------------------------------------------- /man/bindresvport.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)bindresvport.3n 2.2 88/08/02 4.0 RPCSRC; from 1.7 88/03/14 SMI 2 | .\" 3 | .Dd November 22, 1987 4 | .Dt BINDRESVPORT 3 5 | .Os 6 | .Sh NAME 7 | .Nm bindresvport , 8 | .Nm bindresvport_sa 9 | .Nd bind a socket to a privileged IP port 10 | .Sh LIBRARY 11 | .Lb libc 12 | .Sh SYNOPSIS 13 | .In sys/types.h 14 | .In rpc/rpc.h 15 | .Ft int 16 | .Fn bindresvport "int sd" "struct sockaddr_in *sin" 17 | .Ft int 18 | .Fn bindresvport_sa "int sd" "struct sockaddr *sa" 19 | .Sh DESCRIPTION 20 | The 21 | .Fn bindresvport 22 | and 23 | .Fn bindresvport_sa 24 | functions 25 | are used to bind a socket descriptor to a privileged 26 | .Tn IP 27 | port, that is, a 28 | port number in the range 0-1023. 29 | .Pp 30 | If 31 | .Fa sin 32 | is a pointer to a 33 | .Ft "struct sockaddr_in" 34 | then the appropriate fields in the structure should be defined. 35 | Note that 36 | .Fa sin->sin_family 37 | must be initialized to the address family of the socket, passed by 38 | .Fa sd . 39 | If 40 | .Fa sin->sin_port 41 | is 42 | .Sq 0 43 | then an anonymous port (in the range 600-1023) will be 44 | chosen, and if 45 | .Xr bind 2 46 | is successful, the 47 | .Fa sin->sin_port 48 | will be updated to contain the allocated port. 49 | .Pp 50 | If 51 | .Fa sin 52 | is the 53 | .Dv NULL 54 | pointer, 55 | an anonymous port will be allocated (as above). 56 | However, there is no way for 57 | .Fn bindresvport 58 | to return the allocated port in this case. 59 | .Pp 60 | Only root can bind to a privileged port; this call will fail for any 61 | other users. 62 | .Pp 63 | Function prototype of 64 | .Fn bindresvport 65 | is biased to 66 | .Dv AF_INET 67 | socket. 68 | The 69 | .Fn bindresvport_sa 70 | function 71 | acts exactly the same, with more neutral function prototype. 72 | Note that both functions behave exactly the same, and 73 | both support 74 | .Dv AF_INET6 75 | sockets as well as 76 | .Dv AF_INET 77 | sockets. 78 | .Sh RETURN VALUES 79 | .Rv -std bindresvport 80 | .Sh ERRORS 81 | .Bl -tag -width Er 82 | .It Bq Er EPFNOSUPPORT 83 | If second argument was supplied, 84 | and address family did not match between arguments. 85 | .El 86 | .Pp 87 | The 88 | .Fn bindresvport 89 | function 90 | may also fail and set 91 | .Va errno 92 | for any of the errors specified for the calls 93 | .Xr bind 2 , 94 | .Xr getsockopt 2 , 95 | or 96 | .Xr setsockopt 2 . 97 | .Sh SEE ALSO 98 | .Xr bind 2 , 99 | .Xr getsockopt 2 , 100 | .Xr setsockopt 2 , 101 | .Xr ip 4 102 | -------------------------------------------------------------------------------- /man/des_crypt.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)des_crypt.3 2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI; 2 | .\" 3 | .Dd October 6, 1987 4 | .Dt DES_CRYPT 3 5 | .Os 6 | .Sh NAME 7 | .Nm des_crypt , ecb_crypt , cbc_crypt , des_setparity 8 | .Nd "fast DES encryption" 9 | .Sh LIBRARY 10 | .Lb libc 11 | .Sh SYNOPSIS 12 | .In rpc/des_crypt.h 13 | .Ft int 14 | .Fn ecb_crypt "char *key" "char *data" "unsigned datalen" "unsigned mode" 15 | .Ft int 16 | .Fn cbc_crypt "char *key" "char *data" "unsigned datalen" "unsigned mode" "char *ivec" 17 | .Ft void 18 | .Fn des_setparity "char *key" 19 | .Sh DESCRIPTION 20 | The 21 | .Fn ecb_crypt 22 | and 23 | .Fn cbc_crypt 24 | functions 25 | implement the 26 | .Tn NBS 27 | .Tn DES 28 | (Data Encryption Standard). 29 | These routines are faster and more general purpose than 30 | .Xr crypt 3 . 31 | They also are able to utilize 32 | .Tn DES 33 | hardware if it is available. 34 | The 35 | .Fn ecb_crypt 36 | function 37 | encrypts in 38 | .Tn ECB 39 | (Electronic Code Book) 40 | mode, which encrypts blocks of data independently. 41 | The 42 | .Fn cbc_crypt 43 | function 44 | encrypts in 45 | .Tn CBC 46 | (Cipher Block Chaining) 47 | mode, which chains together 48 | successive blocks. 49 | .Tn CBC 50 | mode protects against insertions, deletions and 51 | substitutions of blocks. 52 | Also, regularities in the clear text will 53 | not appear in the cipher text. 54 | .Pp 55 | Here is how to use these routines. 56 | The first argument, 57 | .Fa key , 58 | is the 8-byte encryption key with parity. 59 | To set the key's parity, which for 60 | .Tn DES 61 | is in the low bit of each byte, use 62 | .Fn des_setparity . 63 | The second argument, 64 | .Fa data , 65 | contains the data to be encrypted or decrypted. 66 | The 67 | third argument, 68 | .Fa datalen , 69 | is the length in bytes of 70 | .Fa data , 71 | which must be a multiple of 8. 72 | The fourth argument, 73 | .Fa mode , 74 | is formed by 75 | .Em OR Ns 'ing 76 | together some things. 77 | For the encryption direction 78 | .Em OR 79 | in either 80 | .Dv DES_ENCRYPT 81 | or 82 | .Dv DES_DECRYPT . 83 | For software versus hardware 84 | encryption, 85 | .Em OR 86 | in either 87 | .Dv DES_HW 88 | or 89 | .Dv DES_SW . 90 | If 91 | .Dv DES_HW 92 | is specified, and there is no hardware, then the encryption is performed 93 | in software and the routine returns 94 | .Er DESERR_NOHWDEVICE . 95 | For 96 | .Fn cbc_crypt , 97 | the 98 | .Fa ivec 99 | argument 100 | is the 8-byte initialization 101 | vector for the chaining. 102 | It is updated to the next initialization 103 | vector upon return. 104 | .Sh ERRORS 105 | .Bl -tag -width [DESERR_NOHWDEVICE] -compact 106 | .It Bq Er DESERR_NONE 107 | No error. 108 | .It Bq Er DESERR_NOHWDEVICE 109 | Encryption succeeded, but done in software instead of the requested hardware. 110 | .It Bq Er DESERR_HWERR 111 | An error occurred in the hardware or driver. 112 | .It Bq Er DESERR_BADPARAM 113 | Bad argument to routine. 114 | .El 115 | .Pp 116 | Given a result status 117 | .Va stat , 118 | the macro 119 | .Fn DES_FAILED stat 120 | is false only for the first two statuses. 121 | .Sh SEE ALSO 122 | .\" .Xr des 1 , 123 | .Xr crypt 3 124 | .Sh RESTRICTIONS 125 | These routines are not available in RPCSRC 4.0. 126 | This information is provided to describe the 127 | .Tn DES 128 | interface expected by 129 | Secure RPC. 130 | -------------------------------------------------------------------------------- /man/getrpcent.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)getrpcent.3n 2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI 2 | .\" 3 | .Dd December 14, 1987 4 | .Dt GETRPCENT 3 5 | .Os 6 | .Sh NAME 7 | .Nm getrpcent , 8 | .Nm getrpcbyname , 9 | .Nm getrpcbynumber , 10 | .Nm endrpcent , 11 | .Nm setrpcent 12 | .Nd get RPC entry 13 | .Sh LIBRARY 14 | .Lb libc 15 | .Sh SYNOPSIS 16 | .In rpc/rpc.h 17 | .Ft struct rpcent * 18 | .Fn getrpcent void 19 | .Ft struct rpcent * 20 | .Fn getrpcbyname "char *name" 21 | .Ft struct rpcent * 22 | .Fn getrpcbynumber "int number" 23 | .Ft void 24 | .Fn setrpcent "int stayopen" 25 | .Ft void 26 | .Fn endrpcent void 27 | .Sh DESCRIPTION 28 | The 29 | .Fn getrpcent , 30 | .Fn getrpcbyname , 31 | and 32 | .Fn getrpcbynumber 33 | functions 34 | each return a pointer to an object with the 35 | following structure 36 | containing the broken-out 37 | fields of a line in the rpc program number data base, 38 | .Pa /etc/rpc : 39 | .Bd -literal 40 | struct rpcent { 41 | char *r_name; /* name of server for this rpc program */ 42 | char **r_aliases; /* alias list */ 43 | long r_number; /* rpc program number */ 44 | }; 45 | .Ed 46 | .Pp 47 | The members of this structure are: 48 | .Bl -tag -width r_aliases -offset indent 49 | .It Va r_name 50 | The name of the server for this rpc program. 51 | .It Va r_aliases 52 | A zero terminated list of alternate names for the rpc program. 53 | .It Va r_number 54 | The rpc program number for this service. 55 | .El 56 | .Pp 57 | The 58 | .Fn getrpcent 59 | function 60 | reads the next line of the file, opening the file if necessary. 61 | .Pp 62 | The 63 | .Fn setrpcent 64 | function 65 | opens and rewinds the file. If the 66 | .Fa stayopen 67 | flag is non-zero, 68 | the net data base will not be closed after each call to 69 | .Fn getrpcent 70 | (either directly, or indirectly through one of 71 | the other 72 | .Dq getrpc 73 | calls). 74 | .Pp 75 | The 76 | .Fn endrpcent 77 | function 78 | closes the file. 79 | .Pp 80 | The 81 | .Fn getrpcbyname 82 | and 83 | .Fn getrpcbynumber 84 | functions 85 | sequentially search from the beginning 86 | of the file until a matching rpc program name or 87 | program number is found, or until end-of-file is encountered. 88 | .Sh FILES 89 | .Bl -tag -width /etc/rpc -compact 90 | .It Pa /etc/rpc 91 | .El 92 | .Sh SEE ALSO 93 | .Xr rpc 5 , 94 | .Xr rpcinfo 8 , 95 | .Xr ypserv 8 96 | .Sh DIAGNOSTICS 97 | A 98 | .Dv NULL 99 | pointer is returned on 100 | .Dv EOF 101 | or error. 102 | .Sh BUGS 103 | All information 104 | is contained in a static area 105 | so it must be copied if it is 106 | to be saved. 107 | -------------------------------------------------------------------------------- /man/netconfig.5: -------------------------------------------------------------------------------- 1 | .Dd November 17, 2000 2 | .Dt NETCONFIG 5 3 | .Os 4 | .Sh NAME 5 | .Nm netconfig 6 | .Nd network configuration data base 7 | .Sh SYNOPSIS 8 | .Pa /etc/netconfig 9 | .Sh DESCRIPTION 10 | The 11 | .Nm 12 | file defines a list of 13 | .Dq transport names , 14 | describing their semantics and protocol. 15 | In 16 | .Fx , 17 | this file is only used by the RPC library code. 18 | .Pp 19 | Entries have the following format: 20 | .Pp 21 | .Ar network_id semantics flags family protoname device libraries 22 | .Pp 23 | Entries consist of the following fields: 24 | .Bl -tag -width network_id 25 | .It Ar network_id 26 | The name of the transport described. 27 | .It Ar semantics 28 | Describes the semantics of the transport. 29 | This can be one of: 30 | .Bl -tag -width tpi_cots_ord -offset indent 31 | .It Sy tpi_clts 32 | Connectionless transport. 33 | .It Sy tpi_cots 34 | Connection-oriented transport 35 | .It Sy tpi_cots_ord 36 | Connection-oriented, ordered transport. 37 | .It Sy tpi_raw 38 | A raw connection. 39 | .El 40 | .It Ar flags 41 | This field is either blank (specified by 42 | .Dq Li - ) , 43 | or contains a 44 | .Dq Li v , 45 | meaning visible to the 46 | .Xr getnetconfig 3 47 | function. 48 | .It Ar family 49 | The protocol family of the transport. 50 | This is currently one of: 51 | .Bl -tag -width loopback -offset indent 52 | .It Sy inet6 53 | The IPv6 54 | .Pq Dv PF_INET6 55 | family of protocols. 56 | .It Sy inet 57 | The IPv4 58 | .Pq Dv PF_INET 59 | family of protocols. 60 | .It Sy loopback 61 | The 62 | .Dv PF_LOCAL 63 | protocol family. 64 | .El 65 | .It Ar protoname 66 | The name of the protocol used for this transport. 67 | Can currently be either 68 | .Sy udp , 69 | .Sy tcp 70 | or empty. 71 | .It Ar device 72 | This field is always empty in 73 | .Fx . 74 | .It Ar libraries 75 | This field is always empty in 76 | .Fx . 77 | .El 78 | .Pp 79 | The order of entries in this file will determine which transport will 80 | be preferred by the RPC library code, given a match on a specified 81 | network type. 82 | For example, if a sample network config file would look like this: 83 | .Bd -literal -offset indent 84 | udp6 tpi_clts v inet6 udp - - 85 | tcp6 tpi_cots_ord v inet6 tcp - - 86 | udp tpi_clts v inet udp - - 87 | tcp tpi_cots_ord v inet tcp - - 88 | rawip tpi_raw - inet - - - 89 | local tpi_cots_ord - loopback - - - 90 | .Ed 91 | .Pp 92 | then using the network type 93 | .Sy udp 94 | in calls to the RPC library function (see 95 | .Xr rpc 3 ) 96 | will make the code first try 97 | .Sy udp6 , 98 | and then 99 | .Sy udp . 100 | .Pp 101 | .Xr getnetconfig 3 102 | and associated functions will parse this file and return structures of 103 | the following format: 104 | .Bd -literal 105 | struct netconfig { 106 | char *nc_netid; /* Network ID */ 107 | unsigned long nc_semantics; /* Semantics (see below) */ 108 | unsigned long nc_flag; /* Flags (see below) */ 109 | char *nc_protofmly; /* Protocol family */ 110 | char *nc_proto; /* Protocol name */ 111 | char *nc_device; /* Network device pathname (unused) */ 112 | unsigned long nc_nlookups; /* Number of lookup libs (unused) */ 113 | char **nc_lookups; /* Names of the libraries (unused) */ 114 | unsigned long nc_unused[9]; /* reserved */ 115 | }; 116 | .Ed 117 | .Sh FILES 118 | .Bl -tag -width /etc/netconfig -compact 119 | .It Pa /etc/netconfig 120 | .El 121 | .Sh SEE ALSO 122 | .Xr getnetconfig 3 , 123 | .Xr getnetpath 3 124 | -------------------------------------------------------------------------------- /man/publickey.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)publickey.3r 2.1 88/08/07 4.0 RPCSRC 2 | .\" 3 | .Dd October 6, 1987 4 | .Dt PUBLICKEY 3 5 | .Os 6 | .Sh NAME 7 | .Nm publickey , getpublickey , getsecretkey 8 | .Nd "get public or secret key" 9 | .Sh LIBRARY 10 | .Lb librpcsvc 11 | .Sh SYNOPSIS 12 | .In rpc/rpc.h 13 | .In rpc/key_prot.h 14 | .Ft int 15 | .Fo getpublickey 16 | .Fa "char netname[MAXNETNAMELEN+1]" 17 | .Fa "char publickey[HEXKEYBYTES+1]" 18 | .Fc 19 | .Ft int 20 | .Fo getsecretkey 21 | .Fa "char netname[MAXNETNAMELEN+1]" 22 | .Fa "char secretkey[HEXKEYBYTES+1]" 23 | .Fa "char *passwd" 24 | .Fc 25 | .Sh DESCRIPTION 26 | These routines are used to get public and secret keys from the 27 | .Tn YP 28 | database. 29 | The 30 | .Fn getsecretkey 31 | function 32 | has an extra argument, 33 | .Fa passwd , 34 | which is used to decrypt the encrypted secret key stored in the database. 35 | Both routines return 1 if they are successful in finding the key, 0 otherwise. 36 | The keys are returned as 37 | .Dv NULL Ns \-terminated , 38 | hexadecimal strings. 39 | If the password supplied to 40 | .Fn getsecretkey 41 | fails to decrypt the secret key, the routine will return 1 but the 42 | .Fa secretkey 43 | argument will be a 44 | .Dv NULL 45 | string 46 | .Pq Dq . 47 | .Sh SEE ALSO 48 | .Xr publickey 5 49 | .Pp 50 | .%T "RPC Programmer's Manual" 51 | in 52 | .Pa /usr/share/doc/psd/23.rpc . 53 | -------------------------------------------------------------------------------- /man/publickey.5: -------------------------------------------------------------------------------- 1 | .\" @(#)publickey.5 2.1 88/08/07 4.0 RPCSRC; from 1.6 88/02/29 SMI; 2 | .Dd October 19, 1987 3 | .Dt PUBLICKEY 5 4 | .Os 5 | .Sh NAME 6 | .Nm publickey 7 | .Nd "public key database" 8 | .Sh SYNOPSIS 9 | .Pa /etc/publickey 10 | .Sh DESCRIPTION 11 | .Pa /etc/publickey 12 | is the public key database used for secure 13 | RPC (Remote Procedure Calls). 14 | Each entry in 15 | the database consists of a network user 16 | name (which may either refer to 17 | a user or a hostname), followed by the user's 18 | public key (in hex 19 | notation), a colon, and then the user's 20 | secret key encrypted with 21 | its login password (also in hex notation). 22 | .Pp 23 | This file is altered either by the user through the 24 | .Xr chkey 1 25 | command or by the system administrator through the 26 | .Xr newkey 8 27 | command. 28 | The file 29 | .Pa /etc/publickey 30 | should only contain data on the 31 | .Tn NIS 32 | master machine, where it 33 | is converted into the 34 | .Tn NIS 35 | database 36 | .Pa publickey.byname . 37 | .Sh SEE ALSO 38 | .Xr chkey 1 , 39 | .Xr publickey 3 , 40 | .Xr newkey 8 , 41 | .Xr ypupdated 8 42 | -------------------------------------------------------------------------------- /man/rpc.5: -------------------------------------------------------------------------------- 1 | .\" @(#)rpc.4 1.17 93/08/30 SMI; from SVr4 2 | .\" Copyright 1989 AT&T 3 | .Dd December 10, 1991 4 | .Dt RPC 5 5 | .Os 6 | .Sh NAME 7 | .Nm rpc 8 | .Nd rpc program number data base 9 | .Sh SYNOPSIS 10 | .Pa /etc/rpc 11 | .Sh DESCRIPTION 12 | The 13 | .Nm 14 | file contains user readable names that 15 | can be used in place of RPC program numbers. 16 | For each RPC program a single line should be present 17 | with the following information: 18 | .Pp 19 | .Bl -enum -compact 20 | .It 21 | name of the RPC program 22 | .It 23 | RPC program number 24 | .It 25 | aliases 26 | .El 27 | .Pp 28 | Items are separated by any number of blanks and/or 29 | tab characters. 30 | A hash 31 | .Pq Dq Li # 32 | indicates the beginning of a comment; characters up to the end of 33 | the line are not interpreted by routines which search the file. 34 | .Sh EXAMPLES 35 | Below is an example of an RPC database: 36 | .Bd -literal 37 | # 38 | # rpc 39 | # 40 | rpcbind 100000 portmap sunrpc portmapper 41 | rusersd 100002 rusers 42 | nfs 100003 nfsprog 43 | mountd 100005 mount showmount 44 | walld 100008 rwall shutdown 45 | sprayd 100012 spray 46 | llockmgr 100020 47 | nlockmgr 100021 48 | status 100024 49 | bootparam 100026 50 | keyserv 100029 keyserver 51 | .Ed 52 | .Sh FILES 53 | .Bl -tag -width /etc/nsswitch.conf -compact 54 | .It Pa /etc/nsswitch.conf 55 | .El 56 | .Sh SEE ALSO 57 | .Xr getrpcent 3 58 | -------------------------------------------------------------------------------- /man/rpc_clnt_auth.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)rpc_clnt_auth.3n 1.21 93/05/07 SMI; from SVr4 2 | .\" Copyright 1989 AT&T 3 | .\" @(#)rpc_clnt_auth 1.4 89/07/20 SMI; 4 | .\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. 5 | .\" $NetBSD: rpc_clnt_auth.3,v 1.1 2000/06/03 09:29:50 fvdl Exp $ 6 | .\" $FreeBSD: src/lib/libc/rpc/rpc_clnt_auth.3,v 1.5 2002/12/19 09:40:23 ru Exp $ 7 | .Dd May 7, 1993 8 | .Dt RPC_CLNT_AUTH 3 9 | .Os 10 | .Sh NAME 11 | .Nm auth_destroy , 12 | .Nm authnone_create , 13 | .Nm authsys_create , 14 | .Nm authsys_create_default 15 | .Nd library routines for client side remote procedure call authentication 16 | .Sh LIBRARY 17 | .Lb libc 18 | .Sh SYNOPSIS 19 | .In rpc/rpc.h 20 | .Ft "void" 21 | .Fn auth_destroy "AUTH *auth" 22 | .Ft "AUTH *" 23 | .Fn authnone_create "void" 24 | .Ft "AUTH *" 25 | .Fn authsys_create "const char *host" "const uid_t uid" "const gid_t gid" "const int len" "const gid_t *aup_gids" 26 | .Ft "AUTH *" 27 | .Fn authsys_create_default "void" 28 | .Sh DESCRIPTION 29 | These routines are part of the 30 | RPC library that allows C language programs to make procedure 31 | calls on other machines across the network, 32 | with desired authentication. 33 | .Pp 34 | These routines are normally called after creating the 35 | .Vt CLIENT 36 | handle. 37 | The 38 | .Va cl_auth 39 | field of the 40 | .Vt CLIENT 41 | structure should be initialized by the 42 | .Vt AUTH 43 | structure returned by some of the following routines. 44 | The client's authentication information 45 | is passed to the server when the 46 | RPC 47 | call is made. 48 | .Pp 49 | Only the 50 | .Dv NULL 51 | and the 52 | .Dv SYS 53 | style of authentication is discussed here. 54 | .Sh Routines 55 | .Bl -tag -width authsys_create_default() 56 | .It Fn auth_destroy 57 | A function macro that destroys the authentication 58 | information associated with 59 | .Fa auth . 60 | Destruction usually involves deallocation 61 | of private data structures. 62 | The use of 63 | .Fa auth 64 | is undefined after calling 65 | .Fn auth_destroy . 66 | .It Fn authnone_create 67 | Create and return an RPC 68 | authentication handle that passes nonusable 69 | authentication information with each remote procedure call. 70 | This is the default authentication used by RPC. 71 | .It Fn authsys_create 72 | Create and return an RPC authentication handle that contains 73 | .Dv AUTH_SYS 74 | authentication information. 75 | The 76 | .Fa host 77 | argument 78 | is the name of the machine on which the information was 79 | created; 80 | .Fa uid 81 | is the user's user ID; 82 | .Fa gid 83 | is the user's current group ID; 84 | .Fa len 85 | and 86 | .Fa aup_gids 87 | refer to a counted array of groups to which the user belongs. 88 | .It Fn authsys_create_default 89 | Call 90 | .Fn authsys_create 91 | with the appropriate arguments. 92 | .El 93 | .Sh SEE ALSO 94 | .Xr rpc 3 , 95 | .Xr rpc_clnt_calls 3 , 96 | .Xr rpc_clnt_create 3 97 | -------------------------------------------------------------------------------- /man/rpc_svc_calls.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)rpc_svc_calls.3n 1.28 93/05/10 SMI; from SVr4 2 | .\" Copyright 1989 AT&T 3 | .\" @(#)rpc_svc_calls 1.5 89/07/25 SMI; 4 | .\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. 5 | .\" $NetBSD: rpc_svc_calls.3,v 1.1 2000/06/02 23:11:13 fvdl Exp $ 6 | .\" $FreeBSD: src/lib/libc/rpc/rpc_svc_calls.3,v 1.8 2003/09/08 19:57:15 ru Exp $ 7 | .Dd May 3, 1993 8 | .Dt RPC_SVC_CALLS 3 9 | .Os 10 | .Sh NAME 11 | .Nm svc_getrpccaller , 12 | .Nm svc_sendreply 13 | .Nd library routines for RPC servers 14 | .Sh LIBRARY 15 | .Lb libc 16 | .Sh SYNOPSIS 17 | .In rpc/rpc.h 18 | .Ft "struct netbuf *" 19 | .Fn svc_getrpccaller "const SVCXPRT *xprt" 20 | .Ft enum xprt_stat 21 | .Fn svc_sendreply "struct svc_req *request" 22 | .Sh DESCRIPTION 23 | These routines are part of the 24 | RPC 25 | library which allows C language programs to make procedure 26 | calls on other machines across the network. 27 | .Pp 28 | These routines are associated with the server side of the 29 | RPC mechanism. 30 | Some of them are called by the server side dispatch function, 31 | while others 32 | are called when the server is initiated. 33 | .Sh Routines 34 | See 35 | .Xr rpc 3 36 | for the definition of the 37 | .Vt SVCXPRT 38 | data structure. 39 | .Bl -tag -width svc_sendreply() 40 | .It Fn svc_sendreply 41 | Called by an RPC service's dispatch routine to send the results of a 42 | remote procedure call. 43 | The 44 | .Fa request 45 | argument 46 | is the request. 47 | Its 48 | .Tn struct rpc_msg 49 | .Fa ar_results 50 | fields must be set: 51 | .Fa proc 52 | is the 53 | .Tn XDR 54 | routine which is used to encode the results; and 55 | .Fa where 56 | is the address of the results. 57 | This routine returns 58 | .Dv XPRT_IDLE (0) 59 | for success, 60 | .Dv XPRT_DIED 61 | or greater otherwise. 62 | .El 63 | .Sh SEE ALSO 64 | .Xr poll 2 , 65 | .Xr select 2 , 66 | .Xr rpc 3 , 67 | .Xr rpc_svc_create 3 , 68 | .Xr rpc_svc_err 3 , 69 | .Xr rpc_svc_reg 3 70 | -------------------------------------------------------------------------------- /man/rpc_svc_err.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)rpc_svc_err.3n 1.23 93/08/31 SMI; from SVr4 2 | .\" Copyright 1989 AT&T 3 | .\" @(#)rpc_svc_err 1.4 89/06/28 SMI; 4 | .\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. 5 | .\" $NetBSD: rpc_svc_err.3,v 1.1 2000/06/02 23:11:14 fvdl Exp $ 6 | .\" $FreeBSD: src/lib/libc/rpc/rpc_svc_err.3,v 1.4 2002/12/19 09:40:23 ru Exp $ 7 | .Dd May 3, 1993 8 | .Dt RPC_SVC_ERR 3 9 | .Os 10 | .Sh NAME 11 | .Nm rpc_svc_err , 12 | .Nm svcerr_auth , 13 | .Nm svcerr_decode , 14 | .Nm svcerr_noproc , 15 | .Nm svcerr_noprog , 16 | .Nm svcerr_progvers , 17 | .Nm svcerr_systemerr , 18 | .Nm svcerr_weakauth 19 | .Nd library routines for server side remote procedure call errors 20 | .Sh LIBRARY 21 | .Lb libc 22 | .Sh SYNOPSIS 23 | .In rpc/rpc.h 24 | .Ft void 25 | .Fn svcerr_auth "SVCXPRT *xprt" "enum auth_stat why" 26 | .Ft void 27 | .Fn svcerr_decode "SVCXPRT *xprt" 28 | .Ft void 29 | .Fn svcerr_noproc "SVCXPRT *xprt" 30 | .Ft void 31 | .Fn svcerr_noprog "SVCXPRT *xprt" 32 | .Ft void 33 | .Fn svcerr_progvers "SVCXPRT *xprt" "rpcvers_t low_vers" "rpcvers_t high_vers" 34 | .Ft void 35 | .Fn svcerr_systemerr "SVCXPRT *xprt" 36 | .Ft void 37 | .Fn svcerr_weakauth "SVCXPRT *xprt" 38 | .Sh DESCRIPTION 39 | These routines are part of the RPC 40 | library which allows C language programs to make procedure 41 | calls on other machines across the network. 42 | .Pp 43 | These routines can be called by the server side 44 | dispatch function if there is any error in the 45 | transaction with the client. 46 | .Sh Routines 47 | See 48 | .Xr rpc 3 49 | for the definition of the 50 | .Vt SVCXPRT 51 | data structure. 52 | .Bl -tag -width XXXXX 53 | .It Fn svcerr_auth 54 | Called by a service dispatch routine that refuses to perform 55 | a remote procedure call due to an authentication error. 56 | .It Fn svcerr_decode 57 | Called by a service dispatch routine that cannot successfully 58 | decode the remote arguments. 59 | .It Fn svcerr_noproc 60 | Called by a service dispatch routine that does not implement 61 | the procedure number that the caller requests. 62 | .It Fn svcerr_noprog 63 | Called when the desired program is not registered with the 64 | RPC package. 65 | Service implementors usually do not need this routine. 66 | .It Fn svcerr_progvers 67 | Called when the desired version of a program is not registered with the 68 | RPC package. 69 | The 70 | .Fa low_vers 71 | argument 72 | is the lowest version number, 73 | and 74 | .Fa high_vers 75 | is the highest version number. 76 | Service implementors usually do not need this routine. 77 | .It Fn svcerr_systemerr 78 | Called by a service dispatch routine when it detects a system 79 | error not covered by any particular protocol. 80 | For example, if a service can no longer allocate storage, 81 | it may call this routine. 82 | .It Fn svcerr_weakauth 83 | Called by a service dispatch routine that refuses to perform 84 | a remote procedure call due to insufficient (but correct) 85 | authentication arguments. 86 | The routine calls 87 | .Fn svcerr_auth "xprt" "AUTH_TOOWEAK" . 88 | .El 89 | .Sh SEE ALSO 90 | .Xr rpc 3 , 91 | .Xr rpc_svc_calls 3 , 92 | .Xr rpc_svc_create 3 , 93 | .Xr rpc_svc_reg 3 94 | -------------------------------------------------------------------------------- /man/rpc_xdr.3t: -------------------------------------------------------------------------------- 1 | .\" @(#)rpc_xdr.3n 1.24 93/08/31 SMI; from SVr4 2 | .\" Copyright 1989 AT&T 3 | .\" @(#)rpc_xdr.new 1.1 89/04/06 SMI; 4 | .\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved. 5 | .\" $FreeBSD: src/lib/libc/rpc/rpc_xdr.3,v 1.3 2001/10/03 16:47:56 bde Exp $ 6 | .Dd May 3, 1993 7 | .Dt RPC_XDR 3 8 | .Os 9 | .Sh NAME 10 | .Nm xdr_accepted_reply , 11 | .Nm xdr_authsys_parms , 12 | .Nm xdr_callhdr , 13 | .Nm xdr_callmsg , 14 | .Nm xdr_opaque_auth , 15 | .Nm xdr_rejected_reply , 16 | .Nm xdr_replymsg 17 | .Nd XDR library routines for remote procedure calls 18 | .Sh LIBRARY 19 | .Lb libc 20 | .Sh SYNOPSIS 21 | .In rpc/rpc.h 22 | .Ft bool_t 23 | .Fn xdr_accepted_reply "XDR *xdrs" "struct accepted_reply *ar" 24 | .Ft bool_t 25 | .Fn xdr_authsys_parms "XDR *xdrs" "struct authsys_parms *aupp" 26 | .Ft bool_t 27 | .Fn xdr_callhdr "XDR *xdrs" "struct rpc_msg *chdr" 28 | .Ft bool_t 29 | .Fn xdr_callmsg "XDR *xdrs" "struct rpc_msg *cmsg" 30 | .Ft bool_t 31 | .Fn xdr_opaque_auth "XDR *xdrs" "struct opaque_auth *ap" 32 | .Ft bool_t 33 | .Fn xdr_rejected_reply "XDR *xdrs" "struct rejected_reply *rr" 34 | .Ft bool_t 35 | .Fn xdr_replymsg "XDR *xdrs" "struct rpc_msg *rmsg" 36 | .Sh DESCRIPTION 37 | These routines are used for describing the 38 | RPC messages in XDR language. 39 | They should normally be used by those who do not 40 | want to use the RPC 41 | package directly. 42 | These routines return 43 | .Dv TRUE 44 | if they succeed, 45 | .Dv FALSE 46 | otherwise. 47 | .Sh Routines 48 | See 49 | .Xr rpc 3 50 | for the definition of the 51 | .Vt XDR 52 | data structure. 53 | .Bl -tag -width XXXXX 54 | .It Fn xdr_accepted_reply 55 | Used to translate between RPC 56 | reply messages and their external representation. 57 | It includes the status of the RPC 58 | call in the XDR language format. 59 | In the case of success, it also includes the call results. 60 | .It Fn xdr_authsys_parms 61 | Used for describing 62 | .Ux 63 | operating system credentials. 64 | It includes machine-name, uid, gid list, etc. 65 | .It Fn xdr_callhdr 66 | Used for describing 67 | RPC 68 | call header messages. 69 | It encodes the static part of the call message header in the 70 | XDR language format. 71 | It includes information such as transaction 72 | ID, RPC version number, program and version number. 73 | .It Fn xdr_callmsg 74 | Used for describing 75 | RPC call messages. 76 | This includes all the RPC 77 | call information such as transaction 78 | ID, RPC version number, program number, version number, 79 | authentication information, etc. 80 | This is normally used by servers to determine information about the client 81 | RPC call. 82 | .It Fn xdr_opaque_auth 83 | Used for describing RPC 84 | opaque authentication information messages. 85 | .It Fn xdr_rejected_reply 86 | Used for describing RPC reply messages. 87 | It encodes the rejected RPC message in the XDR language format. 88 | The message could be rejected either because of version 89 | number mis-match or because of authentication errors. 90 | .It Fn xdr_replymsg 91 | Used for describing RPC 92 | reply messages. 93 | It translates between the 94 | RPC reply message and its external representation. 95 | This reply could be either an acceptance, 96 | rejection or 97 | .Dv NULL . 98 | .El 99 | .Sh SEE ALSO 100 | .Xr rpc 3 , 101 | .Xr xdr 3 102 | -------------------------------------------------------------------------------- /ntirpc/fpmath.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003 Mike Barcroft 3 | * Copyright (c) 2002 David Schultz 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | * SUCH DAMAGE. 26 | * 27 | * $FreeBSD: src/lib/libc/include/fpmath.h,v 1.1 2003/02/08 20:37:53 mike Exp $ 28 | */ 29 | 30 | #include 31 | #include "_fpmath.h" 32 | 33 | union IEEEf2bits { 34 | float f; 35 | struct { 36 | #if _BYTE_ORDER == _LITTLE_ENDIAN 37 | unsigned int man:23; 38 | unsigned int exp:8; 39 | unsigned int sign:1; 40 | #else /* _BIG_ENDIAN */ 41 | unsigned int sign:1; 42 | unsigned int exp:8; 43 | unsigned int man:23; 44 | #endif 45 | } bits; 46 | }; 47 | 48 | union IEEEd2bits { 49 | double d; 50 | struct { 51 | #if _BYTE_ORDER == _LITTLE_ENDIAN 52 | unsigned int manl:32; 53 | unsigned int manh:20; 54 | unsigned int exp:11; 55 | unsigned int sign:1; 56 | #else /* _BIG_ENDIAN */ 57 | unsigned int sign:1; 58 | unsigned int exp:11; 59 | unsigned int manh:20; 60 | unsigned int manl:32; 61 | #endif 62 | } bits; 63 | }; 64 | -------------------------------------------------------------------------------- /ntirpc/getpeereid.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * getpeereid.c 4 | * get peer userid for UNIX-domain socket connection 5 | * 6 | * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group 7 | * 8 | * 9 | * IDENTIFICATION 10 | * src/port/getpeereid.c 11 | * 12 | *------------------------------------------------------------------------- 13 | */ 14 | 15 | #ifndef GETPEERID_H 16 | #define GETPEERID_H 17 | 18 | int getpeereid(int s, uid_t *euid, gid_t *egid); 19 | 20 | #endif /* GETPEERID_H */ 21 | -------------------------------------------------------------------------------- /ntirpc/intrinsic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Linux Box Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef _RPC_INTRINSIC_H 27 | #define _RPC_INTRINSIC_H 28 | 29 | #if (__GNUC__ >= 3) 30 | #ifndef likely 31 | #define likely(x) __builtin_expect(!!(x), 1) 32 | #define unlikely(x) __builtin_expect(!!(x), 0) 33 | #endif 34 | #else 35 | #define likely(x) (x) 36 | #define unlikely(x) (x) 37 | #endif 38 | 39 | #endif /* _RPC_INTRINSIC_H */ 40 | -------------------------------------------------------------------------------- /ntirpc/lttng/rpcping.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vim:noexpandtab:shiftwidth=8:tabstop=8: 3 | * 4 | * Copyright 2018 Red Hat, Inc. and/or its affiliates. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * - Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "config.h" 32 | 33 | 34 | #undef TRACEPOINT_PROVIDER 35 | #define TRACEPOINT_PROVIDER rpcping 36 | 37 | #if !defined(GANESHA_LTTNG_RPCPING_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ) 38 | #define GANESHA_LTTNG_RPCPING_TP_H 39 | 40 | #include 41 | 42 | TRACEPOINT_EVENT( 43 | rpcping, 44 | test, 45 | TP_ARGS(const char *, file, 46 | const char *, function, 47 | unsigned int, line, 48 | char *, message), 49 | TP_FIELDS( 50 | ctf_string(file, file) 51 | ctf_string(fnc, function) 52 | ctf_integer(unsigned int, line, line) 53 | ctf_string(msg, message) 54 | ) 55 | ) 56 | 57 | TRACEPOINT_LOGLEVEL( 58 | rpcping, 59 | test, 60 | TRACE_INFO) 61 | 62 | #endif /* GANESHA_LTTNG_RPCPING_TP_H */ 63 | 64 | #undef TRACEPOINT_INCLUDE 65 | #define TRACEPOINT_INCLUDE "lttng/rpcping.h" 66 | 67 | #include 68 | -------------------------------------------------------------------------------- /ntirpc/lttng/xprt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vim:noexpandtab:shiftwidth=8:tabstop=8: 3 | * 4 | * Copyright 2018 Red Hat, Inc. and/or its affiliates. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * - Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "config.h" 32 | #include 33 | 34 | #undef TRACEPOINT_PROVIDER 35 | #define TRACEPOINT_PROVIDER xprt 36 | 37 | #if !defined(GANESHA_LTTNG_XPRT_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ) 38 | #define GANESHA_LTTNG_XPRT_TP_H 39 | 40 | #include 41 | 42 | TRACEPOINT_EVENT( 43 | xprt, 44 | ref, 45 | TP_ARGS(const char *, function, 46 | unsigned int, line, 47 | void *, xprt, 48 | uint32_t, count), 49 | TP_FIELDS( 50 | ctf_string(fnc, function) 51 | ctf_integer(unsigned int, line, line) 52 | ctf_integer_hex(void *, xprt, xprt) 53 | ctf_integer(uint32_t, count, count) 54 | ) 55 | ) 56 | 57 | TRACEPOINT_LOGLEVEL( 58 | xprt, 59 | ref, 60 | TRACE_INFO) 61 | 62 | TRACEPOINT_EVENT( 63 | xprt, 64 | unref, 65 | TP_ARGS(const char *, function, 66 | unsigned int, line, 67 | void *, xprt, 68 | uint32_t, count), 69 | TP_FIELDS( 70 | ctf_string(fnc, function) 71 | ctf_integer(unsigned int, line, line) 72 | ctf_integer_hex(void *, xprt, xprt) 73 | ctf_integer(uint32_t, count, count) 74 | ) 75 | ) 76 | 77 | TRACEPOINT_LOGLEVEL( 78 | xprt, 79 | unref, 80 | TRACE_INFO) 81 | 82 | #endif /* GANESHA_LTTNG_XPRT_TP_H */ 83 | 84 | #undef TRACEPOINT_INCLUDE 85 | #define TRACEPOINT_INCLUDE "lttng/xprt.h" 86 | 87 | #include 88 | -------------------------------------------------------------------------------- /ntirpc/misc/city.h: -------------------------------------------------------------------------------- 1 | /* city.h - cityhash-c 2 | * CityHash on C 3 | * Copyright (c) 2011-2012, Alexander Nusov 4 | * 5 | * - original copyright notice - 6 | * Copyright (c) 2011 Google, Inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | * CityHash, by Geoff Pike and Jyrki Alakuijala 27 | * 28 | * This file provides a few functions for hashing strings. On x86-64 29 | * hardware in 2011, CityHash64() is faster than other high-quality 30 | * hash functions, such as Murmur. This is largely due to higher 31 | * instruction-level parallelism. CityHash64() and CityHash128() also perform 32 | * well on hash-quality tests. 33 | * 34 | * CityHash128() is optimized for relatively long strings and returns 35 | * a 128-bit hash. For strings more than about 2000 bytes it can be 36 | * faster than CityHash64(). 37 | * 38 | * Functions in the CityHash family are not suitable for cryptography. 39 | * 40 | * WARNING: This code has not been tested on big-endian platforms! 41 | * It is known to work well on little-endian platforms that have a small penalty 42 | * for unaligned reads, such as current Intel and AMD moderate-to-high-end CPUs. 43 | * 44 | * By the way, for some hash functions, given strings a and b, the hash 45 | * of a+b is easily derived from the hashes of a and b. This property 46 | * doesn't hold for any hash functions in this file. 47 | */ 48 | 49 | #ifndef CITY_HASH_H_ 50 | #define CITY_HASH_H_ 51 | 52 | #include 53 | #include 54 | 55 | typedef uint8_t uint8; 56 | typedef uint32_t uint32; 57 | typedef uint64_t uint64; 58 | 59 | typedef struct _uint128 uint128; 60 | struct _uint128 { 61 | uint64 first; 62 | uint64 second; 63 | }; 64 | 65 | #define Uint128Low64(x) ((x).first) 66 | #define Uint128High64(x) ((x).second) 67 | 68 | /* Hash function for a byte array. */ 69 | uint64 CityHash64(const char *buf, size_t len); 70 | 71 | /* Hash function for a byte array. For convenience, a 64-bit seed is also 72 | * hashed into the result. */ 73 | uint64 CityHash64WithSeed(const char *buf, size_t len, uint64 seed); 74 | 75 | /* Hash function for a byte array. For convenience, two seeds are also 76 | * hashed into the result. */ 77 | uint64 CityHash64WithSeeds(const char *buf, size_t len, uint64 seed0, 78 | uint64 seed1); 79 | 80 | /* Hash function for a byte array. */ 81 | uint128 CityHash128(const char *s, size_t len); 82 | 83 | /* Hash function for a byte array. For convenience, a 128-bit seed is also 84 | * hashed into the result. */ 85 | uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed); 86 | 87 | #endif /* CITY_HASH_H_ */ 88 | -------------------------------------------------------------------------------- /ntirpc/misc/citycrc.h: -------------------------------------------------------------------------------- 1 | /* citycrc.h - cityhash-c 2 | * CityHash on C 3 | * Copyright (c) 2011-2012, Alexander Nusov 4 | * 5 | * - original copyright notice - 6 | * Copyright (c) 2011 Google, Inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | * CityHash, by Geoff Pike and Jyrki Alakuijala 27 | * 28 | * This file declares the subset of the CityHash functions that require 29 | * _mm_crc32_u64(). See the CityHash README for details. 30 | * 31 | * Functions in the CityHash family are not suitable for cryptography. 32 | */ 33 | 34 | #ifndef CITY_HASH_CRC_H_ 35 | #define CITY_HASH_CRC_H_ 36 | 37 | #include 38 | 39 | /* Hash function for a byte array. */ 40 | uint128 CityHashCrc128(const char *s, size_t len); 41 | 42 | /* Hash function for a byte array. For convenience, a 128-bit seed is also 43 | * hashed into the result. */ 44 | uint128 CityHashCrc128WithSeed(const char *s, size_t len, uint128 seed); 45 | 46 | /* Hash function for a byte array. Sets result[0] ... result[3]. */ 47 | void CityHashCrc256(const char *s, size_t len, uint64 *result); 48 | 49 | #endif /* CITY_HASH_CRC_H_ */ 50 | -------------------------------------------------------------------------------- /ntirpc/misc/opr.h: -------------------------------------------------------------------------------- 1 | #ifndef OPR_H 2 | #define OPR_H 1 3 | 4 | #define opr_containerof(ptr, structure, member) \ 5 | ((structure *)((char *)(ptr)-(char *)(&((structure *)NULL)->member))) 6 | 7 | #endif /* OPR_H */ 8 | -------------------------------------------------------------------------------- /ntirpc/misc/os_epoll.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef NTIRPC_OS_EPOLL_H 3 | #define NTIRPC_OS_EPOLL_H 4 | 5 | #if defined(__linux__) 6 | #include 7 | #else 8 | /* epoll <-> kevent shim by Boaz Harrosh */ 9 | #include 10 | #endif 11 | 12 | #endif /* else NTIRPC_OS_EPOLL_H */ 13 | -------------------------------------------------------------------------------- /ntirpc/misc/portable.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef NTIRPC_PORTABLE_H 3 | #define NTIRPC_PORTABLE_H 4 | 5 | #include 6 | #include /* before rpc.h */ 7 | 8 | #if defined(__FreeBSD__) 9 | #include 10 | 11 | #define SOL_IP 0 12 | #define SOL_IPV6 41 13 | 14 | #define IP_PKTINFO IP_RECVIF 15 | 16 | struct in_pktinfo { 17 | struct in_addr ipi_addr; /* destination IPv4 address */ 18 | int ipi_ifindex; /* received interface index */ 19 | }; 20 | 21 | /* YES. Move. */ 22 | #define HAVE_PEEREID 1 23 | 24 | #endif 25 | 26 | #if defined(__linux__) 27 | 28 | /* POSIX clocks */ 29 | #define CLOCK_REALTIME_FAST CLOCK_REALTIME_COARSE 30 | #define CLOCK_MONOTONIC_FAST CLOCK_MONOTONIC_COARSE 31 | 32 | /* poll */ 33 | #define POLLRDNORM 0x040 /* Normal data may be read. */ 34 | #define POLLRDBAND 0x080 /* Priority data may be read. */ 35 | 36 | #define HAVE_GETPEEREID 0 37 | 38 | #endif 39 | 40 | #if defined(_WIN32) 41 | #ifdef _MSC_VER 42 | #include 43 | #else 44 | #include 45 | #endif 46 | #include 47 | #include 48 | 49 | #define CLOCK_MONOTONIC_FAST 6 50 | 51 | typedef uint32_t clockid_t; 52 | extern int clock_gettime(clockid_t clock, struct timespec *ts); 53 | 54 | void warnx(const char *fmt, ...); 55 | 56 | #else 57 | #define PtrToUlong(addr) ((unsigned long)(addr)) 58 | #endif /* !_WIN32 */ 59 | 60 | #ifdef __APPLE__ 61 | #include 62 | typedef unsigned int clockid_t; 63 | #define CLOCK_MONOTONIC_FAST 6 64 | extern int clock_gettime(clockid_t clock, struct timespec *ts); 65 | #endif 66 | 67 | #ifndef max 68 | #define max(a, b) (a > b ? a : b) 69 | #endif 70 | 71 | #if !defined(CACHE_LINE_SIZE) 72 | #if defined(__PPC64__) 73 | #define CACHE_LINE_SIZE 128 74 | #else /* __x86_64__, __i386__ and others */ 75 | #define CACHE_LINE_SIZE 64 76 | #endif 77 | #endif 78 | 79 | #define CACHE_PAD(_n) char __pad ## _n [CACHE_LINE_SIZE] 80 | 81 | #endif /* NTIRPC_PORTABLE_H */ 82 | -------------------------------------------------------------------------------- /ntirpc/misc/rbtree.h: -------------------------------------------------------------------------------- 1 | /* Left-leaning red/black trees */ 2 | 3 | #ifndef _OPR_RBTREE_H 4 | #define _OPR_RBTREE_H 1 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | /* from opr.h */ 11 | #define opr_containerof(ptr, structure, member) \ 12 | ((structure *)((char *)(ptr)-(char *)(&((structure *)NULL)->member))) 13 | 14 | struct opr_rbtree_node { 15 | struct opr_rbtree_node *left; 16 | struct opr_rbtree_node *right; 17 | struct opr_rbtree_node *parent; 18 | uint32_t red; 19 | uint32_t gen; /* generation number */ 20 | }; 21 | 22 | typedef int (*opr_rbtree_cmpf_t) (const struct opr_rbtree_node *lhs, 23 | const struct opr_rbtree_node *rhs); 24 | 25 | struct opr_rbtree { 26 | struct opr_rbtree_node *root; 27 | opr_rbtree_cmpf_t cmpf; 28 | uint64_t size; 29 | uint64_t gen; /* generation number */ 30 | }; 31 | 32 | extern void opr_rbtree_init(struct opr_rbtree *head, opr_rbtree_cmpf_t cmpf); 33 | extern struct opr_rbtree_node *opr_rbtree_first(struct opr_rbtree *head); 34 | extern struct opr_rbtree_node *opr_rbtree_last(struct opr_rbtree *head); 35 | extern struct opr_rbtree_node *opr_rbtree_next(struct opr_rbtree_node *node); 36 | extern struct opr_rbtree_node *opr_rbtree_prev(struct opr_rbtree_node *node); 37 | extern struct opr_rbtree_node *opr_rbtree_lookup(struct opr_rbtree *head, 38 | struct opr_rbtree_node *node); 39 | extern struct opr_rbtree_node *opr_rbtree_insert(struct opr_rbtree *head, 40 | struct opr_rbtree_node *node); 41 | extern void opr_rbtree_insert_at(struct opr_rbtree *head, 42 | struct opr_rbtree_node *parent, 43 | struct opr_rbtree_node **childptr, 44 | struct opr_rbtree_node *node); 45 | extern void opr_rbtree_remove(struct opr_rbtree *head, 46 | struct opr_rbtree_node *node); 47 | extern void opr_rbtree_replace(struct opr_rbtree *head, 48 | struct opr_rbtree_node *old, 49 | struct opr_rbtree_node *replacement); 50 | 51 | static inline bool opr_rbtree_node_valid(struct opr_rbtree_node *node) 52 | { 53 | return (node->gen != 0); 54 | } 55 | 56 | static inline unsigned long opr_rbtree_size(struct opr_rbtree *head) 57 | { 58 | return (head->size); 59 | } 60 | 61 | #endif /* _OPR_RBTREE_H */ 62 | -------------------------------------------------------------------------------- /ntirpc/misc/socket.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 4. Neither the name of the University nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * @(#)socket.h 8.4 (Berkeley) 2/21/94 30 | * $FreeBSD: stable/10/sys/sys/socket.h 254925 2013-08-26 18:16:05Z jhb $ 31 | */ 32 | 33 | #ifndef MISC_SYS_SOCKET_H 34 | #define MISC_SYS_SOCKET_H 35 | 36 | #include 37 | #if defined(__linux__) 38 | /* 39 | * While we may have more groups than this, the cmsgcred struct must 40 | * be able to fit in an mbuf and we have historically supported a 41 | * maximum of 16 groups. 42 | */ 43 | #define CMGROUP_MAX 16 44 | 45 | /* 46 | * Credentials structure, used to verify the identity of a peer 47 | * process that has sent us a message. This is allocated by the 48 | * peer process but filled in by the kernel. This prevents the 49 | * peer from lying about its identity. (Note that cmcred_groups[0] 50 | * is the effective GID.) 51 | */ 52 | struct cmsgcred { 53 | pid_t cmcred_pid; /* PID of sending process */ 54 | uid_t cmcred_uid; /* real UID of sending process */ 55 | uid_t cmcred_euid; /* effective UID of sending process */ 56 | gid_t cmcred_gid; /* real GID of sending process */ 57 | short cmcred_ngroups; /* number or groups */ 58 | gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ 59 | }; 60 | 61 | #endif /* __linux__ */ 62 | 63 | #endif /* MISC_SYS_SOCKET_H */ 64 | -------------------------------------------------------------------------------- /ntirpc/misc/stdio.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef NTIRPC_STDIO_H 3 | #define NTIRPC_STDIO_H 4 | 5 | #if defined(__MINGW32__) 6 | /* XXX fix -- another attraction MSVC */ 7 | #undef fprintf 8 | #undef printf 9 | #undef sprintf 10 | #undef vfprintf 11 | #undef vprintf 12 | #undef fscanf 13 | #undef scanf 14 | #undef sscanf 15 | #undef fclose 16 | #undef fflush 17 | #undef fgetc 18 | #undef fgetpos 19 | #undef fgets 20 | #undef fopen 21 | #undef fputc 22 | #undef fputs 23 | #undef fread 24 | #undef freopen 25 | #undef fsetpos 26 | #undef fseek 27 | #undef fseeko 28 | #undef ftell 29 | #undef ftello 30 | #undef fwrite 31 | #undef getc 32 | #undef getchar 33 | #undef gets 34 | #undef popen 35 | #undef pclose 36 | #undef putc 37 | #undef putchar 38 | #undef puts 39 | #undef remove 40 | #undef rename 41 | #undef unlink 42 | #undef rewind 43 | #undef tmpfile 44 | #undef tmpnam 45 | #undef ungetc 46 | #undef fwscanf 47 | #undef wscanf 48 | #undef fwprintf 49 | #undef wprintf 50 | #undef vfwprintf 51 | #undef vwprintf 52 | #undef fgetwc 53 | #undef fputwc 54 | #undef getwc 55 | #undef getwchar 56 | #undef putwc 57 | #undef putwchar 58 | #undef ungetwc 59 | #undef fgetws 60 | #undef fputws 61 | #endif 62 | #include 63 | #endif /* NTIRPC_STDIO_H */ 64 | -------------------------------------------------------------------------------- /ntirpc/misc/timespec.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1982, 1986, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * Copyright (c) 2012-2017 Red Hat, Inc. and/or its affiliates. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 4. Neither the name of the University nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 | * SUCH DAMAGE. 29 | * 30 | * @(#)time.h 8.5 (Berkeley) 5/4/95 31 | * $FreeBSD: head/sys/sys/time.h 224732 2011-08-09 14:06:50Z jonathan $ 32 | */ 33 | 34 | #ifndef TIMESPEC_H 35 | 36 | /* Convert to coarse milliseconds with round up */ 37 | #define timespec_ms(tsp) \ 38 | ((tsp)->tv_sec * 1000 + ((tsp)->tv_nsec + 999999) / 1000000) 39 | 40 | /* Operations on timespecs */ 41 | #define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0) 42 | #define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec) 43 | #define timespeccmp(tvp, uvp, cmp) \ 44 | (((tvp)->tv_sec == (uvp)->tv_sec) ? \ 45 | ((tvp)->tv_nsec cmp(uvp)->tv_nsec) : \ 46 | ((tvp)->tv_sec cmp(uvp)->tv_sec)) 47 | #define timespecadd(vvp, uvp) \ 48 | do { \ 49 | (vvp)->tv_sec += (uvp)->tv_sec; \ 50 | (vvp)->tv_nsec += (uvp)->tv_nsec; \ 51 | if ((vvp)->tv_nsec >= 1000000000) { \ 52 | (vvp)->tv_sec++; \ 53 | (vvp)->tv_nsec -= 1000000000; \ 54 | } \ 55 | } while (0) 56 | #define timespec_adds(vvp, s) \ 57 | do { \ 58 | (vvp)->tv_sec += s; \ 59 | } while (0) 60 | 61 | #define timespec_addms(vvp, ms) \ 62 | do { \ 63 | (vvp)->tv_sec += (ms) / 1000; \ 64 | (vvp)->tv_nsec += (((ms) % 1000) * 1000000); \ 65 | if ((vvp)->tv_nsec >= 1000000000) { \ 66 | (vvp)->tv_sec++; \ 67 | (vvp)->tv_nsec -= 1000000000; \ 68 | } \ 69 | } while (0) 70 | #define timespecsub(vvp, uvp) \ 71 | do { \ 72 | (vvp)->tv_sec -= (uvp)->tv_sec; \ 73 | (vvp)->tv_nsec -= (uvp)->tv_nsec; \ 74 | if ((vvp)->tv_nsec < 0) { \ 75 | (vvp)->tv_sec--; \ 76 | (vvp)->tv_nsec += 1000000000; \ 77 | } \ 78 | } while (0) 79 | #endif /* TIMESPEC_H */ 80 | -------------------------------------------------------------------------------- /ntirpc/misc/wait_queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Linux Box Corporation. 3 | * Copyright (c) 2013-2017 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef WAIT_QUEUE_H 28 | #define WAIT_QUEUE_H 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | struct waitq_entry { 38 | mutex_t mtx; 39 | cond_t cv; 40 | }; 41 | 42 | #define Wqe_LFlag_None 0x0000 43 | #define Wqe_LFlag_WaitSync 0x0001 44 | #define Wqe_LFlag_SyncDone 0x0002 45 | 46 | /* thread wait queue */ 47 | struct waitq_head { 48 | TAILQ_HEAD(waitq_head_s, waiter) waitq; 49 | struct waitq_entry lwe; /* left */ 50 | struct waitq_entry rwe; /* right */ 51 | uint32_t flags; 52 | uint32_t waiters; 53 | }; 54 | 55 | static inline void waitq_entry_init(struct waitq_entry *we) 56 | { 57 | mutex_init(&we->mtx, NULL); 58 | pthread_cond_init(&we->cv, NULL); 59 | } 60 | 61 | static inline void waitq_entry_destroy(struct waitq_entry *we) 62 | { 63 | mutex_destroy(&we->mtx); 64 | cond_destroy(&we->cv); 65 | } 66 | 67 | static inline void waitq_head_init(struct waitq_head *wqe) 68 | { 69 | TAILQ_INIT(&wqe->waitq); 70 | waitq_entry_init(&wqe->lwe); 71 | waitq_entry_init(&wqe->rwe); 72 | } 73 | 74 | static inline void waitq_head_destroy(struct waitq_head *wqe) 75 | { 76 | TAILQ_INIT(&wqe->waitq); 77 | waitq_entry_destroy(&wqe->lwe); 78 | waitq_entry_destroy(&wqe->rwe); 79 | } 80 | 81 | #endif /* WAIT_QUEUE_H */ 82 | -------------------------------------------------------------------------------- /ntirpc/namespace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001 Daniel Eischen . 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | * $FreeBSD: src/lib/libc/include/namespace.h,v 1.16 2003/05/01 27 | * 19:03:13 nectar Exp $ 28 | */ 29 | 30 | #ifndef _NAMESPACE_H_ 31 | #define _NAMESPACE_H_ 32 | 33 | #endif /* _NAMESPACE_H_ */ 34 | -------------------------------------------------------------------------------- /ntirpc/netconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETCONFIG_H_ 2 | #define _NETCONFIG_H_ 3 | 4 | #if defined(__linux__) 5 | #include 6 | #endif 7 | 8 | #if defined(_WIN32) 9 | #define NETCONFIG "c:\\etc\\netconfig" 10 | #else 11 | #define NETCONFIG "/etc/netconfig" 12 | #endif 13 | #define NETPATH "NETPATH" 14 | 15 | struct netconfig { 16 | char *nc_netid; /* Network ID */ 17 | unsigned long nc_semantics; /* Semantics (see below) */ 18 | unsigned long nc_flag; /* Flags (see below) */ 19 | char *nc_protofmly; /* Protocol family */ 20 | char *nc_proto; /* Protocol name */ 21 | char *nc_device; /* Network device pathname */ 22 | unsigned long nc_nlookups; /* Number of directory lookup libs */ 23 | char **nc_lookups; /* Names of the libraries */ 24 | unsigned long nc_unused[9]; /* reserved */ 25 | }; 26 | 27 | typedef struct { 28 | struct netconfig **nc_head; 29 | struct netconfig **nc_curr; 30 | } NCONF_HANDLE; 31 | 32 | /* 33 | * nc_semantics values 34 | */ 35 | #define NC_TPI_CLTS 1 36 | #define NC_TPI_COTS 2 37 | #define NC_TPI_COTS_ORD 3 38 | #define NC_TPI_RAW 4 39 | 40 | /* 41 | * nc_flag values 42 | */ 43 | #define NC_NOFLAG 0x00 44 | #define NC_VISIBLE 0x01 45 | #define NC_BROADCAST 0x02 46 | 47 | /* 48 | * nc_protofmly values 49 | */ 50 | #define NC_NOPROTOFMLY "-" 51 | #define NC_LOOPBACK "loopback" 52 | #define NC_INET "inet" 53 | #define NC_INET6 "inet6" 54 | #define NC_IMPLINK "implink" 55 | #define NC_PUP "pup" 56 | #define NC_CHAOS "chaos" 57 | #define NC_NS "ns" 58 | #define NC_NBS "nbs" 59 | #define NC_ECMA "ecma" 60 | #define NC_DATAKIT "datakit" 61 | #define NC_CCITT "ccitt" 62 | #define NC_SNA "sna" 63 | #define NC_DECNET "decnet" 64 | #define NC_DLI "dli" 65 | #define NC_LAT "lat" 66 | #define NC_HYLINK "hylink" 67 | #define NC_APPLETALK "appletalk" 68 | #define NC_NIT "nit" 69 | #define NC_IEEE802 "ieee802" 70 | #define NC_OSI "osi" 71 | #define NC_X25 "x25" 72 | #define NC_OSINET "osinet" 73 | #define NC_GOSIP "gosip" 74 | #define NC_VSOCK "vsock" 75 | 76 | /* 77 | * nc_proto values 78 | */ 79 | #define NC_NOPROTO "-" 80 | #define NC_TCP "tcp" 81 | #define NC_UDP "udp" 82 | #define NC_ICMP "icmp" 83 | 84 | 85 | __BEGIN_DECLS 86 | extern void *setnetconfig(void); 87 | extern struct netconfig *getnetconfig(void *); 88 | extern struct netconfig *getnetconfigent(const char *); 89 | extern void freenetconfigent(struct netconfig *); 90 | extern int endnetconfig(void *); 91 | 92 | extern void *setnetpath(void); 93 | extern struct netconfig *getnetpath(void *); 94 | extern int endnetpath(void *); 95 | 96 | extern void nc_perror(const char *); 97 | extern char *nc_sperror(void); 98 | 99 | __END_DECLS 100 | #endif /* _NETCONFIG_H_ */ 101 | -------------------------------------------------------------------------------- /ntirpc/rpc/auth_stat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1984, 2009, Sun Microsystems, Inc. 3 | * Copyright (c) 2017 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * from: @(#)auth.h 1.17 88/02/08 SMI 30 | * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC 31 | * from: @(#)auth.h 1.43 98/02/02 SMI 32 | * from: $NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $ 33 | * from: $FreeBSD: src/include/rpc/auth.h,v 1.20 2003/01/01 18:48:42 schweikh Exp $ 34 | */ 35 | 36 | #ifndef _TIRPC_AUTH_STAT_H_ 37 | #define _TIRPC_AUTH_STAT_H_ 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /* 44 | * Status returned from authentication check 45 | */ 46 | enum auth_stat { 47 | AUTH_OK = 0, 48 | /* 49 | * failed at remote end 50 | */ 51 | AUTH_BADCRED = 1, /* bogus credentials (seal broken) */ 52 | AUTH_REJECTEDCRED = 2, /* client should begin new session */ 53 | AUTH_BADVERF = 3, /* bogus verifier (seal broken) */ 54 | AUTH_REJECTEDVERF = 4, /* verifier expired or was replayed */ 55 | AUTH_TOOWEAK = 5, /* rejected due to security reasons */ 56 | /* 57 | * failed locally 58 | */ 59 | AUTH_INVALIDRESP = 6, /* bogus response verifier */ 60 | AUTH_FAILED = 7, /* some unknown reason */ 61 | #ifdef KERBEROS 62 | /* 63 | * kerberos errors 64 | */ 65 | AUTH_KERB_GENERIC = 8, /* kerberos generic error */ 66 | AUTH_TIMEEXPIRE = 9, /* time of credential expired */ 67 | AUTH_TKT_FILE = 10, /* something wrong with ticket file */ 68 | AUTH_DECODE = 11, /* can't decode authenticator */ 69 | AUTH_NET_ADDR = 12, /* wrong net address in ticket */ 70 | #endif /* KERBEROS */ 71 | /* 72 | * RPCSEC_GSS errors 73 | */ 74 | RPCSEC_GSS_CREDPROBLEM = 13, 75 | RPCSEC_GSS_CTXPROBLEM = 14, 76 | }; 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | #endif /* !_TIRPC_AUTH_STAT_H_ */ 82 | -------------------------------------------------------------------------------- /ntirpc/rpc/auth_unix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * Copyright (c) 2013-2018 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * from: @(#)auth_unix.h 1.8 88/02/08 SMI 30 | * from: @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC 31 | * $FreeBSD: src/include/rpc/auth_unix.h,v 1.11 2002/03/23 17:24:55 imp Exp $ 32 | */ 33 | 34 | /* 35 | * auth_unix.h, Protocol for UNIX style authentication parameters for RPC 36 | * 37 | * Copyright (C) 1984, Sun Microsystems, Inc. 38 | */ 39 | 40 | /* 41 | * The system is very weak. The client uses no encryption for it 42 | * credentials and only sends null verifiers. The server sends backs 43 | * null verifiers or optionally a verifier that suggests a new short hand 44 | * for the credentials. 45 | */ 46 | 47 | #ifndef _TIRPC_AUTH_UNIX_H 48 | #define _TIRPC_AUTH_UNIX_H 49 | #include 50 | 51 | /* The machine name is part of a credential; it may not exceed 255 bytes */ 52 | #define MAX_MACHINE_NAME 255 53 | 54 | /* gids compose part of a credential; there may not be more than 16 of them */ 55 | #define NGRPS 16 56 | 57 | /* 58 | * Unix style credentials. 59 | */ 60 | struct authunix_parms { 61 | char *aup_machname; 62 | gid_t *aup_gids; 63 | u_int aup_len; /* count of aup_gids */ 64 | uid_t aup_uid; 65 | gid_t aup_gid; 66 | int32_t aup_time; /* old protocol 32-bits not long time_t */ 67 | }; 68 | 69 | #define authsys_parms authunix_parms 70 | 71 | __BEGIN_DECLS 72 | extern bool xdr_authunix_parms(XDR *, struct authunix_parms *); 73 | __END_DECLS 74 | /* 75 | * If a response verifier has flavor AUTH_SHORT, 76 | * then the body of the response verifier encapsulates the following structure; 77 | * again it is serialized in the obvious fashion. 78 | */ 79 | struct short_hand_verf { 80 | struct opaque_auth new_cred; 81 | }; 82 | 83 | #endif /* !_TIRPC_AUTH_UNIX_H */ 84 | -------------------------------------------------------------------------------- /ntirpc/rpc/clnt_stat.h: -------------------------------------------------------------------------------- 1 | /* $FreeBSD: src/include/rpc/clnt_stat.h,v 1.2 2001/03/20 2 | * 08:20:50 alfred Exp $ */ 3 | /* 4 | * Copyright (c) 1986 - 1991, 1994, 1996, 1997 by Sun Microsystems, Inc. 5 | * All rights reserved. 6 | */ 7 | 8 | /* 9 | * clnt_stat.h - Client side remote procedure call enum 10 | * 11 | */ 12 | 13 | #ifndef _RPC_CLNT_STAT_H 14 | #define _RPC_CLNT_STAT_H 15 | 16 | /* #pragma ident "@(#)clnt_stat.h 1.2 97/04/28 SMI" */ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | enum clnt_stat { 23 | RPC_SUCCESS = 0, /* call succeeded */ 24 | /* 25 | * local errors 26 | */ 27 | RPC_CANTENCODEARGS = 1, /* can't encode arguments */ 28 | RPC_CANTDECODERES = 2, /* can't decode results */ 29 | RPC_CANTSEND = 3, /* failure in sending call */ 30 | RPC_CANTRECV = 4, 31 | /* failure in receiving result */ 32 | RPC_TIMEDOUT = 5, /* call timed out */ 33 | RPC_INTR = 18, /* call interrupted */ 34 | RPC_UDERROR = 23, /* recv got uderr indication */ 35 | /* 36 | * remote errors 37 | */ 38 | RPC_VERSMISMATCH = 6, /* rpc versions not compatible */ 39 | RPC_AUTHERROR = 7, /* authentication error */ 40 | RPC_PROGUNAVAIL = 8, /* program not available */ 41 | RPC_PROGVERSMISMATCH = 9, /* program version mismatched */ 42 | RPC_PROCUNAVAIL = 10, /* procedure unavailable */ 43 | RPC_CANTDECODEARGS = 11, /* decode arguments error */ 44 | RPC_SYSTEMERROR = 12, /* generic "other problem" */ 45 | 46 | /* 47 | * rpc_call & clnt_create errors 48 | */ 49 | RPC_UNKNOWNHOST = 13, /* unknown host name */ 50 | RPC_UNKNOWNPROTO = 17, /* unknown protocol */ 51 | RPC_UNKNOWNADDR = 19, /* Remote address unknown */ 52 | RPC_NOBROADCAST = 21, /* Broadcasting not supported */ 53 | 54 | /* 55 | * rpcbind errors 56 | */ 57 | RPC_RPCBFAILURE = 14, /* the pmapper failed in its call */ 58 | #define RPC_PMAPFAILURE RPC_RPCBFAILURE 59 | RPC_PROGNOTREGISTERED = 15,/* remote program not registered */ 60 | RPC_N2AXLATEFAILURE = 22, 61 | /* Name to address translation failed */ 62 | /* 63 | * Misc error in the TLI library 64 | */ 65 | RPC_TLIERROR = 20, 66 | /* 67 | * unspecified error 68 | */ 69 | RPC_FAILED = 16, 70 | /* 71 | * asynchronous errors 72 | */ 73 | RPC_INPROGRESS = 24, 74 | RPC_STALERACHANDLE = 25, 75 | RPC_CANTCONNECT = 26, /* couldn't make connection (cots) */ 76 | RPC_XPRTFAILED = 27, /* received discon from remote (cots) */ 77 | RPC_CANTCREATESTREAM = 28 /* can't push rpc module (cots) */ 78 | }; 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif /* !_RPC_CLNT_STAT_H */ 84 | -------------------------------------------------------------------------------- /ntirpc/rpc/des.h: -------------------------------------------------------------------------------- 1 | /* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ 2 | /* $FreeBSD: src/include/rpc/des.h,v 1.4 2002/03/23 17:24:55 imp Exp $ */ 3 | /* 4 | * Copyright (c) 2009, Sun Microsystems, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * - Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | /* 31 | * Generic DES driver interface 32 | * Keep this file hardware independent! 33 | * Copyright (c) 1986 by Sun Microsystems, Inc. 34 | */ 35 | 36 | #ifndef _RPC_DES_H_ 37 | #define _RPC_DES_H_ 38 | 39 | #define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ 40 | #define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ 41 | 42 | enum desdir { ENCRYPT, DECRYPT }; 43 | enum desmode { CBC, ECB }; 44 | 45 | /* 46 | * parameters to ioctl call 47 | */ 48 | struct desparams { 49 | u_char des_key[8]; /* key (with low bit parity) */ 50 | enum desdir des_dir; /* direction */ 51 | enum desmode des_mode; /* mode */ 52 | u_char des_ivec[8]; /* input vector */ 53 | unsigned des_len; /* number of bytes to crypt */ 54 | union { 55 | u_char UDES_data[DES_QUICKLEN]; 56 | u_char *UDES_buf; 57 | } UDES; 58 | # define des_data UDES.UDES_data /* direct data here if quick */ 59 | # define des_buf UDES.UDES_buf /* otherwise, pointer to data */ 60 | }; 61 | 62 | #ifdef notdef 63 | 64 | /* 65 | * These ioctls are only implemented in SunOS. Maybe someday 66 | * if somebody writes a driver for DES hardware that works 67 | * with FreeBSD, we can being that back. 68 | */ 69 | 70 | /* 71 | * Encrypt an arbitrary sized buffer 72 | */ 73 | #define DESIOCBLOCK _IOWR('d', 6, struct desparams) 74 | 75 | /* 76 | * Encrypt of small amount of data, quickly 77 | */ 78 | #define DESIOCQUICK _IOWR('d', 7, struct desparams) 79 | 80 | #endif 81 | 82 | /* 83 | * Software DES. 84 | */ 85 | extern int _des_crypt(char *, int, struct desparams *); 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /ntirpc/rpc/nettype.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: nettype.h,v 1.2 2000/07/06 03:17:19 christos Exp $ */ 2 | /* $FreeBSD: src/include/rpc/nettype.h,v 1.2 2002/03/23 17:24:55 3 | * imp Exp $ */ 4 | 5 | /* 6 | * Copyright (c) 2009, Sun Microsystems, Inc. 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * - Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * - Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | /* 33 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 34 | */ 35 | 36 | /* 37 | * nettype.h, Nettype definitions. 38 | * All for the topmost layer of rpc 39 | * 40 | */ 41 | 42 | #ifndef _TIRPC_NETTYPE_H 43 | #define _TIRPC_NETTYPE_H 44 | 45 | #include 46 | 47 | #define _RPC_NONE 0 48 | #define _RPC_NETPATH 1 49 | #define _RPC_VISIBLE 2 50 | #define _RPC_CIRCUIT_V 3 51 | #define _RPC_DATAGRAM_V 4 52 | #define _RPC_CIRCUIT_N 5 53 | #define _RPC_DATAGRAM_N 6 54 | #define _RPC_TCP 7 55 | #define _RPC_UDP 8 56 | #define _RPC_VSOCK 9 /* XXX assignment */ 57 | 58 | __BEGIN_DECLS 59 | extern void *__rpc_setconf(const char *); 60 | extern void __rpc_endconf(void *); 61 | extern struct netconfig *__rpc_getconf(void *); 62 | extern struct netconfig *__rpc_getconfip(const char *); 63 | extern struct netbuf *rpcb_find_mapped_addr(char *nettype, rpcprog_t prog, 64 | rpcvers_t vers, char *local_addr); 65 | __END_DECLS 66 | #endif /* !_TIRPC_NETTYPE_H */ 67 | -------------------------------------------------------------------------------- /ntirpc/rpc/pmap_rmt.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: pmap_rmt.h,v 1.7 1998/02/11 23:01:23 lukem Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 2009, Sun Microsystems, Inc. 5 | * Copyright (c) 2013-2018 Red Hat, Inc. and/or its affiliates. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * - Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * - Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * from: @(#)pmap_rmt.h 1.2 88/02/08 SMI 32 | * from: @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC 33 | * $FreeBSD: src/include/rpc/pmap_rmt.h,v 1.12 2002/03/23 17:24:55 imp Exp $ 34 | */ 35 | 36 | /* 37 | * Structures and XDR routines for parameters to and replies from 38 | * the portmapper remote-call-service. 39 | * 40 | * Copyright (C) 1986, Sun Microsystems, Inc. 41 | */ 42 | 43 | #ifndef _RPC_PMAP_RMT_H 44 | #define _RPC_PMAP_RMT_H 45 | #include 46 | 47 | struct rmtcallargs { 48 | xdrproc_t xdr_args; 49 | void *args_ptr; 50 | uint32_t arglen; /* count of args_ptr */ 51 | rpcprog_t prog; 52 | rpcvers_t vers; 53 | rpcproc_t proc; 54 | }; 55 | 56 | struct rmtcallres { 57 | xdrproc_t xdr_results; 58 | void *results_ptr; 59 | uint32_t resultslen; /* count of results_ptr */ 60 | rpcport_t port; 61 | }; 62 | 63 | __BEGIN_DECLS 64 | extern bool xdr_rmtcall_args(XDR *, struct rmtcallargs *); 65 | extern bool xdr_rmtcallres(XDR *, struct rmtcallres *); 66 | __END_DECLS 67 | #endif /* !_RPC_PMAP_RMT_H */ 68 | -------------------------------------------------------------------------------- /ntirpc/rpc/pool_queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015 CohortFS, LLC. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | /** 27 | * @file pool_queue.h 28 | * @author William Allen Simpson 29 | * @brief Pthreads-based TAILQ package 30 | * 31 | * @section DESCRIPTION 32 | * 33 | * This provides simple queues using pthreads and TAILQ primitives. 34 | * 35 | * @note Loosely based upon previous wait_queue by 36 | * Matt Benjamin 37 | */ 38 | 39 | #ifndef POOL_QUEUE_H 40 | #define POOL_QUEUE_H 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | struct poolq_entry { 47 | TAILQ_ENTRY(poolq_entry) q; /*** 1st ***/ 48 | u_int qsize; /* allocated size of q entry, 49 | * 0: default size */ 50 | uint16_t qflags; 51 | }; 52 | 53 | struct poolq_head { 54 | TAILQ_HEAD(poolq_head_s, poolq_entry) qh; 55 | pthread_mutex_t qmutex; 56 | 57 | u_int qsize; /* default size of q entries, 58 | * 0: static size */ 59 | int qcount; /* number of entries, 60 | * < 0: has waiting workers. */ 61 | }; 62 | 63 | static inline void 64 | poolq_head_destroy(struct poolq_head *qh) 65 | { 66 | pthread_mutex_destroy(&qh->qmutex); 67 | } 68 | 69 | static inline void 70 | poolq_head_setup(struct poolq_head *qh) 71 | { 72 | TAILQ_INIT(&qh->qh); 73 | pthread_mutex_init(&qh->qmutex, NULL); 74 | qh->qcount = 0; 75 | } 76 | 77 | #endif /* POOL_QUEUE_H */ 78 | -------------------------------------------------------------------------------- /ntirpc/rpc/rpc_cksum.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or 3 | * code or tables extracted from it, as desired without restriction. 4 | */ 5 | 6 | /* 7 | * First, the polynomial itself and its table of feedback terms. The 8 | * polynomial is 9 | * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 10 | * 11 | * Note that we take it "backwards" and put the highest-order term in 12 | * the lowest-order bit. The X^32 term is "implied"; the LSB is the 13 | * X^31 term, etc. The X^0 term (usually shown as "+1") results in 14 | * the MSB being 1 15 | * 16 | * Note that the usual hardware shift register implementation, which 17 | * is what we're using (we're merely optimizing it by doing eight-bit 18 | * chunks at a time) shifts bits into the lowest-order term. In our 19 | * implementation, that means shifting towards the right. Why do we 20 | * do it this way? Because the calculated CRC must be transmitted in 21 | * order from highest-order term to lowest-order term. UARTs transmit 22 | * characters in order from LSB to MSB. By storing the CRC this way 23 | * we hand it to the UART in the order low-byte to high-byte; the UART 24 | * sends each low-bit to hight-bit; and the result is transmission bit 25 | * by bit from highest- to lowest-order term without requiring any bit 26 | * shuffling on our part. Reception works similarly 27 | * 28 | * The feedback terms table consists of 256, 32-bit entries. Notes 29 | * 30 | * The table can be generated at runtime if desired; code to do so 31 | * is shown later. It might not be obvious, but the feedback 32 | * terms simply represent the results of eight shift/xor opera 33 | * tions for all combinations of data and CRC register values 34 | * 35 | * The values must be right-shifted by eight bits by the "updcrc 36 | * logic; the shift must be unsigned (bring in zeroes). On some 37 | * hardware you could probably optimize the shift in assembler by 38 | * using byte-swap instructions 39 | * polynomial $edb88320 40 | * 41 | * 42 | * CRC32 code derived from work by Gary S. Brown. 43 | */ 44 | 45 | #ifndef RPC_CKSUM_H 46 | #define RPC_CKSUM_H 47 | 48 | /* table-driven, software crc32c */ 49 | uint32_t calculate_crc32c(uint32_t crc32c, const unsigned char *buffer, 50 | unsigned int length); 51 | 52 | #endif /* RPC_CKSUM_H */ 53 | -------------------------------------------------------------------------------- /ntirpc/rpc/rpc_com.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $ */ 2 | /* $FreeBSD: src/include/rpc/rpc_com.h,v 1.6 2003/01/16 07:13:51 mbr Exp $ */ 3 | 4 | /* 5 | * Copyright (c) 2009, Sun Microsystems, Inc. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * - Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * - Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | /* 32 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 33 | */ 34 | 35 | /* 36 | * rpc_com.h, Common definitions for both the server and client side. 37 | * All for the topmost layer of rpc 38 | * 39 | */ 40 | 41 | #ifndef _RPC_RPCCOM_H 42 | #define _RPC_RPCCOM_H 43 | 44 | #include 45 | 46 | /* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */ 47 | 48 | /* 49 | * The max size of the transport, if the size cannot be determined 50 | * by other means. 51 | */ 52 | #define RPC_MAXDATASIZE 9000 53 | #define RPC_MAXADDRSIZE 1024 54 | 55 | #define __RPC_GETXID(now) \ 56 | ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \ 57 | (u_int32_t)(now)->tv_usec) 58 | 59 | __BEGIN_DECLS 60 | extern u_int __rpc_get_a_size(int); 61 | extern int __rpc_dtbsize(void); 62 | extern int _rpc_dtablesize(void); 63 | extern struct netconfig *__rpcgettp(int); 64 | extern int __rpc_get_default_domain(char **); 65 | char *__rpc_taddr2uaddr_af(int, const struct netbuf *); 66 | struct netbuf *__rpc_uaddr2taddr_af(int, const char *); 67 | int __rpc_fixup_addr(struct netbuf *, const struct netbuf *); 68 | int __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **); 69 | int __rpc_seman2socktype(int); 70 | int __rpc_socktype2seman(int); 71 | void *rpc_nullproc(CLIENT *); 72 | int __rpc_sockisbound(int); 73 | struct netbuf *__rpc_set_netbuf(struct netbuf *, const void *, size_t); 74 | struct netbuf *__rpcb_findaddr(rpcprog_t, rpcvers_t, const struct netconfig *, 75 | const char *, CLIENT **); 76 | bool rpc_control(int, void *); 77 | char *_get_next_token(char *, int); 78 | 79 | __END_DECLS 80 | #endif /* _RPC_RPCCOM_H */ 81 | -------------------------------------------------------------------------------- /ntirpc/rpc/rpc_err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Oracle America, Inc. 3 | * Copyright (c) 2012-2017 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of the "Oracle America, Inc." nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * from: @(#)clnt.h 1.31 94/04/29 SMI 30 | * from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC 31 | * from: $NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $ 32 | * from: $FreeBSD: src/include/rpc/clnt.h,v 1.21 2003/01/24 01:47:55 fjoe Exp $ 33 | */ 34 | 35 | #ifndef _TIRPC_RPC_ERR_H_ 36 | #define _TIRPC_RPC_ERR_H_ 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* 47 | * Error info. 48 | */ 49 | struct rpc_err { 50 | union { 51 | int RE_errno; /* related system error */ 52 | enum auth_stat RE_why; /* why the auth error occurred */ 53 | struct { 54 | rpcvers_t low; /* lowest version supported */ 55 | rpcvers_t high; /* highest version supported */ 56 | } RE_vers; 57 | struct { /* maybe meaningful if RPC_FAILED */ 58 | int32_t s1; 59 | int32_t s2; 60 | } RE_lb; /* life boot & debugging only */ 61 | } ru; 62 | #define re_errno ru.RE_errno 63 | #define re_why ru.RE_why 64 | #define re_vers ru.RE_vers 65 | #define re_lb ru.RE_lb 66 | 67 | enum clnt_stat re_status; 68 | }; 69 | 70 | /* 71 | * Print an error message, given the rpc error code 72 | */ 73 | #define RPC_SPERROR_BUFLEN 256 74 | 75 | extern void rpc_perror(const struct rpc_err *, const char *); /* stderr */ 76 | extern char *rpc_sperror(const struct rpc_err *, const char *); /* string */ 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | #endif /* !_TIRPC_RPC_ERR_H_ */ 82 | -------------------------------------------------------------------------------- /ntirpc/rpc/rpcb_clnt.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: rpcb_clnt.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ 2 | /* $FreeBSD: src/include/rpc/rpcb_clnt.h,v 1.2 2002/03/23 17:24:55 imp Exp $ */ 3 | 4 | /* 5 | * Copyright (c) 2009, Sun Microsystems, Inc. 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * - Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * - Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 16 | * contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | /* 32 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 33 | */ 34 | 35 | /* 36 | * rpcb_clnt.h 37 | * Supplies C routines to get to rpcbid services. 38 | * 39 | */ 40 | 41 | /* 42 | * Usage: 43 | * success = rpcb_set(program, version, nconf, address); 44 | * success = rpcb_unset(program, version, nconf); 45 | * success = rpcb_getaddr(program, version, nconf, host); 46 | * head = rpcb_getmaps(nconf, host); 47 | * clnt_stat = rpcb_rmtcall(nconf, host, program, version, procedure, 48 | * xdrargs, argsp, xdrres, resp, tout, addr_ptr) 49 | * success = rpcb_gettime(host, timep) 50 | * uaddr = rpcb_taddr2uaddr(nconf, taddr); 51 | * taddr = rpcb_uaddr2uaddr(nconf, uaddr); 52 | */ 53 | 54 | #ifndef _RPC_RPCB_CLNT_H 55 | #define _RPC_RPCB_CLNT_H 56 | 57 | /* #pragma ident "@(#)rpcb_clnt.h 1.13 94/04/25 SMI" */ 58 | /* rpcb_clnt.h 1.3 88/12/05 SMI */ 59 | 60 | #include 61 | #include 62 | 63 | __BEGIN_DECLS 64 | extern bool rpcb_set(const rpcprog_t, const rpcvers_t, 65 | const struct netconfig *, 66 | const struct netbuf *); 67 | extern bool rpcb_unset(const rpcprog_t, const rpcvers_t, 68 | const struct netconfig *); 69 | extern rpcblist *rpcb_getmaps(const struct netconfig *, const char *); 70 | extern enum clnt_stat rpcb_rmtcall(const struct netconfig *, const char *, 71 | const rpcprog_t, const rpcvers_t, 72 | const rpcproc_t, const xdrproc_t, 73 | void *, const xdrproc_t, 74 | void *, const struct timeval, 75 | const struct netbuf *); 76 | extern bool rpcb_getaddr(const rpcprog_t, const rpcvers_t, 77 | const struct netconfig *, struct netbuf *, 78 | const char *); 79 | extern bool rpcb_gettime(const char *, time_t *); 80 | extern char *rpcb_taddr2uaddr(struct netconfig *, struct netbuf *); 81 | extern struct netbuf *rpcb_uaddr2taddr(struct netconfig *, char *); 82 | __END_DECLS 83 | #endif /* !_RPC_RPCB_CLNT_H */ 84 | -------------------------------------------------------------------------------- /ntirpc/rpc/rpcent.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: rpcent.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ 2 | /* $FreeBSD: src/include/rpc/rpcent.h,v 1.2 2002/03/23 17:24:55 3 | * imp Exp $ */ 4 | 5 | /* 6 | * Copyright (c) 2009, Sun Microsystems, Inc. 7 | * All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions are met: 11 | * - Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * - Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | /* 33 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 34 | */ 35 | 36 | /* 37 | * rpcent.h, 38 | * For converting rpc program numbers to names etc. 39 | * 40 | */ 41 | 42 | #ifndef _RPC_RPCENT_H 43 | #define _RPC_RPCENT_H 44 | 45 | /* #pragma ident "@(#)rpcent.h 1.13 94/04/25 SMI" */ 46 | /* @(#)rpcent.h 1.1 88/12/06 SMI */ 47 | 48 | __BEGIN_DECLS 49 | /* These are defined in /usr/include/rpc/netdb.h */ 50 | #if defined(__FreeBSD__) 51 | struct rpcent { 52 | char *r_name; /* name of server for this rpc program */ 53 | char **r_aliases; /* alias list */ 54 | int r_number; /* rpc program number */ 55 | }; 56 | #endif 57 | #if 0 58 | 59 | extern struct rpcent *getrpcbyname_r(const char *, struct rpcent *, char *, 60 | int); 61 | extern struct rpcent *getrpcbynumber_r(int, struct rpcent *, char *, int); 62 | extern struct rpcent *getrpcent_r(struct rpcent *, char *, int); 63 | 64 | /* Old interfaces that return a pointer to a static area; MT-unsafe */ 65 | extern struct rpcent *getrpcbyname(char *); 66 | extern struct rpcent *getrpcbynumber(int); 67 | extern struct rpcent *getrpcent(void); 68 | #endif 69 | 70 | extern void setrpcent(int); 71 | extern void endrpcent(void); 72 | __END_DECLS 73 | #endif /* !_RPC_CENT_H */ 74 | -------------------------------------------------------------------------------- /ntirpc/rpc/svc_auth.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: svc_auth.h,v 1.8 2000/06/02 22:57:57 fvdl Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 2009, Sun Microsystems, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * - Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * from: @(#)svc_auth.h 1.6 86/07/16 SMI 31 | * @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC 32 | * $FreeBSD: src/include/rpc/svc_auth.h,v 1.14 2002/03/23 17:24:55 imp Exp $ 33 | */ 34 | 35 | /* 36 | * svc_auth.h, Service side of rpc authentication. 37 | * 38 | * Copyright (C) 1984, Sun Microsystems, Inc. 39 | */ 40 | 41 | #ifndef _RPC_SVC_AUTH_H 42 | #define _RPC_SVC_AUTH_H 43 | 44 | #include 45 | 46 | /* 47 | * Interface to server-side authentication flavors. 48 | */ 49 | typedef struct SVCAUTH { 50 | struct svc_auth_ops { 51 | bool(*svc_ah_wrap) (struct svc_req *, XDR *); 52 | bool(*svc_ah_unwrap) (struct svc_req *); 53 | bool(*svc_ah_checksum) (struct svc_req *); 54 | bool(*svc_ah_release) (struct svc_req *); 55 | bool(*svc_ah_destroy) (struct SVCAUTH *); 56 | } *svc_ah_ops; 57 | void *svc_ah_private; 58 | } SVCAUTH; 59 | 60 | #define SVCAUTH_WRAP(req, xdrs) \ 61 | ((*(((req)->rq_auth)->svc_ah_ops->svc_ah_wrap))(req, xdrs)) 62 | 63 | #define SVCAUTH_UNWRAP(req) \ 64 | ((*(((req)->rq_auth)->svc_ah_ops->svc_ah_unwrap))(req)) 65 | 66 | #define SVCAUTH_CHECKSUM(req) \ 67 | ((*(((req)->rq_auth)->svc_ah_ops->svc_ah_checksum))(req)) 68 | 69 | #define SVCAUTH_RELEASE(req) \ 70 | ((*(((req)->rq_auth)->svc_ah_ops->svc_ah_release))(req)) 71 | 72 | #define SVCAUTH_DESTROY(auth) \ 73 | ((*((auth)->svc_ah_ops->svc_ah_destroy))(auth)) 74 | 75 | /* 76 | * Server side authenticator 77 | */ 78 | __BEGIN_DECLS 79 | extern enum auth_stat svc_auth_authenticate(struct svc_req *, bool *); 80 | extern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *)); 81 | __END_DECLS 82 | #endif /* !_RPC_SVC_AUTH_H */ 83 | -------------------------------------------------------------------------------- /ntirpc/rpc/svc_rqst.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Linux Box Corporation. 3 | * Copyright (c) 2013-2015 CohortFS, LLC. 4 | * Copyright (c) 2017 Red Hat, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /** 29 | * @file svc_rqst.h 30 | * @contributeur William Allen Simpson 31 | * @brief Multi-channel event signal package 32 | * 33 | * @section DESCRIPTION 34 | * 35 | * Maintains a list of all extant transports by event (channel) id. 36 | * 37 | * svc_rqst_init -- init module; usually called by svc_init() 38 | * svc_rqst_new_evchan -- create event channel 39 | * svc_rqst_evchan_reg -- set {xprt, dispatcher} mapping 40 | * svc_rqst_foreach_xprt -- scan registered xprts at id (or 0 for all) 41 | * svc_rqst_thrd_signal -- request thread to run a callout function 42 | * (which can cause the thread to return) 43 | * svc_rqst_shutdown -- cause all threads to return 44 | */ 45 | 46 | #ifndef TIRPC_SVC_RQST_H 47 | #define TIRPC_SVC_RQST_H 48 | 49 | #include 50 | 51 | #define SVC_RQST_FLAG_NONE SVC_XPRT_FLAG_NONE 52 | /* uint16_t actually used */ 53 | #define SVC_RQST_FLAG_SHUTDOWN SVC_XPRT_FLAG_DESTROYING 54 | #define SVC_RQST_FLAG_XPRT_UREG SVC_XPRT_FLAG_UREG 55 | #define SVC_RQST_FLAG_CHAN_AFFINITY 0x1000 /* bind conn to parent chan */ 56 | #define SVC_RQST_FLAG_MASK (SVC_RQST_FLAG_CHAN_AFFINITY) 57 | 58 | /* uint32_t instructions */ 59 | #define SVC_RQST_FLAG_LOCKED SVC_XPRT_FLAG_LOCKED 60 | #define SVC_RQST_FLAG_UNLOCK SVC_XPRT_FLAG_UNLOCK 61 | #define SVC_RQST_FLAG_EPOLL 0x00080000 62 | 63 | void svc_rqst_init(uint32_t); 64 | int svc_rqst_new_evchan(uint32_t *chan_id /* OUT */ , void *u_data, 65 | uint32_t flags); 66 | int svc_rqst_evchan_reg(uint32_t chan_id, SVCXPRT *xprt, uint32_t flags); 67 | 68 | int svc_rqst_thrd_signal(uint32_t chan_id, uint32_t flags); 69 | void svc_rqst_shutdown(void); 70 | 71 | /* iterator callback prototype */ 72 | typedef void (*svc_rqst_xprt_each_func_t) (uint32_t chan_id, SVCXPRT *xprt, 73 | void *arg); 74 | int svc_rqst_foreach_xprt(uint32_t chan_id, svc_rqst_xprt_each_func_t each_f, 75 | void *arg); 76 | 77 | 78 | #endif /* TIRPC_SVC_RQST_H */ 79 | -------------------------------------------------------------------------------- /ntirpc/rpc/tirpc_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Linux Box Corporation. 3 | * Copyright (c) 2012-2017 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef TIRPC_COMPAT_H 28 | #define TIRPC_COMPAT_H 29 | 30 | /* svc.h */ 31 | #define svc_create(a, b, c, d) svc_ncreate(a, b, c, d) 32 | #define svc_tp_create(a, b, c, d) svc_tp_ncreate(a, b, c, d) 33 | #define svc_tli_create(a, b, c, d, e) svc_tli_ncreate(a, b, c, d, e) 34 | #define svc_vc_create(a, b, c) svc_vc_ncreate(a, b, c) 35 | #define svc_dg_create(a, b, c) svc_dg_ncreate(a, b, c) 36 | #define svc_fd_create(a, b, c) svc_fd_ncreate(a, b, c) 37 | #define svc_raw_create() svc_raw_ncreate() 38 | #define svc_rdma_create(a, b, c) svc_rdma_ncreate(a, b, c) 39 | 40 | /* rpc_msg */ 41 | #define xdr_callmsg xdr_ncallmsg 42 | #define xdr_callhdr xdr_ncallhdr 43 | #define xdr_replymsg xdr_nreplymsg 44 | #define xdr_accepted_reply xdr_naccepted_reply 45 | #define xdr_rejected_reply xdr_nrejected_reply 46 | 47 | /* xdr */ 48 | #define xdr_netobj xdr_nnetobj 49 | #define xdrmem_create(a, b, c, d) xdrmem_ncreate(a, b, c, d) 50 | #define xdr_free xdr_nfree 51 | 52 | #endif /* !TIRPC_COMPAT_H */ 53 | -------------------------------------------------------------------------------- /ntirpc/rpc/work_pool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015 CohortFS, LLC. 3 | * Copyright (c) 2013-2018 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | /** 28 | * @file work_pool.h 29 | * @author William Allen Simpson 30 | * @brief Pthreads-based work queue package 31 | * 32 | * @section DESCRIPTION 33 | * 34 | * This provides simple work queues using pthreads and TAILQ primitives. 35 | * 36 | * @note Loosely based upon previous thrdpool by 37 | * Matt Benjamin 38 | */ 39 | 40 | #ifndef WORK_POOL_H 41 | #define WORK_POOL_H 42 | 43 | #include 44 | 45 | struct work_pool_params { 46 | int32_t thrd_max; 47 | int32_t thrd_min; 48 | }; 49 | 50 | struct work_pool_thread; 51 | 52 | struct work_pool { 53 | struct poolq_head pqh; 54 | TAILQ_HEAD(work_pool_s, work_pool_thread) wptqh; 55 | char *name; 56 | pthread_attr_t attr; 57 | struct work_pool_params params; 58 | long timeout_ms; 59 | uint32_t n_threads; 60 | uint32_t worker_index; 61 | }; 62 | 63 | struct work_pool_entry; 64 | 65 | struct work_pool_thread { 66 | struct poolq_entry pqe; /*** 1st ***/ 67 | TAILQ_ENTRY(work_pool_thread) wptq; 68 | pthread_cond_t pqcond; 69 | 70 | struct work_pool *pool; 71 | struct work_pool_entry *work; 72 | char worker_name[16]; 73 | pthread_t pt; 74 | uint32_t worker_index; 75 | }; 76 | 77 | typedef void (*work_pool_fun_t) (struct work_pool_entry *); 78 | 79 | struct work_pool_entry { 80 | struct poolq_entry pqe; /*** 1st ***/ 81 | struct work_pool_thread *wpt; 82 | work_pool_fun_t fun; 83 | void *arg; 84 | }; 85 | 86 | int work_pool_init(struct work_pool *, const char *, struct work_pool_params *); 87 | int work_pool_submit(struct work_pool *, struct work_pool_entry *); 88 | int work_pool_shutdown(struct work_pool *); 89 | 90 | #endif /* WORK_POOL_H */ 91 | -------------------------------------------------------------------------------- /ntirpc/rpcsvc/crypt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Please do not edit this file. 3 | * It was generated using rpcgen. 4 | */ 5 | 6 | #ifndef _CRYPT_H_RPCGEN 7 | #define _CRYPT_H_RPCGEN 8 | 9 | #include 10 | 11 | #ifndef IXDR_GET_INT32 12 | #define IXDR_GET_INT32(buf) IXDR_GET_LONG((buf)) 13 | #endif 14 | #ifndef IXDR_PUT_INT32 15 | #define IXDR_PUT_INT32(buf, v) IXDR_PUT_LONG((buf), (v)) 16 | #endif 17 | #ifndef IXDR_GET_U_INT32 18 | #define IXDR_GET_U_INT32(buf) IXDR_GET_U_LONG((buf)) 19 | #endif 20 | #ifndef IXDR_PUT_U_INT32 21 | #define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_U_LONG((buf), (v)) 22 | #endif 23 | 24 | enum des_dir { 25 | ENCRYPT_DES = 0, 26 | DECRYPT_DES = 1, 27 | }; 28 | typedef enum des_dir des_dir; 29 | #ifdef __cplusplus 30 | extern "C" bool xdr_des_dir(XDR *, des_dir *); 31 | #elif __STDC__ 32 | extern bool xdr_des_dir(XDR *, des_dir *); 33 | #else /* Old Style C */ 34 | bool xdr_des_dir(); 35 | #endif /* Old Style C */ 36 | 37 | enum des_mode { 38 | CBC_DES = 0, 39 | ECB_DES = 1, 40 | }; 41 | typedef enum des_mode des_mode; 42 | #ifdef __cplusplus 43 | extern "C" bool xdr_des_mode(XDR *, des_mode *); 44 | #elif __STDC__ 45 | extern bool xdr_des_mode(XDR *, des_mode *); 46 | #else /* Old Style C */ 47 | bool xdr_des_mode(); 48 | #endif /* Old Style C */ 49 | 50 | struct desargs { 51 | u_char des_key[8]; 52 | des_dir des_dir; 53 | des_mode des_mode; 54 | u_char des_ivec[8]; 55 | struct { 56 | u_int desbuf_len; 57 | char *desbuf_val; 58 | } desbuf; 59 | }; 60 | typedef struct desargs desargs; 61 | #ifdef __cplusplus 62 | extern "C" bool xdr_desargs(XDR *, desargs *); 63 | #elif __STDC__ 64 | extern bool xdr_desargs(XDR *, desargs *); 65 | #else /* Old Style C */ 66 | bool xdr_desargs(); 67 | #endif /* Old Style C */ 68 | 69 | struct desresp { 70 | struct { 71 | u_int desbuf_len; 72 | char *desbuf_val; 73 | } desbuf; 74 | u_char des_ivec[8]; 75 | int stat; 76 | }; 77 | typedef struct desresp desresp; 78 | #ifdef __cplusplus 79 | extern "C" bool xdr_desresp(XDR *, desresp *); 80 | #elif __STDC__ 81 | extern bool xdr_desresp(XDR *, desresp *); 82 | #else /* Old Style C */ 83 | bool xdr_desresp(); 84 | #endif /* Old Style C */ 85 | 86 | #define CRYPT_PROG ((u_int32_t)600100029) 87 | #define CRYPT_VERS ((u_int32_t)1) 88 | 89 | #ifdef __cplusplus 90 | #define DES_CRYPT ((u_int32_t)1) 91 | extern "C" { 92 | desresp *des_crypt_1(desargs *, CLIENT *); 93 | desresp *des_crypt_1_svc(desargs *, struct svc_req *); 94 | } 95 | 96 | #elif __STDC__ 97 | #define DES_CRYPT ((u_int32_t)1) 98 | extern desresp *des_crypt_1(desargs *, CLIENT *); 99 | extern desresp *des_crypt_1_svc(desargs *, struct svc_req *); 100 | 101 | #else /* Old Style C */ 102 | #define DES_CRYPT ((u_int32_t)1) 103 | extern desresp *des_crypt_1(); 104 | extern desresp *des_crypt_1_svc(); 105 | #endif /* Old Style C */ 106 | 107 | #endif /* !_CRYPT_H_RPCGEN */ 108 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_definitions( 3 | -DPORTMAP 4 | -DINET6 5 | -D_GNU_SOURCE 6 | ) 7 | 8 | # ok on Linux and FreeBSD w/GCC and clang compilers 9 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 10 | 11 | ########### next target ############### 12 | 13 | SET(ntirpc_common_SRCS 14 | auth_none.c 15 | auth_unix.c 16 | authunix_prot.c 17 | bindresvport.c 18 | bsd_epoll.c 19 | city.c 20 | clnt_bcast.c 21 | clnt_dg.c 22 | clnt_generic.c 23 | clnt_perror.c 24 | clnt_raw.c 25 | clnt_simple.c 26 | clnt_vc.c 27 | getnetconfig.c 28 | getnetpath.c 29 | getpeereid.c 30 | getrpcent.c 31 | mt_misc.c 32 | pmap_prot.c 33 | pmap_prot2.c 34 | pmap_rmt.c 35 | rbtree.c 36 | rbtree_x.c 37 | rpc_prot.c 38 | rpc_callmsg.c 39 | rpc_commondata.c 40 | rpc_crc32.c 41 | rpc_dplx_msg.c 42 | rpc_dtablesize.c 43 | rpc_generic.c 44 | rpcb_clnt.c 45 | rpcb_prot.c 46 | rpcb_st_xdr.c 47 | strlcpy.c 48 | svc.c 49 | svc_auth.c 50 | svc_auth_unix.c 51 | svc_auth_none.c 52 | svc_dg.c 53 | svc_generic.c 54 | svc_raw.c 55 | svc_rqst.c 56 | svc_simple.c 57 | svc_vc.c 58 | svc_xprt.c 59 | xdr.c 60 | xdr_float.c 61 | xdr_mem.c 62 | xdr_reference.c 63 | xdr_ioq.c 64 | svc_ioq.c 65 | work_pool.c 66 | ) 67 | 68 | if(USE_GSS) 69 | SET(ntirpc_gss_SRCS 70 | auth_gss.c authgss_hash.c 71 | authgss_prot.c 72 | svc_auth_gss.c 73 | ) 74 | 75 | # fixme 76 | # libntirpc_la_LDFLAGS += $(GSSGLUE_LIBS) 77 | # libntirpc_la_CFLAGS = -DHAVE_RPCSEC_GSS $(GSSGLUE_CFLAGS) 78 | 79 | endif(USE_GSS) 80 | 81 | if(USE_RPC_RDMA) 82 | SET(ntirpc_rdma_SRCS 83 | clnt_rdma.c 84 | rpc_rdma.c 85 | svc_rdma.c 86 | xdr_rdma.c 87 | ) 88 | endif(USE_RPC_RDMA) 89 | 90 | if(USE_LTTNG_NTIRPC) 91 | add_subdirectory(lttng) 92 | endif(USE_LTTNG_NTIRPC) 93 | 94 | # declares the library 95 | add_library(ntirpc SHARED 96 | ${ntirpc_common_SRCS} 97 | ${ntirpc_gss_SRCS} 98 | ${ntirpc_rdma_SRCS} 99 | ${ntirpc_lttng_SRCS} 100 | ) 101 | 102 | # add required libraries--for Ganesha build, it's ok for them to 103 | # propagate (i.e., omit PRIVATE) 104 | target_link_libraries(ntirpc ${SYSTEM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 105 | 106 | # set library version and symbol namespace(s) from gen'd map file 107 | set_target_properties(ntirpc PROPERTIES LINK_FLAGS 108 | "-Wl,--version-script=${PROJECT_BINARY_DIR}/libntirpc.map" 109 | VERSION ${NTIRPC_VERSION} 110 | SOVERSION "${NTIRPC_MAJOR_VERSION}.${NTIRPC_MINOR_VERSION}" 111 | ) 112 | 113 | install(TARGETS ntirpc DESTINATION ${LIB_INSTALL_DIR}) 114 | 115 | ########### install files ############### 116 | 117 | # We are still missing the install of docs and stuff 118 | -------------------------------------------------------------------------------- /src/authunix_prot.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * Copyright (c) 2012-2018 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #include "config.h" 31 | #include 32 | 33 | /* 34 | * authunix_prot.c 35 | * XDR for UNIX style authentication parameters for RPC 36 | * 37 | * Copyright (C) 1984, Sun Microsystems, Inc. 38 | */ 39 | 40 | #include 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | /* 48 | * XDR for unix authentication parameters. 49 | */ 50 | bool 51 | xdr_authunix_parms(XDR *xdrs, struct authunix_parms *p) 52 | { 53 | 54 | assert(xdrs != NULL); 55 | assert(p != NULL); 56 | 57 | if (inline_xdr_int32_t(xdrs, &(p->aup_time)) 58 | && inline_xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME) 59 | && inline_xdr_u_int32_t(xdrs, &(p->aup_uid)) 60 | && inline_xdr_u_int32_t(xdrs, &(p->aup_gid)) 61 | && xdr_array(xdrs, (char **) &(p->aup_gids), &(p->aup_len), 62 | NGRPS, sizeof(u_int32_t), (xdrproc_t)xdr_u_int32_t)) { 63 | return (true); 64 | } 65 | return (false); 66 | } 67 | -------------------------------------------------------------------------------- /src/citycrc.h: -------------------------------------------------------------------------------- 1 | /* citycrc.h - cityhash-c 2 | * CityHash on C 3 | * Copyright (c) 2011-2012, Alexander Nusov 4 | * 5 | * - original copyright notice - 6 | * Copyright (c) 2011 Google, Inc. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | * CityHash, by Geoff Pike and Jyrki Alakuijala 27 | * 28 | * This file declares the subset of the CityHash functions that require 29 | * _mm_crc32_u64(). See the CityHash README for details. 30 | * 31 | * Functions in the CityHash family are not suitable for cryptography. 32 | */ 33 | #ifndef CITY_HASH_CRC_H_ 34 | #define CITY_HASH_CRC_H_ 35 | 36 | #include 37 | 38 | /* Hash function for a byte array. */ 39 | uint128 CityHashCrc128(const char *s, size_t len); 40 | 41 | /* Hash function for a byte array. For convenience, a 128-bit seed is also 42 | * hashed into the result. */ 43 | uint128 CityHashCrc128WithSeed(const char *s, size_t len, uint128 seed); 44 | 45 | /* Hash function for a byte array. Sets result[0] ... result[3]. */ 46 | void CityHashCrc256(const char *s, size_t len, uint64 *result); 47 | 48 | #endif /* CITY_HASH_CRC_H_ */ 49 | -------------------------------------------------------------------------------- /src/clnt_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Linux Box Corporation. 3 | * Copyright (c) 2012-2018 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | * POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef _CLNT_INTERNAL_H 28 | #define _CLNT_INTERNAL_H 29 | 30 | #include 31 | #include "rpc_dplx_internal.h" 32 | 33 | #define MCALL_MSG_SIZE 24 34 | 35 | struct cx_data { 36 | struct rpc_client cx_c; /**< Transport Independent handle */ 37 | struct rpc_dplx_rec *cx_rec; /* unified sync */ 38 | 39 | char cx_mcallc[MCALL_MSG_SIZE]; /* marshalled callmsg */ 40 | u_int cx_mpos; /* pos after marshal */ 41 | }; 42 | #define CX_DATA(p) (opr_containerof((p), struct cx_data, cx_c)) 43 | 44 | /* compartmentalize a bit */ 45 | static inline void 46 | clnt_data_init(struct cx_data *cx) 47 | { 48 | mutex_init(&cx->cx_c.cl_lock, NULL); 49 | cx->cx_c.cl_refcnt = 1; 50 | } 51 | 52 | static inline void 53 | clnt_data_destroy(struct cx_data *cx) 54 | { 55 | mutex_destroy(&cx->cx_c.cl_lock); 56 | 57 | /* note seemingly pointers to constant ""? */ 58 | if (cx->cx_c.cl_netid && cx->cx_c.cl_netid[0]) 59 | mem_free(cx->cx_c.cl_netid, strlen(cx->cx_c.cl_netid) + 1); 60 | if (cx->cx_c.cl_tp && cx->cx_c.cl_tp[0]) 61 | mem_free(cx->cx_c.cl_tp, strlen(cx->cx_c.cl_tp) + 1); 62 | } 63 | 64 | /* in svc_rqst.c */ 65 | void svc_rqst_expire_insert(struct clnt_req *); 66 | void svc_rqst_expire_remove(struct clnt_req *); 67 | 68 | #endif /* _CLNT_INTERNAL_H */ 69 | -------------------------------------------------------------------------------- /src/des_soft.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | /* 29 | * Table giving odd parity in the low bit for ASCII characters 30 | */ 31 | static char partab[128] = { 32 | 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x07, 0x07, 33 | 0x08, 0x08, 0x0b, 0x0b, 0x0d, 0x0d, 0x0e, 0x0e, 34 | 0x10, 0x10, 0x13, 0x13, 0x15, 0x15, 0x16, 0x16, 35 | 0x19, 0x19, 0x1a, 0x1a, 0x1c, 0x1c, 0x1f, 0x1f, 36 | 0x20, 0x20, 0x23, 0x23, 0x25, 0x25, 0x26, 0x26, 37 | 0x29, 0x29, 0x2a, 0x2a, 0x2c, 0x2c, 0x2f, 0x2f, 38 | 0x31, 0x31, 0x32, 0x32, 0x34, 0x34, 0x37, 0x37, 39 | 0x38, 0x38, 0x3b, 0x3b, 0x3d, 0x3d, 0x3e, 0x3e, 40 | 0x40, 0x40, 0x43, 0x43, 0x45, 0x45, 0x46, 0x46, 41 | 0x49, 0x49, 0x4a, 0x4a, 0x4c, 0x4c, 0x4f, 0x4f, 42 | 0x51, 0x51, 0x52, 0x52, 0x54, 0x54, 0x57, 0x57, 43 | 0x58, 0x58, 0x5b, 0x5b, 0x5d, 0x5d, 0x5e, 0x5e, 44 | 0x61, 0x61, 0x62, 0x62, 0x64, 0x64, 0x67, 0x67, 45 | 0x68, 0x68, 0x6b, 0x6b, 0x6d, 0x6d, 0x6e, 0x6e, 46 | 0x70, 0x70, 0x73, 0x73, 0x75, 0x75, 0x76, 0x76, 47 | 0x79, 0x79, 0x7a, 0x7a, 0x7c, 0x7c, 0x7f, 0x7f, 48 | }; 49 | 50 | /* 51 | * Add odd parity to low bit of 8 byte key 52 | */ 53 | void 54 | des_setparity(char *p) 55 | { 56 | int i; 57 | 58 | for (i = 0; i < 8; i++) { 59 | *p = partab[*p & 0x7f]; 60 | p++; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/getpeereid.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | * 3 | * getpeereid.c 4 | * get peer userid for UNIX-domain socket connection 5 | * 6 | * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group 7 | * 8 | * 9 | * IDENTIFICATION 10 | * src/port/getpeereid.c 11 | * 12 | *------------------------------------------------------------------------- 13 | */ 14 | 15 | #include "config.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #ifdef HAVE_SYS_UN_H 24 | #include 25 | #endif 26 | #ifdef HAVE_UCRED_H 27 | #include 28 | #endif 29 | #ifdef HAVE_SYS_UCRED_H 30 | #include 31 | #endif 32 | 33 | #if !HAVE_GETPEEREID 34 | 35 | /* 36 | * BSD-style getpeereid() for platforms that lack it. 37 | */ 38 | int 39 | getpeereid(int sock, uid_t *uid, gid_t *gid) 40 | { 41 | #if defined(SO_PEERCRED) 42 | /* Linux: use getsockopt(SO_PEERCRED) */ 43 | struct ucred peercred; 44 | socklen_t so_len = sizeof(peercred); 45 | 46 | if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 47 | || so_len != sizeof(peercred)) 48 | return -1; 49 | *uid = peercred.uid; 50 | *gid = peercred.gid; 51 | return 0; 52 | #elif defined(LOCAL_PEERCRED) 53 | /* Debian with FreeBSD kernel: use getsockopt(LOCAL_PEERCRED) */ 54 | struct xucred peercred; 55 | ACCEPT_TYPE_ARG3 so_len = sizeof(peercred); 56 | 57 | if (getsockopt(sock, 0, LOCAL_PEERCRED, &peercred, &so_len) != 0 58 | || so_len != sizeof(peercred) 59 | || peercred.cr_version != XUCRED_VERSION) 60 | return -1; 61 | *uid = peercred.cr_uid; 62 | *gid = peercred.cr_gid; 63 | return 0; 64 | #elif defined(HAVE_GETPEERUCRED) 65 | /* Solaris: use getpeerucred() */ 66 | ucred_t *ucred; 67 | 68 | ucred = NULL; /* must be initialized to NULL */ 69 | if (getpeerucred(sock, &ucred) == -1) 70 | return -1; 71 | 72 | *uid = ucred_geteuid(ucred); 73 | *gid = ucred_getegid(ucred); 74 | ucred_free(ucred); 75 | 76 | if (*uid == (uid_t) (-1) || *gid == (gid_t) (-1)) 77 | return -1; 78 | return 0; 79 | #else 80 | /* No implementation available on this platform */ 81 | errno = ENOSYS; 82 | return -1; 83 | #endif 84 | } 85 | 86 | #endif /* HAVE_PEEREID */ 87 | -------------------------------------------------------------------------------- /src/lttng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${LTTNG_INCLUDE_DIR} 3 | ) 4 | 5 | set(ntirpc_tracepoints_LIB_SRCS 6 | rpcping.c 7 | xprt.c 8 | ) 9 | 10 | add_library(ntirpc_tracepoints SHARED ${ntirpc_tracepoints_LIB_SRCS}) 11 | #add_sanitizers(ntirpc_tracepoints) 12 | 13 | target_link_libraries(ntirpc_tracepoints 14 | ${LTTNG_LIBRARIES} 15 | ) 16 | 17 | set_target_properties(ntirpc_tracepoints PROPERTIES 18 | VERSION ${NTIRPC_VERSION} 19 | SOVERSION "${NTIRPC_MAJOR_VERSION}.${NTIRPC_MINOR_VERSION}" 20 | ) 21 | 22 | install(TARGETS ntirpc_tracepoints COMPONENT tracing DESTINATION ${LIB_INSTALL_DIR} ) 23 | 24 | set(ntirpc_lttng_LIB_SRCS 25 | main.c 26 | ) 27 | 28 | add_library(ntirpc_lttng STATIC ${ntirpc_lttng_LIB_SRCS}) 29 | #add_sanitizers(ntirpc_lttng) 30 | 31 | target_link_libraries(ntirpc_lttng 32 | ${LTTNG_LIBRARIES} 33 | ) 34 | 35 | install(TARGETS ntirpc_lttng COMPONENT tracing DESTINATION ${LIB_INSTALL_DIR} ) 36 | -------------------------------------------------------------------------------- /src/lttng/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * vim:noexpandtab:shiftwidth=8:tabstop=8: 3 | * 4 | * Copyright 2018 Red Hat, Inc. and/or its affiliates. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * - Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "config.h" 32 | 33 | /** 34 | * @brief LTTng trace enabling magic 35 | * 36 | * Every trace include file must be added here regardless whether it 37 | * is actually used in this source file. The file must also be 38 | * included ONLY ONCE. Failure to do so will create interesting 39 | * build time failure messages. The key bit is the definitions of 40 | * TRACEPOINT_DEFINE and TRACEPOINT_PROBE_DYNAMIC_LINKAGE that are here 41 | * to trigger the global definitions as a shared object with the right 42 | * (weak) symbols to make the module loading optional. 43 | * 44 | * If and when this file gets some tracepoints of its own, the include 45 | * here is necessary and sufficient. 46 | */ 47 | 48 | #ifdef USE_LTTNG_NTIRPC 49 | #define TRACEPOINT_DEFINE 50 | #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE 51 | 52 | #include "lttng/rpcping.h" 53 | #include "lttng/xprt.h" 54 | 55 | /* This is a hack to make older versions of LTTng link */ 56 | struct lttng_ust_tracepoint_dlopen tracepoint_dlopen 57 | __attribute__((weak)); 58 | 59 | #endif /* USE_LTTNG_NTIRPC */ 60 | -------------------------------------------------------------------------------- /src/lttng/rpcping.c: -------------------------------------------------------------------------------- 1 | #define TRACEPOINT_CREATE_PROBES 2 | #include "lttng/rpcping.h" 3 | -------------------------------------------------------------------------------- /src/lttng/xprt.c: -------------------------------------------------------------------------------- 1 | #define TRACEPOINT_CREATE_PROBES 2 | #include "lttng/xprt.h" 3 | -------------------------------------------------------------------------------- /src/mt_misc.c: -------------------------------------------------------------------------------- 1 | 2 | #include "config.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "rpc_com.h" 12 | 13 | /* protects the services list (svc.c) */ 14 | pthread_rwlock_t svc_lock = RWLOCK_INITIALIZER; 15 | 16 | /* protects the RPCBIND address cache */ 17 | pthread_rwlock_t rpcbaddr_cache_lock = RWLOCK_INITIALIZER; 18 | 19 | /* protects the Auths list (svc_auth.c) */ 20 | pthread_mutex_t authsvc_lock = MUTEX_INITIALIZER; 21 | 22 | /* domainname and domain_fd (getdname.c) and default_domain (rpcdname.c) */ 23 | pthread_mutex_t dname_lock = MUTEX_INITIALIZER; 24 | 25 | /* protects first_time and hostname (key_call.c) */ 26 | pthread_mutex_t keyserv_lock = MUTEX_INITIALIZER; 27 | 28 | /* serializes rpc_trace() (rpc_trace.c) */ 29 | pthread_mutex_t libnsl_trace_lock = MUTEX_INITIALIZER; 30 | 31 | /* loopnconf (rpcb_clnt.c) */ 32 | pthread_mutex_t loopnconf_lock = MUTEX_INITIALIZER; 33 | 34 | /* serializes ops initializations */ 35 | pthread_mutex_t ops_lock = MUTEX_INITIALIZER; 36 | 37 | /* protects ``port'' static in bindresvport() */ 38 | pthread_mutex_t portnum_lock = MUTEX_INITIALIZER; 39 | 40 | /* protects proglst list (svc_simple.c) */ 41 | pthread_mutex_t proglst_lock = MUTEX_INITIALIZER; 42 | 43 | /* svc_raw.c serialization */ 44 | pthread_mutex_t svcraw_lock = MUTEX_INITIALIZER; 45 | 46 | /* protects TSD key creation */ 47 | pthread_mutex_t tsd_lock = MUTEX_INITIALIZER; 48 | 49 | /* Library global tsd keys */ 50 | thread_key_t rpc_call_key = -1; 51 | thread_key_t tcp_key = -1; 52 | thread_key_t udp_key = -1; 53 | thread_key_t nc_key = -1; 54 | thread_key_t vsock_key = -1; 55 | 56 | /* xprtlist (svc_generic.c) */ 57 | pthread_mutex_t xprtlist_lock = MUTEX_INITIALIZER; 58 | 59 | /* serializes calls to public key routines */ 60 | pthread_mutex_t serialize_pkey = MUTEX_INITIALIZER; 61 | 62 | void tsd_key_delete(void) 63 | { 64 | if (rpc_call_key != -1) 65 | pthread_key_delete(rpc_call_key); 66 | if (tcp_key != -1) 67 | pthread_key_delete(tcp_key); 68 | if (udp_key != -1) 69 | pthread_key_delete(udp_key); 70 | if (nc_key != -1) 71 | pthread_key_delete(nc_key); 72 | return; 73 | } 74 | -------------------------------------------------------------------------------- /src/ntmakefile: -------------------------------------------------------------------------------- 1 | 2 | # Minimal makefile for compilation with mingw64--almost certain to 3 | # be replaced with something more flexible 4 | 5 | LIBNTIRPC = libntirpc.a 6 | 7 | SOURCES = \ 8 | auth_none.c \ 9 | portable.c \ 10 | rbtree.c \ 11 | rbtree_x.c \ 12 | rpc_ctx.c \ 13 | rpc_dplx_msg.c \ 14 | strlcat.c \ 15 | strlcpy.c \ 16 | svc.c \ 17 | svc_run.c \ 18 | xdr.c \ 19 | xdr_array.c \ 20 | xdr_float.c \ 21 | xdr_mem.c \ 22 | xdr_rec.c \ 23 | xdr_reference.c \ 24 | xdr_sizeof.c \ 25 | xdr_stdio.c 26 | 27 | OBJECTS = $(SOURCES:%.c=%.o) 28 | 29 | # Compiler flags 30 | CC = x86_64-w64-mingw32-gcc 31 | CFLAGS += -g3 -O0 -I../tirpc/ -D_REENTRANT 32 | 33 | #LDFLAGS += -L$(CUNIT)/lib $(TIRPC)/src/.libs/libntirpc.a \ 34 | # -lcunit -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lpthread \ 35 | # -lc -lrt -lgssglue 36 | 37 | # Targets 38 | all : $(LIBNTIRPC) 39 | 40 | $(LIBNTIRPC) : $(OBJECTS) 41 | 42 | $(OBJECTS) : $(SOURCES) 43 | 44 | clean: 45 | $(RM) $(OBJECTS) $(LIBTIRPC) 46 | 47 | -------------------------------------------------------------------------------- /src/pmap_prot.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * Copyright (c) 2009-2018 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /* 31 | * pmap_prot.c 32 | * Protocol for the local binder service, or pmap. 33 | * 34 | * Copyright (C) 1984, Sun Microsystems, Inc. 35 | */ 36 | 37 | #include "config.h" 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | bool 45 | xdr_pmap(XDR *xdrs, struct pmap *regs) 46 | { 47 | assert(xdrs != NULL); 48 | assert(regs != NULL); 49 | 50 | if (xdr_rpcprog(xdrs, ®s->pm_prog) 51 | && xdr_rpcvers(xdrs, ®s->pm_vers) 52 | && xdr_rpcprot(xdrs, ®s->pm_prot)) 53 | return (xdr_rpcport(xdrs, ®s->pm_port)); 54 | return (false); 55 | } 56 | -------------------------------------------------------------------------------- /src/pmap_rmt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * Copyright (c) 2012-2018 Red Hat, Inc. and/or its affiliates. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 14 | * contributors may be used to endorse or promote products derived 15 | * from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /* 31 | * pmap_rmt.c 32 | * remote call and broadcast service 33 | * 34 | * Copyright (C) 1984, Sun Microsystems, Inc. 35 | */ 36 | 37 | #include "config.h" 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | 54 | #include 55 | #include 56 | #include 57 | #include 58 | 59 | /* 60 | * XDR remote call arguments 61 | * written for XDR_ENCODE direction only 62 | */ 63 | bool 64 | xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap) 65 | { 66 | u_int lenposition, argposition, position; 67 | 68 | assert(xdrs != NULL); 69 | assert(cap != NULL); 70 | 71 | if (xdr_rpcprog(xdrs, &(cap->prog)) 72 | && xdr_rpcvers(xdrs, &(cap->vers)) 73 | && xdr_rpcproc(xdrs, &(cap->proc))) { 74 | lenposition = XDR_GETPOS(xdrs); 75 | if (!xdr_uint32_t(xdrs, &(cap->arglen))) 76 | return (false); 77 | argposition = XDR_GETPOS(xdrs); 78 | if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) 79 | return (false); 80 | position = XDR_GETPOS(xdrs); 81 | cap->arglen = position - argposition; 82 | XDR_SETPOS(xdrs, lenposition); 83 | if (!xdr_uint32_t(xdrs, &(cap->arglen))) 84 | return (false); 85 | XDR_SETPOS(xdrs, position); 86 | return (true); 87 | } 88 | return (false); 89 | } 90 | 91 | /* 92 | * XDR remote call results 93 | * written for XDR_DECODE direction only 94 | */ 95 | bool 96 | xdr_rmtcallres(XDR *xdrs, struct rmtcallres *crp) 97 | { 98 | assert(xdrs != NULL); 99 | assert(crp != NULL); 100 | 101 | if (xdr_rpcport(xdrs, &crp->port) 102 | && xdr_uint32_t(xdrs, &crp->resultslen)) { 103 | return ((*(crp->xdr_results)) (xdrs, crp->results_ptr)); 104 | } 105 | return (false); 106 | } 107 | -------------------------------------------------------------------------------- /src/portable.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Linux Box Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "config.h" 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #ifdef __APPLE__ 33 | int clock_gettime(clockid_t clock, struct timespec *ts) 34 | { 35 | struct timeval tv; 36 | gettimeofday(&tv, NULL); 37 | ts->tv_sec = tv.tv_sec; 38 | ts->tv_nsec = tv.tv_usec * 1000UL; 39 | return 0; 40 | } 41 | #endif 42 | 43 | #if defined(_WIN32) 44 | pthread_mutex_t clock_mtx = PTHREAD_MUTEX_INITIALIZER; 45 | 46 | int clock_gettime(clockid_t clock, struct timespec *ts) 47 | { 48 | static bool initialized; 49 | static LARGE_INTEGER start, freq, ctr, m; 50 | static double ftom; 51 | bool rslt = false; 52 | 53 | if (!initialized) { 54 | mutex_lock(&clock_mtx); 55 | if (!initialized) { 56 | QueryPerformanceCounter(&start); 57 | (void)QueryPerformanceFrequency(&freq); 58 | /* XXXX can be 0, would need to fall back */ 59 | ftom = (double)freq.QuadPart / 1000000.; 60 | } 61 | mutex_unlock(&clock_mtx); 62 | } 63 | 64 | rslt = QueryPerformanceCounter(&ctr); 65 | switch (rslt) { 66 | case 0: 67 | ts->tv_sec = 0; 68 | ts->tv_nsec = 0; 69 | break; 70 | default: 71 | ctr.QuadPart -= start.QuadPart; 72 | m.QuadPart = ctr.QuadPart / ftom; 73 | ctr.QuadPart = m.QuadPart % 1000000; 74 | ts->tv_sec = m.QuadPart / 1000000; 75 | ts->tv_nsec = ctr.QuadPart * 1000; 76 | } 77 | 78 | return (rslt); 79 | } 80 | 81 | /* XXX this mutex actually -is- serializing calls, however, these 82 | * calls should be rare */ 83 | pthread_mutex_t warn_mtx = PTHREAD_MUTEX_INITIALIZER; 84 | 85 | void warnx(const char *fmt, ...) 86 | { 87 | va_list ap; 88 | static char msg[128]; 89 | 90 | va_start(ap, fmt); 91 | if (fmt != NULL) 92 | _vsnprintf(msg, 128, fmt, ap); 93 | else 94 | msg[0] = '\0'; 95 | va_end(ap); 96 | fprintf(stderr, "%s\n", msg); 97 | } 98 | 99 | #endif /* _WIN32 */ 100 | -------------------------------------------------------------------------------- /src/rbtree_x.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Linux Box Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "config.h" 27 | 28 | #include 29 | #if !defined(_WIN32) 30 | #include 31 | #include 32 | #endif 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #define RBTX_REC_MAXPART 23 41 | 42 | int rbtx_init(struct rbtree_x *xt, opr_rbtree_cmpf_t cmpf, uint32_t npart, 43 | uint32_t flags) 44 | { 45 | int ix, code = 0; 46 | pthread_rwlockattr_t rwlock_attr; 47 | struct rbtree_x_part *t; 48 | 49 | xt->flags = flags; 50 | 51 | if ((npart > RBTX_REC_MAXPART) || (npart % 2 == 0)) { 52 | __warnx(TIRPC_DEBUG_FLAG_RBTREE, 53 | "rbtx_init: value %d is an unlikely value for npart " 54 | "(suggest a small prime)", npart); 55 | } 56 | 57 | if (flags & RBT_X_FLAG_ALLOC) 58 | xt->tree = mem_alloc(npart * sizeof(struct rbtree_x_part)); 59 | 60 | /* prior versions of Linux tirpc are subject to default prefer-reader 61 | * behavior (so have potential for writer starvation) */ 62 | rwlockattr_init(&rwlock_attr); 63 | #ifdef GLIBC 64 | pthread_rwlockattr_setkind_np( 65 | &rwlock_attr, 66 | PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); 67 | #endif 68 | 69 | xt->npart = npart; 70 | 71 | for (ix = 0; ix < npart; ++ix) { 72 | t = &(xt->tree[ix]); 73 | mutex_init(&t->mtx, NULL); 74 | rwlock_init(&t->lock, &rwlock_attr); 75 | pthread_spin_init(&t->sp, PTHREAD_PROCESS_PRIVATE); 76 | opr_rbtree_init(&t->t, cmpf /* may be NULL */); 77 | } 78 | 79 | return (code); 80 | } 81 | -------------------------------------------------------------------------------- /src/rpc_com.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | /* 29 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 30 | */ 31 | 32 | /* 33 | * rpc_com.h, Common definitions for both the server and client side. 34 | * All for the topmost layer of rpc 35 | * 36 | * In Sun's tirpc distribution, this was installed as , 37 | * but as it contains only non-exported interfaces, it was moved here. 38 | */ 39 | 40 | #ifndef _TIRPC_RPCCOM_H 41 | #define _TIRPC_RPCCOM_H 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | /* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */ 48 | 49 | /* 50 | * The max size of the transport, if the size cannot be determined 51 | * by other means. 52 | */ 53 | #define RPC_MAXDATASIZE 9000 54 | #define RPC_MAXADDRSIZE 1024 55 | 56 | #ifndef __RPC_GETXID 57 | #define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \ 58 | (u_int32_t)((now)->tv_nsec)) 59 | #endif /* !__RPC_GETXID */ 60 | 61 | __BEGIN_DECLS 62 | extern u_int __rpc_get_a_size(int); 63 | extern int __rpc_dtbsize(void); 64 | extern struct netconfig *__rpcgettp(int); 65 | extern int __rpc_get_default_domain(char **); 66 | struct netbuf *__rpc_set_netbuf(struct netbuf *, const void *, size_t); 67 | 68 | char *__rpc_taddr2uaddr_af(int, const struct netbuf *); 69 | struct netbuf *__rpc_uaddr2taddr_af(int, const char *); 70 | int __rpc_fixup_addr(struct netbuf *, const struct netbuf *); 71 | int __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **); 72 | int __rpc_seman2socktype(int); 73 | int __rpc_socktype2seman(int); 74 | void *rpc_nullproc(CLIENT *); 75 | int __rpc_sockisbound(int); 76 | 77 | struct netbuf *__rpcb_findaddr(rpcprog_t, rpcvers_t, const struct netconfig *, 78 | const char *, CLIENT **); 79 | struct netbuf *__rpcb_findaddr_timed(rpcprog_t, rpcvers_t, 80 | const struct netconfig *, const char *, 81 | CLIENT **, struct timeval *); 82 | 83 | bool __rpc_control(int, void *); 84 | 85 | char *_get_next_token(char *, int); 86 | 87 | __END_DECLS 88 | #endif /* _TIRPC_RPCCOM_H */ 89 | -------------------------------------------------------------------------------- /src/rpc_commondata.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include "config.h" 30 | #include 31 | 32 | /* 33 | * This file should only contain common data (global data) that is exported 34 | * by public interfaces 35 | */ 36 | struct opaque_auth _null_auth; 37 | -------------------------------------------------------------------------------- /src/rpc_dtablesize.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include "config.h" 30 | #include 31 | 32 | #include 33 | 34 | int _rpc_dtablesize(void); /* XXX */ 35 | 36 | /* 37 | * Cache the result of getdtablesize(), so we don't have to do an 38 | * expensive system call every time. 39 | */ 40 | /* 41 | * XXX In FreeBSD 2.x, you can have the maximum number of open file 42 | * descriptors be greater than FD_SETSIZE (which us 256 by default). 43 | * 44 | * Since old programs tend to use this call to determine the first arg 45 | * for _select(), having this return > FD_SETSIZE is a Bad Idea(TM)! 46 | */ 47 | int _rpc_dtablesize(void) 48 | { 49 | static int size; 50 | 51 | if (size == 0) { 52 | size = getdtablesize(); 53 | if (size > FD_SETSIZE) 54 | size = FD_SETSIZE; 55 | } 56 | return (size); 57 | } 58 | -------------------------------------------------------------------------------- /src/rpc_raw.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: raw.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ 2 | /* $FreeBSD: src/include/rpc/raw.h,v 1.1 2001/03/19 12:49:47 3 | * alfred Exp $ */ 4 | 5 | /* 6 | * Copyright (c) 2009, Sun Microsystems, Inc. 7 | * Copyright (c) 2017 Red Hat, Inc. and/or its affiliates. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions are met: 12 | * - Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * - Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | * POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | /* 34 | * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 35 | */ 36 | 37 | #ifndef _RPC_RAW_H 38 | #define _RPC_RAW_H 39 | 40 | /* from: @(#)raw.h 1.11 94/04/25 SMI */ 41 | /* from: @(#)raw.h 1.2 88/10/25 SMI */ 42 | 43 | #include "rpc_dplx_internal.h" 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* 50 | * raw.h 51 | * 52 | * Raw interface 53 | * The common memory area over which they will communicate 54 | */ 55 | struct rpc_raw_xprt { 56 | struct rpc_dplx_rec raw_dr; 57 | char raw_verf_body[MAX_AUTH_BYTES]; 58 | char raw_buf[0]; 59 | }; 60 | #define RAW_DR(p) (opr_containerof((p), struct rpc_raw_xprt, raw_dr)) 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #endif /* _RPC_RAW_H */ 66 | -------------------------------------------------------------------------------- /src/rpcdname.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Sun Microsystems, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * - Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * - Redistributions in binary form must reproduce the above copyright notice, 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * - Neither the name of Sun Microsystems, Inc. nor the names of its 13 | * contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | #include "config.h" 29 | #include 30 | 31 | /* 32 | * rpcdname.c 33 | * Gets the default domain name 34 | */ 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | static char *default_domain; 41 | 42 | static char *get_default_domain(void) 43 | { 44 | char temp[256]; 45 | 46 | if (default_domain) 47 | return (default_domain); 48 | if (getdomainname(temp, sizeof(temp)) < 0) 49 | return (0); 50 | if ((int)strlen(temp) > 0) { 51 | default_domain = 52 | (char *)mem_alloc((strlen(temp) + (unsigned)1)); 53 | if (default_domain == 0) 54 | return (0); 55 | (void)strcpy(default_domain, temp); 56 | return (default_domain); 57 | } 58 | return (0); 59 | } 60 | 61 | /* 62 | * This is a wrapper for the system call getdomainname which returns a 63 | * ypclnt.h error code in the failure case. It also checks to see that 64 | * the domain name is non-null, knowing that the null string is going to 65 | * get rejected elsewhere in the NIS client package. 66 | */ 67 | int __rpc_get_default_domain(char **domain) 68 | { 69 | *domain = get_default_domain(); 70 | if (*domain) 71 | return (0); 72 | return (-1); 73 | } 74 | -------------------------------------------------------------------------------- /src/strlcat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998 Todd C. Miller 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef HAVE_STRLCAT 18 | 19 | #include "config.h" 20 | #include 21 | #include 22 | 23 | /* 24 | * Appends src to string dst of size siz (unlike strncat, siz is the 25 | * full size of dst, not space left). At most siz-1 characters 26 | * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 27 | * Returns strlen(src) + MIN(siz, strlen(initial dst)). 28 | * If retval >= siz, truncation occurred. 29 | */ 30 | size_t 31 | strlcat(char *dst, const char *src, size_t siz) 32 | { 33 | register char *d = dst; 34 | register const char *s = src; 35 | register size_t n = siz; 36 | size_t dlen; 37 | 38 | /* Find the end of dst and adjust bytes left but don't go past end */ 39 | while (n-- != 0 && *d != '\0') 40 | d++; 41 | dlen = d - dst; 42 | n = siz - dlen; 43 | 44 | if (n == 0) 45 | return (dlen + strlen(s)); 46 | while (*s != '\0') { 47 | if (n != 1) { 48 | *d++ = *s; 49 | n--; 50 | } 51 | s++; 52 | } 53 | *d = '\0'; 54 | 55 | return (dlen + (s - src)); /* count does not include NUL */ 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /src/strlcpy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1998 Todd C. Miller 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef HAVE_STRLCPY 18 | 19 | #include "config.h" 20 | #include 21 | 22 | /* 23 | * Copy src to string dst of size siz. At most siz-1 characters 24 | * will be copied. Always NUL terminates (unless siz == 0). 25 | * Returns strlen(src); if retval >= siz, truncation occurred. 26 | */ 27 | size_t 28 | strlcpy(char *dst, const char *src, size_t siz) 29 | { 30 | register char *d = dst; 31 | register const char *s = src; 32 | register size_t n = siz; 33 | 34 | /* Copy as many bytes as will fit */ 35 | if (n != 0 && --n != 0) { 36 | do { 37 | if ((*d++ = *s++) == 0) 38 | break; 39 | } while (--n != 0); 40 | } 41 | 42 | /* Not enough room in dst, add NUL and traverse rest of src */ 43 | if (n == 0) { 44 | if (siz != 0) 45 | *d = '\0'; /* NUL-terminate dst */ 46 | while (*s++); 47 | } 48 | 49 | return (s - src - 1); /* count does not include NUL */ 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /src/svc_auth_none.c: -------------------------------------------------------------------------------- 1 | /* 2 | svc_auth_none.c 3 | 4 | Copyright (c) 2000 The Regents of the University of Michigan. 5 | All rights reserved. 6 | 7 | Copyright (c) 2000 Dug Song . 8 | All rights reserved, all wrongs reversed. 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions 12 | are met: 13 | 14 | 1. Redistributions of source code must retain the above copyright 15 | notice, this list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright 17 | notice, this list of conditions and the following disclaimer in the 18 | documentation and/or other materials provided with the distribution. 19 | 3. Neither the name of the University nor the names of its 20 | contributors may be used to endorse or promote products derived 21 | from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 24 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 30 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | $Id: svc_auth_none.c,v 1.1 2004/10/22 17:24:30 bfields Exp $ 36 | */ 37 | 38 | #include "config.h" 39 | #include 40 | #include 41 | 42 | static bool 43 | svcauth_none_wrap(struct svc_req *req, XDR *xdrs) 44 | { 45 | return ((*req->rq_msg.RPCM_ack.ar_results.proc) 46 | (xdrs, req->rq_msg.RPCM_ack.ar_results.where)); 47 | } 48 | 49 | static bool 50 | svcauth_none_unwrap(struct svc_req *req) 51 | { 52 | return ((*req->rq_msg.rm_xdr.proc) 53 | (req->rq_xdrs, req->rq_msg.rm_xdr.where)); 54 | } 55 | 56 | static bool 57 | svcauth_none_checksum(struct svc_req *req) 58 | { 59 | XDR *xdrs = req->rq_xdrs; 60 | 61 | SVC_CHECKSUM(req, xdrs->x_data, xdr_size_inline(xdrs)); 62 | return ((*req->rq_msg.rm_xdr.proc) (xdrs, req->rq_msg.rm_xdr.where)); 63 | } 64 | 65 | static bool 66 | svcauth_none_release(struct svc_req * __attribute__ ((unused)) req) 67 | { 68 | return (true); 69 | } 70 | 71 | static bool 72 | svcauth_none_destroy(SVCAUTH *auth) 73 | { 74 | return (true); 75 | } 76 | 77 | static struct svc_auth_ops svc_auth_none_ops = { 78 | svcauth_none_wrap, 79 | svcauth_none_unwrap, 80 | svcauth_none_checksum, 81 | svcauth_none_release, 82 | svcauth_none_destroy 83 | }; 84 | 85 | SVCAUTH svc_auth_none = { 86 | &svc_auth_none_ops, 87 | NULL, 88 | }; 89 | 90 | enum auth_stat 91 | _svcauth_none(struct svc_req *req) 92 | { 93 | req->rq_auth = &svc_auth_none; 94 | 95 | return (AUTH_OK); 96 | } 97 | -------------------------------------------------------------------------------- /src/svc_ioq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Linux Box Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef SVC_IOQ_H 27 | #define SVC_IOQ_H 28 | 29 | #include 30 | #include 31 | 32 | void svc_ioq_init(void); 33 | void svc_ioq_write_now(SVCXPRT *, struct xdr_ioq *); 34 | void svc_ioq_write_submit(SVCXPRT *, struct xdr_ioq *); 35 | 36 | #endif /* SVC_IOQ_H */ 37 | -------------------------------------------------------------------------------- /src/svc_xprt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Linux Box Corporation. 3 | * Copyright (c) 2013-2015 CohortFS, LLC. 4 | * Copyright (c) 2017 Red Hat, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef TIRPC_SVC_XPRT_H 29 | #define TIRPC_SVC_XPRT_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | /** 36 | * @file svc_xprt.h 37 | * @contributeur William Allen Simpson 38 | * @brief Service transports package 39 | * 40 | * @section DESCRIPTION 41 | * 42 | * Maintains a tree of all extant transports by fd. 43 | * 44 | * svc_xprt_init -- init module; usually called by svc_init() 45 | * svc_xprt_lookup -- find or create shared fd state 46 | * svc_xprt_clear -- remove a transport 47 | * svc_xprt_foreach -- scan registered transports 48 | * svc_xprt_dump_xprts -- dump registered transports 49 | * svc_xprt_shutdown -- clear the tree, destroy transports 50 | */ 51 | 52 | int svc_xprt_init(void); 53 | 54 | typedef void (*svc_xprt_setup_t) (SVCXPRT **); 55 | 56 | /* 57 | * returns with lock taken 58 | */ 59 | SVCXPRT *svc_xprt_lookup(int, svc_xprt_setup_t); 60 | void svc_xprt_clear(SVCXPRT *); 61 | 62 | typedef bool(*svc_xprt_each_func_t) (SVCXPRT *, void *); 63 | int svc_xprt_foreach(svc_xprt_each_func_t, void *); 64 | 65 | void svc_xprt_dump_xprts(const char *); 66 | void svc_xprt_shutdown(); 67 | 68 | #endif /* TIRPC_SVC_XPRT_H */ 69 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | SET(rpcping_SRCS 3 | rpcping.c 4 | ) 5 | add_executable(rpcping ${rpcping_SRCS}) 6 | target_link_libraries(rpcping ntirpc 7 | ${BINARY_LIBRARIES} 8 | ${CMAKE_THREAD_LIBS_INIT} 9 | ${LTTNG_LIBRARIES} 10 | -ldl) 11 | -------------------------------------------------------------------------------- /version-h.in.cmake: -------------------------------------------------------------------------------- 1 | /* version.h file expanded by Cmake for build */ 2 | 3 | #ifndef VERSION_H 4 | #define VERSION_H 5 | 6 | #define NTIRPC_VERSION_MAJOR @NTIRPC_MAJOR_VERSION@ 7 | #define NTIRPC_VERSION_MINOR @NTIRPC_MINOR_VERSION@ 8 | #define NTIRPC_PATCH_LEVEL @NTIRPC_PATCH_LEVEL@ 9 | 10 | #define NTIRPC_VERSION "@NTIRPC_MAJOR_VERSION@.@NTIRPC_MINOR_VERSION@.@NTIRPC_PATCH_LEVEL@" 11 | #define NTIRPC_VERSION_COMMENT "@VERSION_COMMENT@" 12 | #define _GIT_HEAD_COMMIT "@_GIT_HEAD_COMMIT@" 13 | #define _GIT_DESCRIBE "@_GIT_DESCRIBE@" 14 | 15 | #endif /* VERSION_H */ 16 | --------------------------------------------------------------------------------