• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
  • network
syssocket.h
1 /*
2  * Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
3  *
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef KDE_SYSSOCKET_H
26 #define KDE_SYSSOCKET_H
27 
28 #ifdef TDESOCKETBASE_H
29 #error syssocket.h must be included before tdesocketbase.h!
30 #endif
31 
32 #include <sys/types.h>
33 #include <sys/socket.h>
34 
35 namespace {
36 
37  /*
38  * These function here are just wrappers for the real system calls.
39  *
40  * Unfortunately, a number of systems out there work by redefining
41  * symbols through the preprocessor -- symbols that we need.
42  *
43  * So we write wrappers for all the low-level system calls.
44  *
45  * Qt has a very similar implementation. I got the idea from them, but
46  * I copied no code.
47  */
48 
49  // socket
50  inline int kde_socket(int af, int style, int protocol)
51  {
52  return ::socket(af, style, protocol);
53  }
54 
55  // bind
56  inline int kde_bind(int fd, const struct sockaddr* sa, socklen_t len)
57  {
58  return ::bind(fd, sa, len);
59  }
60 
61  // listen
62  inline int kde_listen(int fd, int backlog)
63  {
64  return ::listen(fd, backlog);
65  }
66 
67  // connect
68  inline int kde_connect(int fd, const struct sockaddr* sa, socklen_t len)
69  {
70  return ::connect(fd, (struct sockaddr*)sa, len);
71  }
72 
73  // accept
74  inline int kde_accept(int fd, struct sockaddr* sa, socklen_t* len)
75  {
76  return ::accept(fd, sa, len);
77  }
78 
79  // getpeername
80  inline int kde_getpeername(int fd, struct sockaddr* sa, socklen_t* len)
81  {
82  return ::getpeername(fd, sa, len);
83  }
84 
85  // getsockname
86  inline int kde_getsockname(int fd, struct sockaddr* sa, socklen_t* len)
87  {
88  return ::getsockname(fd, sa, len);
89  }
90 
91 } // anonymous namespace
92 
93 #endif

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.