Classified ads
Classes | Enumerations | Functions
protocol.h File Reference
#include "../util/hash.h"
Include dependency graph for protocol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SendQueueItem
 send-queue item. More...
 
struct  PublishItem
 Carrier for keeping state of item about to be published. More...
 

Enumerations

enum  ProtocolItemType {
  OwnNodeGreeting =1, NodeGreeting =2, ClassifiedAd =3, PrivateMessage =4,
  BinaryBlob =5, UserProfile =6, RequestForClassifiedAd =7, RequestForPrivateMessage =8,
  RequestForBinaryBlob =9, RequestForUserProfile =10, RandomNumbers =11, RequestForNodesAroundHash =12,
  UserProfilePublish =13, BinaryFilePublish =14, ClassifiedAdPublish =15, ClassifiedAd2NdAddr =16,
  RequestAdsClassified =17, PrivateMessagePublish =18, PrivateMessagesForProfile =19, UserProfileComment =20,
  ProfileCommentPublish =21, UserProfileCommentsForProfile =22, RequestForProfilePoll =23, RequestForProfileComment =24,
  RequestForSearchSend =25, RequestForVoiceCallStart =26, RequestForVoiceCallEnd =27
}
 

Functions

static const unsigned char KProtocolVersion (1)
 
static const unsigned char KRandomNumbersPacket (100)
 
static const unsigned char KNodesAroundHash (101)
 
static const unsigned char KProfileAtHash (103)
 
static const unsigned char KBinaryFileAtHash (104)
 
static const unsigned char KClassifiedAdAtHash (109)
 
static const unsigned char KProfilePublish (102)
 
static const unsigned char KBinaryFilePublish (105)
 
static const unsigned char KBinaryFileSend (106)
 
static const unsigned char KClassifiedAdPublish (107)
 
static const unsigned char KProfileSend (108)
 
static const unsigned char KClassifiedAdSend (110)
 
static const unsigned char KAdsClassifiedAtHash (111)
 
static const unsigned char KListOfAdsClassifiedAtHash (112)
 
static const unsigned char KPrivMessagePublish (113)
 
static const unsigned char KPrivMessageSend (114)
 
static const unsigned char KPrivMessagesAtHash (115)
 
static const unsigned char KPrivMessagesForProfile (116)
 
static const unsigned char KProfileCommentPublish (117)
 
static const unsigned char KProfileCommentSend (118)
 
static const unsigned char KProfileCommentAtHash (119)
 
static const unsigned char KSingleProfileCommentAtHash (120)
 
static const unsigned char KSearchRequest (121)
 
static const unsigned char KSearchResults (122)
 
static const unsigned char KVoiceCallStart (123)
 
static const unsigned char KVoiceCallEnd (124)
 
static const unsigned char KRealtimeData (125)
 
static const unsigned char KFutureUse4 (126)
 
static const unsigned char KFutureUse5 (127)
 
static const unsigned char KFutureUse6 (128)
 
static const unsigned char KRTDataAudioSubtype (1)
 
static const unsigned char KRTDataControlSubtype (2)
 
static const int KMaxOpenConnections (100)
 
static const int KNumberOfNodesToSendToEachPeer (300)
 
static const int KNumberOfClassifiedAdsToSendToEachPeer (300)
 
static const quint32 KMaxProtocolItemSize (1024 *1024 *2)
 
static const quint16 KBroadCastAdvertismentPort (23432)
 

Detailed Description

this file protocol.h defines constants that are passed between peers as protocol entries.

Possible messages are

Enumeration Type Documentation

this enum lists possible items that we send over socket from one node to another. These get serialized into bitstream whose values are #defined above.

Enumerator
OwnNodeGreeting 

normal node greeting but inside program special handling

NodeGreeting 

node connectivity details

ClassifiedAd 

normal public posting

PrivateMessage 

a message destined to owner of specific profile

BinaryBlob 

just data, relates to something, has SHA1

UserProfile 

user RSA key and possible other related data

RequestForClassifiedAd 

query for other nodes if there is anything about classified ads

RequestForPrivateMessage 

query for other nodes if there is any private msgs

RequestForBinaryBlob 

query for other nodes if there is specific binary avail

RequestForUserProfile 

query for other nodes if user has been in da hood

RandomNumbers 

explained later. this really contains 1 or more random numbers

RequestForNodesAroundHash 

request that other nodes use to retrieve node-refs around given hash

UserProfilePublish 

publish message is different from normal UserProfile

BinaryFilePublish 

publish binary blob is different from normal BinaryBlob

ClassifiedAdPublish 

publish CA is different from normal ad

ClassifiedAd2NdAddr 

publish of CA to group controller

RequestAdsClassified 

query for articles whose classification is known

