[Xorp-hackers] Template files

Pavlin Radoslavov pavlin at ICSI.Berkeley.EDU
Tue Jan 27 03:10:01 PST 2009


Victor Faion <vfaion at gmail.com> wrote:

> Hello,
> 
> Just wanted some help regarding template files. I was trying to write
> a simple template file for a process that has a function that just
> takes in an input message (string), modifies it and gives it back to
> the callback function, but I didn't know how. Or are the template
> files supposed to be automatically generated?

You need to write them by hand.

Your template file should look like the following. The string to be
set in the user config is "my-string", and the XRL itself is
"myproto/myproto/0.1/set_mystring?mystring:txt=$(@)"

Hope that helps,
Pavlin

protocols {
    myproto {
	targetname:	txt = "myproto";
	my-string:	txt;
    }
}

protocols {
    myproto {
	%help:		short		"Configure myproto";
	%modinfo:	provides	myproto;
/* XXX: uncomment if the FEA must be started first
	%modinfo:	depends		fea;
*/
	%modinfo:	path		"myproto/xorp_myproto";
	%modinfo:	default_targetname "myproto";
	%modinfo:	status_method	xrl "$(myproto.targetname)/common/0.1/get_status->status:u32&reason:txt";
	%modinfo:	shutdown_method	xrl "$(myproto.targetname)/common/0.1/shutdown";

	%mandatory:	$(@.targetname);

/* XXX: The optional XRL that will be called on startup
	%activate:	xrl "$(myproto.targetname)/myproto/0.1/start_myproto";
*/

	targetname {
	    %user-hidden: "XRL target name";
	    %help:	short "XRL target name";
	    %set:;
	}

	my-string {
	    %help:	short "Set my string";
	    %set:	xrl "$(myproto.targetname)/myproto/0.1/set_mystring?mystring:txt=$(@)";
	}
    }
}



More information about the Xorp-hackers mailing list