#include "qplatformdefs.h"
#include "qnativesocketengine_p.h"
#include "qiodevice.h"
#include "qhostaddress.h"
#include "qvarlengtharray.h"
#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <net/if.h>
Include dependency graph for qnativesocketengine_unix.cpp:

Go to the source code of this file.
Defines | |
| #define | QT_SOCKOPTLEN_T QT_SOCKLEN_T |
Functions | |
| static int | qt_socket_accept (int s, struct sockaddr *addr, QT_SOCKLEN_T *addrlen) |
| static int | qt_socket_listen (int s, int backlog) |
| static int | qt_socket_socket (int domain, int type, int protocol) |
| static void | qt_ignore_sigpipe () |
| static void | qt_socket_getPortAndAddress (struct sockaddr *sa, quint16 *port, QHostAddress *addr) |
| #define QT_SOCKOPTLEN_T QT_SOCKLEN_T |
Definition at line 78 of file qnativesocketengine_unix.cpp.
| static void qt_ignore_sigpipe | ( | ) | [static] |
Definition at line 102 of file qnativesocketengine_unix.cpp.
References Q_ATOMIC_INIT, and QBasicAtomic::testAndSet().
00103 { 00104 // Set to ignore SIGPIPE once only. 00105 static QBasicAtomic atom = Q_ATOMIC_INIT(0); 00106 if (atom.testAndSet(0, 1)) { 00107 struct sigaction noaction; 00108 memset(&noaction, 0, sizeof(noaction)); 00109 noaction.sa_handler = SIG_IGN; 00110 ::sigaction(SIGPIPE, &noaction, 0); 00111 } 00112 }
Here is the call graph for this function:

| static int qt_socket_accept | ( | int | s, | |
| struct sockaddr * | addr, | |||
| QT_SOCKLEN_T * | addrlen | |||
| ) | [inline, static] |
Definition at line 82 of file qnativesocketengine_unix.cpp.
Referenced by Q3SocketDevice::accept(), and QNativeSocketEnginePrivate::nativeAccept().
00083 { return ::accept(s, addr, static_cast<QT_SOCKLEN_T *>(addrlen)); }
| static void qt_socket_getPortAndAddress | ( | struct sockaddr * | sa, | |
| quint16 * | port, | |||
| QHostAddress * | addr | |||
| ) | [inline, static] |
Definition at line 118 of file qnativesocketengine_unix.cpp.
References QString::number(), QHostAddress::setAddress(), and QHostAddress::setScopeId().
Referenced by QNativeSocketEnginePrivate::fetchConnectionParameters(), and QNativeSocketEnginePrivate::nativeReceiveDatagram().
00119 { 00120 #if !defined(QT_NO_IPV6) 00121 if (sa->sa_family == AF_INET6) { 00122 struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; 00123 Q_IPV6ADDR tmp; 00124 memcpy(&tmp, &sa6->sin6_addr.s6_addr, sizeof(tmp)); 00125 if (addr) { 00126 QHostAddress tmpAddress; 00127 tmpAddress.setAddress(tmp); 00128 *addr = tmpAddress; 00129 #ifndef QT_NO_IPV6IFNAME 00130 char scopeid[IFNAMSIZ]; 00131 if (::if_indextoname(sa6->sin6_scope_id, scopeid) > 0) { 00132 addr->setScopeId(QLatin1String(scopeid)); 00133 } else 00134 #endif 00135 addr->setScopeId(QString::number(sa6->sin6_scope_id)); 00136 } 00137 if (port) 00138 *port = ntohs(sa6->sin6_port); 00139 return; 00140 } 00141 #endif 00142 struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; 00143 if (port) 00144 *port = ntohs(sa4->sin_port); 00145 if (addr) { 00146 QHostAddress tmpAddress; 00147 tmpAddress.setAddress(ntohl(sa4->sin_addr.s_addr)); 00148 *addr = tmpAddress; 00149 } 00150 }
Here is the call graph for this function:

| static int qt_socket_listen | ( | int | s, | |
| int | backlog | |||
| ) | [inline, static] |
Definition at line 89 of file qnativesocketengine_unix.cpp.
Referenced by Q3SocketDevice::listen(), and QNativeSocketEnginePrivate::nativeListen().
00090 { return ::listen(s, backlog); }
| static int qt_socket_socket | ( | int | domain, | |
| int | type, | |||
| int | protocol | |||
| ) | [inline, static] |
Definition at line 96 of file qnativesocketengine_unix.cpp.
Referenced by Q3SocketDevice::createNewSocket(), and QNativeSocketEnginePrivate::createNewSocket().
00097 { return ::socket(domain, type, protocol); }
1.5.1