• Nils Goroll's avatar
    vcc: Expand SUB type, add possible calling methods · bba4b145
    Nils Goroll authored
    Until now, the VCC SUB type represented the literal name of a
    vcc-generated C function, which was used to expand the VCL "call"
    action.
    
    We now add a struct to describe VCL subs and calculate a bitmask which
    represents the bilt-in subs which a SUB may be called from (the
    "okmask"),
    
    This is in preparation of the goal to add a VCL_SUB vmod type which
    will allow VMODs to call into vcl subs.
    
    We add to the vcl shared object a struct vcl_sub for each sub, which
    contains:
    
    	- a methods bitmask defining which built-in subs this sub may
    	  be called from (directly or indirectly)
    	- the name as seen from vcl
    	- a pointer back to the VCL_conf
    	- the function pointer to the vcl_func_f
    	- a unique number
    
    About the methods bitmask:
    
    It contains the VCL_MET_* bits of of built-in subs (traditionally
    called methods) which are allowed to call this sub.
    
    It is intended for checks like
    
    	if (sub->methods & ctx->method) {
    		sub->func(ctx);
    		return;
    	} else {
    		VRT_fail(ctx, "not allowed here");
    		return;
    	}
    
    In existing compile-time calls, we already check if used objects and
    returned actions are allowed within the respective calling context.
    
    To build the methods bitmask, we begin with a VCL_MET_TASK_ALL
    bitfield and clear the bits of methods which would not be allowed for
    any used object or returned action.
    
    About the VCL_conf pointer:
    
    Each VCL SUB belongs to a VCL, this pointer will allow to check that
    it is only ever used from the right VCL.
    
    About the unique number:
    
    By numbering vcl subs (per VCL), we can later implement a recursion
    check using a bitmask.
    
    In struct VCL_conf, we record the total number of subs.
    bba4b145
Name
Last commit
Last update
..
compat Loading commit data...
tbl Loading commit data...
vapi Loading commit data...
Makefile.am Loading commit data...
generate.py Loading commit data...
libvcc.h Loading commit data...
miniobj.h Loading commit data...
vas.h Loading commit data...
vav.h Loading commit data...
vbh.h Loading commit data...
vbm.h Loading commit data...
vbm_test.c Loading commit data...
vcc_interface.h Loading commit data...
vcli.h Loading commit data...
vcli_serve.h Loading commit data...
vcs.h Loading commit data...
vct.h Loading commit data...
vcurses.h Loading commit data...
vdef.h Loading commit data...
venc.h Loading commit data...
vend.h Loading commit data...
vev.h Loading commit data...
vfil.h Loading commit data...
vfl.h Loading commit data...
vin.h Loading commit data...
vjsn.h Loading commit data...
vlu.h Loading commit data...
vmb.h Loading commit data...
vnum.h Loading commit data...
vpf.h Loading commit data...
vqueue.h Loading commit data...
vre.h Loading commit data...
vrnd.h Loading commit data...
vrt.h Loading commit data...
vsa.h Loading commit data...
vsb.h Loading commit data...
vsc_priv.h Loading commit data...
vsha256.h Loading commit data...
vsl_priv.h Loading commit data...
vsm_priv.h Loading commit data...
vss.h Loading commit data...
vsub.h Loading commit data...
vtcp.h Loading commit data...
vtim.h Loading commit data...
vtree.h Loading commit data...
vus.h Loading commit data...
vut.h Loading commit data...
vut_options.h Loading commit data...