Advertisement
fuzzy

Test BinPAC

Apr 3rd, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. analyzer TEST withcontext {
  2. connection: TEST_Conn;
  3. flow: TEST_Flow;
  4. };
  5.  
  6. connection TEST_Conn {
  7. upflow = TEST_Flow(true);
  8. downflow = TEST_Flow(false);
  9. };
  10.  
  11. type TEST_Client = record
  12. {
  13. header: TEST_Header;
  14. body: TEST_Body;
  15. };
  16.  
  17. type TEST_Header = record
  18. {
  19. header: "HEADER";
  20. } &oneline;
  21.  
  22. type TEST_Body = record
  23. {
  24. body: bytestring &restofflow &chunked;
  25. };
  26.  
  27. type TEST_PDU(is_orig: bool) = case is_orig of
  28. {
  29. true -> client: TEST_Client;
  30. };
  31.  
  32. flow TEST_Flow(is_orig: bool) {
  33. flowunit = TEST_PDU(is_orig) withcontext (connection, this);
  34. };
  35.  
  36. function header_done(header: TEST_Header): bool
  37. %{
  38. printf("Header done event\n");
  39. %}
  40.  
  41. function body_done(body: TEST_Body): bool
  42. %{
  43. printf("Body done event\n");
  44. %}
  45.  
  46. function message_done(pdu: TEST_PDU): bool
  47. %{
  48. printf("Message done event\n");
  49. %}
  50.  
  51. refine typeattr TEST_Header += &let {
  52. process_header: bool = header_done(this);
  53. };
  54.  
  55. refine typeattr TEST_Body += &let {
  56. process_body: bool = body_done(this);
  57. };
  58.  
  59. refine typeattr TEST_PDU += &let {
  60. process_message: bool = message_done(this);
  61. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement