Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct gg_login110_ok
- {
- uint64_t unknown1;
- char *somehash;
- gg_uin_t uin;
- uint32_t server_time;
- };
- int gg_packet_login110_ok_unpack(char *packet, size_t length, struct gg_login110_ok &dst)
- {
- gg_pbuff *pb = gg_pbuff_new(packet, length);
- if (!pb)
- return 0;
- gg_pbuff_get_uint64(pb, &dst->unknown1);
- gg_pbuff_get_str(pb, &dst->somehash);
- gg_pbuff_get_uin(pb, &dst->uin);
- gg_pbuff_get_uint32(pb, &dst->server_time);
- return gg_pbuff_cleanup(pb); // zwraca 1, jeżeli pb jest "valid", a jest valid, jeżeli typy się zgadzały
- }
- void gg_packet_login110_ok_cleanup(struct gg_login110_ok &pkt)
- {
- free(pkt->somehash);
- pkt->somehash = NULL;
- }
- // inne metody do pobierania danych:
- {
- (...)
- gg_pbuff_get_str_optional(pb, &dst->str, NULL);
- gg_pbuff_get_uint64_optional(pb, &dst->val, (uint64_t)-1);
- gg_pbuff_get_submessage(pb, &dst->sub, &gg_packet_submsg_unpack);
- gg_pbuff_get_array(pb, &dst->arr1, &dst->arr1_count, &gg_pbuff_get_uint32, sizeof(uint32_t));
- gg_pbuff_get_array(pb, &dst->arr2, &dst->arr2_count, &gg_packet_submsg_unpack, sizeof(gg_submsg_t));
- (...)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement