int PMC_Usr::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_Usr::encode")); ACE_NEW_RETURN (this->ss, SL_Client (this->usr_name), -1); SET_PACKET_TYPE (packet, Options::PROTO_USR); char *buf_ptr = SKIP_PACKET_TYPE (packet); buf_ptr = ACE_OS::strecpy (buf_ptr, this->get_next_friend ()->get_login ()); packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; }
int PMC_All::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_All::encode\n")); ACE_NEW_RETURN (this->ss, HT_Client, -1); SET_PACKET_TYPE (packet, Options::PROTO_ALL); char *buf_ptr = SKIP_PACKET_TYPE (packet); packet_length = buf_ptr - packet; return 1; }
int PMC_Ruser::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUG) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_Ruser::encode\n")); ACE_NEW_RETURN (this->ss, HT_Client, -1); SET_PACKET_TYPE (packet, Options::PROTO_RUSER); char *buf_ptr = SKIP_PACKET_TYPE (packet); *buf_ptr++ = char (Options::get_opt (Options::PRINT_LOGIN_NAME)); packet_length = buf_ptr - packet; return 1; }
int PMC_Flo::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUG) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_Flo::encode")); ACE_NEW_RETURN (this->ss, BS_Client, -1); SET_PACKET_TYPE (packet, Options::PROTO_FLO); char *buf_ptr = SKIP_PACKET_TYPE (packet); sprintf (buf_ptr, "%d", this->friend_count ()); buf_ptr += MAXUSERIDNAMELEN; // Iterate through all the friends, copying them into the packet // buffer. for (Protocol_Record *prp; (prp = this->get_next_friend ()) != 0; ) buf_ptr = ACE_OS::strecpy (buf_ptr, prp->get_login ()); packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUG) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; }