PRecvAudioREQ.cpp
Upload User: popouu88
Upload Date: 2013-02-11
Package Size: 2894k
Code Size: 1k
Category:

VOIP program

Development Platform:

Visual C++

  1. // PRecvAudioREQ.cpp: implementation of the PRecvAudioREQ class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "PRecvAudioREQ.h"
  5. //////////////////////////////////////////////////////////////////////
  6. // Construction/Destruction
  7. //////////////////////////////////////////////////////////////////////
  8. PRecvAudioREQ::PRecvAudioREQ()
  9. {
  10. this->Tag = PRecvAudioREQTAG;
  11. this->user_id = 0;
  12. }
  13. PRecvAudioREQ::~PRecvAudioREQ()
  14. {
  15. }
  16. bool PRecvAudioREQ::assembleData( int user_id )
  17. {
  18. this->buffer.Resize( 3 * INT_SIZE );
  19. char * now = this->buffer.GetBuffer( );
  20. *( int * )now = this->buffer.GetSize( ); now += INT_SIZE;
  21. *( int * )now = this->Tag; now += INT_SIZE; 
  22. *( int * )now = user_id;
  23. return true;
  24. }
  25. bool PRecvAudioREQ::parseData( CBuffer & buffer )
  26. {
  27. if( ! buffer.GetSize( ) ) return false;
  28. char * now = buffer.GetBuffer( ) + 2 * INT_SIZE;
  29. this->user_id = *( int * )now;
  30. return true;
  31. }