ZrtpQueue.h | ZrtpQueue.h | |||
---|---|---|---|---|
skipping to change at line 223 | skipping to change at line 223 | |||
* <code>$HOME/.GNUccRTP.zid</code> if the <code>HOME</code> | * <code>$HOME/.GNUccRTP.zid</code> if the <code>HOME</code> | |||
* environment variable is set. If it is not set the current | * environment variable is set. If it is not set the current | |||
* directory is used. | * directory is used. | |||
* | * | |||
* If the method could set up the timeout thread and open the ZID | * If the method could set up the timeout thread and open the ZID | |||
* file then it enables ZRTP processing and returns. | * file then it enables ZRTP processing and returns. | |||
* | * | |||
* @param zidFilename | * @param zidFilename | |||
* The name of the ZID file, can be a relative or absolut | * The name of the ZID file, can be a relative or absolut | |||
* filename. | * filename. | |||
* | ||||
* @param autoEnable | ||||
* if set to true the method automatically sets enableZrtp to | ||||
* true. This enables the ZRTP auto-sense mode. | ||||
* | ||||
* @return | * @return | |||
* 1 on success, ZRTP processing enabled, -1 on failure, | * 1 on success, ZRTP processing enabled, -1 on failure, | |||
* ZRTP processing disabled. | * ZRTP processing disabled. | |||
* | * | |||
*/ | */ | |||
int32_t initialize(const char *zidFilename); | int32_t initialize(const char *zidFilename, bool autoEnable = true) ; | |||
/* | /* | |||
* Applications use the following methods to control ZRTP, for exam ple | * Applications use the following methods to control ZRTP, for exam ple | |||
* to enable ZRTP, set flags etc. | * to enable ZRTP, set flags etc. | |||
*/ | */ | |||
/** | /** | |||
* Enable or disable ZRTP processing. | * Enable or disable ZRTP processing. | |||
* | * | |||
* Call this method to enable or disable ZRTP processing after | * Call this method to enable or disable ZRTP processing after | |||
skipping to change at line 319 | skipping to change at line 324 | |||
* Request to switch off secure mode. | * Request to switch off secure mode. | |||
* | * | |||
* Call this method is the user itself wants to switch off secure | * Call this method is the user itself wants to switch off secure | |||
* mode (go clear). After sending the "go clear" request to the pee r | * mode (go clear). After sending the "go clear" request to the pee r | |||
* ZRTP immediatly switch off SRTP processing. Every RTP data is se nt | * ZRTP immediatly switch off SRTP processing. Every RTP data is se nt | |||
* in clear after the go clear request. | * in clear after the go clear request. | |||
*/ | */ | |||
void requestGoClear(); | void requestGoClear(); | |||
/** | /** | |||
* Set the sigs secret. | * Set the S3 secret. | |||
* | ||||
* Use this method to set the sigs secret data. Refer to ZRTP | ||||
* specification, chapter 3.2.1 | ||||
* | ||||
* @param data | ||||
* Points to the sigs secret data. The data must have a length | ||||
* of 32 bytes (length of SHA256 hash) | ||||
*/ | ||||
void setSigsSecret(uint8* data); | ||||
/** | ||||
* Set the srtps secret. | ||||
* | * | |||
* Use this method to set the srtps secret data. Refer to ZRTP | * Use this method to set the srtps secret data. Refer to ZRTP | |||
* specification, chapter 3.2.1 | * specification, chapter 3.2.1 | |||
* | * | |||
* @param data | * @param data | |||
* Points to the srtps secret data. The data must have a length | * Points to the srtps secret data. The data must have a length | |||
* of 32 bytes (length of SHA256 hash) | * of 32 bytes (length of SHA256 hash) | |||
*/ | */ | |||
void setSrtpsSecret(uint8* data); | void setS3Secret(uint8* data); | |||
/** | /** | |||
* Set the other secret. | * Set the other secret. | |||
* | * | |||
* Use this method to set the other secret data. Refer to ZRTP | * Use this method to set the other secret data. Refer to ZRTP | |||
* specification, chapter 3.2.1 | * specification, chapter 3.2.1 | |||
* | * | |||
* @param data | * @param data | |||
* Points to the other secret data. | * Points to the other secret data. | |||
* @param length | * @param length | |||
* The length in bytes of the data. | * The length in bytes of the data. | |||
*/ | */ | |||
void setOtherSecret(uint8* data, int32 length); | void setPbxSecret(uint8* data, int32 length); | |||
/** | /** | |||
* Set the application's callback class. | * Set the application's callback class. | |||
* | * | |||
* The destructor of ZrtpQueue also destorys the user callback | * The destructor of ZrtpQueue also destorys the user callback | |||
* class if it was set. The application must not delete the | * class if it was set. The application must not delete the | |||
* callback object or use/reference the callback object after | * callback object or use/reference the callback object after | |||
* ZrtpQueue was destroyed. | * ZrtpQueue was destroyed. | |||
* | * | |||
* @param ucb | * @param ucb | |||
skipping to change at line 375 | skipping to change at line 368 | |||
*/ | */ | |||
void setUserCallback(ZrtpUserCallback* ucb); | void setUserCallback(ZrtpUserCallback* ucb); | |||
/** | /** | |||
* Set the client ID for ZRTP Hello message. | * Set the client ID for ZRTP Hello message. | |||
* | * | |||
* The GNU ccRTP client may set its id to identify itself in the | * The GNU ccRTP client may set its id to identify itself in the | |||
* ZRTP Hello message. The maximum length is 16 characters. A | * ZRTP Hello message. The maximum length is 16 characters. A | |||
* shorter id string is possible, it will be filled with blanks. A | * shorter id string is possible, it will be filled with blanks. A | |||
* longer id string will be truncated to 16 characters. The | * longer id string will be truncated to 16 characters. The | |||
* standard client id is <code>GNU ccRTP ZRTP </code>. | * standard client id is <code>'GNU ccRTP ZRTP '</code> (without | |||
* the quotes). | ||||
* | * | |||
* Setting the client's id must be done before calling | * Setting the client's id must be done before calling | |||
* initialize() or starting the ZRTP protocol with startZrtp() . | * ZrtpQueue#initialize() or ZrtpQueue#startZrtp() . | |||
* | * | |||
* @param id | * @param id | |||
* The client's id string | * The client's id string | |||
*/ | */ | |||
void setClientId(std::string id); | void setClientId(std::string id); | |||
/** | /** | |||
* Get the ZRTP Hello Hash data. | * Get the ZRTP Hello Hash data. | |||
* | * | |||
* Use this method to get the ZRTP Hello Hash data. The method | * Use this method to get the ZRTP Hello Hash data. The method | |||
* returns the data as a string containing hex-digits. Refer to ZRT | * returns the data as a string containing hex-digits. Refer | |||
P | * to ZRTP specification, chapter 9.1. | |||
* specification, chapter 9.1. | ||||
* | * | |||
* @return | * @return | |||
* a std:string containing the Hello hash value as hex-digits. T he | * a std:string containing the Hello hash value as hex-digits. T he | |||
* hello hash is available immediatly after starting the ZrtpQue | * hello hash is available immediatly after calling | |||
ue. | * ZrtpQueue#startZrtp. If ZRTP was not started the method retur | |||
* If ZRTP was not started or ZRTP the method returns an empty s | ns | |||
tring. | * an empty string. | |||
*/ | */ | |||
std::string getHelloHash(); | std::string getHelloHash(); | |||
/** | /** | |||
* Get the ZRTP SAS data. | ||||
* | ||||
* Use this method to get the ZRTP SAS data formatted as string | ||||
* and ready to use in the SDP as defined in the ZRTP | ||||
* specification, chapter 9.4. The format of this SAS string is | ||||
* different from the SAS string sent to the application via | ||||
* ZrtpUserCallback#showSAS. | ||||
* | ||||
* @return a std:string containing the SAS and the SAS hash, | ||||
* formatted as specified in chapter 9.4. If ZRTP was not | ||||
* started or ZRTP is not yet in secure state the method | ||||
* returns an empty string. | ||||
*/ | ||||
std::string getSasData(); | ||||
/** | ||||
* Get Multi-stream parameters. | * Get Multi-stream parameters. | |||
* | * | |||
* Use this method to get the Multi-stream that were computed durin g | * Use this method to get the Multi-stream that were computed durin g | |||
* the ZRTP handshake. An application may use these parameters to | * the ZRTP handshake. An application may use these parameters to | |||
* enable multi-stream processing for an associated SRTP session. | * enable multi-stream processing for an associated SRTP session. | |||
* | * | |||
* Refer to chapter 5.4.2 in the ZRTP specification for further det ails | * Refer to chapter 5.4.2 in the ZRTP specification for further det ails | |||
* and restriction how and when to use multi-stream mode. | * and restriction how and when to use multi-stream mode. | |||
* | * | |||
* @return | * @return | |||
* a string that contains the multi-stream parameters. The appli cation | * a string that contains the multi-stream parameters. The appli cation | |||
* must not modify the contents of this string, it is opaque dat a. The | * must not modify the contents of this string, it is opaque dat a. The | |||
* application may hand over this string to a new ZrtpQueue inst ance | * application may hand over this string to a new ZrtpQueue inst ance | |||
* to enable multi-stream processing for this ZrtpQueue. If ZRTP was | * to enable multi-stream processing for this ZrtpQueue. If ZRTP was | |||
* not started or ZRTP is not yet in secure state the method ret urns an | * not started or ZRTP is not yet in secure state the method ret urns an | |||
* empty string. | * empty string. | |||
* | ||||
* @see setMultiStrParams() | ||||
*/ | */ | |||
std::string getMultiStrParams(); | std::string getMultiStrParams(); | |||
/** | /** | |||
* Set Multi-stream parameters. | * Set Multi-stream parameters. | |||
* | * | |||
* Use this method to set the parameters required to enable Multi-s tream | * Use this method to set the parameters required to enable Multi-s tream | |||
* processing of ZRTP. The multi-stream parameters must be set befo re the | * processing of ZRTP. The multi-stream parameters must be set befo re the | |||
* application starts the ZRTP protocol engine. | * application starts the ZRTP protocol engine. | |||
* | * | |||
* Refer to chapter 5.4.2 in the ZRTP specification for further det ails | * Refer to chapter 5.4.2 in the ZRTP specification for further det ails | |||
* of multi-stream mode. | * of multi-stream mode. | |||
* | * | |||
* @param parameters | * @param parameters | |||
* A string that contains the multi-stream parameters that this | * A string that contains the multi-stream parameters that this | |||
* new ZrtpQueue instanace shall use. See also | * new ZrtpQueue instanace shall use. | |||
* <code>getMultiStrParams()</code> | * | |||
* @see getMultiStrParams() | ||||
*/ | */ | |||
void setMultiStrParams(std::string parameters); | void setMultiStrParams(std::string parameters); | |||
/** | /** | |||
* Check if this ZRTP use Multi-stream. | * Check if this ZRTP use Multi-stream. | |||
* | * | |||
* Use this method to check if this ZRTP instance uses multi-stream . Even | * Use this method to check if this ZRTP instance uses multi-stream . Even | |||
* if the application provided multi-stram parameters it may happen that | * if the application provided multi-stram parameters it may happen that | |||
* full DH mode was used. Refer to chapters 5.2 and 5.4.2 in the ZR TP # | * full DH mode was used. Refer to chapters 5.2 and 5.4.2 in the ZR TP # | |||
* when this may happen. | * when this may happen. | |||
skipping to change at line 716 | skipping to change at line 698 | |||
ZRtp *zrtpEngine; | ZRtp *zrtpEngine; | |||
ZrtpUserCallback* zrtpUserCallback; | ZrtpUserCallback* zrtpUserCallback; | |||
std::string clientIdString; | std::string clientIdString; | |||
bool enableZrtp; | bool enableZrtp; | |||
int32 secureParts; | int32 secureParts; | |||
CryptoContext* recvCryptoContext; | // CryptoContext* recvCryptoContext; | |||
CryptoContext* senderCryptoContext; | // CryptoContext* senderCryptoContext; | |||
int16 senderZrtpSeqNo; | int16 senderZrtpSeqNo; | |||
ost::Mutex synchLock; // Mutex for ZRTP (used by ZrtpStateClass) | ost::Mutex synchLock; // Mutex for ZRTP (used by ZrtpStateClass) | |||
uint32 peerSSRC; | ||||
bool started; | ||||
}; | }; | |||
class IncomingZRTPPkt : public IncomingRTPPkt { | class IncomingZRTPPkt : public IncomingRTPPkt { | |||
public: | public: | |||
/** | /** | |||
* Build a ZRTP packet object from a data buffer. | * Build a ZRTP packet object from a data buffer. | |||
* | * | |||
* @param block pointer to the buffer the whole packet is stored in . | * @param block pointer to the buffer the whole packet is stored in . | |||
* @param len length of the whole packet, expressed in octets. | * @param len length of the whole packet, expressed in octets. | |||
* | * | |||
**/ | **/ | |||
IncomingZRTPPkt(const unsigned char* block, size_t len); | IncomingZRTPPkt(const unsigned char* block, size_t len); | |||
~IncomingZRTPPkt() | ~IncomingZRTPPkt() | |||
{ } | { } | |||
inline uint32 | uint32 | |||
getZrtpMagic() const | getZrtpMagic() const; | |||
{ return ntohl(getHeader()->timestamp); } | ||||
uint32 | ||||
getSSRC() const; | ||||
}; | }; | |||
class OutgoingZRTPPkt : public OutgoingRTPPkt { | class OutgoingZRTPPkt : public OutgoingRTPPkt { | |||
public: | public: | |||
/** | /** | |||
* Construct a new ZRTP packet to be sent. | * Construct a new ZRTP packet to be sent. | |||
* | * | |||
* A new copy in memory (holding all this components | * A new copy in memory (holding all this components | |||
* along with the fixed header) is created. | * along with the fixed header) is created. | |||
End of changes. 15 change blocks. | ||||
48 lines changed or deleted | 32 lines changed or added | |||