+ size_t count=0;
+ TID_SRVR_BLK *this=NULL;
+
+ assert(resp!=NULL);
+ for (count=0, this=resp->servers; this!=NULL; count++, this=this->next) {}
+ return count;
+}
+
+static int tid_srvr_blk_destructor(void *obj)
+{
+ TID_SRVR_BLK *srvr=talloc_get_type_abort(obj, TID_SRVR_BLK);
+
+ if (srvr->key_name!=NULL)
+ tr_free_name(srvr->key_name);
+ if (srvr->aaa_server_dh!=NULL)
+ tr_destroy_dh_params(srvr->aaa_server_dh);
+ if (srvr->path!=NULL)
+ json_decref((json_t *)(srvr->path));
+ return 0;
+}
+
+TR_EXPORT TID_SRVR_BLK *tid_srvr_blk_new(TALLOC_CTX *mem_ctx)
+{
+ TID_SRVR_BLK *srvr=talloc(mem_ctx, TID_SRVR_BLK);
+
+ if (srvr!=NULL) {
+ srvr->next=NULL;
+ srvr->aaa_server_addr=NULL;
+ srvr->key_name=NULL;
+ srvr->aaa_server_dh=NULL;
+ srvr->key_expiration=(GTimeVal){0};
+ srvr->path=NULL;
+ talloc_set_destructor((void *)srvr, tid_srvr_blk_destructor);
+ }
+ return srvr;
+}
+
+TR_EXPORT void tid_srvr_blk_free(TID_SRVR_BLK *srvr)
+{
+ talloc_free(srvr);
+}
+
+TR_EXPORT TID_SRVR_BLK *tid_srvr_blk_dup(TALLOC_CTX *mem_ctx, TID_SRVR_BLK *srvr)
+{
+ TID_SRVR_BLK *new=NULL;
+
+ if (srvr==NULL)
+ return NULL;
+
+ new=tid_srvr_blk_new(mem_ctx);
+ if (new!=NULL) {
+ if (srvr->aaa_server_addr!=NULL)
+ new->aaa_server_addr=talloc_strdup(new, srvr->aaa_server_addr);
+ new->key_name=tr_dup_name(srvr->key_name);
+ new->aaa_server_dh=tr_dh_dup(srvr->aaa_server_dh);
+ new->key_expiration=srvr->key_expiration;
+
+ tid_srvr_blk_set_path(new, srvr->path);
+
+ tid_srvr_blk_add(new->next, tid_srvr_blk_dup(mem_ctx, srvr->next));
+ }
+ return new;
+}
+
+/* use the macro */
+TR_EXPORT TID_SRVR_BLK *tid_srvr_blk_add_func(TID_SRVR_BLK *head, TID_SRVR_BLK *new)
+{
+ TID_SRVR_BLK *this=head;
+
+ if (head==NULL)
+ return new;
+
+ while (this->next!=NULL)
+ this=this->next;
+
+ this->next=new;
+ while (this!=NULL) {
+ talloc_steal(head, this);
+ this=this->next;
+ }
+ return head;