*** openser-devel/modules/enum/enum.c	Fri Sep  2 23:29:17 2005
--- openser-devel-current/modules/enum/enum.c	Fri Jan 20 14:04:05 2006
***************
*** 51,56 ****
--- 51,99 ----
  }
  
  
+ /* Parse NAPTR regexp field of the form !pattern!replacement! and return its
+  * components in pattern and replacement parameters.  Regexp field starts at
+  * address first and is len characters long.
+  */
+ static inline int parse_naptr_regexp(char* first, int len, str* pattern,
+ 										str* replacement)
+ {
+ 	char *second, *third;
+ 
+ 	if (len > 0) {
+ 		if (*first == '!') {
+ 			second = (char *)memchr((void *)(first + 1), '!', len - 1);
+ 			if (second) {
+ 				len = len - (second - first + 1);
+ 				if (len > 0) {
+ 					third = memchr(second + 1, '!', len);
+ 					if (third) {
+ 						pattern->len = second - first - 1;
+ 						pattern->s = first + 1;
+ 						replacement->len = third - second - 1;
+ 						replacement->s = second + 1;
+ 						return 1;
+ 					} else {
+ 						LOG(LOG_ERR, "parse_regexp(): third ! missing from regexp\n");
+ 						return -1;
+ 					}
+ 				} else {
+ 					LOG(LOG_ERR, "parse_regexp(): third ! missing from regexp\n");
+ 					return -2;
+ 				}
+ 			} else {
+ 				LOG(LOG_ERR, "parse_regexp(): second ! missing from regexp\n");
+ 				return -3;
+ 			}
+ 		} else {
+ 			LOG(LOG_ERR, "parse_regexp(): first ! missing from regexp\n");
+ 			return -4;
+ 		}
+ 	} else {
+ 		LOG(LOG_ERR, "parse_regexp(): regexp missing\n");
+ 		return -5;
+ 	}
+ }
  /* Checks if NAPTR record has flag u and its services field
   * e2u+[service:]sip or
   * e2u+service[+service[+service[+...]]]
***************
*** 167,218 ****
  	return result;
  }
  
  
! /* Parse NAPTR regexp field of the form !pattern!replacement! and return its
!  * components in pattern and replacement parameters.  Regexp field starts at
!  * address first and is len characters long.
   */
! static inline int parse_naptr_regexp(char* first, int len, str* pattern,
! 										str* replacement)
  {
! 	char *second, *third;
  
! 	if (len > 0) {
! 		if (*first == '!') {
! 			second = (char *)memchr((void *)(first + 1), '!', len - 1);
! 			if (second) {
! 				len = len - (second - first + 1);
! 				if (len > 0) {
! 					third = memchr(second + 1, '!', len);
! 					if (third) {
! 						pattern->len = second - first - 1;
! 						pattern->s = first + 1;
! 						replacement->len = third - second - 1;
! 						replacement->s = second + 1;
! 						return 1;
! 					} else {
! 						LOG(LOG_ERR, "parse_regexp(): third ! missing from regexp\n");
! 						return -1;
! 					}
! 				} else {
! 					LOG(LOG_ERR, "parse_regexp(): third ! missing from regexp\n");
! 					return -2;
! 				}
! 			} else {
! 				LOG(LOG_ERR, "parse_regexp(): second ! missing from regexp\n");
! 				return -3;
! 			}
! 		} else {
! 			LOG(LOG_ERR, "parse_regexp(): first ! missing from regexp\n");
  			return -4;
  		}
! 	} else {
! 		LOG(LOG_ERR, "parse_regexp(): regexp missing\n");
! 		return -5;
  	}
  }
  
  
  /* 
   * Add parameter to URI.
   */
--- 210,381 ----
  	return result;
  }
  
+ /*
+  * Call is_from_user_enum_2 with module parameter suffix and default service.
+  */
+ int is_from_user_enum_0(struct sip_msg* _msg, char* _str1, char* _str2)
+ {
+ 	return is_from_user_enum_2(_msg, (char *)(&suffix), (char *)(&service));
+ }
  
! /*
!  * Call is_from_user_enum_2 with given suffix and default service.
   */
! int is_from_user_enum_1(struct sip_msg* _msg, char* _suffix, char* _str2)
  {
! 	return is_from_user_enum_2(_msg, _suffix, (char *)(&service));
! }
  
