# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KUnixSocketAddress Class Reference

A Unix socket address a Unix socket address. More...

`#include <ksockaddr.h>`

Inheritance diagram for KUnixSocketAddress:

[legend]
Collaboration diagram for KUnixSocketAddress:

[legend]
List of all members.

## Public Member Functions

| KUnixSocketAddress ()
| Default constructor.
| KUnixSocketAddress (const sockaddr_un *raw_data, ksocklen_t size)
| Constructor from raw data.
| KUnixSocketAddress (QCString pathname)
| Constructor from pathname.
virtual | ~KUnixSocketAddress ()
| Destructor.
bool | setAddress (const sockaddr_un *socket_address, ksocklen_t size)
| Sets this to given sockaddr_un.
bool | setAddress (QCString path)
| Sets this to given pathname.
QCString | pathname () const
| Returns the pathname.
virtual QString | pretty () const
| Returns pretty representation of this socket.
virtual QString | serviceName () const
| Returns the service name for this socket, as KExtendedSocket::lookup expects as the service argument.
const sockaddr_un * | address () const
| Returns raw socket address.
| operator const sockaddr_un * () const
| Returns raw socket address.

## Static Public Member Functions

bool | areEqualUnix (const KSocketAddress &s1, const KSocketAddress &s2, bool coreOnly)
| Compares two unix socket addresses.

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)

## Friends

class | KExtendedSocket

## Detailed Description

A Unix socket address a Unix socket address.

This is a Unix socket address.

This class expects QCString instead of QString values, which means the filenames should be encoded in whatever form locale/system deems necessary before passing down to the function

Author:
  Thiago Macieira <thiagom@mail.com>

Version:
  Id
    ksockaddr.h,v 1.15 2002/09/09 21:11:35 tjansen Exp

Definition at line 588 of file ksockaddr.h.

## Constructor & Destructor Documentation

KUnixSocketAddress::KUnixSocketAddress | ( |  | ) |

| Default constructor. Definition at line 741 of file ksockaddr.cpp.

KUnixSocketAddress::KUnixSocketAddress | ( | const sockaddr_un * | raw_data,
|  | ksocklen_t | size
| ) |

Constructor from raw data.

Parameters:

  raw_data | raw data
  size | data length

Definition at line 746 of file ksockaddr.cpp.

References setAddress(), and KSocketAddress::size().

KUnixSocketAddress::KUnixSocketAddress | ( | QCString | pathname | ) |

Constructor from pathname.

Parameters:

  path | pathname

Definition at line 752 of file ksockaddr.cpp.

References pathname(), and setAddress().

KUnixSocketAddress::~KUnixSocketAddress | ( |  | ) | `[virtual]`

| Destructor. Definition at line 758 of file ksockaddr.cpp.

## Member Function Documentation

bool KUnixSocketAddress::setAddress | ( | const sockaddr_un * | socket_address,
|  | ksocklen_t | size
| ) |

Sets this to given sockaddr_un.

Parameters:

  socket_address | socket address
  size | the socket length

Returns:
  true if successful, false otherwise

Definition at line 763 of file ksockaddr.cpp.

Referenced by KUnixSocketAddress().

bool KUnixSocketAddress::setAddress | ( | QCString | path | ) |

Sets this to given pathname.

Parameters:

  path | pathname

Returns:
  true if successful, false otherwise

Definition at line 802 of file ksockaddr.cpp.

References QCString::length().

QCString KUnixSocketAddress::pathname | ( |  | ) | const

Returns the pathname.

Returns:
  the pathname, can be QCString::null if uninitialized, or "" if unknown

Definition at line 838 of file ksockaddr.cpp.

Referenced by KUnixSocketAddress(), pretty(), and serviceName().

QString KUnixSocketAddress::pretty | ( |  | ) | const`[virtual]`

Returns pretty representation of this socket.

Returns:
  a pretty text representation of the socket.

Reimplemented from KSocketAddress.

Definition at line 849 of file ksockaddr.cpp.

References QFile::decodeName(), QCString::isEmpty(), and pathname().

QString KUnixSocketAddress::serviceName | ( |  | ) | const`[virtual]`

Returns the service name for this socket, as KExtendedSocket::lookup expects as the service argument.

In the case of Internet sockets, this is the port number. The default implementation returns QString::null.

Returns:
  the service name, can be QString::null

Reimplemented from KSocketAddress.

Definition at line 857 of file ksockaddr.cpp.

References QString::fromUtf8(), and pathname().

const sockaddr_un * KUnixSocketAddress::address | ( |  | ) | const

Returns raw socket address.

Returns:
  the raw socket address (can be 0 if uninitialized)

Reimplemented from KSocketAddress.

Definition at line 862 of file ksockaddr.cpp.

Referenced by operator const sockaddr_un *().

KUnixSocketAddress::operator const sockaddr_un * | ( |  | ) | const`[inline]`

Returns raw socket address.

Returns:
  the raw socket address (can be 0 if uninitialized)

See also:
  address()

Definition at line 662 of file ksockaddr.h.

References address().

bool KUnixSocketAddress::areEqualUnix | ( | const KSocketAddress & | s1,
|  | const KSocketAddress & | s2,
|  | bool | coreOnly
| ) | `[static]`

Compares two unix socket addresses.

Parameters:

  s1 | the first address to compare
  s2 | the second address to compare
  coreOnly | true if only core parts should be compared (currently unused)

Returns:
  true if the given addresses are equal.

See also:
  KSocketAddress::isEqual()

  KSocketAddress::isCoreEqual()

Definition at line 867 of file ksockaddr.cpp.

References KSocketAddress::address(), KSocketAddress::family(), and KSocketAddress::size().

Referenced by KSocketAddress::isCoreEqual(), and KSocketAddress::isEqual().

The documentation for this class was generated from the following files:

- ksockaddr.h
- ksockaddr.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:51:49 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001