summaryrefslogtreecommitdiff
path: root/ext/socket/rubysocket.h
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-15 22:53:59 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-15 22:53:59 +0000
commit35f8072e5c9a17d364f88df72f0751f894689931 (patch)
treeed829af59d7243ada98161c02cac18d820d8043d /ext/socket/rubysocket.h
parentcb31e783798438420e33a84a8bfe66acafaa7c4a (diff)
preprocessor directives indented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/rubysocket.h')
-rw-r--r--ext/socket/rubysocket.h144
1 files changed, 74 insertions, 70 deletions
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index 28d50d1..ea225b8 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -11,79 +11,81 @@
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
#endif
#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
+# include <sys/uio.h>
#endif
#ifdef HAVE_XTI_H
-#include <xti.h>
+# include <xti.h>
#endif
#ifndef _WIN32
-#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
-# include <net/socket.h>
-#else
-# include <sys/socket.h>
-#endif
-#include <netinet/in.h>
-#ifdef HAVE_NETINET_IN_SYSTM_H
-# include <netinet/in_systm.h>
-#endif
-#ifdef HAVE_NETINET_TCP_H
-# include <netinet/tcp.h>
-#endif
-#ifdef HAVE_NETINET_UDP_H
-# include <netinet/udp.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
-#include <netdb.h>
+# if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
+# include <net/socket.h>
+# else
+# include <sys/socket.h>
+# endif
+# include <netinet/in.h>
+# ifdef HAVE_NETINET_IN_SYSTM_H
+# include <netinet/in_systm.h>
+# endif
+# ifdef HAVE_NETINET_TCP_H
+# include <netinet/tcp.h>
+# endif
+# ifdef HAVE_NETINET_UDP_H
+# include <netinet/udp.h>
+# endif
+# ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+# endif
+# include <netdb.h>
#endif
+
#include <errno.h>
+
#ifdef HAVE_SYS_UN_H
-#include <sys/un.h>
+# include <sys/un.h>
#endif
#if defined(HAVE_FCNTL)
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
+# ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
+# ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+# endif
#endif
#ifdef HAVE_IFADDRS_H
-#include <ifaddrs.h>
+# include <ifaddrs.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
+# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>
+# include <sys/sockio.h>
#endif
#ifdef HAVE_NET_IF_H
-#include <net/if.h>
+# include <net/if.h>
#endif
#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
+# include <sys/param.h>
#endif
#ifdef HAVE_SYS_UCRED_H
-#include <sys/ucred.h>
+# include <sys/ucred.h>
#endif
#ifdef HAVE_UCRED_H
-#include <ucred.h>
+# include <ucred.h>
#endif
#ifndef HAVE_TYPE_SOCKLEN_T
@@ -91,7 +93,7 @@ typedef int socklen_t;
#endif
#ifndef EWOULDBLOCK
-#define EWOULDBLOCK EAGAIN
+# define EWOULDBLOCK EAGAIN
#endif
/*
@@ -104,44 +106,45 @@ typedef int socklen_t;
#define pseudo_AF_FTIP pseudo_AF_RTIP
#ifndef HAVE_GETADDRINFO
-#include "addrinfo.h"
+# include "addrinfo.h"
#endif
+
#include "sockport.h"
#ifndef NI_MAXHOST
-# define NI_MAXHOST 1025
+# define NI_MAXHOST 1025
#endif
#ifndef NI_MAXSERV
-# define NI_MAXSERV 32
+# define NI_MAXSERV 32
#endif
#ifdef AF_INET6
-# define IS_IP_FAMILY(af) ((af) == AF_INET || (af) == AF_INET6)
+# define IS_IP_FAMILY(af) ((af) == AF_INET || (af) == AF_INET6)
#else
-# define IS_IP_FAMILY(af) ((af) == AF_INET)
+# define IS_IP_FAMILY(af) ((af) == AF_INET)
#endif
#ifndef IN6_IS_ADDR_UNIQUE_LOCAL
-# define IN6_IS_ADDR_UNIQUE_LOCAL(a) (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
+# define IN6_IS_ADDR_UNIQUE_LOCAL(a) (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
#endif
#ifndef HAVE_TYPE_STRUCT_SOCKADDR_STORAGE
/*
* RFC 2553: protocol-independent placeholder for socket addresses
*/
-#define _SS_MAXSIZE 128
-#define _SS_ALIGNSIZE (sizeof(double))
-#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
-#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
+# define _SS_MAXSIZE 128
+# define _SS_ALIGNSIZE (sizeof(double))
+# define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
+# define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
_SS_PAD1SIZE - _SS_ALIGNSIZE)
struct sockaddr_storage {
-#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
unsigned char ss_len; /* address length */
unsigned char ss_family; /* address family */
-#else
+# else
unsigned short ss_family;
-#endif
+# endif
char __ss_pad1[_SS_PAD1SIZE];
double __ss_align; /* force desired structure storage alignment */
char __ss_pad2[_SS_PAD2SIZE];
@@ -154,22 +157,22 @@ struct sockaddr_storage {
* aligns up to __darwin_size_t which is 64bit, but CMSG_DATA is
* 32bit-aligned.
*/
-#undef __DARWIN_ALIGNBYTES
-#define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1)
+# undef __DARWIN_ALIGNBYTES
+# define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1)
#endif
#if defined(_AIX)
-#ifndef CMSG_SPACE
-# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
-#endif
-#ifndef CMSG_LEN
-# define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
-#endif
+# ifndef CMSG_SPACE
+# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
+# endif
+# ifndef CMSG_LEN
+# define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+# endif
#endif
#ifdef __BEOS__
-#undef close
-#define close closesocket
+# undef close
+# define close closesocket
#endif
#define INET_CLIENT 0
@@ -196,12 +199,12 @@ extern VALUE rb_eSocket;
#ifdef SOCKS
extern VALUE rb_cSOCKSSocket;
-#ifdef SOCKS5
-#include <socks.h>
-#else
+# ifdef SOCKS5
+# include <socks.h>
+# else
void SOCKSinit();
int Rconnect();
-#endif
+# endif
#endif
#include "constdefs.h"
@@ -289,6 +292,7 @@ VALUE rsock_bsock_sendmsg_nonblock(int argc, VALUE *argv, VALUE sock);
#define rsock_bsock_sendmsg rb_f_notimplement
#define rsock_bsock_sendmsg_nonblock rb_f_notimplement
#endif
+
#if defined(HAVE_RECVMSG)
VALUE rsock_bsock_recvmsg(int argc, VALUE *argv, VALUE sock);
VALUE rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock);