| 1 | /* Load the real underlying functions for withsctp and related scripts. |
| 2 | * |
| 3 | * Copyright 2003 La Monte HP Yarroll <[email protected]> |
| 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 | * |
| 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 |
| 12 | * copyright notice, this list of conditions and the following |
| 13 | * disclaimer in the documentation and/or other materials provided with |
| 14 | * the distribution. |
| 15 | * 3. The name of the author may not be used to endorse or promote |
| 16 | * products derived from this software without specific prior written |
| 17 | * permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 23 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 25 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 27 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 28 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 29 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | #include <stdio.h> |
| 32 | #include <stdlib.h> |
| 33 | #include "sctp_socket.h"cxx . . $ `<file>/src/withsctp/sctp_socket.h`/ |
| 34 | |
| 35 | int (*real_bindcxx . . $ real_bind.)(int sockfd, const struct sockaddrcxx . . $ sockaddr# *my_addr, socklen_tcxx . . $ socklen_t# addrlen); |
| 36 | int (*real_socketcxx . . $ real_socket.)(int domain, int type, int protocol); |
| 37 | int (*real_setsockoptcxx . . $ real_setsockopt.)(int s, int level, int optname, const void *optval, |
| 38 | socklen_tcxx . . $ socklen_t# optlen); |
| 39 | static void *lib_handlecxx . . $ lib_handle. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 40 | |
| 41 | void |
| 42 | _sctp_load_libscxx . . $ _sctp_load_libs(49f6e7a06ebc5aa8).(void) |
| 43 | { |
| 44 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! != lib_handlecxx . . $ lib_handle.) return; /* Only init once. */ |
| 45 | |
| 46 | if (!(lib_handlecxx . . $ lib_handle. = dlopencxx . . $ dlopen(fb9ec0bb113f3da8).("libc.so", RTLD_LAZYcxx . . $ `<external>/10632388298615623587/dlfcn.h:24:9`!))) { |
| 47 | if (!(lib_handlecxx . . $ lib_handle. = dlopencxx . . $ dlopen(fb9ec0bb113f3da8).("libc.so.6", RTLD_LAZYcxx . . $ `<external>/10632388298615623587/dlfcn.h:24:9`!))) { |
| 48 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "error loading libc!\n"); |
| 49 | exitcxx . . $ exit(3ca292c338df9bb3). (1); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | if (!(real_socketcxx . . $ real_socket. = dlsymcxx . . $ dlsym(5c3a2d84d269ab4b).(lib_handlecxx . . $ lib_handle., "socket"))) { |
| 54 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "socket() not found in libc!\n"); |
| 55 | exitcxx . . $ exit(3ca292c338df9bb3). (1); |
| 56 | } |
| 57 | |
| 58 | if (!(real_bindcxx . . $ real_bind. = dlsymcxx . . $ dlsym(5c3a2d84d269ab4b).(lib_handlecxx . . $ lib_handle., "bind"))) { |
| 59 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "bind() not found in libc!\n"); |
| 60 | exitcxx . . $ exit(3ca292c338df9bb3). (1); |
| 61 | } |
| 62 | |
| 63 | if (!(real_setsockoptcxx . . $ real_setsockopt. = dlsymcxx . . $ dlsym(5c3a2d84d269ab4b).(lib_handlecxx . . $ lib_handle., "setsockopt"))) { |
| 64 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "setsockopt() not found in libc!\n"); |
| 65 | exitcxx . . $ exit(3ca292c338df9bb3). (1); |
| 66 | } |
| 67 | } |