lib/libvarnishapi/vsl_dispatch.c
static int
vtx_parse_link(const char *str, enum VSL_transaction_e *ptype,
    unsigned *pvxid, enum VSL_reason_e *preason)
{
	char type[16], reason[16];
	unsigned vxid;
	int i;
	enum VSL_transaction_e et;
	enum VSL_reason_e er;

	AN(str);
	AN(ptype);
	AN(pvxid);
	AN(preason);

	i = sscanf(str, "%15s %u %15s", type, &vxid, reason);
	if (i < 1)
		return (0);

	/* transaction type */
	for (et = VSL_t_unknown; et < VSL_t__MAX; et++)
		if (!strcmp(type, vsl_t_names[et]))
			break;
	if (et >= VSL_t__MAX)
		et = VSL_t_unknown;
	*ptype = et;
	if (i == 1)
		return (1);

	/* vxid */
	assert((vxid & ~VSL_IDENTMASK) == 0);
	*pvxid = vxid;
	if (i == 2)
		return (2);

	/* transaction reason */
	for (er = VSL_r_unknown; er < VSL_r__MAX; er++)
		if (!strcmp(reason, vsl_r_names[er]))
			break;
	if (er >= VSL_r__MAX)
		er = VSL_r_unknown;
	*preason = er;
	return (3);
}
/* Parse a begin or link record. Returns the number of elements that was
   successfully parsed. */
Parse a begin or link record. Returns the number of elements that was
successfully parsed.
Parse a begin or link record . Returns the number of elements that was successfully parsed .
static int
vtx_parse_link(const char *str, enum VSL_transaction_e *ptype,
    unsigned *pvxid, enum VSL_reason_e *preason)
{
	char type[16], reason[16];
	unsigned vxid;
	int i;
	enum VSL_transaction_e et;
	enum VSL_reason_e er;
	AN(str);
	AN(ptype);
	AN(pvxid);
	AN(preason);
	i = sscanf(str, "%15s %u %15s", type, &vxid, reason);
	if (i < 1)
		return (0);
	for (et = VSL_t_unknown; et < VSL_t__MAX; et++)
		if (!strcmp(type, vsl_t_names[et]))
			break;
	if (et >= VSL_t__MAX)
		et = VSL_t_unknown;
	*ptype = et;
	if (i == 1)
		return (1);
	assert((vxid & ~VSL_IDENTMASK) == 0);
	*pvxid = vxid;
	if (i == 2)
		return (2);
	for (er = VSL_r_unknown; er < VSL_r__MAX; er++)
		if (!strcmp(reason, vsl_r_names[er]))
			break;
	if (er >= VSL_r__MAX)
		er = VSL_r_unknown;
	*preason = er;
	return (3);
}
static int vtx_parse_link ( const char * str , enum VSL_transaction_e * ptype , unsigned * pvxid , enum VSL_reason_e * preason ) { char type [ 16 ] , reason [ 16 ] ; unsigned vxid ; int i ; enum VSL_transaction_e et ; enum VSL_reason_e er ; AN ( str ) ; AN ( ptype ) ; AN ( pvxid ) ; AN ( preason ) ; i = sscanf ( str , " " , type , & vxid , reason ) ; if ( i < 1 ) return ( 0 ) ; for ( et = VSL_t_unknown ; et < VSL_t__MAX ; et ++ ) if ( ! strcmp ( type , vsl_t_names [ et ] ) ) break ; if ( et >= VSL_t__MAX ) et = VSL_t_unknown ; * ptype = et ; if ( i == 1 ) return ( 1 ) ; assert ( ( vxid & ~ VSL_IDENTMASK ) == 0 ) ; * pvxid = vxid ; if ( i == 2 ) return ( 2 ) ; for ( er = VSL_r_unknown ; er < VSL_r__MAX ; er ++ ) if ( ! strcmp ( reason , vsl_r_names [ er ] ) ) break ; if ( er >= VSL_r__MAX ) er = VSL_r_unknown ; * preason = er ; return ( 3 ) ; }
Parse a begin or link record.
Parse a begin or link record .
/* transaction type */ /* vxid */ /* transaction reason */