*
* Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact:
+ * Contact:
*
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Woojin Jung <woojin2.jung@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
* Anastasia Lyupa <a.lyupa@samsung.com>
- *
+ *
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
- *
+ *
* This library is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* Contributors:
* - S-Core Co., Ltd
* - Samsung RnD Institute Russia
- *
+ *
*/
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#include <stdbool.h>
-
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include <ifaddrs.h>
-#include <arpa/inet.h>
-
+#include <sys/un.h>
#include <errno.h>
-#include "daprobe.h"
+#include <time.h>
+#include <sys/epoll.h>
+#include <sys/poll.h>
#include "probeinfo.h"
#include "dautil.h"
-#include "dahelper.h"
#include "da_socket.h"
+#include "daprobe.h"
+#include "dahelper.h"
+#include "api_id_mapping.h"
+#include "binproto.h"
+#define OBJ_DUMMY 0
+
+static enum DaOptions _sopt = OPT_NETWORK;
+char g_address[128];
+char* getAddress(const struct sockaddr *sa) {
+ char buff[INET6_ADDRSTRLEN];
+ switch (sa->sa_family) {
+ case AF_INET:
+ sprintf(g_address, "%s:%d",
+ inet_ntoa(((struct sockaddr_in*) sa)->sin_addr),
+ (int) ntohs(((struct sockaddr_in*) sa)->sin_port));
+ break;
+ case AF_INET6:
+ sprintf(g_address, "%s:%d",
+ inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) sa)->sin6_addr),
+ buff, sizeof(buff)),
+ ntohs(((struct sockaddr_in6*) sa)->sin6_port));
+ break;
+ }
+ return g_address;
+}
+
+//FD
+int socket(int domain, int type, int protocol) {
+ static int (*socketp)(int domain, int type, int protocol);
+ BEFORE_ORIGINAL_SOCK(socket, LIBC);
+ ret = socketp(domain, type, protocol);
-#include "binproto.h"
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, "",
+ 0, NO_DESTINATIONINFO, "ddd", domain, type, protocol);
-#define GCC_VERSION (__GNUC__ * 10000 \
- + __GNUC__MINOR__ * 100 \
- + __GNUC_PATCHLEVEL__ )
+ return ret;
+}
+int accept(int socket, struct sockaddr *address, socklen_t *address_len) {
-static enum DaOptions _sopt = OPT_FILE;
+ static int (*acceptp)(int socket, struct sockaddr *address,
+ socklen_t *address_len);
-int socket(int domain, int type, int protocol)
-{
- static int (*socketp)(int domain, int type, int protocol);
-
- BEFORE_ORIGINAL_NOFILTER(socket, LIBC);
+ BEFORE_ORIGINAL_SOCK(accept, LIBC);
- ret = socketp(domain, type, protocol);
+ char* callAddress = getAddress(address);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
+ SOCKET_API_ACCEPT_START, "", 0, address, "dsp",
+ socket, callAddress, address_len);
+
+ ret = acceptp(socket, address, address_len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_socket,
- ret, 0, ret, FD_API_OPEN, "ddd", domain, type, protocol);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, socket,
+ SOCKET_API_ACCEPT_END, "", 0, address, "dsp",
+ socket, callAddress, address_len);
return ret;
}
-int socketpair(int domain, int type, int protocol,int socket_vector[2])
-{
- static int (*socketpairp)(int domain, int type, int protocol,int socket_vector[2]);
-
- BEFORE_ORIGINAL_NOFILTER(socketpair, LIBC);
-
- ret = socketpairp(domain, type, protocol, socket_vector);
+int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) {
+ static int (*accept4p)(int sockfd, struct sockaddr *addr,
+ socklen_t *addrlen, int flags);
- //TODO: socket pair: socket_vector[0]/socket_vector[1], FD - ?
- AFTER_PACK_ORIGINAL_SOCK(API_ID_socketpair,
- ret, 0, socket_vector[0], FD_API_OPEN,
- "dddp", domain, type, protocol, socket_vector);
-
- return ret;
-}
+ BEFORE_ORIGINAL_SOCK(accept4, LIBC);
+ char* callAddress = getAddress(addr);
-int shutdown(int socket, int how)
-{
- static int (*shutdownp)(int socket, int how);
-
- BEFORE_ORIGINAL_NOFILTER(shutdown, LIBC);
-
- ret = shutdownp(socket, how);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, sockfd,
+ SOCKET_API_ACCEPT_START, "", 0, addr, "dspd",
+ sockfd, callAddress, addrlen, flags);
+
+ ret = accept4p(sockfd, addr, addrlen, flags);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_shutdown,
- ret, 0, socket, FD_API_OTHER, "dd", socket, how);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, sockfd,
+ SOCKET_API_ACCEPT_END, "", 0, addr, "dspd",
+ sockfd, callAddress, addrlen, flags);
return ret;
}
-int bind(int socket, const struct sockaddr *address, socklen_t address_len)
-{
- static int (*bindp)(int socket, const struct sockaddr *address, socklen_t address_len);
-
- BEFORE_ORIGINAL(bind, LIBC);
-
- ret = bindp(socket, address, address_len);
+int connect(int socket, const struct sockaddr *address, socklen_t address_len) {
+ static int (*connectp)(int socket, const struct sockaddr *address,
+ socklen_t address_len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_bind,
- ret, 0, socket, FD_API_MANAGE,
- "dpd", socket, address, address_len);
-
- return ret;
-}
+ BEFORE_ORIGINAL_SOCK(connect, LIBC);
-int listen(int socket, int backlog)
-{
- static int (*listenp)(int socket, int backlog);
-
- BEFORE_ORIGINAL(listen, LIBC);
-
- ret = listenp(socket, backlog);
+ ret = connectp(socket, address, address_len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_listen,
- ret, 0, socket, FD_API_MANAGE, "dd", socket, backlog);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_CONNECT,
+ "", 0, address, "dsd",
+ socket, getAddress(address), address_len);
return ret;
}
-int accept(int socket, struct sockaddr *address, socklen_t *address_len)
-{
- static int (*acceptp)(int socket, struct sockaddr *address, socklen_t *address_len);
-
- BEFORE_ORIGINAL_NOFILTER(accept, LIBC);
-
- ret = acceptp(socket, address, address_len);
+int shutdown(int socket, int how) {
+ static int (*shutdownp)(int socket, int how);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_accept,
- ret, 0, socket, FD_API_MANAGE,
- "dpp", socket, address, address_len);
-
- return ret;
-}
+ BEFORE_ORIGINAL_SOCK(shutdown, LIBC);
-int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
-{
- static int (*accept4p)(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
-
- BEFORE_ORIGINAL_NOFILTER(accept4, LIBC);
-
- ret = accept4p(sockfd, addr, addrlen, flags);
+ ret = shutdownp(socket, how);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_accept4,
- ret, 0, sockfd, FD_API_MANAGE,
- "dppd", sockfd, addr, addrlen, flags);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_FD_CLOSE,
+ "", 0, NO_DESTINATIONINFO, "dd", socket, how);
return ret;
}
-int connect(int socket, const struct sockaddr *address, socklen_t address_len)
-{
- static int (*connectp)(int socket, const struct sockaddr *address, socklen_t address_len);
-
- BEFORE_ORIGINAL(connect, LIBC);
-
- ret = connectp(socket, address, address_len);
+int bind(int socket, const struct sockaddr *address, socklen_t address_len) {
+ static int (*bindp)(int socket, const struct sockaddr *address,
+ socklen_t address_len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_connect,
- ret, address_len, socket, FD_API_MANAGE,
- "dpd", socket, address, address_len);
-
- return ret;
-}
+ BEFORE_ORIGINAL_SOCK(bind, LIBC);
+
+ ret = bindp(socket, address, address_len);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_BIND, "",
+ 0, address, "dsd",
+ socket, getAddress(address), address_len);
-int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
-{
- static int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
-
- BEFORE_ORIGINAL(select, LIBC);
-
- ret = selectp(nfds, readfds, writefds,exceptfds, timeout);
-
- AFTER_PACK_ORIGINAL_SOCK(API_ID_select,
- ret, 0, nfds, FD_API_MANAGE,
- "dpppp", nfds, readfds, writefds, exceptfds, timeout);
-
return ret;
}
-int pselect(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask)
-{
- static int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask);
+int listen(int socket, int backlog) {
+ static int (*listenp)(int socket, int backlog);
+ BEFORE_ORIGINAL_SOCK(listen, LIBC);
+ ret = listenp(socket, backlog);
- BEFORE_ORIGINAL(pselect, LIBC);
-
- ret = pselectp(nfds, readfds, writefds,exceptfds, ntimeout, sigmask);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_LISTEN, "",
+ 0, NO_DESTINATIONINFO, "dd", socket, backlog);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_pselect,
- ret, 0, nfds, FD_API_MANAGE, "dppppp",
- nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
-
return ret;
}
-ssize_t send(int socket, const void *message, size_t length, int flags)
-{
- static ssize_t (*sendp)(int socket, const void *message, size_t length, int flags);
+ssize_t send(int socket, const void *message, size_t length, int flags) {
+ static ssize_t (*sendp)(int socket, const void *message, size_t length,
+ int flags);
ssize_t sret;
-
- BEFORE_ORIGINAL(send, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(send, LIBC);
+
+ int* messagP = (int*) message;
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
+ SOCKET_API_SEND_START, "", 0, NO_DESTINATIONINFO, "dpdd",
+ socket, messagP, length, flags);
+
sret = sendp(socket, message, length, flags);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_send,
- sret, sret, socket, FD_API_SEND,
- "dpxd", socket, message, length, flags);
-
+ int sendMaxSize = SOCKET_SEND_SIZE;
+ char* out = (char*) malloc(sendMaxSize + 5);
+ if (sret <= 0) {
+ out[0] = '\0';
+ } else {
+ memcpy(out, message, sendMaxSize + 5);
+ if (sret > sendMaxSize + 5) {
+ out[sendMaxSize] = '.';
+ out[sendMaxSize + 1] = '.';
+ out[sendMaxSize + 2] = '.';
+ out[sendMaxSize + 3] = '\0';
+ } else {
+ out[sret] = '\0';
+ }
+ }
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
+ SOCKET_API_SEND_END, out, sret, NO_DESTINATIONINFO, "dpdd",
+ socket, messagP, length, flags);
+ free(out);
return sret;
}
-ssize_t sendmsg(int socket, const struct msghdr *message, int flags)
-{
- static ssize_t (*sendmsgp)(int socket, const struct msghdr *message, int flags);
+ssize_t recv(int socket, void *buffer, size_t length, int flags) {
+ static ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags);
ssize_t sret;
-
- BEFORE_ORIGINAL(sendmsg, LIBC);
-
- sret = sendmsgp(socket, message, flags);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_sendmsg,
- sret, sret, socket, FD_API_SEND,
- "dpd", socket, message, flags);
-
+ BEFORE_ORIGINAL_SOCK(recv, LIBC);
+
+ int* bufferP = (int*) buffer;
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
+ SOCKET_API_RECV_START, "", 0, NO_DESTINATIONINFO, "dpdd",
+ socket, bufferP, length, flags);
+
+ sret = recvp(socket, buffer, length, flags);
+
+ int sendMaxSize = SOCKET_SEND_SIZE;
+ char* out = (char*) malloc(sendMaxSize + 5);
+ if (sret <= 0) {
+ out[0] = '\0';
+ } else {
+ memcpy(out, buffer, sendMaxSize + 5);
+ if (sret > sendMaxSize + 5) {
+ out[sendMaxSize] = '.';
+ out[sendMaxSize + 1] = '.';
+ out[sendMaxSize + 2] = '.';
+ out[sendMaxSize + 3] = '\0';
+ } else {
+ out[sret] = '\0';
+ }
+ }
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
+ SOCKET_API_RECV_END, out, sret, NO_DESTINATIONINFO, "dpdd",
+ socket, bufferP, length, flags);
+ free(out);
return sret;
}
-ssize_t sendto(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len)
-{
- static ssize_t (*sendtop)(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len);
+ssize_t sendto(int socket, const void *message, size_t length, int flags,
+ const struct sockaddr *dest_addr, socklen_t dest_len) {
+ static ssize_t (*sendtop)(int socket, const void *message, size_t length,
+ int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
ssize_t sret;
-
- BEFORE_ORIGINAL(sendto, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(sendto, LIBC);
+
+ int* bufferP = (int*) message;
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
+ SOCKET_API_SEND_START, "", 0, dest_addr, "dpddpd",
+ socket, bufferP, length, flags, dest_addr, dest_len);
+
sret = sendtop(socket, message, length, flags, dest_addr, dest_len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_sendto,
- sret, sret, socket, FD_API_SEND,
- "dpxdpd", socket, message, length, flags, dest_addr, dest_len);
-
+ int sendMaxSize = SOCKET_SEND_SIZE;
+ char* out = (char*) malloc(sendMaxSize + 5);
+ if (sret <= 0) {
+ out[0] = '\0';
+ } else {
+ memcpy(out, message, sendMaxSize + 5);
+ if (sret > sendMaxSize + 5) {
+ out[sendMaxSize] = '.';
+ out[sendMaxSize + 1] = '.';
+ out[sendMaxSize + 2] = '.';
+ out[sendMaxSize + 3] = '\0';
+ } else {
+ out[sret] = '\0';
+ }
+ }
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
+ SOCKET_API_SEND_END, out, sret, NO_DESTINATIONINFO, "dpddpd",
+ socket, bufferP, length, flags, dest_addr, dest_len);
+ free(out);
return sret;
}
-ssize_t recv(int socket, void *buffer, size_t length, int flags)
-{
- static ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags);
+ssize_t recvfrom(int socket, void *buffer, size_t length, int flags,
+ struct sockaddr *address, socklen_t *address_len) {
+ static ssize_t (*recvfromp)(int socket, void *buffer, size_t length,
+ int flags, struct sockaddr *address, socklen_t *address_len);
ssize_t sret;
-
- BEFORE_ORIGINAL(recv, LIBC);
- sret = recvp(socket, buffer, length, flags);
+ BEFORE_ORIGINAL_SOCK(recvfrom, LIBC);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_recv,
- sret, sret, socket, FD_API_RECEIVE,
- "dpxd", socket, buffer, length, flags);
-
+ int* bufferP = (int*) buffer;
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
+ SOCKET_API_RECV_START, "", 0, NO_DESTINATIONINFO, "dpddpp",
+ socket, bufferP, length, flags, address, address_len);
+
+ sret = recvfromp(socket, buffer, length, flags, address, address_len);
+
+ int sendMaxSize = SOCKET_SEND_SIZE;
+ char* out = (char*) malloc(sendMaxSize + 5);
+ if (sret <= 0) {
+ out[0] = '\0';
+ } else {
+ memcpy(out, buffer, sendMaxSize + 5);
+ if (sret > sendMaxSize + 5) {
+ out[sendMaxSize] = '.';
+ out[sendMaxSize + 1] = '.';
+ out[sendMaxSize + 2] = '.';
+ out[sendMaxSize + 3] = '\0';
+ } else {
+ out[sret] = '\0';
+ }
+ }
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
+ SOCKET_API_RECV_END, out, sret, NO_DESTINATIONINFO, "dpddpp",
+ socket, bufferP, length, flags, address, address_len);
+ free(out);
return sret;
}
-ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
-{
- static ssize_t (*recvfromp)(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len);
+ssize_t recvmsg(int socket, struct msghdr *message, int flags) {
+ static ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags);
ssize_t sret;
- BEFORE_ORIGINAL(recvfrom, LIBC);
-
- sret = recvfromp(socket, buffer, length, flags, address, address_len);
+ BEFORE_ORIGINAL_SOCK(recvmsg, LIBC);
+
+ int* bufferP = (int*) message->msg_name;
- AFTER_PACK_ORIGINAL_SOCK(API_ID_recvfrom,
- sret, sret, socket, FD_API_RECEIVE,
- "dpxdpp", socket, buffer, length, flags, address, address_len);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
+ SOCKET_API_RECV_START, "", 0, NO_DESTINATIONINFO, "dpd",
+ socket, message, flags);
+ sret = recvmsgp(socket, message, flags);
+ if (sret <= 0) {
+ memset(&message, 0, sizeof(message));
+ }
+
+ int sendMaxSize = SOCKET_SEND_SIZE;
+ char* out = (char*) malloc(sendMaxSize + 5);
+ if (sret <= 0) {
+ out[0] = '\0';
+ } else {
+ memcpy(out, message, sendMaxSize + 5);
+ if (sret > sendMaxSize + 5) {
+ out[sendMaxSize] = '.';
+ out[sendMaxSize + 1] = '.';
+ out[sendMaxSize + 2] = '.';
+ out[sendMaxSize + 3] = '\0';
+ } else {
+ out[sret] = '\0';
+ }
+ }
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
+ SOCKET_API_RECV_END, out, sret, NO_DESTINATIONINFO, "dpd",
+ socket, bufferP, flags);
+ free(out);
return sret;
}
-ssize_t recvmsg(int socket, struct msghdr *message, int flags)
-{
- static ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags);
+ssize_t sendmsg(int socket, const struct msghdr *message, int flags) {
+ static ssize_t (*sendmsgp)(int socket, const struct msghdr *message,
+ int flags);
ssize_t sret;
-
- BEFORE_ORIGINAL(recvmsg, LIBC);
-
- sret = recvmsgp(socket, message, flags);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_recvmsg,
- sret, sret, socket, FD_API_RECEIVE,
- "dpd", socket, message, flags);
+ BEFORE_ORIGINAL_SOCK(sendmsg, LIBC);
+ int* bufferP = (int*) message->msg_name;
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
+ SOCKET_API_SEND_START, "", 0, NO_DESTINATIONINFO, "dpd",
+ socket, message, flags);
+
+ sret = sendmsgp(socket, message, flags);
+ if (sret <= 0) {
+ memset(&message, 0, sizeof(message));
+ }
+ int sendMaxSize = SOCKET_SEND_SIZE;
+ char* out = (char*) malloc(sendMaxSize + 5);
+ if (sret <= 0) {
+ out[0] = '\0';
+ } else {
+ memcpy(out, message, sendMaxSize + 5);
+ if (sret > sendMaxSize + 5) {
+ out[sendMaxSize] = '.';
+ out[sendMaxSize + 1] = '.';
+ out[sendMaxSize + 2] = '.';
+ out[sendMaxSize + 3] = '\0';
+ } else {
+ out[sret] = '\0';
+ }
+ }
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
+ SOCKET_API_SEND_END, out, sret, NO_DESTINATIONINFO, "dpd",
+ socket, bufferP, flags);
+ free(out);
return sret;
}
-uint32_t htonl(uint32_t hostlong)
-{
- static uint32_t (*htonlp)(uint32_t hostlong);
- uint32_t uret;
-
- BEFORE_ORIGINAL(htonl, LIBC);
-
- uret = htonlp(hostlong);
+int getsockopt(int socket, int level, int option_name, void *option_value,
+ socklen_t *option_len) {
+ static int (*getsockoptp)(int socket, int level, int option_name,
+ void *option_value, socklen_t *option_len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_htonl,
- uret, 0, 0, FD_API_OTHER, "d", hostlong);
-
- return uret;
+ BEFORE_ORIGINAL_SOCK(getsockopt, LIBC);
+
+ ret = getsockoptp(socket, level, option_name, option_value, option_len);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_OTHER, "",
+ 0, NO_DESTINATIONINFO, "dddpp",
+ socket, level, option_name, option_value, option_len);
+
+ return ret;
}
-uint16_t htons(uint16_t hostshort)
-{
- static uint16_t (*htonsp)(uint16_t hostshort);
- uint16_t uret;
-
- BEFORE_ORIGINAL(htons, LIBC);
-
- uret = htonsp(hostshort);
+int setsockopt(int socket, int level, int option_name, const void *option_value,
+ socklen_t option_len) {
+ static int (*setsockoptp)(int socket, int level, int option_name,
+ const void *option_value, socklen_t option_len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_htons,
- uret, 0, 0, FD_API_OTHER, "d", hostshort);
-
- return uret;
+ BEFORE_ORIGINAL_SOCK(setsockopt, LIBC);
+
+ ret = setsockoptp(socket, level, option_name, option_value, option_len);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_OTHER, "",
+ 0, NO_DESTINATIONINFO, "dddpd",
+ socket, level, option_name, option_value, option_len);
+
+ return ret;
}
-uint32_t ntohl(uint32_t netlong)
-{
- static uint32_t (*ntohlp)(uint32_t netlong);
- uint32_t uret;
-
- BEFORE_ORIGINAL(ntohl, LIBC);
-
- uret = ntohlp(netlong);
+int getpeername(int fd, struct sockaddr *addr, socklen_t *len) {
+ static int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_ntohl,
- uret, 0, 0, FD_API_OTHER, "d", netlong);
+ BEFORE_ORIGINAL_SOCK(getpeername, LIBC);
- return uret;
+ ret = getpeernamep(fd, addr, len);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, fd, SOCKET_API_OTHER, "", 0,
+ getAddress(addr), "dsp", fd, getAddress(addr), len);
+ return ret;
}
-uint16_t ntohs(uint16_t netshort)
-{
- static uint16_t (*ntohsp)(uint16_t netshort);
- uint16_t uret;
-
- BEFORE_ORIGINAL(ntohs, LIBC);
-
- uret = ntohsp(netshort);
+int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
+ static int (*getsocknamep)(int sockfd, struct sockaddr *addr,
+ socklen_t *addrlen);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_ntohs,
- uret, 0, 0, FD_API_OTHER, "d", netshort);
+ BEFORE_ORIGINAL_SOCK(getsockname, LIBC);
- return uret;
+ ret = getsocknamep(sockfd, addr, addrlen);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, sockfd, SOCKET_API_OTHER, "",
+ 0, getAddress(addr), "dsp",
+ sockfd, getAddress(addr), addrlen);
+
+ return ret;
}
-#if 0
-uint16_t htobe16(uint16_t host_16bits)
-{
- static uint16_t (*htobe16p)(uint16_t host_16bits);
- uint16_t uret;
-
- BEFORE_ORIGINAL(htobe16, LIBC);
-
- uret = htobe16p(host_16bits);
-
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "d", host_16bits);
+int socketpair(int domain, int type, int protocol, int socket_vector[2]) {
+ static int (*socketpairp)(int domain, int type, int protocol,
+ int socket_vector[2]);
- return uret;
+ BEFORE_ORIGINAL_SOCK(socketpair, LIBC);
+
+ ret = socketpairp(domain, type, protocol, socket_vector);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket_vector[0],
+ SOCKET_API_FD_OPEN, "", 0, NO_DESTINATIONINFO, "ddddd",
+ domain, type, protocol, socket_vector[0], socket_vector[1]);
+
+ return ret;
}
-uint16_t htole16(uint16_t host_16bits)
-{
- static uint16_t (*htole16p)(uint16_t host_16bits);
- uint16_t uret;
-
- BEFORE_ORIGINAL(htole16, LIBC);
-
- uret = htole16p(host_16bits);
-
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "d", host_16bits);
+int sockatmark(int __fd) {
+ static int (*sockatmarkp)(int __fd);
- return uret;
+ BEFORE_ORIGINAL_SOCK(sockatmark, LIBC);
+
+ ret = sockatmarkp(__fd);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, __fd,
+ SOCKET_API_OTHER, "", 0, NO_DESTINATIONINFO, "d", __fd);
+ return ret;
}
-uint16_t be16toh(uint16_t big_endian_16bits)
-{
- static uint16_t (*be16tohp)(uint16_t big_endian_16bits);
- uint16_t uret;
-
- BEFORE_ORIGINAL(be16toh, LIBC);
-
- uret = be16tohp(big_endian_16bits);
+int isfdtype(int __fd, int __fdtype) {
+ static int (*isfdtypep)(int __fd, int __fdtype);
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "d", big_endian_16bits);
-
- return uret;
+ BEFORE_ORIGINAL_SOCK(isfdtype, LIBC);
+
+ ret = isfdtypep(__fd, __fdtype);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, __fd, SOCKET_API_OTHER, "", 0,
+ NO_DESTINATIONINFO, "dd", __fd, __fdtype);
+ return ret;
}
-uint16_t le16toh(uint16_t little_endian_16bits)
-{
- static uint16_t (*le16tohp)(uint16_t little_endian_16bits);
- uint16_t uret;
-
- BEFORE_ORIGINAL(le16toh, LIBC);
-
- uret = le16tohp(little_endian_16bits);
+int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ struct timeval *timeout) {
+ static int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, struct timeval *timeout);
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "d", little_endian_16bits);
-
- return uret;
+ BEFORE_ORIGINAL_SOCK(select, LIBC);
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, 0,
+ SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dpppp",
+ nfds, readfds, writefds, exceptfds, timeout);
+
+ ret = selectp(nfds, readfds, writefds, exceptfds, timeout);
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, 0,
+ SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dpppp",
+ nfds, readfds, writefds, exceptfds, timeout);
+
+ return ret;
}
-uint32_t htobe32(uint32_t host_32bits)
-{
- static uint32_t (*htobe32p)(uint32_t host_32bits);
- uint32_t uret;
-
- BEFORE_ORIGINAL(htobe32, LIBC);
+int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ const struct timespec *ntimeout, const sigset_t *sigmask) {
+ static int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, const struct timespec *ntimeout,
+ const sigset_t *sigmask);
- uret = htobe32p(host_32bits);
+ BEFORE_ORIGINAL_SOCK(pselect, LIBC);
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "d", host_32bits);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, 0,
+ SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dppppp",
+ nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
- return uret;
+ ret = pselectp(nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, 0,
+ SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dppppp",
+ nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
+
+ return ret;
}
-uint32_t htole32(uint32_t host_32bits)
-{
- static uint32_t (*htole32p)(uint32_t host_32bits);
- uint32_t uret;
-
- BEFORE_ORIGINAL(htole32, LIBC);
+int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
+ static int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout);
- uret = htole32p(host_32bits);
+ BEFORE_ORIGINAL_SOCK(poll, LIBC);
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "d", host_32bits);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, fds->fd,
+ SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "pxd",
+ fds, nfds, timeout);
- return uret;
+ ret = pollp(fds, nfds, timeout);
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, fds->fd,
+ SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "pxd", fds, nfds, timeout);
+
+ return ret;
}
-uint32_t be32toh(uint32_t big_endian_32bits)
-{
- static uint32_t (*be32tohp)(uint32_t big_endian_32bits);
- uint32_t uret;
-
- BEFORE_ORIGINAL(be32toh, LIBC);
+int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts,
+ const sigset_t *sigmask) {
+ static int (*ppollp)(struct pollfd *fds, nfds_t nfds,
+ const struct timespec *timeout_ts, const sigset_t *sigmask);
- uret = be32tohp(big_endian_32bits);
+ BEFORE_ORIGINAL_SOCK(ppoll, LIBC);
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "d", big_endian_32bits);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, fds->fd,
+ SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "pxpp",
+ fds, nfds, timeout_ts, sigmask);
- return uret;
+ ret = ppollp(fds, nfds, timeout_ts, sigmask);
+
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, fds->fd,
+ SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "pxpp",
+ fds, nfds, timeout_ts, sigmask);
+
+ return ret;
}
-uint32_t le32toh(uint32_t little_endian_32bits)
-{
- static uint32_t (*le32tohp)(uint32_t little_endian_32bits);
- uint32_t uret;
-
- BEFORE_ORIGINAL(le32toh, LIBC);
+int epoll_create(int __size) {
+ static int (*epoll_createp)(int __size);
+ BEFORE_ORIGINAL_SOCK(epoll_create, LIBC);
- uret = le32tohp(little_endian_32bits);
+ ret = epoll_createp(__size);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, "",
+ 0, NO_DESTINATIONINFO, "d", __size);
+ return ret;
+}
- AFTER_PACK_ORIGINAL_SOCK(API_ID_le32toh,
- uret, 0, 0, FD_API_OTHER, "d", little_endian_32bits);
+int epoll_create1(int __flags) {
+ static int (*epoll_create1p)(int __size);
+ BEFORE_ORIGINAL_SOCK(epoll_create1, LIBC);
- return uret;
+ ret = epoll_create1p(__flags);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, "",
+ 0, NO_DESTINATIONINFO, "d", __flags);
+ return ret;
}
-uint64_t htobe64(uint64_t host_64bits)
-{
- static uint64_t (*htobe64p)(uint64_t host_64bits);
- uint64_t uret;
+int epoll_wait(int __epfd, struct epoll_event *__events, int __maxevents,
+ int __timeout) {
+ static int (*epoll_waitp)(int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout);
+ BEFORE_ORIGINAL_SOCK(epoll_wait, LIBC);
- BEFORE_ORIGINAL(htobe64, LIBC);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, __epfd,
+ SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dpdd",
+ __epfd, __events, __maxevents, __timeout);
- uret = htobe64p(host_64bits);
-
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "x", host_64bits);
+ ret = epoll_waitp(__epfd, __events, __maxevents, __timeout);
- return uret;
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, __epfd,
+ SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dpdd",
+ __epfd, __events, __maxevents, __timeout);
+
+ return ret;
}
-uint64_t htole64(uint64_t host_64bits)
-{
- static uint64_t (*htole64p)(uint64_t host_64bits);
- uint64_t uret;
-
- BEFORE_ORIGINAL(htole64, LIBC);
+int epoll_pwait(int __epfd, struct epoll_event *__events, int __maxevents,
+ int __timeout, __const __sigset_t *__ss) {
+ static int (*epoll_pwaitp)(int __epfd, struct epoll_event *__events,
+ int __maxevents, int __timeout, __const __sigset_t *__ss);
+ BEFORE_ORIGINAL_SOCK(epoll_pwait, LIBC);
- uret = htole64p(host_64bits);
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, __epfd,
+ SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dpdd %p",
+ __epfd, __events, __maxevents, __timeout, __ss);
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "x", host_64bits);
+ ret = epoll_pwaitp(__epfd, __events, __maxevents, __timeout, __ss);
- return uret;
+ AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, __epfd,
+ SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dpdd %p",
+ __epfd, __events, __maxevents, __timeout, __ss);
+
+ return ret;
}
-uint64_t be64toh(uint64_t big_endian_64bits)
-{
- static uint64_t (*be64tohp)(uint64_t big_endian_64bits);
- uint64_t uret;
-
- BEFORE_ORIGINAL(be64toh, LIBC);
+int epoll_ctl(int __epfd, int __op, int __fd, struct epoll_event *__event) {
+ static int (*epoll_ctlp)(int __epfd, int __op, int __fd,
+ struct epoll_event *__event);
- uret = be64tohp(big_endian_64bits);
+ BEFORE_ORIGINAL_SOCK(epoll_ctl, LIBC);
+
+ ret = epoll_ctlp(__epfd, __op, __fd, __event);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, __fd, SOCKET_API_OTHER, "", 0,
+ NO_DESTINATIONINFO, "dddp", __epfd, __op, __fd, __event);
+ return ret;
+}
+
+#if 0
+//OPTION _//NO FD
+
+uint32_t htonl(uint32_t hostlong) {
+ static uint32_t (*htonlp)(uint32_t hostlong);
+ uint32_t uret;
+
+ BEFORE_ORIGINAL_SOCK(htonl, LIBC);
+
+ uret = htonlp(hostlong);
- AFTER_PACK_ORIGINAL_SOCK(uret, 0, 0, FD_API_OTHER, "x", big_endian_64bits);
+ AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
+ NO_DESTINATIONINFO, "", "d", hostlong);
return uret;
}
-uint64_t le64toh(uint64_t little_endian_64bits)
-{
- static uint64_t (*le64tohp)(uint64_t little_endian_64bits);
- uint64_t uret;
-
- BEFORE_ORIGINAL(le64toh, LIBC);
+uint16_t htons(uint16_t hostshort) {
+ static uint16_t (*htonsp)(uint16_t hostshort);
+ uint16_t uret;
- uret = le64tohp(little_endian_64bits);
+ BEFORE_ORIGINAL_SOCK(htons, LIBC);
+
+ uret = htonsp(hostshort);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_le64toh,
- uret, 0, 0, FD_API_OTHER, "x", little_endian_64bits);
+ AFTER_ORIGINAL_LIBC_SOCK(VT_UINT16_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
+ NO_DESTINATIONINFO, "", "d", hostshort);
return uret;
}
-#endif
-#if 1
-int inet_aton(const char *cp, struct in_addr *inp)
-{
+int inet_aton(const char *cp, struct in_addr *inp) {
static int (*inet_atonp)(const char *cp, struct in_addr *inp);
- BEFORE_ORIGINAL(inet_aton, LIBC);
-
- ret = inet_atonp(cp,inp);
+ BEFORE_ORIGINAL_SOCK(inet_aton, LIBC);
+
+ ret = inet_atonp(cp, inp);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pp", cp, inp);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_aton,
- ret, 0, 0, FD_API_OTHER, "pp", cp, inp);
-
return ret;
}
-in_addr_t inet_addr(const char *cp)
-{
+in_addr_t inet_addr(const char *cp) {
static in_addr_t (*inet_addrp)(const char *cp);
in_addr_t iret;
-
- BEFORE_ORIGINAL(inet_addr, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(inet_addr, LIBC);
+
iret = inet_addrp(cp);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_addr,
- iret, 0, 0, FD_API_OTHER, "p", cp);
-
+ AFTER_ORIGINAL_LIBC_SOCK(iret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", cp);
+
return iret;
}
-in_addr_t inet_network(const char *cp)
-{
+in_addr_t inet_network(const char *cp) {
static in_addr_t (*inet_networkp)(const char *cp);
in_addr_t iret;
-
- BEFORE_ORIGINAL(inet_network, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(inet_network, LIBC);
+
iret = inet_networkp(cp);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_network,
- iret, 0, 0, FD_API_OTHER, "p", cp);
+ AFTER_ORIGINAL_LIBC_SOCK(iret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", cp);
return iret;
}
-char *inet_ntoa(struct in_addr in)
-{
+char *inet_ntoa(struct in_addr in) {
static char * (*inet_ntoap)(struct in_addr in);
char* sret;
-
- BEFORE_ORIGINAL(inet_ntoa, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(inet_ntoa, LIBC);
+
sret = inet_ntoap(in);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_ntoa, sret, 0, 0, FD_API_OTHER, "d", in.s_addr);
-
+ AFTER_ORIGINAL_LIBC_SOCK(sret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", in.s_addr);
+
return sret;
}
-#if 0
-struct in_addr inet_makeaddr(int net, int host)
-{
- static struct in_addr (*inet_makeaddrp)(int net, int host);
- struct in_addr iret;
-
- BEFORE_ORIGINAL(inet_makeaddr, LIBC);
-
- iret = inet_makeaddrp(net,host);
+uint32_t ntohl(uint32_t netlong) {
+ static uint32_t (*ntohlp)(uint32_t netlong);
+ uint32_t uret;
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_makeaddr,
- iret.s_addr, 0, 0, FD_API_OTHER,
- "dd", net, host);
+ BEFORE_ORIGINAL_SOCK(ntohl, LIBC);
- return iret;
+ uret = ntohlp(netlong);
+
+ AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
+ NO_DESTINATIONINFO, "", "d", netlong);
+
+ return uret;
}
-#endif
-in_addr_t inet_lnaof(struct in_addr in)
-{
+uint16_t ntohs(uint16_t netshort) {
+ static uint16_t (*ntohsp)(uint16_t netshort);
+ uint16_t uret;
+
+ BEFORE_ORIGINAL_SOCK(ntohs, LIBC);
+
+ uret = ntohsp(netshort);
+
+ AFTER_ORIGINAL_LIBC_SOCK(VT_UINT16_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
+ NO_DESTINATIONINFO, "", "d", netshort);
+
+ return uret;
+}
+
+in_addr_t inet_lnaof(struct in_addr in) {
static in_addr_t (*inet_lnaofp)(struct in_addr in);
in_addr_t iret;
-
- BEFORE_ORIGINAL(inet_lnaof, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(inet_lnaof, LIBC);
+
iret = inet_lnaofp(in);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_lnaof,
- iret, 0, 0, FD_API_OTHER, "d", in.s_addr);
-
+ AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
+ NO_DESTINATIONINFO, "", "d", in.s_addr);
+
return iret;
}
-in_addr_t inet_netof(struct in_addr in)
-{
+in_addr_t inet_netof(struct in_addr in) {
static in_addr_t (*inet_netofp)(struct in_addr in);
in_addr_t iret;
-
- BEFORE_ORIGINAL(inet_netof, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(inet_netof, LIBC);
+
iret = inet_netofp(in);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_netof,
- iret, 0, 0, FD_API_OTHER, "d", in.s_addr);
-
+ AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
+ NO_DESTINATIONINFO, "", "d", in.s_addr);
+
return iret;
}
-const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
-{
- static const char* (*inet_ntopp)(int af, const void *src, char *dst, socklen_t size);
+const char *inet_ntop(int af, const void *src, char *dst, socklen_t size) {
+ static const char* (*inet_ntopp)(int af, const void *src, char *dst,
+ socklen_t size);
const char* cret;
-
- BEFORE_ORIGINAL(inet_ntop, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(inet_ntop, LIBC);
+
cret = inet_ntopp(af, src, dst, size);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_ntop,
- cret, size, 0, FD_API_OTHER,
- "dppd", af, src, dst, size);
-
+ AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dppd", af, src, dst, size);
+
return cret;
}
-int inet_pton(int af, const char *src, void *dst)
-{
+int inet_pton(int af, const char *src, void *dst) {
static int (*inet_ptonp)(int af, const char *src, void *dst);
-
- BEFORE_ORIGINAL(inet_pton, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(inet_pton, LIBC);
+
ret = inet_ptonp(af, src, dst);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_inet_pton,
- ret, 0, 0, FD_API_OTHER, "%dpp", af, src, dst);
-
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dpp", af, src, dst);
+
return ret;
}
-int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
-{
- static int (*getaddrinfop)(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
-
+int getaddrinfo(const char *node, const char *service,
+ const struct addrinfo *hints, struct addrinfo **res) {
+ static int (*getaddrinfop)(const char *node, const char *service,
+ const struct addrinfo *hints, struct addrinfo **res);
+
BEFORE_ORIGINAL_NOFILTER(getaddrinfo, LIBC);
-
+
ret = getaddrinfop(node, service, hints, res);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getaddrinfo,
- ret, 0, 0, FD_API_OTHER, "pppp", node, service, hints, res);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pppp", node, service, hints, res);
return ret;
}
-void freeaddrinfo(struct addrinfo *res)
-{
+void freeaddrinfo(struct addrinfo *res) {
static void (*freeaddrinfop)(struct addrinfo *res);
BEFORE_ORIGINAL_NOFILTER(freeaddrinfo, LIBC);
-
- freeaddrinfop(res);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_freeaddrinfo,
- 0, 0, 0, FD_API_OTHER, "p", res);
+ freeaddrinfop(res);
+
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", res);
}
-const char *gai_strerror(int errcode)
-{
+const char *gai_strerror(int errcode) {
static const char * (*gai_strerrorp)(int errcode);
const char * cret;
-
- BEFORE_ORIGINAL(gai_strerror, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(gai_strerror, LIBC);
+
cret = gai_strerrorp(errcode);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gai_strerror,
- cret, 0, 0, FD_API_OTHER, "d", errcode);
+ AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", errcode);
return cret;
}
-int gai_suspend(const struct gaicb* const list[], int nitems, const struct timespec *timeout)
-{
- static int (*gai_suspendp)(const struct gaicb* const list[], int nitems, const struct timespec *timeout);
+int gai_suspend(const struct gaicb* const list[], int nitems,
+ const struct timespec *timeout) {
+ static int (*gai_suspendp)(const struct gaicb* const list[], int nitems,
+ const struct timespec *timeout);
+
+ BEFORE_ORIGINAL_SOCK(gai_suspend, LIBC);
- BEFORE_ORIGINAL(gai_suspend, LIBC);
-
- ret = gai_suspendp(list,nitems,timeout);
+ ret = gai_suspendp(list, nitems, timeout);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gai_suspend,
- ret, 0, 0, FD_API_OTHER, "pdp", list, nitems, timeout);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pdp", list, nitems, timeout);
return ret;
}
-int gai_error(struct gaicb *req)
-{
+int gai_error(struct gaicb *req) {
static int (*gai_errorp)(struct gaicb *req);
-
- BEFORE_ORIGINAL(gai_error, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(gai_error, LIBC);
+
ret = gai_errorp(req);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gai_error,
- ret, 0, 0, FD_API_OTHER, "p", req);
-
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", req);
+
return ret;
}
-int gai_cancel(struct gaicb *req)
-{
+int gai_cancel(struct gaicb *req) {
static int (*gai_cancelp)(struct gaicb *req);
-
- BEFORE_ORIGINAL(gai_cancel, LIBC);
-
- ret = gai_cancelp(req);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gai_cancel,
- ret, 0, 0, FD_API_OTHER, "p", req);
-
- return ret;
-}
+ BEFORE_ORIGINAL_SOCK(gai_cancel, LIBC);
-int getaddrinfo_a(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp)
-{
- static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp);
-
- BEFORE_ORIGINAL(getaddrinfo_a, LIBC);
-
- ret = getaddrinfo_ap(mode, list,nitems, sevp);
-
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getaddrinfo_a,
- ret, 0, 0, FD_API_OTHER, "dpdp", mode, list, nitems, sevp);
-
- return ret;
-}
-#endif
+ ret = gai_cancelp(req);
-int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
-{
- static int (*getsockoptp)(int socket, int level, int option_name, void *option_value, socklen_t *option_len);
-
- BEFORE_ORIGINAL(getsockopt, LIBC);
-
- ret = getsockoptp(socket, level, option_name, option_value, option_len);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", req);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getsockopt,
- ret, 0, socket, FD_API_OPTION, "dddpp",
- socket, level, option_name, option_value, option_len);
-
return ret;
}
-int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
-{
- static int (*setsockoptp)(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
-
- BEFORE_ORIGINAL(setsockopt, LIBC);
-
- ret = setsockoptp(socket, level, option_name, option_value, option_len);
+int getaddrinfo_a(int mode, struct gaicb *list[], int nitems,
+ struct sigevent *sevp) {
+ static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems,
+ struct sigevent *sevp);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_setsockopt,
- ret, option_len, socket, FD_API_OPTION, "dddpd",
- socket, level, option_name, option_value, option_len);
-
- return ret;
-}
+ BEFORE_ORIGINAL_SOCK(getaddrinfo_a, LIBC);
-#if 1
-int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen )
-{
- static int (*getsocknamep)(int sockfd, struct sockaddr *addr, socklen_t *addrlen );
-
- BEFORE_ORIGINAL(getsockname, LIBC);
-
- ret = getsocknamep(sockfd, addr, addrlen);
+ ret = getaddrinfo_ap(mode, list, nitems, sevp);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getsockname,
- ret, 0, sockfd, FD_API_OTHER, "dpp", sockfd, addr, addrlen);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dpdp", mode, list, nitems, sevp);
return ret;
}
-int getdomainname(char *name, size_t len)
-{
+int getdomainname(char *name, size_t len) {
static int (*getdomainnamep)(char *name, size_t len);
-
- BEFORE_ORIGINAL(getdomainname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getdomainname, LIBC);
+
ret = getdomainnamep(name, len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getdomainname,
- ret, len, 0, FD_API_OTHER, "px", name, len);
+ //AFTER_ORIGINAL_NOSOCK(FD_API_OTHER, "pd", name, len);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pd", name, len);
return ret;
}
-int setdomainname(const char *name, size_t len)
-{
+int setdomainname(const char *name, size_t len) {
static int (*setdomainnamep)(const char *name, size_t len);
-
- BEFORE_ORIGINAL(setdomainname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(setdomainname, LIBC);
+
ret = setdomainnamep(name, len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_setdomainname,
- ret, len, 0, FD_API_OTHER, "px", name, len);
-
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pd", name, len);
+
return ret;
}
-int gethostname(char *name, size_t len)
-{
+int gethostname(char *name, size_t len) {
static int (*gethostnamep)(char *name, size_t len);
-
- BEFORE_ORIGINAL(gethostname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(gethostname, LIBC);
+
ret = gethostnamep(name, len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostname,
- ret, len, 0, FD_API_OTHER, "px", name, len);
-
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pd", name, len);
+
return ret;
}
-int sethostname(const char *name, size_t len)
-{
+int sethostname(const char *name, size_t len) {
static int (*sethostnamep)(const char *name, size_t len);
-
- BEFORE_ORIGINAL(sethostname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(sethostname, LIBC);
+
ret = sethostnamep(name, len);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_sethostname,
- ret, len, 0, FD_API_OTHER, "px", name, len);
-
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pd", name, len);
+
return ret;
}
-int getpeername(int s, struct sockaddr *addr, socklen_t *len)
-{
- static int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len);
+int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags) {
+ static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen,
+ char *host, socklen_t hostlen, char *serv, socklen_t servlen,
+ unsigned int flags);
- BEFORE_ORIGINAL(getpeername, LIBC);
-
- ret = getpeernamep(s, addr, len);
+ BEFORE_ORIGINAL_SOCK(getnameinfo, LIBC);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getpeername,
- ret, 0, s, FD_API_OTHER, "dpp", s, addr, len);
-
- return ret;
-}
+ ret = getnameinfop(sa, salen, host, hostlen, serv, servlen, flags);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pdpdpdd",
+ sa, salen, host, hostlen, serv, servlen, flags);
-#if GCC_VERSION < 40800
-int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags)
-{
- static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags);
-#else
-int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
-{
- static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
-#endif
- BEFORE_ORIGINAL(getnameinfo, LIBC);
-
- ret = getnameinfop(sa, salen,host, hostlen, serv, servlen, flags);
-
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getnameinfo,
- ret, 0, 0, FD_API_OTHER, "pdpdpdd",
- sa, salen, host, hostlen, serv, servlen, flags);
-
return ret;
}
-struct hostent *gethostbyname(const char *name)
-{
+struct hostent *gethostbyname(const char *name) {
static struct hostent * (*gethostbynamep)(const char *name);
struct hostent* pret;
-
- BEFORE_ORIGINAL(gethostbyname, LIBC);
+
+ BEFORE_ORIGINAL_SOCK(gethostbyname, LIBC);
pret = gethostbynamep(name);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostbyname,
- pret, 0, 0, FD_API_OTHER, "p", name);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", name);
return pret;
}
-struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type)
-{
- static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len, int type);
+struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
+ static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len,
+ int type);
struct hostent* pret;
-
- BEFORE_ORIGINAL(gethostbyaddr, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(gethostbyaddr, LIBC);
+
pret = gethostbyaddrp(addr, len, type);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostbyaddr,
- pret, 0, 0, FD_API_OTHER, "pdd", addr, len, type);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pdd", addr, len, type);
return pret;
}
-void sethostent(int stayopen)
-{
+void sethostent(int stayopen) {
static void (*sethostentp)(int stayopen);
- BEFORE_ORIGINAL(sethostent, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(sethostent, LIBC);
+
sethostentp(stayopen);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_sethostent,
- 0, 0, 0, FD_API_OTHER, "d", stayopen);
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", stayopen);
}
-void endhostent(void)
-{
+void endhostent(void) {
static void (*endhostentp)(void);
- BEFORE_ORIGINAL(endhostent, LIBC);
+ BEFORE_ORIGINAL_SOCK(endhostent, LIBC);
endhostentp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_endhostent,
- 0, 0, 0, FD_API_OTHER, "", 0);
+ //AFTER_ORIGINAL_NOSOCK_RET(NULL, 0, FD_API_OTHER, "s", "");
+
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
}
-void herror(const char *s)
-{
+void herror(const char *s) {
static void (*herrorp)(const char *s);
- BEFORE_ORIGINAL(herror, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(herror, LIBC);
+
herrorp(s);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_herror,
- 0, 0, 0, FD_API_OTHER, "p", s);
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", s);
}
-const char *hstrerror(int err)
-{
+const char *hstrerror(int err) {
static const char* (*hstrerrorp)(int err);
const char* cret;
-
- BEFORE_ORIGINAL(hstrerror, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(hstrerror, LIBC);
+
cret = hstrerrorp(err);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_hstrerror,
- cret, 0, 0, FD_API_OTHER, "d", err);
+ AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", err);
return cret;
}
-struct hostent *gethostent(void)
-{
+struct hostent *gethostent(void) {
static struct hostent* (*gethostentp)(void);
struct hostent* pret;
-
- BEFORE_ORIGINAL(gethostent, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(gethostent, LIBC);
+
pret = gethostentp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostent,
- pret, 0, 0, FD_API_OTHER, "", 0);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
return pret;
}
-struct hostent *gethostbyname2(const char *name, int af)
-{
+struct hostent *gethostbyname2(const char *name, int af) {
static struct hostent * (*gethostbyname2p)(const char *name, int af);
struct hostent* pret;
-
- BEFORE_ORIGINAL(gethostbyname2, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(gethostbyname2, LIBC);
+
pret = gethostbyname2p(name, af);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostbyname2,
- pret, 0, 0, FD_API_OTHER, "pd", name, af);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pd", name, af);
return pret;
}
-int gethostent_r(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
-{
- static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
-
- BEFORE_ORIGINAL(gethostent_r, LIBC);
-
+int gethostent_r(struct hostent *rret, char *buf, size_t buflen,
+ struct hostent **result, int *h_errnop) {
+ static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen,
+ struct hostent **result, int *h_errnop);
+
+ BEFORE_ORIGINAL_SOCK(gethostent_r, LIBC);
+
ret = gethostent_rp(rret, buf, buflen, result, h_errnop);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostent_r,
- ret, 0, 0, FD_API_OTHER, "ppxpp",
- rret, buf, buflen, result, h_errnop);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "ppdpp", rret, buf, buflen, result, h_errnop);
return ret;
}
-int gethostbyaddr_r(const void *addr, socklen_t len, int type, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
-{
- static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, int type, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
+int gethostbyaddr_r(const void *addr, socklen_t len, int type,
+ struct hostent *rret, char *buf, size_t buflen, struct hostent **result,
+ int *h_errnop) {
+ static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, int type,
+ struct hostent *rret, char *buf, size_t buflen,
+ struct hostent **result, int *h_errnop);
- BEFORE_ORIGINAL(gethostbyaddr_r, LIBC);
+ BEFORE_ORIGINAL_SOCK(gethostbyaddr_r, LIBC);
- ret = gethostbyaddr_rp(addr, len, type, rret, buf, buflen, result, h_errnop);
+ ret = gethostbyaddr_rp(addr, len, type, rret, buf, buflen, result,
+ h_errnop);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostbyaddr_r,
- ret, 0, 0, FD_API_OTHER, "pddppxpp",
- addr, len, type, rret, buf, buflen, result, h_errnop);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pddppdpp",
+ addr, len, type, rret, buf, buflen, result, h_errnop);
return ret;
}
-int gethostbyname_r(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
-{
- static int (*gethostbyname_rp)(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
-
- BEFORE_ORIGINAL(gethostbyname_r, LIBC);
+int gethostbyname_r(const char *name, struct hostent *rret, char *buf,
+ size_t buflen, struct hostent **result, int *h_errnop) {
+ static int (*gethostbyname_rp)(const char *name, struct hostent *rret,
+ char *buf, size_t buflen, struct hostent **result, int *h_errnop);
+
+ BEFORE_ORIGINAL_SOCK(gethostbyname_r, LIBC);
ret = gethostbyname_rp(name, rret, buf, buflen, result, h_errnop);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostbyname_r,
- ret, 0, 0, FD_API_OTHER, "pppxpp",
- name, rret, buf, buflen, result, h_errnop);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pppdpp",
+ name, rret, buf, buflen, result, h_errnop);
return ret;
}
-int gethostbyname2_r(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
-{
- static int (*gethostbyname2_rp)(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
-
- BEFORE_ORIGINAL(gethostbyname2_r, LIBC);
-
+int gethostbyname2_r(const char *name, int af, struct hostent *rret, char *buf,
+ size_t buflen, struct hostent **result, int *h_errnop) {
+ static int (*gethostbyname2_rp)(const char *name, int af,
+ struct hostent *rret, char *buf, size_t buflen,
+ struct hostent **result, int *h_errnop);
+
+ BEFORE_ORIGINAL_SOCK(gethostbyname2_r, LIBC);
+
ret = gethostbyname2_rp(name, af, rret, buf, buflen, result, h_errnop);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_gethostbyname2_r,
- ret, 0, 0, FD_API_OTHER, "pdppxpp",
- name, af, rret, buf, buflen, result, h_errnop);
-
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pdppdpp",
+ name, af, rret, buf, buflen, result, h_errnop);
+
return ret;
}
-struct servent *getservbyname(const char *name, const char *proto)
-{
- static struct servent * (*getservbynamep)(const char *name, const char *proto);
+struct servent *getservbyname(const char *name, const char *proto) {
+ static struct servent * (*getservbynamep)(const char *name,
+ const char *proto);
struct servent* pret;
-
- BEFORE_ORIGINAL(getservbyname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getservbyname, LIBC);
+
pret = getservbynamep(name, proto);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getservbyname,
- pret, 0, 0, FD_API_OTHER, "pp", name, proto);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pp", name, proto);
return pret;
}
-void setservent(int stayopen)
-{
+void setservent(int stayopen) {
static void (*setserventp)(int stayopen);
- BEFORE_ORIGINAL(setservent, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(setservent, LIBC);
+
setserventp(stayopen);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_setservent,
- 0, 0, 0, FD_API_OTHER, "d", stayopen);
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", stayopen);
}
-void endservent(void)
-{
+void endservent(void) {
static void (*endserventp)(void);
- BEFORE_ORIGINAL(endservent, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(endservent, LIBC);
+
endserventp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_endservent,
- 0, 0, 0, FD_API_OTHER, "", 0);
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
}
-struct servent *getservent(void)
-{
+struct servent *getservent(void) {
static struct servent * (*getserventp)(void);
struct servent* pret;
-
- BEFORE_ORIGINAL(getservent, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getservent, LIBC);
+
pret = getserventp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getservent,
- pret, 0, 0, FD_API_OTHER, "", 0);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
return pret;
}
-struct servent *getservbyport(int port, const char *proto)
-{
+struct servent *getservbyport(int port, const char *proto) {
static struct servent * (*getservbyportp)(int port, const char *proto);
struct servent* pret;
-
- BEFORE_ORIGINAL(getservbyport, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getservbyport, LIBC);
+
pret = getservbyportp(port, proto);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getservbyport,
- pret, 0, 0, FD_API_OTHER, "dp", port, proto);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dp", port, proto);
return pret;
}
-int getservent_r(struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
-{
- static int (*getservent_rp)(struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
-
- BEFORE_ORIGINAL(getservent_r, LIBC);
-
+int getservent_r(struct servent *result_buf, char *buf, size_t buflen,
+ struct servent **result) {
+ static int (*getservent_rp)(struct servent *result_buf, char *buf,
+ size_t buflen, struct servent **result);
+
+ BEFORE_ORIGINAL_SOCK(getservent_r, LIBC);
+
ret = getservent_rp(result_buf, buf, buflen, result);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getservent_r,
- ret, 0, 0, FD_API_OTHER, "ppxp",
- result_buf, buf, buflen, result);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "ppdp", result_buf, buf, buflen, result);
return ret;
}
-int getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
-{
- static int (*getservbyname_rp)(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
-
- BEFORE_ORIGINAL(getservbyname_r, LIBC);
-
+int getservbyname_r(const char *name, const char *proto,
+ struct servent *result_buf, char *buf, size_t buflen,
+ struct servent **result) {
+ static int (*getservbyname_rp)(const char *name, const char *proto,
+ struct servent *result_buf, char *buf, size_t buflen,
+ struct servent **result);
+
+ BEFORE_ORIGINAL_SOCK(getservbyname_r, LIBC);
+
ret = getservbyname_rp(name, proto, result_buf, buf, buflen, result);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getservbyname_r,
- ret, 0, 0, FD_API_OTHER, "ppppxp",
- name, proto, result_buf, buf, buflen, result);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "ppppdp",
+ name, proto, result_buf, buf, buflen, result);
return ret;
}
-int getservbyport_r(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
-{
- static int (*getservbyport_rp)(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
-
- BEFORE_ORIGINAL(getservbyport_r, LIBC);
-
+int getservbyport_r(int port, const char *proto, struct servent *result_buf,
+ char *buf, size_t buflen, struct servent **result) {
+ static int (*getservbyport_rp)(int port, const char *proto,
+ struct servent *result_buf, char *buf, size_t buflen,
+ struct servent **result);
+
+ BEFORE_ORIGINAL_SOCK(getservbyport_r, LIBC);
+
ret = getservbyport_rp(port, proto, result_buf, buf, buflen, result);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getservbyport_r,
- ret, 0, 0, FD_API_OTHER, "dpppxp",
- port, proto, result_buf, buf, buflen, result);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dpppdp",
+ port, proto, result_buf, buf, buflen, result);
return ret;
}
-struct netent* getnetent(void)
-{
+struct netent* getnetent(void) {
static struct netent * (*getnetentp)(void);
struct netent* pret;
-
- BEFORE_ORIGINAL(getnetent, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getnetent, LIBC);
+
pret = getnetentp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getnetent,
- pret, 0, 0, FD_API_OTHER, "", 0);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
return pret;
}
-struct netent *getnetbyname(const char *name)
-{
+struct netent *getnetbyname(const char *name) {
static struct netent * (*getnetbynamep)(const char *name);
struct netent* pret;
-
- BEFORE_ORIGINAL(getnetbyname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getnetbyname, LIBC);
+
pret = getnetbynamep(name);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getnetbyname,
- pret, 0, 0, FD_API_OTHER, "p", name);
-
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", name);
+
return pret;
}
-struct netent *getnetbyaddr(uint32_t net, int type)
-{
+struct netent *getnetbyaddr(uint32_t net, int type) {
static struct netent * (*getnetbyaddrp)(uint32_t net, int type);
struct netent * pret;
-
- BEFORE_ORIGINAL(getnetbyaddr, LIBC);
+
+ BEFORE_ORIGINAL_SOCK(getnetbyaddr, LIBC);
pret = getnetbyaddrp(net, type);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getnetbyaddr,
- pret, 0, 0, FD_API_OTHER, "dd", net, type);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dd", net, type);
return pret;
}
-void setnetent(int stayopen)
-{
+void setnetent(int stayopen) {
static void (*setnetentp)(int stayopen);
- BEFORE_ORIGINAL(setnetent, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(setnetent, LIBC);
+
setnetentp(stayopen);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_setnetent,
- 0, 0, 0, FD_API_OTHER, "d", stayopen);
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", stayopen);
}
-void endnetent(void)
-{
+void endnetent(void) {
static void (*endnetentp)(void);
- BEFORE_ORIGINAL(endnetent, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(endnetent, LIBC);
+
endnetentp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_endnetent,
- 0, 0, 0, FD_API_OTHER, "", 0);
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
}
-int getnetent_r(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
-{
- static int (*getnetent_rp)(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
-
- BEFORE_ORIGINAL(getnetent_r, LIBC);
-
+int getnetent_r(struct netent *result_buf, char *buf, size_t buflen,
+ struct netent **result, int *h_errnop) {
+ static int (*getnetent_rp)(struct netent *result_buf, char *buf,
+ size_t buflen, struct netent **result, int *h_errnop);
+
+ BEFORE_ORIGINAL_SOCK(getnetent_r, LIBC);
+
ret = getnetent_rp(result_buf, buf, buflen, result, h_errnop);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getnetent_r,
- ret, 0, 0, FD_API_OTHER, "ppxpp",
- result_buf, buf, buflen, result, h_errnop);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "ppdpp",
+ result_buf, buf, buflen, result, h_errnop);
return ret;
}
-int getnetbyname_r(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
-{
- static int (*getnetbyname_rp)(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
-
- BEFORE_ORIGINAL(getnetbyname_r, LIBC);
-
- ret = getnetbyname_rp(name,result_buf, buf, buflen, result, h_errnop);
+int getnetbyname_r(const char *name, struct netent *result_buf, char *buf,
+ size_t buflen, struct netent **result, int *h_errnop) {
+ static int (*getnetbyname_rp)(const char *name, struct netent *result_buf,
+ char *buf, size_t buflen, struct netent **result, int *h_errnop);
+
+ BEFORE_ORIGINAL_SOCK(getnetbyname_r, LIBC);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getnetbyname_r,
- ret, 0, 0, FD_API_OTHER, "pppxpp",
- name, result_buf, buf, buflen, result, h_errnop);
+ ret = getnetbyname_rp(name, result_buf, buf, buflen, result, h_errnop);
+
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pppdpp",
+ name, result_buf, buf, buflen, result, h_errnop);
return ret;
}
-int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
-{
- static int (*getnetbyaddr_rp)(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
-
- BEFORE_ORIGINAL(getnetbyaddr_r, LIBC);
-
+int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf,
+ size_t buflen, struct netent **result, int *h_errnop) {
+ static int (*getnetbyaddr_rp)(uint32_t net, int type,
+ struct netent *result_buf, char *buf, size_t buflen,
+ struct netent **result, int *h_errnop);
+
+ BEFORE_ORIGINAL_SOCK(getnetbyaddr_r, LIBC);
+
ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, h_errnop);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getnetbyaddr_r,
- ret, 0, 0, FD_API_OTHER, "ddppxpp",
- net, type, result_buf, buf, buflen, result, h_errnop);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "ddppdpp",
+ net, type, result_buf, buf, buflen, result, h_errnop);
return ret;
}
-struct protoent *getprotoent(void)
-{
+struct protoent *getprotoent(void) {
static struct protoent * (*getprotoentp)(void);
struct protoent * pret;
-
- BEFORE_ORIGINAL(getprotoent, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getprotoent, LIBC);
+
pret = getprotoentp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getprotoent,
- pret, 0, 0, FD_API_OTHER, "", 0);
-
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
+
return pret;
}
-struct protoent *getprotobyname(const char *name)
-{
+struct protoent *getprotobyname(const char *name) {
static struct protoent * (*getprotobynamep)(const char *name);
struct protoent * pret;
-
- BEFORE_ORIGINAL(getprotobyname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getprotobyname, LIBC);
+
pret = getprotobynamep(name);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getprotobyname,
- pret, 0, 0, FD_API_OTHER, "p", name);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", name);
return pret;
}
-struct protoent *getprotobynumber(int proto)
-{
+struct protoent *getprotobynumber(int proto) {
static struct protoent * (*getprotobynumberp)(int proto);
struct protoent * pret;
-
- BEFORE_ORIGINAL(getprotobynumber, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(getprotobynumber, LIBC);
+
pret = getprotobynumberp(proto);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getprotobynumber,
- pret, 0, 0, FD_API_OTHER, "d", proto);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", proto);
return pret;
}
-void setprotoent(int stayopen)
-{
+void setprotoent(int stayopen) {
static void (*setprotoentp)(int stayopen);
- BEFORE_ORIGINAL(setprotoent, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(setprotoent, LIBC);
+
setprotoentp(stayopen);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_setprotoent,
- 0, 0, 0, FD_API_OTHER, "d", stayopen);
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "d", stayopen);
}
-void endprotoent(void)
-{
+void endprotoent(void) {
static void (*endprotoentp)(void);
- BEFORE_ORIGINAL(endprotoent, LIBC);
-
+ BEFORE_ORIGINAL_SOCK(endprotoent, LIBC);
+
endprotoentp();
-
- AFTER_PACK_ORIGINAL_SOCK(API_ID_endprotoent,
- 0, 0, 0, FD_API_OTHER, "", 0);
+
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
}
-int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
-{
- static int (*getprotoent_rp)(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
-
- BEFORE_ORIGINAL(getprotoent_r, LIBC);
-
+int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen,
+ struct protoent **result) {
+ static int (*getprotoent_rp)(struct protoent *result_buf, char *buf,
+ size_t buflen, struct protoent **result);
+
+ BEFORE_ORIGINAL_SOCK(getprotoent_r, LIBC);
+
ret = getprotoent_rp(result_buf, buf, buflen, result);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getprotoent_r,
- ret, 0, 0, FD_API_OTHER, "ppxp",
- result_buf, buf, buflen, result);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "ppdp", result_buf, buf, buflen, result);
return ret;
}
-int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
-{
- static int (*getprotobyname_rp)(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
-
- BEFORE_ORIGINAL(getprotobyname_r, LIBC);
-
+int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf,
+ size_t buflen, struct protoent **result) {
+ static int (*getprotobyname_rp)(const char *name,
+ struct protoent *result_buf, char *buf, size_t buflen,
+ struct protoent **result);
+
+ BEFORE_ORIGINAL_SOCK(getprotobyname_r, LIBC);
+
ret = getprotobyname_rp(name, result_buf, buf, buflen, result);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getprotobyname_r,
- ret, 0, 0, FD_API_OTHER, "pppxp",
- name, result_buf, buf, buflen, result);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "pppdp", name, result_buf, buf, buflen, result);
return ret;
}
-int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
-{
- static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
-
- BEFORE_ORIGINAL(getprotobynumber_r, LIBC);
-
+int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf,
+ size_t buflen, struct protoent **result) {
+ static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf,
+ char *buf, size_t buflen, struct protoent **result);
+
+ BEFORE_ORIGINAL_SOCK(getprotobynumber_r, LIBC);
+
ret = getprotobynumber_rp(proto, result_buf, buf, buflen, result);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getprotobynumber_r,
- ret, 0, 0, FD_API_OTHER, "dppxp",
- proto, result_buf, buf, buflen, result);
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dppdp", proto, result_buf, buf, buflen, result);
return ret;
}
-unsigned int if_nametoindex (__const char *__ifname)
-{
+unsigned int if_nametoindex(__const char *__ifname) {
static unsigned int (*if_nametoindexp)(__const char *__ifname);
unsigned int uret;
-
- BEFORE_ORIGINAL(if_nametoindex, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(if_nametoindex, LIBC);
+
uret = if_nametoindexp(__ifname);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_if_nametoindex,
- uret, 0, 0, FD_API_OTHER, "p", __ifname);
-
+ AFTER_ORIGINAL_LIBC_SOCK(uret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", __ifname);
+
return uret;
}
-char *if_indextoname (unsigned int __ifindex, char *__ifname)
-{
+char *if_indextoname(unsigned int __ifindex, char *__ifname) {
static char * (*if_indextonamep)(unsigned int __ifindex, char *__ifname);
char * cret;
-
- BEFORE_ORIGINAL(if_indextoname, LIBC);
-
+
+ BEFORE_ORIGINAL_SOCK(if_indextoname, LIBC);
+
cret = if_indextonamep(__ifindex, __ifname);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_if_indextoname,
- cret, 0, 0, FD_API_OTHER,
- "dp", __ifindex, __ifname);
+ AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "dp", __ifindex, __ifname);
return cret;
}
-struct if_nameindex *if_nameindex (void)
-{
+struct if_nameindex *if_nameindex(void) {
static struct if_nameindex * (*if_nameindexp)(void);
struct if_nameindex * pret;
-
+
BEFORE_ORIGINAL_NOFILTER(if_nameindex, LIBC);
-
+
pret = if_nameindexp();
- AFTER_PACK_ORIGINAL_SOCK(API_ID_if_nameindex,
- pret, 0, 0, FD_API_OTHER, "", 0);
+ AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "s", "");
return pret;
}
-void if_freenameindex (struct if_nameindex *__ptr)
-{
+void if_freenameindex(struct if_nameindex *__ptr) {
static void (*if_freenameindexp)(struct if_nameindex *__ptr);
BEFORE_ORIGINAL_NOFILTER(if_freenameindex, LIBC);
-
+
if_freenameindexp(__ptr);
-
- AFTER_PACK_ORIGINAL_SOCK(API_ID_if_freenameindex,
- 0, 0, 0, FD_API_OTHER, "p", __ptr);
+
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", __ptr);
}
-int getifaddrs(struct ifaddrs **ifap)
-{
+int getifaddrs(struct ifaddrs **ifap) {
static int (*getifaddrsp)(struct ifaddrs **ifap);
-
+
BEFORE_ORIGINAL_NOFILTER(getifaddrs, LIBC);
-
+
ret = getifaddrsp(ifap);
- AFTER_PACK_ORIGINAL_SOCK(API_ID_getifaddrs,
- ret, 0, 0, FD_API_OTHER, "p", ifap);
-
+ AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", ifap);
+
return ret;
}
-void freeifaddrs(struct ifaddrs *ifa)
-{
+void freeifaddrs(struct ifaddrs *ifa) {
static void (*freeifaddrsp)(struct ifaddrs *ifa);
BEFORE_ORIGINAL_NOFILTER(freeifaddrs, LIBC);
-
+
freeifaddrsp(ifa);
-
- AFTER_PACK_ORIGINAL_SOCK(API_ID_freeifaddrs,
- 0, 0, 0, FD_API_OTHER, "p", ifa);
+
+ AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
+ NO_DESTINATIONINFO, "p", ifa);
}
-#if 0
-int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
+//To do
+
+uint16_t htobe16(uint16_t host_16bits)
{
- static int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout);
-
- BEFORE_ORIGINAL(poll, LIBC);
-
- ret = pollp(ufds, nfds, timeout);
+ static uint16_t (*htobe16p)(uint16_t host_16bits);
+ uint16_t uret;
- AFTER_PACK_ORIGINAL_SOCK(ret, timeout, 0, FD_API_OTHER, "pdd", ufds, nfds, timeout);
+ BEFORE_ORIGINAL_SOCK(htobe16, LIBC);
- return ret;
+ uret = htobe16p(host_16bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "d", host_16bits);
+
+ return uret;
}
-int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask)
+uint16_t htole16(uint16_t host_16bits)
{
- static int (*ppollp)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask);
-
- BEFORE_ORIGINAL(ppoll, LIBC);
-
- ret = ppollp(fds, nfds, timeout_ts, sigmask);
+ static uint16_t (*htole16p)(uint16_t host_16bits);
+ uint16_t uret;
- AFTER_PACK_ORIGINAL_SOCK(ret, 0, 0, FD_API_OTHER, "pxpp",
- fds, nfds, timeout_ts, sigmask);
+ BEFORE_ORIGINAL_SOCK(htole16, LIBC);
- return ret;
+ uret = htole16p(host_16bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "d", host_16bits);
+
+ return uret;
+}
+
+uint16_t be16toh(uint16_t big_endian_16bits)
+{
+ static uint16_t (*be16tohp)(uint16_t big_endian_16bits);
+ uint16_t uret;
+
+ BEFORE_ORIGINAL_SOCK(be16toh, LIBC);
+
+ uret = be16tohp(big_endian_16bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
+ "d", big_endian_16bits);
+
+ return uret;
+}
+
+uint16_t le16toh(uint16_t little_endian_16bits)
+{
+ static uint16_t (*le16tohp)(uint16_t little_endian_16bits);
+ uint16_t uret;
+
+ BEFORE_ORIGINAL_SOCK(le16toh, LIBC);
+
+ uret = le16tohp(little_endian_16bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
+ "d", little_endian_16bits);
+
+ return uret;
+}
+
+uint32_t htobe32(uint32_t host_32bits)
+{
+ static uint32_t (*htobe32p)(uint32_t host_32bits);
+ uint32_t uret;
+
+ BEFORE_ORIGINAL_SOCK(htobe32, LIBC);
+
+ uret = htobe32p(host_32bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+ "d", host_32bits);
+
+ return uret;
+}
+
+uint32_t htole32(uint32_t host_32bits)
+{
+ static uint32_t (*htole32p)(uint32_t host_32bits);
+ uint32_t uret;
+
+ BEFORE_ORIGINAL_SOCK(htole32, LIBC);
+
+ uret = htole32p(host_32bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+ "d", host_32bits);
+
+ return uret;
+}
+
+uint32_t be32toh(uint32_t big_endian_32bits)
+{
+ static uint32_t (*be32tohp)(uint32_t big_endian_32bits);
+ uint32_t uret;
+
+ BEFORE_ORIGINAL_SOCK(be32toh, LIBC);
+
+ uret = be32tohp(big_endian_32bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+ "d", big_endian_32bits);
+
+ return uret;
+}
+
+uint32_t le32toh(uint32_t little_endian_32bits)
+{
+ static uint32_t (*le32tohp)(uint32_t little_endian_32bits);
+ uint32_t uret;
+
+ BEFORE_ORIGINAL_SOCK(le32toh, LIBC);
+
+ uret = le32tohp(little_endian_32bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
+ "d", little_endian_32bits);
+
+ return uret;
+}
+
+uint64_t htobe64(uint64_t host_64bits)
+{
+ static uint64_t (*htobe64p)(uint64_t host_64bits);
+ uint64_t uret;
+
+ BEFORE_ORIGINAL_SOCK(htobe64, LIBC);
+
+ uret = htobe64p(host_64bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+ "d", host_64bits);
+
+ return uret;
+}
+
+uint64_t htole64(uint64_t host_64bits)
+{
+ static uint64_t (*htole64p)(uint64_t host_64bits);
+ uint64_t uret;
+
+ BEFORE_ORIGINAL_SOCK(htole64, LIBC);
+
+ uret = htole64p(host_64bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+ "d", host_64bits);
+
+ return uret;
+}
+
+uint64_t be64toh(uint64_t big_endian_64bits)
+{
+ static uint64_t (*be64tohp)(uint64_t big_endian_64bits);
+ uint64_t uret;
+
+ BEFORE_ORIGINAL_SOCK(be64toh, LIBC);
+
+ uret = be64tohp(big_endian_64bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+ "d", big_endian_64bits);
+
+ return uret;
+}
+
+uint64_t le64toh(uint64_t little_endian_64bits)
+{
+ static uint64_t (*le64tohp)(uint64_t little_endian_64bits);
+ uint64_t uret;
+
+ BEFORE_ORIGINAL_SOCK(le64toh, LIBC);
+
+ uret = le64tohp(little_endian_64bits);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
+ "d", little_endian_64bits);
+
+ return uret;
+}
+
+struct in_addr inet_makeaddr(int net, int host)
+{
+ static struct in_addr (*inet_makeaddrp)(int net, int host);
+ struct in_addr iret;
+
+ BEFORE_ORIGINAL_SOCK(inet_makeaddr, LIBC);
+
+ iret = inet_makeaddrp(net,host);
+
+ AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret.s_addr, 0, FD_API_OTHER,
+ "dd", net, host);
+
+ return iret;
}
-#endif
#endif