You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smtp_received.rl 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. %%{
  2. machine smtp_received;
  3. # http://tools.ietf.org/html/rfc5321#section-4.4
  4. Addtl_Link = Atom;
  5. Link = "TCP" | Addtl_Link;
  6. Attdl_Protocol = Atom;
  7. Protocol = "ESMTP"i %ESMTP_proto |
  8. "SMTP"i %SMTP_proto |
  9. "ESMTPS"i %ESMTPS_proto |
  10. "ESMTPA"i %ESMTPA_proto |
  11. "ESMTPSA"i %ESMTPSA_proto |
  12. "LMTP"i %LMTP_proto |
  13. "IMAP"i %IMAP_proto |
  14. Attdl_Protocol;
  15. TCP_info = address_literal >Real_IP_Start %Real_IP_End |
  16. ( Domain >Real_Domain_Start %Real_Domain_End FWS address_literal >Real_IP_Start %Real_IP_End ) |
  17. ( non_conformant_address_literal >Real_IP_Start %Real_IP_End );
  18. Extended_Domain = (Domain >Real_Domain_Start %Real_Domain_End | # Used to be a real domain
  19. ( Domain >Reported_Domain_Start %Reported_Domain_End FWS "(" TCP_info ")" ) | # Here domain is something specified by remote side
  20. ( address_literal >Real_Domain_Start %Real_Domain_End FWS "(" TCP_info ")" ) );
  21. ccontent = ctext | FWS | '(' @{ fcall balanced_ccontent; };
  22. balanced_ccontent := ccontent* ')' @{ fret; };
  23. comment = "(" ((WSP* ccontent)* WSP*) >Comment_Start %Comment_End ")";
  24. CFWS = WSP* (comment+ WSP*)*;
  25. From_domain = "FROM"i FWS Extended_Domain >From_Start %From_End;
  26. By_domain = "BY"i FWS Extended_Domain >By_Start %By_End;
  27. Retarded_Domain = TCP_info;
  28. From_domain_retarded = "FROM"i FWS Retarded_Domain >From_Start %From_End;
  29. Via = CFWS "VIA"i FWS Link;
  30. With = CFWS "WITH"i FWS Protocol;
  31. id_left = dot_atom_text;
  32. no_fold_literal = "[" dtext* "]";
  33. id_right = dot_atom_text | no_fold_literal;
  34. msg_id = "<" id_left "@" id_right ">";
  35. ID = CFWS "ID"i FWS ( Dot_string | msg_id );
  36. For = CFWS "FOR"i FWS ( Path | Mailbox ) >For_Start %For_End;
  37. Additional_Registered_Clauses = CFWS Atom FWS String;
  38. Opt_info = Via? With? ID? For? Additional_Registered_Clauses?;
  39. # Here we make From part optional just because many received headers lack it
  40. Received = From_domain? CFWS? By_domain? CFWS? Opt_info CFWS? ";" FWS date_time >Date_Start %Date_End CFWS?;
  41. Received_retarded = From_domain_retarded CFWS? By_domain? CFWS? Opt_info CFWS? ";" FWS date_time >Date_Start %Date_End CFWS?;
  42. prepush {
  43. if (top >= st_storage.size) {
  44. st_storage.size = (top + 1) * 2;
  45. st_storage.data = realloc (st_storage.data, st_storage.size * sizeof (int));
  46. g_assert (st_storage.data != NULL);
  47. stack = st_storage.data;
  48. }
  49. }
  50. }%%