Qt 4.8
Public Types | Public Functions | Public Variables | List of all members
QUnixSocketMessagePrivate Struct Reference
Inheritance diagram for QUnixSocketMessagePrivate:
QSharedData

Public Types

enum  AncillaryDataState { Default = 0x00, Truncated = 0x01, Credential = 0x02 }
 

Public Functions

 QUnixSocketMessagePrivate ()
 
 QUnixSocketMessagePrivate (const QByteArray &b)
 
 QUnixSocketMessagePrivate (const QByteArray &b, const QList< QUnixSocketRights > &r)
 
void removeBytes (unsigned int)
 
int size () const
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Public Variables

QByteArray bytes
 
int dataSize
 
gid_t gid
 
int iovecLen
 
pid_t pid
 
QList< QUnixSocketRightsrights
 
AncillaryDataState state
 
uid_t uid
 
::iovec * vec
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Definition at line 274 of file qunixsocket.cpp.

Enumerations

◆ AncillaryDataState

Enumerator
Default 
Truncated 
Credential 

Definition at line 290 of file qunixsocket.cpp.

Constructors and Destructors

◆ QUnixSocketMessagePrivate() [1/3]

QUnixSocketMessagePrivate::QUnixSocketMessagePrivate ( )
inline

◆ QUnixSocketMessagePrivate() [2/3]

QUnixSocketMessagePrivate::QUnixSocketMessagePrivate ( const QByteArray b)
inline

◆ QUnixSocketMessagePrivate() [3/3]

QUnixSocketMessagePrivate::QUnixSocketMessagePrivate ( const QByteArray b,
const QList< QUnixSocketRights > &  r 
)
inline

Functions

◆ removeBytes()

void QUnixSocketMessagePrivate::removeBytes ( unsigned int  bytesToDequeue)
Warning
This function is not part of the public interface. Remove bytesToDequeue bytes from the front of this message

Definition at line 310 of file qunixsocket.cpp.

Referenced by QUnixSocketPrivate::writeActivated().

311 {
312  if ( vec )
313  {
314  ::iovec *vecPtr = vec;
315  if ( bytesToDequeue > (unsigned int)dataSize ) bytesToDequeue = dataSize;
316  while ( bytesToDequeue > 0 && iovecLen > 0 )
317  {
318  if ( vecPtr->iov_len > bytesToDequeue )
319  {
320  // dequeue the bytes by taking them off the front of the
321  // current vector. since we don't own the iovec, its okay
322  // to "leak" this away by pointing past it
323  char **base = reinterpret_cast<char**>(&(vecPtr->iov_base));
324  *base += bytesToDequeue;
325  vecPtr->iov_len -= bytesToDequeue;
326  bytesToDequeue = 0;
327  }
328  else
329  {
330  // dequeue bytes by skipping a whole vector. again, its ok
331  // to lose the pointers to this data
332  bytesToDequeue -= vecPtr->iov_len;
333  iovecLen--;
334  vecPtr++;
335  }
336  }
337  dataSize -= bytesToDequeue;
338  if ( iovecLen == 0 ) vec = 0;
339  }
340  else
341  {
342  bytes.remove(0, bytesToDequeue );
343  }
344 }
static const uint base
Definition: qurl.cpp:268
QByteArray & remove(int index, int len)
Removes len bytes from the array, starting at index position pos, and returns a reference to the arra...

◆ size()

int QUnixSocketMessagePrivate::size ( ) const
inline

Definition at line 284 of file qunixsocket.cpp.

Referenced by QUnixSocket::write(), and QUnixSocketPrivate::writeActivated().

284 { return vec ? dataSize : bytes.size(); }
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402

Properties

◆ bytes

QByteArray QUnixSocketMessagePrivate::bytes

◆ dataSize

int QUnixSocketMessagePrivate::dataSize

Definition at line 303 of file qunixsocket.cpp.

Referenced by QUnixSocketMessage::QUnixSocketMessage().

◆ gid

gid_t QUnixSocketMessagePrivate::gid

◆ iovecLen

int QUnixSocketMessagePrivate::iovecLen

◆ pid

pid_t QUnixSocketMessagePrivate::pid

◆ rights

QList<QUnixSocketRights> QUnixSocketMessagePrivate::rights

◆ state

AncillaryDataState QUnixSocketMessagePrivate::state

◆ uid

uid_t QUnixSocketMessagePrivate::uid

◆ vec

::iovec* QUnixSocketMessagePrivate::vec

The documentation for this struct was generated from the following file: