HACKING 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. $Id: HACKING 1782 2007-04-02 04:21:30Z aturner $
  2. Guide to Hacking Tcpreplay
  3. [Note: Pay attention to the last update date at the top of this file. If it
  4. was significantly long ago, this document may be out of date.]
  5. 0. Contributing Code
  6. If you contribute code the following will happen:
  7. a) You will be given credit in the CREDITS file
  8. b) Your code will be licensed under the same license as that of tcpreplay
  9. c) You will be assigning your copyright to me- Aaron Turner
  10. If you have any questions regarding any of the three above stipulations,
  11. feel free to email the list at: tcpreplay-users@lists.sourceforge.net
  12. 1. Introduction
  13. If you're reading this to find out how to add a new feature or fix a bug in
  14. tcpreplay or tcpprep, then you've come to the right place. This isn't the
  15. place to find answers regarding how to use tcpreplay, the meaning of life,
  16. etc.
  17. 2. File Layout
  18. The file layout is pretty simple:
  19. / - Base directory
  20. /lib - 3rd party libraries stolen verbatim
  21. /libopts - GNU AutoOpts tearoff
  22. /src - Main code routines
  23. /src/common - Common routines for all binaries
  24. /src/tcpedit - libtcpedit
  25. /docs - Where to find documentation
  26. /test - Test scripts and stuff which is used during 'make test'
  27. 3. Coding Standards
  28. 1) Indent 4 spaces using spaces, not tabs
  29. 2) Opening braces for control blocks (if, while, etc) should be on the same line
  30. 3) Opening braces for functions should be on next line
  31. 4) Use provided warnx, dbg, and errx functions provided in err.h
  32. 5) Use provided safe_strdup, safe_malloc and safe_realloc functions provided
  33. in common/utils.h
  34. 6) Use provided strl* functions in lib/strlcat.c and lib/strlcpy.c
  35. 4. Adding support for additional DLTs (Data Link Types)
  36. libtcpedit supports a plugin based architecture for handling different DLT
  37. types. If you wish to add support for another DLT type, you should read:
  38. http://tcpreplay.synfin.net/trac/wiki/tcpeditDeveloper
  39. Which contains information on creating new DLT plugins.
  40. 5. Hacking tcprewrite
  41. Tcprewrite is basically a front-end to libtcpedit. Hence any packet editing
  42. improvements should be done there. However, please remember that tcprewrite
  43. is not the only application which uses libtcpedit (tcpbridge is another
  44. example) so make sure you test your code there too.