aboutsummaryrefslogtreecommitdiffstats
path: root/src/ragel
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-27 08:38:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-27 08:38:27 +0100
commit09f116bb2596ad0593fe2ad24c1c2f6297d638ad (patch)
tree83342b4374246e01b46462fe9404c5faee0e49b5 /src/ragel
parenta310f8defd90479ca09274fab1958addb4fb95ae (diff)
downloadrspamd-09f116bb2596ad0593fe2ad24c1c2f6297d638ad.tar.gz
rspamd-09f116bb2596ad0593fe2ad24c1c2f6297d638ad.zip
[Minor] Remove ragel version
Diffstat (limited to 'src/ragel')
-rw-r--r--src/ragel/content_type_parser.rl170
1 files changed, 0 insertions, 170 deletions
diff --git a/src/ragel/content_type_parser.rl b/src/ragel/content_type_parser.rl
deleted file mode 100644
index f248e0116..000000000
--- a/src/ragel/content_type_parser.rl
+++ /dev/null
@@ -1,170 +0,0 @@
-%%{
- machine content_type_parser;
-
- action Type_Start {
- qstart = NULL;
- qend = NULL;
- ct->type.begin = p;
- }
-
- action Type_End {
- if (qstart) {
- ct->type.begin = qstart;
- }
- if (qend && qend >= qstart) {
- ct->type.len = qend - qstart;
- }
- else if (p >= ct->type.begin) {
- ct->type.len = p - ct->type.begin;
- }
- qstart = NULL;
- qend = NULL;
- }
-
- action Subtype_Start {
- qstart = NULL;
- qend = NULL;
- ct->subtype.begin = p;
- }
-
- action Subtype_End {
- if (qstart) {
- ct->subtype.begin = qstart;
- }
- if (qend && qend >= qstart) {
- ct->subtype.len = qend - qstart;
- }
- else if (p >= ct->subtype.begin) {
- ct->subtype.len = p - ct->subtype.begin;
- }
- qstart = NULL;
- qend = NULL;
- }
-
- action Param_Name_Start {
- printf("name start: %s\n", p);
- qstart = NULL;
- qend = NULL;
- pname_start = p;
- pname_end = NULL;
- }
-
-
- action Param_Name_End {
- printf("name end: %s\n", p);
- if (qstart) {
- pname_start = qstart;
- }
- if (qstart && qend && qend >= qstart) {
- pname_end = qend;
- }
- else if (p >= pname_start) {
- pname_end = p;
- }
-
- if (qstart && qend) {
- qstart = NULL;
- qend = NULL;
- }
- }
-
-
- action Param_Value_Start {
- printf("value start: %s\n", p);
- if (qend) {
- qstart = NULL;
- qend = NULL;
- }
-
- if (pname_end && !pvalue_start) {
- pvalue_start = p;
- pvalue_end = NULL;
- }
- }
-
-
- action Param_Value_End {
- printf("value end: %s\n", p);
- if (pname_end && pname_start) {
- if (qstart) {
- pvalue_start = qstart;
-
- if (!qend) {
- pvalue_end = NULL;
- }
- }
-
- if (qend && qend >= qstart) {
- if (qstart) {
- pvalue_end = qend;
- }
- else {
- pvalue_end = NULL;
- }
- }
- else if (!qstart && p >= pvalue_start) {
- pvalue_end = p;
- }
-
- if (pname_start && pvalue_start && pvalue_end && pvalue_end > pvalue_start
- && pname_end > pname_start) {
- rspamd_content_type_add_param (pool, ct, pname_start, pname_end,
- pvalue_start, pvalue_end);
- pname_start = NULL;
- pname_end = NULL;
- pvalue_start = NULL;
- pvalue_end = NULL;
- qend = NULL;
- qstart = NULL;
- }
- }
- }
-
- action Quoted_Str_Start {
- qstart = p;
- qend = NULL;
- }
-
- action Quoted_Str_End {
- if (qstart) {
- qend = p;
- }
- }
-
-
- include content_type "content_type.rl";
-
- main := content_type;
-
-}%%
-
-#include "smtp_parsers.h"
-#include "content_type.h"
-
-%% write data;
-
-gboolean
-rspamd_content_type_parser (const char *data, size_t len, struct rspamd_content_type *ct, rspamd_mempool_t *pool)
-{
- const char *p = data, *pe = data + len, *eof, *qstart = NULL, *qend = NULL,
- *pname_start = NULL, *pname_end = NULL, *pvalue_start = NULL, *pvalue_end = NULL;
- int cs, *stack = NULL;
- gsize top = 0;
- struct _ragel_st_storage {
- int *data;
- gsize size;
- } st_storage;
-
- memset (&st_storage, 0, sizeof (st_storage));
- memset (ct, 0, sizeof (*ct));
- eof = pe;
-
- %% write init;
- %% write exec;
-
- if (st_storage.data) {
- free (st_storage.data);
- }
-
- return ct->type.len > 0;
-}