! /*
!  * Check if from user is a valid enum based user, and check to make sure
!  * that the src_ip == an srv record that maps to the enum from user.
!  */
! int is_from_user_enum_2(struct sip_msg* _msg, char* _suffix, char* _service)
! {
! 	struct ip_addr addr;
! 	struct hostent* he;
! 	unsigned short zp;
! 	char *user_s;
! 	int user_len, i, j;
! 	char name[MAX_DOMAIN_SIZE];
! 	char uri[MAX_URI_SIZE];
! 	struct to_body* body;
! 	struct sip_uri muri;
! 	struct sip_uri luri;
! 	struct rdata* head;
! 
! 	str* suffix;
! 	str* service;
! 
! 	struct rdata* l;
! 	struct naptr_rdata* naptr;
! 
! 	str pattern, replacement, result;
! 	char string[17];
! 
! 	body = get_parsed_from_body(_msg);
! 	if (!body) return -1;
! 
! 	if (parse_uri(body->uri.s, body->uri.len, &muri) < 0) {
! 		LOG(L_ERR, "is_from_user_e164(): Error while parsing From uri\n");
! 		return -1;
! 	}
! 
! 	suffix = (str*)_suffix;
! 	service = (str*)_service;
! 
! 	if (is_e164(&(muri.user)) == -1) {
! 		LOG(L_ERR, "is_from_user_valid(): from user is not an E164 number\n");
! 		return -2;
! 	}
! 
! 	/* assert: the from user is a valid formatted e164 string */
! 
! 	user_s = muri.user.s;
! 	user_len = muri.user.len;
! 
! 	j = 0;
! 	for (i = user_len - 1; i > 0; i--) {
! 		name[j] = user_s[i];
! 		name[j + 1] = '.';
! 		j = j + 2;
! 	}
! 
! 	memcpy(name + j, suffix->s, suffix->len + 1);
! 
! 	head = get_record(name, T_NAPTR);
! 
! 	if (head == 0) {
! 		DBG("enum_query(): No NAPTR record found for %s.\n", name);
! 		return -3;
! 	}
! 
! 	/* we have the naptr records, loop and find an srv record with */
! 	/* same ip address as source ip address, if we do then true is returned */
! 
! 	for (l = head; l; l = l->next) {
! 
! 		if (l->type != T_NAPTR) continue; /*should never happen*/
! 		naptr = (struct naptr_rdata*)l->rdata;
! 		if (naptr == 0) {
! 			LOG(L_CRIT, "is_from_user_enum: BUG: null rdata\n");
! 			free_rdata_list(head);
  			return -4;
  		}
! 
! 		DBG("is_from_user_enum(): order %u, pref %u, flen %u, flags '%.*s', slen %u, "
! 		    "services '%.*s', rlen %u, regexp '%.*s'\n", naptr->order, naptr->pref,
! 		    naptr->flags_len, (int)(naptr->flags_len), ZSW(naptr->flags), naptr->services_len,
! 		    (int)(naptr->services_len), ZSW(naptr->services), naptr->regexp_len,
! 		    (int)(naptr->regexp_len), ZSW(naptr->regexp));
! 
! 		if (sip_match(naptr, service) != 0) {
! 			if (parse_naptr_regexp(&(naptr->regexp[0]), naptr->regexp_len,
! 					 &pattern, &replacement) < 0) {
! 				free_rdata_list(head); /*clean up*/
! 				LOG(L_ERR, "is_from_user_enum(): parsing of NAPTR regexp failed\n");
! 				return -5;
! 			}
! #ifdef LATER
! 			if ((pattern.len == 4) && (strncmp(pattern.s, "^.*$", 4) == 0)) {
! 				DBG("is_from_user_enum(): resulted in replacement: '%.*s'\n",
! 				    replacement.len, ZSW(replacement.s));				
! 				retval = set_uri(_msg, replacement.s, replacement.len);
! 				free_rdata_list(head); /*clean up*/
! 				return retval;
! 			}
! #endif
! 			result.s = &(uri[0]);
! 			result.len = MAX_URI_SIZE;
! 			/* Avoid making copies of pattern and replacement */
! 			pattern.s[pattern.len] = (char)0;
! 			replacement.s[replacement.len] = (char)0;
! 			/* We have already checked the size of
! 			   _msg->parsed_uri.user.s */ 
! 			memcpy(&(string[0]), user_s, user_len);
! 			string[user_len] = (char)0;
! 			if (reg_replace(pattern.s, replacement.s, &(string[0]),
! 					&result) < 0) {
! 				pattern.s[pattern.len] = '!';
! 				replacement.s[replacement.len] = '!';
! 				LOG(L_ERR, "is_from_user_enum(): regexp replace failed\n");
! 				free_rdata_list(head); /*clean up*/
! 				return -6;
! 			}
! 			DBG("is_from_user_enum(): resulted in replacement: '%.*s'\n",
! 			    result.len, ZSW(result.s));
! 
! 			if(parse_uri(result.s, result.len, &luri) < 0)
! 			{
! 				LOG(L_ERR, "is_from_user_enum(): parse uri failed\n");
! 				free_rdata_list(head); /*clean up*/
! 				return -7;
! 			}
! 
! 			pattern.s[pattern.len] = '!';
! 			replacement.s[replacement.len] = '!';
! 
! 			zp = 0;
! 			he = sip_resolvehost(&luri.host, &zp, PROTO_UDP);
! 
! 			hostent2ip_addr(&addr, he, 0);
! 
! 			if(ip_addr_cmp(&addr, &_msg->rcv.src_ip))
! 			{
! 				free_rdata_list(head);
! 				return(1);
! 			}
! 		}
  	}
+ 	free_rdata_list(head); /*clean up*/
+ 	LOG(L_INFO, "is_from_user_enum(): FAIL\n");
+ 
+     /* must not have found the record */
+     return(-8);
  }
  
  
