apps/dtnquery/dtnquery.c
changeset 65 333724f2f7cf
parent 64 1296a0283271
child 66 e1101c5d54a1
equal deleted inserted replaced
64:1296a0283271 65:333724f2f7cf
    92     fprintf(stderr, " -N  assert destination endpoint is not a singleton\n");
    92     fprintf(stderr, " -N  assert destination endpoint is not a singleton\n");
    93     fprintf(stderr, " -W  set the do not fragment option\n");
    93     fprintf(stderr, " -W  set the do not fragment option\n");
    94     fprintf(stderr, " -h  help\n");
    94     fprintf(stderr, " -h  help\n");
    95     fprintf(stderr, " -v  verbose\n");
    95     fprintf(stderr, " -v  verbose\n");
    96 
    96 
    97     return 0;
    97     return DTN_SUCCESS;
    98 }
    98 }
    99 
    99 
   100 /*******************************************************************************
   100 /*******************************************************************************
   101 * parse matching file
   101 * parse matching file
   102 * if matching file is passed in rather than cml line literal query,
   102 * if matching file is passed in rather than cml line literal query,
   159 
   159 
   160     //ensure there are no more tokens
   160     //ensure there are no more tokens
   161     token = strtok (NULL, ",");
   161     token = strtok (NULL, ",");
   162     if (token != NULL)  return 1;
   162     if (token != NULL)  return 1;
   163 
   163 
   164     return 0;
   164     return DTN_SUCCESS;
   165 }
   165 }
   166 
   166 
   167 /*******************************************************************************
   167 /*******************************************************************************
   168 * parse options:
   168 * parse options:
   169 * set internal variables based on cmd line args.
   169 * set internal variables based on cmd line args.
   372             exit(1);
   372             exit(1);
   373         }
   373         }
   374     }
   374     }
   375 
   375 
   376     // if no reply-to eid set, use the src eid
   376     // if no reply-to eid set, use the src eid
   377     if (reply_eid_name == NULL)
   377     if (*reply_eid_name == NULL)
   378         strncpy(reply_eid_name, src_eid_name, PATH_MAX);
   378         strncpy(reply_eid_name, src_eid_name, PATH_MAX);
   379     
   379     
   380     return 0;
   380     return DTN_SUCCESS;
   381 }
   381 }
   382 
   382 
   383 /*******************************************************************************
   383 /*******************************************************************************
   384 * validate options:
   384 * validate options:
   385 * as there are different requirements depending on the mode,
   385 * as there are different requirements depending on the mode,
   434             query_type == DTN_BPQ_FILE, "-t <query type> invalid type\n");
   434             query_type == DTN_BPQ_FILE, "-t <query type> invalid type\n");
   435 
   435 
   436     REQUIRE(matching_rule == BPQ_MATCHING_RULE_EXACT,
   436     REQUIRE(matching_rule == BPQ_MATCHING_RULE_EXACT,
   437          "-u <matching rule> invalid rule\n");
   437          "-u <matching rule> invalid rule\n");
   438     REQUIRE(bundle_expiry > 0, "-e <expiry> must be a positive integer\n");
   438     REQUIRE(bundle_expiry > 0, "-e <expiry> must be a positive integer\n");
       
   439 
       
   440     return DTN_SUCCESS;
   439 #undef REQUIRE
   441 #undef REQUIRE
   440 //todo: check this is ok
       
   441     return 0;
       
   442 }
   442 }
   443 
   443 
   444 /*******************************************************************************
   444 /*******************************************************************************
   445 * register with dtn:
   445 * register with dtn:
   446 * 
   446 * 
   585     }
   585     }
   586 
   586 
   587     if (verbose) printf("%d byte file from [%s]: transit time=%d ms, written to '%s'\n",
   587     if (verbose) printf("%d byte file from [%s]: transit time=%d ms, written to '%s'\n",
   588            (int)fileinfo.st_size, bundle_spec.source.uri, 0, destination);
   588            (int)fileinfo.st_size, bundle_spec.source.uri, 0, destination);
   589 
   589 
   590     return 0;
   590     return DTN_SUCCESS;
   591 }
   591 }
   592 
   592 
   593 /*******************************************************************************
   593 /*******************************************************************************
   594 * bpq to char array
   594 * bpq to char array
   595 * encode the following information:
   595 * encode the following information:
  1238     // close the ipc handle
  1238     // close the ipc handle
  1239     if (verbose) fprintf(stdout, "closing connection to dtn router...\n");
  1239     if (verbose) fprintf(stdout, "closing connection to dtn router...\n");
  1240     dtn_close(handle);
  1240     dtn_close(handle);
  1241     if (verbose) fprintf(stdout, "closed connection to dtn router...\n");
  1241     if (verbose) fprintf(stdout, "closed connection to dtn router...\n");
  1242 
  1242 
  1243     return 0;
  1243     return DTN_SUCCESS;
  1244 }
  1244 }
  1245 
  1245