xpcom_chimera/comproxy/PinoPacket.cpp
PinoPacket::PinoPacket(string pkt)
{
        /* TODO */   // unsigned char   pkt_type; unsigned short pkt_len; string pkt_stream;
        char* pPkt = convertStreamToPacket(pkt);
        // skip first byte  version
        pPkt++;
        // get packet type
        pkt_type = *pPkt;
        pPkt++;
        // get packet length
        pkt_len = *((unsigned short *) packet);
        pPkt += 2; // skip the length
        // get body length
        unsigned short body_len = *((unsigned short *) pPkt);
        pPkt += 2; // skip the length
        // get body string
        string pkt_body(pPkt);   // cstr to string

        buildPacket(pkt_type, pkt_body, body_len);
}
/*
 * _ONLY_ for a complete packet stream
 *
 * Used to construct a PinoPacket from the packet stream we received, 
 * so that, we can call member functions, such as getComent(), getComments()
 * to parse the pino packet (we received) and get what we want, 
 & like Comment(s) in PostCommentReq(QueryCommentResp) 
 * and Parameters of QueryCommentReq
 *
 */
_ONLY_ for a complete packet stream
Used to construct a PinoPacket from the packet stream we received,
so that, we can call member functions, such as getComent(), getComments()
to parse the pino packet (we received) and get what we want,
& like Comment(s) in PostCommentReq(QueryCommentResp)
and Parameters of QueryCommentReq
_ONLY_ for a complete packet stream Used to construct a PinoPacket from the packet stream we received so that we can call member functions such as getComent () getComments () to parse the pino packet ( we received ) and get what we want & like Comment ( s ) in PostCommentReq ( QueryCommentResp ) and Parameters of QueryCommentReq
PinoPacket::PinoPacket(string pkt)
{
        char* pPkt = convertStreamToPacket(pkt);
        pPkt++;
        pkt_type = *pPkt;
        pPkt++;
        pkt_len = *((unsigned short *) packet);
        pPkt += 2; 
        unsigned short body_len = *((unsigned short *) pPkt);
        pPkt += 2; 
        string pkt_body(pPkt);   
        buildPacket(pkt_type, pkt_body, body_len);
}
PinoPacket :: PinoPacket ( string pkt ) { char * pPkt = convertStreamToPacket ( pkt ) ; pPkt ++ ; pkt_type = * pPkt ; pPkt ++ ; pkt_len = * ( ( unsigned short * ) packet ) ; pPkt += 2 ; unsigned short body_len = * ( ( unsigned short * ) pPkt ) ; pPkt += 2 ; string pkt_body ( pPkt ) ; buildPacket ( pkt_type , pkt_body , body_len ) ; }
_ONLY_ for a complete packet stream
 Used to construct a PinoPacket from the packet stream we received,
 so that, we can call member functions, such as getComent(), getComments()
 to parse the pino packet (we received) and get what we want,
& like Comment(s) in PostCommentReq(QueryCommentResp)
 and Parameters of QueryCommentReq
_ONLY_ for a complete packet stream Used to construct a PinoPacket from the packet stream we received so that we can call member functions such as getComent () getComments () to parse the pino packet ( we received ) and get what we want & like Comment ( s ) in PostCommentReq ( QueryCommentResp ) and Parameters of QueryCommentReq
/* TODO */ // unsigned char   pkt_type; unsigned short pkt_len; string pkt_stream; // skip first byte  version // get packet type // get packet length // skip the length // get body length // skip the length // get body string // cstr to string