Qt 4.8
Classes | Macros | Functions
qwscommand_qws_p.h File Reference
#include <QtCore/qbytearray.h>
#include <QtGui/qwsutils_qws.h>
#include <QtGui/qfont.h>
#include <QtCore/qdatastream.h>
#include <QtCore/qvariant.h>
#include <QtCore/qrect.h>
#include <QtGui/qregion.h>
#include <QtCore/qvector.h>
#include <QtCore/qvarlengtharray.h>
#include <QtGui/qwsevent_qws.h>
#include "qwsprotocolitem_qws.h"

Go to the source code of this file.

Classes

struct  QWSAddPropertyCommand
 
struct  QWSAddPropertyCommand::SimpleData
 
struct  QWSChangeAltitudeCommand
 
struct  QWSChangeAltitudeCommand::SimpleData
 
struct  QWSCommand
 
struct  QWSConvertSelectionCommand
 
struct  QWSConvertSelectionCommand::SimpleData
 
struct  QWSCreateCommand
 
struct  QWSDefineCursorCommand
 
struct  QWSDefineCursorCommand::SimpleData
 
struct  QWSEmbedCommand
 
struct  QWSFontCommand
 
struct  QWSFontCommand::SimpleData
 
struct  QWSGetPropertyCommand
 
struct  QWSGetPropertyCommand::SimpleData
 
struct  QWSGrabKeyboardCommand
 
struct  QWSGrabKeyboardCommand::SimpleData
 
struct  QWSGrabMouseCommand
 
struct  QWSGrabMouseCommand::SimpleData
 
struct  QWSIdentifyCommand
 
struct  QWSIdentifyCommand::SimpleData
 
struct  QWSIMMouseCommand
 
struct  QWSIMMouseCommand::SimpleData
 
struct  QWSIMResponseCommand
 
struct  QWSIMResponseCommand::SimpleData
 
struct  QWSIMUpdateCommand
 
struct  QWSIMUpdateCommand::SimpleData
 
struct  QWSPlaySoundCommand
 
struct  QWSPlaySoundCommand::SimpleData
 
struct  QWSPositionCursorCommand
 
struct  QWSPositionCursorCommand::SimpleData
 
struct  QWSQCopRegisterChannelCommand
 
struct  QWSQCopRegisterChannelCommand::SimpleData
 
struct  QWSQCopSendCommand
 
struct  QWSQCopSendCommand::SimpleData
 
struct  QWSRegionCommand
 
struct  QWSRegionCommand::SimpleData
 
struct  QWSRegionDestroyCommand
 
struct  QWSRegionDestroyCommand::SimpleData
 
struct  QWSRegionMoveCommand
 
struct  QWSRegionMoveCommand::SimpleData
 
struct  QWSRegionNameCommand
 
struct  QWSRegionNameCommand::SimpleData
 
struct  QWSRemovePropertyCommand
 
struct  QWSRemovePropertyCommand::SimpleData
 
struct  QWSRepaintRegionCommand
 
struct  QWSRepaintRegionCommand::SimpleData
 
struct  QWSRequestFocusCommand
 
struct  QWSRequestFocusCommand::SimpleData
 
struct  QWSScreenTransformCommand
 
struct  QWSScreenTransformCommand::SimpleData
 
struct  QWSSelectCursorCommand
 
struct  QWSSelectCursorCommand::SimpleData
 
struct  QWSSetOpacityCommand
 
struct  QWSSetOpacityCommand::SimpleData
 
struct  QWSSetPropertyCommand
 
struct  QWSSetPropertyCommand::SimpleData
 
struct  QWSSetSelectionOwnerCommand
 
struct  QWSSetSelectionOwnerCommand::SimpleData
 

Macros

#define MAX_COMMAND_SIZE   (16 * 1024)
 

Functions

QDebugoperator<< (QDebug &dbg, QWSCommand::Type tp)
 
const char * qws_getCommandTypeString (QWSCommand::Type tp)
 
bool qws_read_command (QIODevice *socket, char *&simpleData, int &simpleLen, char *&rawData, int &rawLen, int &bytesRead)
 
void qws_write_command (QIODevice *socket, int type, char *simpleData, int simpleLen, char *rawData, int rawLen)
 

Macro Definition Documentation

◆ MAX_COMMAND_SIZE

#define MAX_COMMAND_SIZE   (16 * 1024)

Function Documentation

◆ operator<<()

QDebug& operator<< ( QDebug dbg,
QWSCommand::Type  tp 
)

◆ qws_getCommandTypeString()

const char* qws_getCommandTypeString ( QWSCommand::Type  tp)

Definition at line 243 of file qwscommand_qws.cpp.

Referenced by RequestAnalyzer::analyze().

244 {
245  const char *typeStr;
246  switch(tp) {
247  case QWSCommand::Create:
248  typeStr = "Create";
249  break;
251  typeStr = "Shutdown";
252  break;
253  case QWSCommand::Region:
254  typeStr = "Region";
255  break;
257  typeStr = "RegionMove";
258  break;
260  typeStr = "RegionDestroy";
261  break;
263  typeStr = "SetProperty";
264  break;
266  typeStr = "AddProperty";
267  break;
269  typeStr = "RemoveProperty";
270  break;
272  typeStr = "GetProperty";
273  break;
275  typeStr = "SetSelectionOwner";
276  break;
278  typeStr = "ConvertSelection";
279  break;
281  typeStr = "RequestFocus";
282  break;
284  typeStr = "ChangeAltitude";
285  break;
287  typeStr = "SetOpacity";
288  break;
290  typeStr = "DefineCursor";
291  break;
293  typeStr = "SelectCursor";
294  break;
296  typeStr = "PositionCursor";
297  break;
299  typeStr = "GrabMouse";
300  break;
302  typeStr = "PlaySound";
303  break;
305  typeStr = "QCopRegisterChannel";
306  break;
308  typeStr = "QCopSend";
309  break;
311  typeStr = "RegionName";
312  break;
314  typeStr = "Identify";
315  break;
317  typeStr = "GrabKeyboard";
318  break;
320  typeStr = "RepaintRegion";
321  break;
322  case QWSCommand::IMMouse:
323  typeStr = "IMMouse";
324  break;
326  typeStr = "IMUpdate";
327  break;
329  typeStr = "IMResponse";
330  break;
331  case QWSCommand::Font:
332  typeStr = "Font";
333  break;
334  case QWSCommand::Unknown:
335  default:
336  typeStr = "Unknown";
337  break;
338  }
339  return typeStr;
340 }

◆ qws_read_command()

bool qws_read_command ( QIODevice socket,
char *&  simpleData,
int &  simpleLen,
char *&  rawData,
int &  rawLen,
int &  bytesRead 
)

Definition at line 388 of file qwscommand_qws.cpp.

Referenced by QWSProtocolItem::read().

390 {
391 
392  // read rawLen
393  if (rawLen == -1) {
394  rawLen = qws_read_uint(socket);
395  if (rawLen == -1)
396  return false;
397  }
398 
399  // read simpleData, assumes socket is capable of buffering all the data
400  if (simpleLen && !rawData) {
401  if (socket->bytesAvailable() < uint(simpleLen))
402  return false;
403  int tmp = socket->read(simpleData, simpleLen);
404  Q_ASSERT(tmp == simpleLen);
405  Q_UNUSED(tmp);
406  }
407 
408  if (rawLen > MAX_COMMAND_SIZE) {
409  socket->close();
410  qWarning("qws_read_command: Won't read command of length %d, "
411  "connection closed.", rawLen);
412  return false;
413  }
414 
415  // read rawData
416  if (rawLen && !rawData) {
417  rawData = new char[rawLen];
418  bytesRead = 0;
419  }
420  if (bytesRead < rawLen && socket->bytesAvailable())
421  bytesRead += socket->read(rawData + bytesRead, rawLen - bytesRead);
422 
423  return (bytesRead == rawLen);
424 }
virtual void close()
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
Definition: qiodevice.cpp:590
int qws_read_uint(QIODevice *socket)
Definition: qwsutils_qws.h:73
#define MAX_COMMAND_SIZE
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
Definition: qiodevice.cpp:791
Q_CORE_EXPORT void qWarning(const char *,...)
unsigned int uint
Definition: qglobal.h:996
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
Definition: qiodevice.cpp:752
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ qws_write_command()

void qws_write_command ( QIODevice socket,
int  type,
char *  simpleData,
int  simpleLen,
char *  rawData,
int  rawLen 
)

Definition at line 350 of file qwscommand_qws.cpp.

Referenced by QWSProtocolItem::write().

352 {
353 #ifdef QWSCOMMAND_DEBUG
354  if (simpleLen) qDebug() << "WRITE simpleData " << QWSHexDump(simpleData, simpleLen);
355  if (rawLen > 0) qDebug() << "WRITE rawData " << QWSHexDump(rawData, rawLen);
356 #endif
357 
358 #ifndef QT_NO_SXE
360  // ###### as soon as public API can be modified get rid of horrible casts
361  QIODevice *ad = a->passThroughByClient(reinterpret_cast<QWSClient*>(socket));
362  if (ad)
363  socket = ad;
364 #endif
365 
366  qws_write_uint(socket, type);
367 
368  if (rawLen > MAX_COMMAND_SIZE) {
369  qWarning("qws_write_command: Message of size %d too big. "
370  "Truncated to %d", rawLen, MAX_COMMAND_SIZE);
371  rawLen = MAX_COMMAND_SIZE;
372  }
373 
374  qws_write_uint(socket, rawLen == -1 ? 0 : rawLen);
375 
376  if (simpleData && simpleLen)
377  socket->write(simpleData, simpleLen);
378 
379  if (rawLen && rawData)
380  socket->write(rawData, rawLen);
381 }
int type
Definition: qmetatype.cpp:239
long ASN1_INTEGER_get ASN1_INTEGER * a
#define MAX_COMMAND_SIZE
Q_CORE_EXPORT void qDebug(const char *,...)
Q_CORE_EXPORT void qWarning(const char *,...)
Authenticate a message transport.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
Definition: qiodevice.cpp:1342
void qws_write_uint(QIODevice *socket, int i)
Definition: qwsutils_qws.h:84
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
QIODevice * passThroughByClient(QWSClient *) const
static QTransportAuth * getInstance()
Return a pointer to the instance of this process&#39;s QTransportAuth object.