int cil_gen_ibendportcon(__attribute__((unused)) struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
{
	enum cil_syntax syntax[] = {
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_STRING | CIL_SYN_LIST,
		CIL_SYN_END
	};
	int syntax_len = sizeof(syntax) / sizeof(*syntax);
	int rc = SEPOL_ERR;
	struct cil_ibendportcon *ibendportcon = NULL;

	if (!parse_current || !ast_node)
		goto exit;

	rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
	if (rc != SEPOL_OK)
		goto exit;

	cil_ibendportcon_init(&ibendportcon);

	ibendportcon->dev_name_str = parse_current->next->data;

	rc = cil_fill_integer(parse_current->next->next, &ibendportcon->port, 10);
	if (rc != SEPOL_OK) {
		cil_log(CIL_ERR, "Improper ibendport port specified\n");
		goto exit;
	}

	if (!parse_current->next->next->next->cl_head) {
		ibendportcon->context_str = parse_current->next->next->next->data;
	} else {
		cil_context_init(&ibendportcon->context);

		rc = cil_fill_context(parse_current->next->next->next->cl_head, ibendportcon->context);
		if (rc != SEPOL_OK)
			goto exit;
	}

	ast_node->data = ibendportcon;
	ast_node->flavor = CIL_IBENDPORTCON;

	return SEPOL_OK;

exit:
	cil_tree_log(parse_current, CIL_ERR, "Bad ibendportcon declaration");
	cil_destroy_ibendportcon(ibendportcon);
	return SEPOL_ERR;
}
int cil_gen_ibendportcon(__attribute__((unused)) struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node)
{
	enum cil_syntax syntax[] = {
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_STRING | CIL_SYN_LIST,
		CIL_SYN_END
	};
	int syntax_len = sizeof(syntax) / sizeof(*syntax);
	int rc = SEPOL_ERR;
	struct cil_ibendportcon *ibendportcon = NULL;

	if (!parse_current || !ast_node)
		goto exit;

	rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
	if (rc != SEPOL_OK)
		goto exit;

	cil_ibendportcon_init(&ibendportcon);

	ibendportcon->dev_name_str = parse_current->next->data;

	rc = cil_fill_integer(parse_current->next->next, &ibendportcon->port, 10);
	if (rc != SEPOL_OK) {
		cil_log(CIL_ERR, "Improper ibendport port specified\n");
		goto exit;
	}

	if (!parse_current->next->next->next->cl_head) {
		ibendportcon->context_str = parse_current->next->next->next->data;
	} else {
		cil_context_init(&ibendportcon->context);

		rc = cil_fill_context(parse_current->next->next->next->cl_head, ibendportcon->context);
		if (rc != SEPOL_OK)
			goto exit;
	}

	ast_node->data = ibendportcon;
	ast_node->flavor = CIL_IBENDPORTCON;

	return SEPOL_OK;

exit:
	cil_tree_log(parse_current, CIL_ERR, "Bad ibendportcon declaration");
	cil_destroy_ibendportcon(ibendportcon);
	return SEPOL_ERR;
}