1
0

HACKING 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. $Id$
  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 Aaron Turner
  10. and Fred Klassen - Appneta Inc.
  11. If you have any questions regarding any of the three above stipulations,
  12. feel free to email the list at: tcpreplay-users@lists.sourceforge.net
  13. 1. Introduction
  14. If you're reading this to find out how to add a new feature or fix a bug in
  15. tcpreplay or tcpprep, then you've come to the right place. This isn't the
  16. place to find answers regarding how to use tcpreplay, the meaning of life,
  17. etc.
  18. 2. File Layout
  19. The file layout is pretty simple:
  20. / - Base directory
  21. /lib - 3rd party libraries stolen verbatim
  22. /libopts - GNU AutoOpts tearoff
  23. /src - Main code routines
  24. /src/common - Common routines for all binaries
  25. /src/tcpedit - libtcpedit
  26. /src/tcpedit/plugins - plugins for libtcpedit (mostly DLT)
  27. /docs - Where to find documentation
  28. /test - Test scripts and stuff which is used during 'make test'
  29. 3. Coding Standards
  30. 1) Indent 4 spaces using spaces, not tabs
  31. 2) Opening braces for control blocks (if, while, etc) should be on the same line
  32. 3) Opening braces for functions should be on next line
  33. 4) Use provided warnx, dbg, and errx functions provided in err.h
  34. 5) Use provided safe_strdup, safe_malloc and safe_realloc functions provided
  35. in common/utils.h
  36. 6) Use provided strl* functions in lib/strlcat.c and lib/strlcpy.c
  37. 4. Adding support for additional DLTs (Data Link Types)
  38. libtcpedit supports a plugin based architecture for handling different DLT
  39. types. If you wish to add support for another DLT type, you should read:
  40. http://tcpreplay.synfin.net/wiki/tcpeditDeveloper
  41. Which contains information on creating new DLT plugins.
  42. 5. Hacking tcprewrite
  43. Tcprewrite is basically a front-end to libtcpedit. Hence any packet editing
  44. improvements should be done there. However, please remember that tcprewrite
  45. is not the only application which uses libtcpedit (tcpbridge is another
  46. example) so make sure you test your code there too.