Exemplo n.º 1
0
void print_pair(jnx_guid *a, jnx_guid *b) {
  jnx_char *str,*str2;
  jnx_guid_to_string(a,&str);
  jnx_guid_to_string(b,&str2);
  JNXLOG(LDEBUG,"[%s] [%s]",str,str2);
  free(str);
  free(str2);
}
Exemplo n.º 2
0
void test_string() {

    jnx_int i;
    for(i=0; i<5; ++i) {
        jnx_guid g;
        jnx_guid_create(&g);
        char *ostr;
        jnx_guid_to_string(&g,&ostr);
        JNXLOG(LDEBUG,"GUID A=>%s",ostr);
        jnx_guid f;
        jnx_guid_from_string(ostr,&f);
        char *ostrtwo;
        jnx_guid_to_string(&f,&ostrtwo);
        JNXLOG(LDEBUG,"GUID B=>%s",ostrtwo);
        JNXCHECK(jnx_guid_compare(&g,&f) == JNX_GUID_STATE_SUCCESS);
    }
}
Exemplo n.º 3
0
static void debug_packet(discovery_service *svc, char *packet_type) {
  char *guid_str;
  jnx_guid_to_string(&peerstore_get_local_peer(svc->peers)->guid, &guid_str);
  printf("[DEBUG] Sent %s packet for peer %s, %s, %s.\n",
      packet_type,
      guid_str,
      peerstore_get_local_peer(svc->peers)->host_address, 
      peerstore_get_local_peer(svc->peers)->user_name);
}
Exemplo n.º 4
0
void test_generate_guid() {
    jnx_guid g;
    jnx_guid_state s = jnx_guid_create(&g);
    JNXCHECK(g.guid);

    jnx_char *ostr;
    jnx_guid_to_string(&g,&ostr);
    JNXLOG(LDEBUG,"GUID -> %s",ostr);

}
Exemplo n.º 5
0
void print_peer(peer *p) {
  printf("----------\n");
  jnx_char *str;
  jnx_guid_to_string(&(*p).guid,&str);
  printf("Peer guid => %s\n",str);
  free(str);
  printf("Peer host_addres => %s\n",p->host_address);
  printf("Peer user_name => %s\n",p->user_name);
  printf("Peer last seen => %ld\n",p->last_seen);
  printf("----------\n");
}
Exemplo n.º 6
0
void print_guid(jnx_guid *g) {
  jnx_char *str;
  jnx_guid_to_string(g,&str);
  JNXLOG(LDEBUG,"%s",str);
  free(str);
}