PrivateMessagePublish 

local user is sending a privmsg

PrivateMessagesForProfile 

specifies a request to send messages destined to profile

UserProfileComment 

invididual profile comment to be sent

ProfileCommentPublish 

profile comment publish item type

UserProfileCommentsForProfile 

request to queue profile comments commenting given profile

RequestForProfilePoll 

UI request regarding profile update poll

RequestForProfileComment 

UI request regarding individual comment

RequestForSearchSend 

UI request about network search

RequestForVoiceCallStart 

node<->node audio control start

RequestForVoiceCallEnd 

node<->node audio control stop

Function Documentation

static const unsigned char KAdsClassifiedAtHash ( 111  )
static

Query about CAs whose classification matches the hash

static const unsigned char KBinaryFileAtHash ( 104  )
static

Message id for a binary file request

static const unsigned char KBinaryFilePublish ( 105  )
static

Binary blob is published with this number

static const unsigned char KBinaryFileSend ( 106  )
static

Binary blob is sent (compare to publish) with this number

static const quint16 KBroadCastAdvertismentPort ( 23432  )
static

 node may advertise itself in local ethernet segment with broadcast. the port where ads are sent is this

static const unsigned char KClassifiedAdAtHash ( 109  )
static

Message id for CA request

static const unsigned char KClassifiedAdPublish ( 107  )
static

Classified ad is published with this number

static const unsigned char KClassifiedAdSend ( 110  )
static

CA is sent (compare to publish) with this number

static const unsigned char KFutureUse4 ( 126  )
static

Protocol constants for future use

static const unsigned char KFutureUse5 ( 127  )
static
static const unsigned char KFutureUse6 ( 128  )
static
static const unsigned char KListOfAdsClassifiedAtHash ( 112  )
static

Reply to Query about CAs whose classification matches the hash

static const int KMaxOpenConnections ( 100  )
static

How many open connections we wish to have open at same time

static const quint32 KMaxProtocolItemSize ( 1024 *1024 *  2)
static

max size of single published item

static const unsigned char KNodesAroundHash ( 101  )
static

Message id for requesting nodes around hash

static const int KNumberOfClassifiedAdsToSendToEachPeer ( 300  )
static

how many classified ads to send to remote peer without the peer asking.

static const int KNumberOfNodesToSendToEachPeer ( 300  )
static

how many noderefs to send automatically after peer has connected. Noderef with ipv4+ipv6 as compressed json is ~100bytes so 300 mean some 30 kilobytes -> can handle.

static const unsigned char KPrivMessagePublish ( 113  )
static

user is publishing a new private message

static const unsigned char KPrivMessagesAtHash ( 115  )
static

Request for private message having given hash

static const unsigned char KPrivMessageSend ( 114  )
static

node is sending a private message

static const unsigned char KPrivMessagesForProfile ( 116  )
static

Request for private message destined so given profile

static const unsigned char KProfileAtHash ( 103  )
static

Message id for a profile request

static const unsigned char KProfileCommentAtHash ( 119  )
static

sent as a request to send profile comments. This is not about sending individual comment but instead comments of a profile there is separate request for single comment

static const unsigned char KProfileCommentPublish ( 117  )
static

user is publishing a new comment to profile

static const unsigned char KProfileCommentSend ( 118  )
static

node is sending a profile comment

static const unsigned char KProfilePublish ( 102  )
static

Profile is published with this number

static const unsigned char KProfileSend ( 108  )
static

Operator profile is sent (compare to publish) with this number

static const unsigned char KProtocolVersion ( )
static

node greeting msg identifier

static const unsigned char KRandomNumbersPacket ( 100  )
static

rnd number msg identifier

static const unsigned char KRealtimeData ( 125  )
static

This is used to send rt-data inside ssl socket. Typically RT data would belong to UDP packet but sometimes UDP won't work while TCP does. Use-case for this is voice call audio packets but there may be other types also ; the data anyway contains a sub-type, for instance for sending separate audio, chat messages or even moving pictures.

static const unsigned char KRTDataAudioSubtype ( )
static

next thing is rt-data subtypes. First audio.

static const unsigned char KRTDataControlSubtype ( )
static

Call control real-time data packet subtype

static const unsigned char KSearchRequest ( 121  )
static

sent as a request to perform search

static const unsigned char KSearchResults ( 122  )
static

sent as a response to KSearchRequest (if there were any results)

static const unsigned char KSingleProfileCommentAtHash ( 120  )
static

sent as a request to send single profile comment.

static const unsigned char KVoiceCallEnd ( 124  )
static

send as indication about closing of audio channel to operators node

static const unsigned char KVoiceCallStart ( 123  )
static

send as request to open audio channel to operators node