cmogstored.git  about / heads / tags
alternative mogstored implementation for MogileFS
blob 97c4fe5911df1e2dd9da5ee6094608ee5f1d3491 638 bytes (raw)
$ git show gl-env: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-2016 all contributors <cmogstored-public@bogomips.org>
 * License: GPLv3 or later (see COPYING for details)
 */
%%{
	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