76 fprintf(stderr, " -N assert destination endpoint is not a singleton\n"); |
76 fprintf(stderr, " -N assert destination endpoint is not a singleton\n"); |
77 fprintf(stderr, " -W set the do not fragment option\n"); |
77 fprintf(stderr, " -W set the do not fragment option\n"); |
78 fprintf(stderr, " -h help\n"); |
78 fprintf(stderr, " -h help\n"); |
79 fprintf(stderr, " -v verbose\n"); |
79 fprintf(stderr, " -v verbose\n"); |
80 |
80 |
81 return 0; |
81 return DTN_SUCCESS; |
82 } |
82 } |
83 |
83 |
84 /******************************************************************************* |
84 /******************************************************************************* |
85 * parse options: |
85 * parse options: |
86 * set internal variables based on cmd line args. |
86 * set internal variables based on cmd line args. |
218 |
218 |
219 // if no reply-to eid set, use the local eid |
219 // if no reply-to eid set, use the local eid |
220 if (*reply_eid_name == NULL) |
220 if (*reply_eid_name == NULL) |
221 strncpy(reply_eid_name, local_eid_name, PATH_MAX); |
221 strncpy(reply_eid_name, local_eid_name, PATH_MAX); |
222 |
222 |
223 return 0; |
223 return DTN_SUCCESS; |
224 } |
224 } |
225 |
225 |
226 /******************************************************************************* |
226 /******************************************************************************* |
227 * validate options: |
227 * validate options: |
228 * returns success or exits on failure |
228 * returns success or exits on failure |
401 // remove any trailing whitespace |
401 // remove any trailing whitespace |
402 // by testing if the current char is in the whitespace string |
402 // by testing if the current char is in the whitespace string |
403 for (j = strlen(out)-1; strchr(whitespace, in[i]) != NULL; --j) |
403 for (j = strlen(out)-1; strchr(whitespace, in[i]) != NULL; --j) |
404 out[j--] = 0; |
404 out[j--] = 0; |
405 |
405 |
406 return 0; |
406 return DTN_SUCCESS; |
407 |
|
408 } |
407 } |
409 |
408 |
410 /******************************************************************************* |
409 /******************************************************************************* |
411 * escape spaces: |
410 * escape spaces: |
412 * first move past any leading whitespace |
411 * first move past any leading whitespace |
502 |
501 |
503 // read line from matching file |
502 // read line from matching file |
504 // TODO: handle malformed input from matching file |
503 // TODO: handle malformed input from matching file |
505 if (fgets(line, PATH_MAX, file) == NULL) { |
504 if (fgets(line, PATH_MAX, file) == NULL) { |
506 break; |
505 break; |
507 } else { |
|
508 matching_rule = strtok(line, ","); |
|
509 query = strtok(NULL, ","); |
|
510 path = strtok(NULL, ","); |
|
511 kind = strtok(NULL, ","); |
|
512 expiry = strtok(NULL, ","); |
|
513 } |
506 } |
|
507 |
|
508 if (strncmp(line, "#", 1) == 0) |
|
509 continue; |
|
510 |
|
511 matching_rule = strtok(line, ","); |
|
512 query = strtok(NULL, ","); |
|
513 path = strtok(NULL, ","); |
|
514 kind = strtok(NULL, ","); |
|
515 expiry = strtok(NULL, ","); |
|
516 |
514 |
517 |
515 // match query |
518 // match query |
516 if (atoi(matching_rule) != (int)bpq->matching_rule || |
519 if (atoi(matching_rule) != (int)bpq->matching_rule || |
517 BPQ_MATCHING_RULE_EXACT != bpq->matching_rule || |
520 BPQ_MATCHING_RULE_EXACT != bpq->matching_rule || |
518 strlen(query) != bpq->query.query_len || |
521 strlen(query) != bpq->query.query_len || |
1118 // close the ipc handle |
1121 // close the ipc handle |
1119 if (verbose) fprintf(stdout, "closing connection to dtn router...\n"); |
1122 if (verbose) fprintf(stdout, "closing connection to dtn router...\n"); |
1120 dtn_close(handle); |
1123 dtn_close(handle); |
1121 if (verbose) fprintf(stdout, "closed connection to dtn router...\n"); |
1124 if (verbose) fprintf(stdout, "closed connection to dtn router...\n"); |
1122 |
1125 |
1123 return 0; |
1126 return DTN_SUCCESS; |
1124 |
1127 |
1125 // UNREACHABLE CODE if count = 0 ////////////////////////////////////////////// |
1128 // UNREACHABLE CODE if count = 0 ////////////////////////////////////////////// |
1126 } |
1129 } |
1127 |
1130 |