cmogstored.git  about / heads / tags
alternative mogstored implementation for MogileFS
blob 1231e7470b7bc1a13297cad0e5417bb9527aff99 645 bytes (raw)
$ git show HEAD:listen_parser_common.rl	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
/*
 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 */
%%{
	machine listen_parser_common;

	ipv4 = (digit+ '.' digit+ '.' digit+ '.' digit+)
		> { mark_beg = fpc; }
		@ {
			mark_len = fpc - mark_beg + 1;
			sa_family = AF_INET;
		};
	ipv6 = '['
			((xdigit|':')+)
			> { mark_beg = fpc; }
			@ { mark_len = fpc - mark_beg + 1; }
		']' @ { sa_family = AF_INET6; };
	port = (digit+)
		> { port_beg = fpc; }
		@ { port_len = fpc - port_beg + 1; };

	listen = (((ipv4|ipv6)? ':')? port ) $! {
		syslog(LOG_ERR, "bad character in IP address: %c", fc);
	};
}%%

git clone https://yhbt.net/cmogstored.git