Skip to content

magbone/traceroute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

traceroute

Preface

traceroute is based on the ICMP protocol, and can test the route you trece easily.

Usage

traceroute [-P][protocol] [-t][ttl][host]
Usage:
-P  protocol. ICMP, UDP, TCP argument.
-t  time to live.

API Documents

There are there apis total. we provide two methods to process the results, one is the asynchronization method, we recommend you using this way to handle the process because the traceroute work would take long time; the other is the synchronization method, ather the traceroute work is finished, the result will give.

  • int traceroute_init(traceroute **tpp, char **err_msg); initalizes a traceroute struct pointer including the config and operation handler, if it's failed that will return 0 and get the error meessge from the err_msg argument.
  • int traceroute_run_async(traceroute *tp, int (*success_callback)(char *route, long long *ms, INFO info), int (*err_callback)(char *err_msg));handles the async working. First argument ip pointer had been initalized before. Success will execute the success_callback, failure will execute the err_callback. success_callbackincluding there params, more details plaese see the test. -int traceroute_free(traceroute *tp)destorys the traceroute pointer and voids the memory leak.

Build test

Installed clang or gun compiler(other included c compiler, etc). Using very sample cammands as follows.

gcc traceroute.c test.c -o test  // GUN compiler

clang traceroute.c test.c -o test // Clang compiler

Make sure traceroute.c traceroute.h test.c are in same directory, or it will make mistake generally.

Furtures

  • IPv6 support
  • DNS support
  • TCP support
  • synchronization method
  • others

License

MIT License

About

traceroute is based on the ICMP protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages