/* $XORP: xorp/xrl/interfaces/policy.xif,v 1.10 2007/07/12 21:35:29 pavlin Exp $ */

/**
 * Policy manager XRL interface.
 */
interface policy/0.1 {
	/**
	 * Create a term in a policy.
	 *
	 * The term will be the last term in the policy statement.
	 *
	 * @param policy the name of the policy.
	 * @param order position of term.
	 * @param term the name of the term.
	 */
	create_term ? policy:txt & order:txt & term:txt;

	/**
	 * Delete a term in a policy.
	 *
	 * @param policy the name of the policy.
	 * @param term the name of the term.
	 */
	delete_term ? policy:txt & term:txt;

	/**
	 * Update the source/dest/action block of a term in a policy.
	 *
	 * Note: if statement is empty, the previous one in that position will
	 * be deleted.
	 *
	 * @param policy the name of the policy.
	 * @param term the name of the term.
	 * @param block the block to update (0:source, 1:dest, 2:action).
	 * @param order numerical position (local) of statement.
	 * @param statement the statement to insert or delete.
	 */
	update_term_block ? policy:txt & term:txt & block:u32 & order:txt \
			  & statement:txt;
	
	/**
	 * Create a policy.
	 *
	 * @param policy name of the policy.
	 */
	create_policy ? policy:txt;

	/**
	 * Delete a policy.
	 *
	 * @param policy name of the policy.
	 */
	delete_policy ? policy:txt;

	/**
	 * Create a set.
	 *
	 * @param set name of the set.
	 */
	create_set ? set:txt;

	/**
	 * Replace elements in a set.
	 *
	 * @param type the type of the set.
	 * @param set name of the set.
	 * @param elements comma delimited list of set elements.
	 */
	update_set ? type:txt & set:txt & elements:txt;

	/**
	 * Delete a set.
	 *
	 * @param set name of the set.
	 */
	delete_set ? set:txt;

	/**
	 * Add an element to a set.
	 *
	 * @param type the type of the set.
	 * @param set name of the set.
	 * @param element the element to add.
	 */
	add_to_set ? type:txt & set:txt & element:txt;

	/**
	 * Delete an element from a set.
	 *
	 * @param type the type of the set.
	 * @param set name of the set.
	 * @param element the element to delete.
	 */
	delete_from_set ? type:txt & set:txt & element:txt;

	/**
	 * Commit the configuration.
	 */
	done_global_policy_conf;

	/**
	 * Replace import/export policies for a protocol.
	 *
	 * Will normally cause a delayed commit.
	 *
	 * @param protocol protocol for which policies must be replaced.
	 * @param policies comma separated list of policies.
	 * @param modifier a match statement to insert in each policy.
	 */
	import ? protocol:txt & policies:txt & modifier:txt;
	export ? protocol:txt & policies:txt & modifier:txt;

	/**
	 * Add a variable to the varmap configuration.
	 *
	 * @param protocol the protocol this variable is available to.
	 * @param variable name of the variable.
	 * @param type the type of the variable.
	 * @param access the permissions on the variable (r/rw).
	 * @param id unique id for this var.  Scoped by protocol.
	 */
	add_varmap ? protocol:txt & variable:txt & type:txt & access:txt \
		   & id:u32;

	/**
	 * Dump state of policy manager.  To be used ONLY for debugging.
	 *
	 * @param id which aspect of the internal state to dump.
	 */
	dump_state ? id:u32 -> state:txt;

	/**
	 * Update the mapping from protocols to their XRL target name.
	 *
	 * @param protocol protocol to update.
	 * @param target XRL target for the protocol.
	 */
	set_proto_target ? protocol:txt & target:txt;
}
