static GByteArray* m2v2_remote_pack_RAW_SUBST(struct oio_url_s *url, GSList *new_chunks, GSList *old_chunks) { GByteArray *new_chunks_gba = bean_sequence_marshall(new_chunks); GByteArray *old_chunks_gba = bean_sequence_marshall(old_chunks); MESSAGE msg = _m2v2_build_request(NAME_MSGNAME_M2V2_RAW_SUBST, url, NULL); metautils_message_add_fields_gba(msg, NAME_MSGKEY_NEW, new_chunks_gba, NAME_MSGKEY_OLD, old_chunks_gba, NULL); g_byte_array_unref (new_chunks_gba); g_byte_array_unref (old_chunks_gba); return message_marshall_gba_and_clean(msg); }
GHashTable* gridd_stats_remote (addr_info_t *ai, gint ms, GError **err, const gchar *pattern) { GHashTable *ht=NULL; struct code_handler_s codes [] = { { CODE_FINAL_OK, REPSEQ_FINAL, NULL, field_extractor }, { CODE_PARTIAL_CONTENT, 0, NULL, field_extractor }, { 0, 0, NULL, NULL }, }; struct reply_sequence_data_s data = { &ht , 0 , codes }; /*create the result hash table*/ ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); if (!ht) { GSETERROR(err, "cannot create a hashtable"); return NULL; } /*create and fill the request*/ GByteArray *gba_pattern = g_byte_array_append(g_byte_array_new(), (guint8*)pattern, strlen(pattern)); MESSAGE request = metautils_message_create_named("REQ_STATS"); metautils_message_add_fields_gba (request, MSGKEY_PATTERN, gba_pattern, NULL); g_byte_array_free(gba_pattern, TRUE); if (!request) { GSETERROR(err, "Cannot create a message"); goto errorLabel; } /*run the reply sequence*/ if (!metaXClient_reply_sequence_run_from_addrinfo(err, request, ai, ms, &data)) { GSETERROR(err, "Cannot execute the request and parse the answers"); goto errorLabel; } metautils_message_destroy (request); return ht; errorLabel: if (ht) g_hash_table_destroy (ht); metautils_message_destroy (request); return NULL; }