2
Kopete Groupwise Protocol
3
coreprotocol.h- the core GroupWise protocol
5
Copyright (c) 2004 SUSE Linux AG http://www.suse.com
7
Based on Iris, Copyright (C) 2003 Justin Karneges <justin@affinix.com>
9
Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
11
*************************************************************************
13
* This library is free software; you can redistribute it and/or *
14
* modify it under the terms of the GNU Lesser General Public *
15
* License as published by the Free Software Foundation; either *
16
* version 2 of the License, or (at your option) any later version. *
18
*************************************************************************
21
#ifndef GW_CORE_PROTOCOL_H
22
#define GW_CORE_PROTOCOL_H
30
class CoreProtocol : public QObject
34
enum State { NeedMore, Available, NoData, OutOfSync };
38
virtual ~CoreProtocol();
41
* Reset the protocol, clear buffers
46
* Accept data from the network, and buffer it into a useful message
47
* This requires parsing out each FLAP, etc. from the incoming data
48
* @param incomingBytes Raw data in wire format.
50
void addIncomingData( const QByteArray& incomingBytes );
53
* @return the incoming transfer or 0 if none is available.
55
Transfer* incomingTransfer();
58
* Convert a request into an outgoing transfer
59
* emits @ref outgoingData() with each part of the transfer
61
void outgoingTransfer( Transfer* outgoing );
64
* Get the state of the protocol
70
* Emitted as the core protocol converts fields to wire ready data
72
void outgoingData( const QByteArray& );
75
* Emitted when there is incoming data, parsed into a Transfer
80
* Just a debug method to test emitting to the socket, atm - should go to the ClientStream
82
void slotOutgoingData( const QByteArray & );
86
* Check that there is data to read, and set the protocol's state if there isn't any.
88
bool okToProceed( const QDataStream &din );
90
* Convert incoming wire data into a Transfer object and queue it
91
* @return number of bytes from the input that were parsed into a Transfer
93
int wireToTransfer( const QByteArray& wire );
96
QByteArray m_in; // buffer containing unprocessed bytes we received
98
Transfer* m_inTransfer; // the transfer that is being received
99
int m_state; // represents the protocol's overall state
100
SnacProtocol* m_snacProtocol;
101
FlapProtocol* m_flapProtocol;