• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDECore

syssocket.h

Go to the documentation of this file.
00001 /*  -*- C++ -*-
00002  *  Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
00003  *
00004  *
00005  *  Permission is hereby granted, free of charge, to any person obtaining
00006  *  a copy of this software and associated documentation files (the
00007  *  "Software"), to deal in the Software without restriction, including
00008  *  without limitation the rights to use, copy, modify, merge, publish,
00009  *  distribute, sublicense, and/or sell copies of the Software, and to
00010  *  permit persons to whom the Software is furnished to do so, subject to
00011  *  the following conditions:
00012  *
00013  *  The above copyright notice and this permission notice shall be included
00014  *  in all copies or substantial portions of the Software.
00015  *
00016  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00017  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00018  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00019  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00020  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00021  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00022  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 #ifndef KDE_SYSSOCKET_H
00026 #define KDE_SYSSOCKET_H
00027 
00028 #ifdef KSOCKETBASE_H
00029 #error syssocket.h must be included before ksocketbase.h!
00030 #endif
00031 
00032 #include <sys/types.h>
00033 #include <sys/socket.h>
00034 
00035 namespace {
00036 
00037   /*
00038    * These function here are just wrappers for the real system calls.
00039    *
00040    * Unfortunately, a number of systems out there work by redefining
00041    * symbols through the preprocessor -- symbols that we need.
00042    *
00043    * So we write wrappers for all the low-level system calls.
00044    *
00045    * Qt has a very similar implementation. I got the idea from them, but
00046    * I copied no code.
00047    */
00048   
00049   // socket
00050   inline int kde_socket(int af, int style, int protocol)
00051   {
00052     return ::socket(af, style, protocol);
00053   }
00054 
00055   // bind
00056   inline int kde_bind(int fd, const struct sockaddr* sa, socklen_t len)
00057   {
00058     return ::bind(fd, sa, len);
00059   }
00060 
00061   // listen
00062   inline int kde_listen(int fd, int backlog)
00063   {
00064     return ::listen(fd, backlog);
00065   }
00066 
00067   // connect
00068   inline int kde_connect(int fd, const struct sockaddr* sa, socklen_t len)
00069   {
00070     return ::connect(fd, (struct sockaddr*)sa, len);
00071   }
00072 
00073   // accept
00074   inline int kde_accept(int fd, struct sockaddr* sa, socklen_t* len)
00075   {
00076     return ::accept(fd, sa, len);
00077   }
00078 
00079   // getpeername
00080   inline int kde_getpeername(int fd, struct sockaddr* sa, socklen_t* len)
00081   {
00082     return ::getpeername(fd, sa, len);
00083   }
00084 
00085   // getsockname
00086   inline int kde_getsockname(int fd, struct sockaddr* sa, socklen_t* len)
00087   {
00088     return ::getsockname(fd, sa, len);
00089   }
00090 
00091 } // anonymous namespace
00092 
00093 #endif

KDECore

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal