Formatting and CLeaning nlsr_sync.c/h
diff --git a/nlsr_sync.c b/nlsr_sync.c
index 789a0c5..86b26bf 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -93,7 +93,8 @@
ccn_name_init(content_name);
if (components->n < 2)
return 0;
- res = ccn_name_append_components(content_name, name->buf, components->buf[0], components->buf[components->n - 1]);
+ res = ccn_name_append_components(content_name, name->buf, components->buf[0]
+ , components->buf[components->n - 1]);
if ( res < 0)
return 0;
@@ -116,11 +117,13 @@
if ( nlsr->debugging )
{
printf("Number of components in name = %d \n",res);
- printf("Number of components in name as indexbuf->n = %d \n",(int)components1->n);
+ printf("Number of components in name as indexbuf->n = %d \n",
+ (int)components1->n);
}
ccn_name_chop(content_name,components1,-3);
if ( nlsr->debugging )
- printf("Number of components in name as indexbuf->n after chopping= %d \n",(int)components1->n);
+ printf("Number of components in name as indexbuf->n after chopping= %d \n"
+ ,(int)components1->n);
//debugging purpose
struct ccn_charbuf *temp1=ccn_charbuf_create();
@@ -138,8 +141,10 @@
}
+
void
-get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb, struct ccn_indexbuf *interest_comps, int offset)
+get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb,
+ struct ccn_indexbuf *interest_comps, int offset)
{
@@ -163,7 +168,8 @@
size_t comp_size;
for(i=lsa_position+1+offset;i<interest_comps->n-1;i++)
{
- ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, &comp_size);
+ ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1,
+ &comp_size);
len+=1;
len+=(int)comp_size;
}
@@ -174,9 +180,11 @@
for(i=lsa_position+1+offset; i<interest_comps->n-1;i++)
{
- ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, &comp_size);
+ ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1,
+ &comp_size);
memcpy(neighbor+strlen(neighbor),"/",1);
- memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
+ memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,
+ strlen((char *)comp_ptr1));
}
@@ -189,59 +197,7 @@
free(neighbor);
}
-void
-get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset)
-{
-
-
- int res,i;
- int len=0;
- const unsigned char *comp_ptr1;
- size_t comp_size;
-
- struct ccn_charbuf *name=ccn_charbuf_create();
- name = ccn_charbuf_create();
- res = ccn_name_from_uri(name,nbr_name_uri);
- if (res < 0) {
- fprintf(stderr, "Bad ccn URI: %s\n", nbr_name_uri);
- exit(1);
- }
-
- struct ccn_indexbuf cid={0};
-
- struct ccn_indexbuf *components=&cid;
- ccn_name_split (name, components);
-
- for(i=components->n-2;i> (0+offset);i--)
- {
- res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
- len+=1;
- len+=(int)comp_size;
- }
- len++;
-
- char *neighbor=(char *)malloc(len);
- memset(neighbor,0,len);
-
- for(i=components->n-2;i> (0+offset);i--)
- {
- res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
- if ( i != components->n-2)
- memcpy(neighbor+strlen(neighbor),".",1);
- memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
-
- }
-
- name_part->name=(char *)malloc(strlen(neighbor)+1);
- memset(name_part->name,0,strlen(neighbor)+1);
- memcpy(name_part->name,neighbor,strlen(neighbor)+1);
- name_part->length=strlen(neighbor)+1;
-
- // 01/31/2013
- free(neighbor);
- ccn_charbuf_destroy(&name);
-}
@@ -295,7 +251,8 @@
int i;
for (i = sizeof(buf) - 1; i >= 0; i--, lifetime_l12 >>= 8)
buf[i] = lifetime_l12 & 0xff;
- ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf, sizeof(buf));
+ ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf,
+ sizeof(buf));
}
ccn_charbuf_append_closer(templ); /* </Interest> */
}
@@ -307,7 +264,8 @@
resultbuf->length = 0;
}
}
- res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL, get_flags);
+ res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL,
+ get_flags);
if (res >= 0) {
ptr = resultbuf->buf;
length = resultbuf->length;