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_ip.rl 1.3KB

123456789101112131415161718192021222324252627282930313233343536
  1. %%{
  2. machine smtp_ip;
  3. # Parses IPv4/IPv6 address
  4. # Source: https://tools.ietf.org/html/rfc5321#section-4.1.3
  5. # Dependencies: none
  6. # Required actions:
  7. # - IP4_start
  8. # - IP4_end
  9. # - IP6_start
  10. # - IP6_end
  11. # - Domain_addr_start
  12. # - Domain_addr_end
  13. Snum = digit{1,3};
  14. IPv4_addr = (Snum ("." Snum){3});
  15. IPv4_address_literal = IPv4_addr >IP4_start %IP4_end;
  16. IPv6_hex = xdigit{1,4};
  17. IPv6_full = IPv6_hex (":" IPv6_hex){7};
  18. IPv6_comp = (IPv6_hex (":" IPv6_hex){0,5})? "::"
  19. (IPv6_hex (":" IPv6_hex){0,5})?;
  20. IPv6v4_full = IPv6_hex (":" IPv6_hex){5} ":" IPv4_address_literal;
  21. IPv6v4_comp = (IPv6_hex (":" IPv6_hex){0,3})? "::"
  22. (IPv6_hex (":" IPv6_hex){0,3} ":")?
  23. IPv4_address_literal;
  24. IPv6_simple = IPv6_full | IPv6_comp;
  25. IPv6_addr = IPv6_simple | IPv6v4_full | IPv6v4_comp;
  26. IPv6_address_literal = "IPv6:" %IP6_start IPv6_addr %IP6_end;
  27. General_address_literal = Standardized_tag ":" dcontent+;
  28. address_literal = "[" ( IPv4_address_literal |
  29. IPv6_address_literal |
  30. General_address_literal ) >Domain_addr_start %Domain_addr_end "]";
  31. non_conformant_address_literal = IPv4_address_literal >Domain_addr_start %Domain_addr_end;
  32. }%%