implemented publish_enforcement_report and endSession methods
This commit is contained in:
@@ -211,6 +211,30 @@ static xmlNodePtr create_identity(private_tnc_ifmap2_soap_t *this,
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create enforcement-report metadata
|
||||||
|
*/
|
||||||
|
static xmlNodePtr create_enforcement_report(private_tnc_ifmap2_soap_t *this,
|
||||||
|
xmlChar *action, xmlChar *reason)
|
||||||
|
{
|
||||||
|
xmlNodePtr node, node2, node3;
|
||||||
|
|
||||||
|
node = xmlNewNode(NULL, "metadata");
|
||||||
|
node2 = xmlNewNode(this->ns_meta, "enforcement-report");
|
||||||
|
xmlAddChild(node, node2);
|
||||||
|
xmlNewProp(node2, "ifmap-cardinality", "multiValue");
|
||||||
|
|
||||||
|
node3 = xmlNewNode(NULL, "enforcement-action");
|
||||||
|
xmlAddChild(node2, node3);
|
||||||
|
xmlNodeAddContent(node3, action);
|
||||||
|
|
||||||
|
node3 = xmlNewNode(NULL, "enforcement-reason");
|
||||||
|
xmlAddChild(node2, node3);
|
||||||
|
xmlNodeAddContent(node3, reason);
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create delete filter
|
* Create delete filter
|
||||||
*/
|
*/
|
||||||
@@ -523,17 +547,45 @@ METHOD(tnc_ifmap2_soap_t, publish_device_ip, bool,
|
|||||||
METHOD(tnc_ifmap2_soap_t, publish_enforcement_report, bool,
|
METHOD(tnc_ifmap2_soap_t, publish_enforcement_report, bool,
|
||||||
private_tnc_ifmap2_soap_t *this, host_t *host, char *action, char *reason)
|
private_tnc_ifmap2_soap_t *this, host_t *host, char *action, char *reason)
|
||||||
{
|
{
|
||||||
/* send publish request and receive publishReceived */
|
tnc_ifmap2_soap_msg_t *soap_msg;
|
||||||
/* return send_receive(this, "publish", request, "publishReceived", NULL); */
|
xmlNodePtr request, update;
|
||||||
return FALSE;
|
bool success;
|
||||||
|
|
||||||
|
/* build publish update request */
|
||||||
|
request = create_publish_request(this);
|
||||||
|
update = xmlNewNode(NULL, "update");
|
||||||
|
xmlAddChild(request, update);
|
||||||
|
|
||||||
|
/* add ip-address and metadata */
|
||||||
|
xmlAddChild(update, create_ip_address(this, host));
|
||||||
|
xmlAddChild(update, create_device(this));
|
||||||
|
xmlAddChild(update, create_enforcement_report(this, action, reason));
|
||||||
|
|
||||||
|
soap_msg = tnc_ifmap2_soap_msg_create(this->tls);
|
||||||
|
success = soap_msg->post(soap_msg, request, "publishReceived", NULL);
|
||||||
|
soap_msg->destroy(soap_msg);
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tnc_ifmap2_soap_t, endSession, bool,
|
METHOD(tnc_ifmap2_soap_t, endSession, bool,
|
||||||
private_tnc_ifmap2_soap_t *this)
|
private_tnc_ifmap2_soap_t *this)
|
||||||
{
|
{
|
||||||
/* send endSession request and receive end SessionResult */
|
tnc_ifmap2_soap_msg_t *soap_msg;
|
||||||
/* return send_receive(this, "endSession", request, "endSessionResult", NULL); */
|
xmlNodePtr request;
|
||||||
return FALSE;
|
bool success;
|
||||||
|
|
||||||
|
/* build endSession request */
|
||||||
|
request = xmlNewNode(NULL, "endSession");
|
||||||
|
this->ns = xmlNewNs(request, IFMAP_NS, "ifmap");
|
||||||
|
xmlSetNs(request, this->ns);
|
||||||
|
xmlNewProp(request, "session-id", this->session_id);
|
||||||
|
|
||||||
|
soap_msg = tnc_ifmap2_soap_msg_create(this->tls);
|
||||||
|
success = soap_msg->post(soap_msg, request, "endSessionResult", NULL);
|
||||||
|
soap_msg->destroy(soap_msg);
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(tnc_ifmap2_soap_t, destroy, void,
|
METHOD(tnc_ifmap2_soap_t, destroy, void,
|
||||||
|
|||||||
Reference in New Issue
Block a user