Browse code

core: dns_cache rpc commands updated to use rpl_printf()

Daniel-Constantin Mierla authored on 01/09/2014 17:21:16
Showing 1 changed files
... ...
@@ -3814,21 +3814,21 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
3814 3814
 	now=get_ticks_raw();
3815 3815
 	expires = (s_ticks_t)(e->expire-now)<0?-1: TICKS_TO_S(e->expire-now);
3816 3816
 	
3817
-	rpc->printf(ctx, "%sname: %s", SPACE_FORMAT, e->name);
3818
-	rpc->printf(ctx, "%stype: %s", SPACE_FORMAT, print_type(e->type));
3819
-	rpc->printf(ctx, "%ssize (bytes): %d", SPACE_FORMAT,
3817
+	rpc->rpl_printf(ctx, "%sname: %s", SPACE_FORMAT, e->name);
3818
+	rpc->rpl_printf(ctx, "%stype: %s", SPACE_FORMAT, print_type(e->type));
3819
+	rpc->rpl_printf(ctx, "%ssize (bytes): %d", SPACE_FORMAT,
3820 3820
 						e->total_size);
3821
-	rpc->printf(ctx, "%sreference counter: %d", SPACE_FORMAT,
3821
+	rpc->rpl_printf(ctx, "%sreference counter: %d", SPACE_FORMAT,
3822 3822
 						e->refcnt.val);
3823 3823
 	if (e->ent_flags & DNS_FLAG_PERMANENT) {
3824
-		rpc->printf(ctx, "%spermanent: yes", SPACE_FORMAT);
3824
+		rpc->rpl_printf(ctx, "%spermanent: yes", SPACE_FORMAT);
3825 3825
 	} else {
3826
-		rpc->printf(ctx, "%spermanent: no", SPACE_FORMAT);
3827
-		rpc->printf(ctx, "%sexpires in (s): %d", SPACE_FORMAT, expires);
3826
+		rpc->rpl_printf(ctx, "%spermanent: no", SPACE_FORMAT);
3827
+		rpc->rpl_printf(ctx, "%sexpires in (s): %d", SPACE_FORMAT, expires);
3828 3828
 	}
3829
-	rpc->printf(ctx, "%slast used (s): %d", SPACE_FORMAT,
3829
+	rpc->rpl_printf(ctx, "%slast used (s): %d", SPACE_FORMAT,
3830 3830
 						TICKS_TO_S(now-e->last_used));
3831
-	rpc->printf(ctx, "%snegative entry: %s", SPACE_FORMAT,
3831
+	rpc->rpl_printf(ctx, "%snegative entry: %s", SPACE_FORMAT,
3832 3832
 						(e->ent_flags & DNS_FLAG_BAD_NAME) ? "yes" : "no");
3833 3833
 	
3834 3834
 	for (rr=e->rr_lst; rr; rr=rr->next) {
... ...
@@ -3836,74 +3836,74 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
3836 3836
 			case T_A:
3837 3837
 			case T_AAAA:
3838 3838
 				if (dns_rr2ip(e->type, rr, &ip)==0){
3839
-				  rpc->printf(ctx, "%srr ip: %s", SPACE_FORMAT,
3839
+				  rpc->rpl_printf(ctx, "%srr ip: %s", SPACE_FORMAT,
3840 3840
 									ip_addr2a(&ip) );
3841 3841
 				}else{
3842
-				  rpc->printf(ctx, "%srr ip: <error: bad rr>", 
3842
+				  rpc->rpl_printf(ctx, "%srr ip: <error: bad rr>", 
3843 3843
 									SPACE_FORMAT);
3844 3844
 				}
3845 3845
 				break;
3846 3846
 			case T_SRV:
3847
-				rpc->printf(ctx, "%srr name: %s", SPACE_FORMAT,
3847
+				rpc->rpl_printf(ctx, "%srr name: %s", SPACE_FORMAT,
3848 3848
 							((struct srv_rdata*)(rr->rdata))->name);
3849
-				rpc->printf(ctx, "%srr port: %d", SPACE_FORMAT,
3849
+				rpc->rpl_printf(ctx, "%srr port: %d", SPACE_FORMAT,
3850 3850
 							((struct srv_rdata*)(rr->rdata))->port);
3851
-				rpc->printf(ctx, "%srr priority: %d", SPACE_FORMAT,
3851
+				rpc->rpl_printf(ctx, "%srr priority: %d", SPACE_FORMAT,
3852 3852
 						((struct srv_rdata*)(rr->rdata))->priority);
3853
-				rpc->printf(ctx, "%srr weight: %d", SPACE_FORMAT,
3853
+				rpc->rpl_printf(ctx, "%srr weight: %d", SPACE_FORMAT,
3854 3854
 							((struct srv_rdata*)(rr->rdata))->weight);
3855 3855
 				break;
3856 3856
 			case T_NAPTR:
3857
-				rpc->printf(ctx, "%srr order: %d", SPACE_FORMAT,
3857
+				rpc->rpl_printf(ctx, "%srr order: %d", SPACE_FORMAT,
3858 3858
 							((struct naptr_rdata*)(rr->rdata))->order);
3859
-				rpc->printf(ctx, "%srr preference: %d", SPACE_FORMAT,
3859
+				rpc->rpl_printf(ctx, "%srr preference: %d", SPACE_FORMAT,
3860 3860
 							((struct naptr_rdata*)(rr->rdata))->pref);
3861 3861
 				s.s = ((struct naptr_rdata*)(rr->rdata))->flags;
3862 3862
 				s.len = ((struct naptr_rdata*)(rr->rdata))->flags_len;
3863
-				rpc->printf(ctx, "%srr flags: %.*s", SPACE_FORMAT,
3863
+				rpc->rpl_printf(ctx, "%srr flags: %.*s", SPACE_FORMAT,
3864 3864
 									s.len, s.s);
3865 3865
 				s.s=((struct naptr_rdata*)(rr->rdata))->services;
3866 3866
 				s.len=((struct naptr_rdata*)(rr->rdata))->services_len;
3867
-				rpc->printf(ctx, "%srr service: %.*s", SPACE_FORMAT,
3867
+				rpc->rpl_printf(ctx, "%srr service: %.*s", SPACE_FORMAT,
3868 3868
 									s.len, s.s);
3869 3869
 				s.s = ((struct naptr_rdata*)(rr->rdata))->regexp;
3870 3870
 				s.len = ((struct naptr_rdata*)(rr->rdata))->regexp_len;
3871
-				rpc->printf(ctx, "%srr regexp: %.*s", SPACE_FORMAT,
3871
+				rpc->rpl_printf(ctx, "%srr regexp: %.*s", SPACE_FORMAT,
3872 3872
 									s.len, s.s);
3873 3873
 				s.s = ((struct naptr_rdata*)(rr->rdata))->repl;
3874 3874
 				s.len = ((struct naptr_rdata*)(rr->rdata))->repl_len;
3875
-				rpc->printf(ctx, "%srr replacement: %.*s", 
3875
+				rpc->rpl_printf(ctx, "%srr replacement: %.*s", 
3876 3876
 									SPACE_FORMAT, s.len, s.s);
3877 3877
 				break;
3878 3878
 			case T_CNAME:
3879
-				rpc->printf(ctx, "%srr name: %s", SPACE_FORMAT,
3879
+				rpc->rpl_printf(ctx, "%srr name: %s", SPACE_FORMAT,
3880 3880
 							((struct cname_rdata*)(rr->rdata))->name);
3881 3881
 				break;
3882 3882
 			case T_TXT:
3883 3883
 				for (i=0; i<((struct txt_rdata*)(rr->rdata))->cstr_no;
3884 3884
 						i++){
3885
-					rpc->printf(ctx, "%stxt[%d]: %s", SPACE_FORMAT, i,
3885
+					rpc->rpl_printf(ctx, "%stxt[%d]: %s", SPACE_FORMAT, i,
3886 3886
 						((struct txt_rdata*)(rr->rdata))->txt[i].cstr);
3887 3887
 				}
3888 3888
 				break;
3889 3889
 			case T_EBL:
3890
-				rpc->printf(ctx, "%srr position: %d", SPACE_FORMAT,
3890
+				rpc->rpl_printf(ctx, "%srr position: %d", SPACE_FORMAT,
3891 3891
 							((struct ebl_rdata*)(rr->rdata))->position);
3892
-				rpc->printf(ctx, "%srr separator: %s", SPACE_FORMAT,
3892
+				rpc->rpl_printf(ctx, "%srr separator: %s", SPACE_FORMAT,
3893 3893
 							((struct ebl_rdata*)(rr->rdata))->separator);
3894
-				rpc->printf(ctx, "%srr apex: %s", SPACE_FORMAT,
3894
+				rpc->rpl_printf(ctx, "%srr apex: %s", SPACE_FORMAT,
3895 3895
 							((struct ebl_rdata*)(rr->rdata))->apex);
3896 3896
 				break;
3897 3897
 			case T_PTR:
3898
-				rpc->printf(ctx, "%srr name: %s", SPACE_FORMAT,
3898
+				rpc->rpl_printf(ctx, "%srr name: %s", SPACE_FORMAT,
3899 3899
 							((struct ptr_rdata*)(rr->rdata))->ptrdname);
3900 3900
 				break;
3901 3901
 			default:
3902
-				rpc->printf(ctx, "%sresource record: unknown",
3902
+				rpc->rpl_printf(ctx, "%sresource record: unknown",
3903 3903
 									SPACE_FORMAT);
3904 3904
 		}
3905 3905
 		if ((e->ent_flags & DNS_FLAG_PERMANENT) == 0)
3906
-			rpc->printf(ctx, "%srr expires in (s): %d", SPACE_FORMAT,
3906
+			rpc->rpl_printf(ctx, "%srr expires in (s): %d", SPACE_FORMAT,
3907 3907
 						(s_ticks_t)(rr->expire-now)<0?-1 : 
3908 3908
 						TICKS_TO_S(rr->expire-now));
3909 3909
 	}
... ...
@@ -3931,9 +3931,9 @@ void dns_cache_view(rpc_t* rpc, void* ctx)
3931 3931
 			) {
3932 3932
 				continue;
3933 3933
 			}
3934
-			rpc->printf(ctx, "{\n");
3934
+			rpc->rpl_printf(ctx, "{\n");
3935 3935
 			dns_cache_print_entry(rpc, ctx, e);
3936
-			rpc->printf(ctx, "}");
3936
+			rpc->rpl_printf(ctx, "}");
3937 3937
 		}
3938 3938
 	}
3939 3939
 	UNLOCK_DNS_HASH();