+ 
  /* 
   * Add parameter to URI.
   */
***************
*** 469,474 ****
--- 632,826 ----
  			new_result.len = MAX_URI_SIZE;
  			if (add_uri_param(&result, &param, &new_result) == 0) {
  				LOG(L_ERR, "ERROR: enum_query(): Parsing of URI failed\n");
+ 				continue;
+ 			}
+ 			if (new_result.len > 0) {
+ 				result = new_result;
+ 			}
+ 		}
+ 
+ 		if (first) {
+ 			if (rewrite_uri(_msg, &result) == -1) {
+ 				goto done;
+ 			}
+ 			set_ruri_q(q);
+ 			first = 0;
+ 			curr_prio = ((naptr->order) << 16) + naptr->pref;
+ 		} else {
+ 			priority = ((naptr->order) << 16) + naptr->pref;
+ 			if (priority > curr_prio) {
+ 				q = q - 10;
+ 				curr_prio = priority;
+ 			}
+ 			if (append_branch(_msg, &result, 0, q, 0, 0) == -1) {
+ 				goto done;
+ 			}
+ 		}
+ 	}
+ 
+ done:
+ 	free_rdata_list(head);
+ 	return first ? -1 : 1;
+ }
+ 
+ /*
+  * Call enum_fquery_2 with module parameter suffix and default service.
+  */
+ int enum_fquery_0(struct sip_msg* _msg, char* _str1, char* _str2)
+ {
+ 	return enum_fquery_2(_msg, (char *)(&suffix), (char *)(&service));
+ }
+ 
+ /*
+  * Call enum_fquery_2 with given suffix and default service.
+  */
+ int enum_fquery_1(struct sip_msg* _msg, char* _suffix, char* _str2)
+ {
+ 	return enum_fquery_2(_msg, _suffix, (char *)(&service));
+ }
+ 
+ /*
+  * See documentation in README file.
+  */
+ 
+ int enum_fquery_2(struct sip_msg* _msg, char* _suffix, char* _service)
+ {
+ 	char *user_s;
+ 	int user_len, i, j, first;
+ 	char name[MAX_DOMAIN_SIZE];
+ 	char uri[MAX_URI_SIZE];
+ 	char new_uri[MAX_URI_SIZE];
+ 	unsigned int priority, curr_prio;
+ 	struct to_body* body;
+ 	struct sip_uri muri;
+ 	qvalue_t q;
+ 	char tostring[17];
+ 	struct rdata* head;
+ 	struct rdata* l;
+ 	struct naptr_rdata* naptr;
+ 
+ 	str pattern, replacement, result, new_result;
+ 
+ 	char string[17];
+ 
+ 	/*
+ 	** all of this to pick up the 'to' string
+ 	*/
+ 	if (parse_sip_msg_uri(_msg) < 0) {
+ 		LOG(L_ERR, "enum_query(): uri parsing failed\n");
+ 		return -1;
+ 	}
+ 
+ 	if (is_e164(&(_msg->parsed_uri.user)) == -1) {
+ 		LOG(L_ERR, "enum_query(): uri user is not an E164 number\n");
+ 		return -1;
+ 	}
+ 
+ 	user_s = _msg->parsed_uri.user.s;
+ 	user_len = _msg->parsed_uri.user.len;
+ 
+ 	memcpy(&(tostring[0]), user_s, user_len);
+ 	tostring[user_len] = (char)0;
+ 	/*
+ 	** to here
+ 	*/
+ 
+ 
+ 	body = get_parsed_from_body(_msg);
+ 	if (!body) return -1;
+ 
+ 	if (parse_uri(body->uri.s, body->uri.len, &muri) < 0) {
+ 		LOG(L_ERR, "is_from_user_e164(): Error while parsing From uri\n");
+ 		return -1;
+ 	}
+ 
+ 	str *suffix, *service;
+ 
+ 	suffix = (str*)_suffix;
+ 	service = (str*)_service;
+ 
+ 	if (is_e164(&(muri.user)) == -1) {
+ 		LOG(L_ERR, "enum_fquery(): uri user is not an E164 number\n");
+ 		return -1;
+ 	}
+ 
+ 	user_s = muri.user.s;
+ 	user_len = muri.user.len;
+ 
+ 	memcpy(&(string[0]), user_s, user_len);
+ 	string[user_len] = (char)0;
+ 
+ 	j = 0;
+ 	for (i = user_len - 1; i > 0; i--) {
+ 		name[j] = user_s[i];
+ 		name[j + 1] = '.';
+ 		j = j + 2;
+ 	}
+ 
+ 	memcpy(name + j, suffix->s, suffix->len + 1);
+ 
+ 	head = get_record(name, T_NAPTR);
+ 
+ 	if (head == 0) {
+ 		DBG("enum_fquery(): No NAPTR record found for %s.\n", name);
+ 		return -1;
+ 	}
+ 
+ 	naptr_sort(&head);
+ 
+ 	q = MAX_Q - 10;
+ 	curr_prio = 0;
+ 	first = 1;
+ 
+ 	for (l = head; l; l = l->next) {
+ 
+ 		if (l->type != T_NAPTR) continue; /*should never happen*/
+ 		naptr = (struct naptr_rdata*)l->rdata;
+ 		if (naptr == 0) {
+ 			LOG(L_CRIT, "enum_fquery: BUG: null rdata\n");
+ 			continue;
+ 		}
+ 
+ 		DBG("enum_fquery(): order %u, pref %u, flen %u, flags '%.*s', slen %u, "
+ 		    "services '%.*s', rlen %u, regexp '%.*s'\n", naptr->order, naptr->pref,
+ 		    naptr->flags_len, (int)(naptr->flags_len), ZSW(naptr->flags),
+ 		    naptr->services_len,
+ 		    (int)(naptr->services_len), ZSW(naptr->services), naptr->regexp_len,
+ 		    (int)(naptr->regexp_len), ZSW(naptr->regexp));
+ 
+ 		if (sip_match(naptr, service) == 0) continue;
+ 
+ 		if (parse_naptr_regexp(&(naptr->regexp[0]), naptr->regexp_len,
+ 				       &pattern, &replacement) < 0) {
+ 			LOG(L_ERR, "enum_fquery(): parsing of NAPTR regexp failed\n");
+ 			continue;
+ 		}
+ 		result.s = &(uri[0]);
+ 		result.len = MAX_URI_SIZE;
+ 		/* Avoid making copies of pattern and replacement */
+ 		pattern.s[pattern.len] = (char)0;
+ 		replacement.s[replacement.len] = (char)0;
+ 		if (reg_replace(pattern.s, replacement.s, &(tostring[0]),
+ 				&result) < 0) {
+ 			pattern.s[pattern.len] = '!';
+ 			replacement.s[replacement.len] = '!';
+ 			LOG(L_ERR, "enum_fquery(): regexp replace failed\n");
+ 			continue;
+ 		}
+ 		DBG("enum_fquery(): resulted in replacement: '%.*s'\n",
+ 		    result.len, ZSW(result.s));
+ 		pattern.s[pattern.len] = '!';
+ 		replacement.s[replacement.len] = '!';
+ 		
+ 		if (param.len > 0) {
+ 			if (result.len + param.len > MAX_URI_SIZE - 1) {
+ 				LOG(L_ERR, "ERROR: enum_fquery(): URI is too long\n");
+ 				continue;
+ 			}
+ 			new_result.s = &(new_uri[0]);
+ 			new_result.len = MAX_URI_SIZE;
+ 			if (add_uri_param(&result, &param, &new_result) == 0) {
+ 				LOG(L_ERR, "ERROR: enum_fquery(): Parsing of URI failed\n");
  				continue;
  			}
  			if (new_result.len > 0) {
*** openser-devel/modules/enum/enum.h	Mon Jun 13 11:47:38 2005
--- openser-devel-current/modules/enum/enum.h	Wed Jan 18 15:26:55 2006
***************
*** 38,43 ****
--- 38,58 ----
   */
  int is_from_user_e164(struct sip_msg* _msg, char* _s1, char* _s2);
  
+ /*
+  * Check if from user is an e164 number and has a naptr record
+  */
+ int is_from_user_enum_0(struct sip_msg* _msg, char* _str1, char* _str2);
+ int is_from_user_enum_1(struct sip_msg* _msg, char* _suffix, char* _str2);
+ int is_from_user_enum_2(struct sip_msg* _msg, char* _suffix, char* _service);
+ 
+ /*
+  * do source number destination routing.
+  * that is, make the ruri based on the from number
+  * this is like source ip policy routing
+  */
+ int enum_fquery_0(struct sip_msg* _msg, char* _str1, char* _str2);
+ int enum_fquery_1(struct sip_msg* _msg, char* _suffix, char* _str2);
+ int enum_fquery_2(struct sip_msg* _msg, char* _suffix, char* _service);
  
  /*
   * Make enum query and if query succeeds, replace current uri with the
*** openser-devel/modules/enum/enum_mod.c	Mon Jun 13 11:47:38 2005
--- openser-devel-current/modules/enum/enum_mod.c	Wed Jan 18 15:24:51 2006
***************
*** 70,79 ****
   * Exported functions
   */
  static cmd_export_t cmds[] = {
! 	{"enum_query",        enum_query_0,      0, 0,          REQUEST_ROUTE},
! 	{"enum_query",        enum_query_1,      1, str_fixup,  REQUEST_ROUTE},
! 	{"enum_query",        enum_query_2,      2, enum_fixup, REQUEST_ROUTE},
! 	{"is_from_user_e164", is_from_user_e164, 0, 0,          REQUEST_ROUTE},
  	{0, 0, 0, 0, 0}
  };
  
--- 70,85 ----
   * Exported functions
   */
  static cmd_export_t cmds[] = {
! 	{"enum_query",        enum_query_0,     0, 0,            REQUEST_ROUTE},
! 	{"enum_query",        enum_query_1,     1, str_fixup,    REQUEST_ROUTE},
! 	{"enum_query",        enum_query_2,     2, enum_fixup,   REQUEST_ROUTE},
! 	{"enum_fquery",       enum_fquery_0,    0, 0,            REQUEST_ROUTE},
! 	{"enum_fquery",       enum_fquery_1,    1, str_fixup,    REQUEST_ROUTE},
! 	{"enum_fquery",       enum_fquery_2,    2, enum_fixup,   REQUEST_ROUTE},
! 	{"is_from_user_enum", is_from_user_enum_0, 0, 0,         REQUEST_ROUTE},
! 	{"is_from_user_enum", is_from_user_enum_1, 1, str_fixup, REQUEST_ROUTE},
! 	{"is_from_user_enum", is_from_user_enum_2, 2, enum_fixup,REQUEST_ROUTE},
! 	{"is_from_user_e164",is_from_user_e164, 0, 0,            REQUEST_ROUTE},
  	{0, 0, 0, 0, 0}
  };
  
*** openser-devel/modules/enum/doc/enum_user.sgml	Tue Oct 25 23:26:56 2005
--- openser-devel-current/modules/enum/doc/enum_user.sgml	Sun Jan 29 11:14:35 2006
***************
*** 66,71 ****
--- 66,81 ----
  		by a '+' sign.
  	</para>
  	<para>
+ 		Most of the time you want to route based on the RURI.  On rare occasions
+ 		you may wish to route based on the user part of the <quote>From:</quote> tag,
+ 		analogous to source based policy routing in the ip world. The function
+ 		<function moreinfo="none">enum_fquery</function> mimics the behaviour
+ 		of the <function moreinfo="none">enum_query</function> function except the
+ 		user part of the <quote>From:</quote> is used for the enum lookup instead of the user
+ 		part of the RURI.  Obviously the user part of the RURI is still used in the
+ 		naptr regexp.
+ 	</para>
+ 	<para>
  		Enum query returns 1 if the current Request URI was replaced 
  		and -1 if not.
  	</para>
***************
*** 73,78 ****
--- 83,93 ----
  		Enum module also implements is_from_user_e164 function that checks if 
  		the user part of from URI is an E164 number.
  	</para>
+ 	<para>
+ 		Enum module also implements is_from_user_enum function.
+ 		This function does an enum lookup on the from user and
+ 		returns true if found, false otherwise.
+ 	</para>
  	</section>
  
  	<section>
***************
*** 187,192 ****
--- 202,260 ----
  	</section>
  
  	<section>
+ 		<title>
+ 		<function moreinfo="none">enum_fquery(),enum_fquery("suffix"), enum_fquery("suffix", "service")</function>
+ 		</title>
+ 		<para>
+ 		The function performs an enum query
+ 		on the user part of the From: tag and rewrites the Request-URI with 
+ 		the result of the query. See <xref linkend="sec-overview"/> for more 
+ 		information.
+ 		</para>
+ 		<para>Meaning of the parameters is as follows:</para>
+ 		<itemizedlist>
+ 		<listitem>
+ 			<para><emphasis>suffix</emphasis> - Suffix to be appended to the 
+ 			domain name.
+ 			</para>
+ 		</listitem>
+ 		<listitem>
+ 			<para><emphasis>service</emphasis> - Service string to be used in 
+ 			the service field.
+ 			</para>
+ 		</listitem>
+ 		</itemizedlist>
+ 		<para>
+ 		This function can be used from REQUEST_ROUTE.
+ 		</para>
+ 		<example>
+ 		<title><function moreinfo="none">enum_fquery</function> usage</title>
+ 		<programlisting format="linespecific">
+ ...
+ # search for "e2u+sip" in freenum.org 
+ enum_fquery("freenum.org.");
+ ...
+ # search for "e2u+sip" in default tree (configured as parameter)
+ enum_fquery();
+ ...
+ # search for "e2u+voice:sip" in e164.arpa
+ enum_fquery("e164.arpa.","voice");
+ ...
+ # search for service type "sip" or "voice:sip" or "video:sip"
+ # note the '+' sign in front of the second parameter
+ enum_fquery("e164.arpa.","+sip+voice:sip+video:sip");
+ ...
+ # quering for service sip and voice:sip
+ enum_fquery("e164.arpa.");
+ enum_fquery("e164.arpa.","voice");
+ # or use instead
+ enum_fquery("e164.arpa.","+sip+voice:sip");
+ ...
+ </programlisting>
+ 		</example>
+ 	</section>
+ 
+ 	<section>
  		<title><function moreinfo="none">is_from_user_e164()</function></title>
  		<para>
  		Checks if the user part of from <abbrev>URI</abbrev> an 
***************
*** 201,206 ****
--- 269,296 ----
  		<programlisting format="linespecific">
  ...
  if (is_from_user_e164()) {
+ 	....
+ };
+ ...
+ </programlisting>
+ 		</example>
+ 	</section>
+ 
+ 	<section>
+ 		<title><function moreinfo="none">is_from_user_enum()</function></title>
+ 		<para>
+ 		Checks if the user part of from <abbrev>URI</abbrev>
+ 		is found in an enum lookup.
+ 		Returns 1 if yes and -1 if not.
+ 		</para>
+ 		<para>
+ 		This function can be used from REQUEST_ROUTE.
+ 		</para>
+ 		<example>
+ 		<title><function moreinfo="none">is_from_user_enum</function> usage</title>
+ 		<programlisting format="linespecific">
+ ...
+ if (is_from_user_enum()) {
  	....
  };
  ...
