git-svn-id: svn://db.shs.com.ru/pip@636 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -19,6 +19,28 @@
|
||||
|
||||
#include "pibroadcast.h"
|
||||
|
||||
/** \class PIBroadcast
|
||||
* \brief Broadcast for all interfaces, including loopback
|
||||
*
|
||||
* \section PIBroadcast_synopsis Synopsis
|
||||
* %PIBroadcast used as multichannel IO device. It can use
|
||||
* multicast, broadcast and loopback ethernet channels to
|
||||
* send/receive packets. \a send() function send packet to
|
||||
* all initialized ethernets. \a receiveEvent() raised on
|
||||
* packet received by any ethernet. All multi/broadcast
|
||||
* ethernets created for all current addresses, obtained
|
||||
* by \a PIEthernets::allAddresses().
|
||||
*
|
||||
* * \a Multicast ethernets use \a multicastGroup() and \a multicastPort()
|
||||
* * \a Broadcast ethernets use \a broadcastPort()
|
||||
* * \a Loopback ethernet use \a loopbackPortsCount() started from \a loopbackPort()
|
||||
*
|
||||
* %PIBroadcast starts thread , which every 3 seconds check if
|
||||
* current \a PIEthernet::allAddresses() was changed and call
|
||||
* \a reinit() if it necessary.
|
||||
*
|
||||
*/
|
||||
|
||||
#define MULTICAST_TTL 4
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,29 @@
|
||||
# include "picrypt.h"
|
||||
#endif
|
||||
|
||||
/** \class PIEthUtilBase
|
||||
* \brief Base class for ethernet utils
|
||||
*
|
||||
* \section PIEthUtilBase_synopsis Synopsis
|
||||
* %PIEthUtilBase provides crypt layer for derived classes:
|
||||
* \a PIStreamPacker and \a PIBroadcast. All input and output
|
||||
* (sended and received) data can be decrypted/encrypted by this layer.
|
||||
*
|
||||
* By default crypt layer is disabled.
|
||||
*
|
||||
* You can separetely enable it and set ready-to-use
|
||||
* key by \a setCryptEnabled() and \a setCryptKey(). Or you can
|
||||
* use \a createCryptKey() to generate key from your passphrase
|
||||
* and automatic enable crypt layer.
|
||||
*
|
||||
* \note To use crypt layer, PIP should be built with crypt module,
|
||||
* otherwise your in/out data will be lost.
|
||||
*
|
||||
* You can use this class as base for your own classes. Use \a cryptData()
|
||||
* and \a decryptData() when send and receive your data.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
PIEthUtilBase::PIEthUtilBase() {
|
||||
_crypt = false;
|
||||
|
||||
@@ -20,10 +20,28 @@
|
||||
#include "pistreampacker.h"
|
||||
#include "piiodevice.h"
|
||||
|
||||
/** \class PIStreamPacker
|
||||
* \brief Simple packet wrap aroud any PIIODevice
|
||||
*
|
||||
* \section PIStreamPacker_synopsis Synopsis
|
||||
* %PIStreamPacker provides simple pack/unpack logic for any data packets.
|
||||
*
|
||||
* When you call \a send() function data splited into several
|
||||
* parts, \a packetSign() prepended to first part and \a sendRequest()
|
||||
* event raised several times.
|
||||
*
|
||||
* When your device receive some data, call \a received() function.
|
||||
* \a packetReceiveEvent() event will be raised when packet will be
|
||||
* collected.
|
||||
*
|
||||
* Use \a assignDevice() to connect device to this %PIStreamPacker.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
PIStreamPacker::PIStreamPacker(PIIODevice * dev): PIObject() {
|
||||
packet_size = -1;
|
||||
max_packet_size = 1000;
|
||||
max_packet_size = 1400;
|
||||
packet_sign = 0xAFBE;
|
||||
assignDevice(dev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user