Added request variable to get_info_string method
This commit is contained in:
@@ -305,7 +305,7 @@ METHOD(imc_msg_t, receive, TNC_Result,
|
|||||||
max_seg_size, FALSE, this->src_id, TRUE);
|
max_seg_size, FALSE, this->src_id, TRUE);
|
||||||
contracts->add_contract(contracts, contract);
|
contracts->add_contract(contracts, contract);
|
||||||
}
|
}
|
||||||
contract->get_info_string(contract, buf, BUF_LEN);
|
contract->get_info_string(contract, buf, BUF_LEN, TRUE);
|
||||||
DBG2(DBG_IMC, "%s", buf);
|
DBG2(DBG_IMC, "%s", buf);
|
||||||
|
|
||||||
/* Determine maximum PA-TNC attribute segment size */
|
/* Determine maximum PA-TNC attribute segment size */
|
||||||
@@ -348,7 +348,7 @@ METHOD(imc_msg_t, receive, TNC_Result,
|
|||||||
my_max_seg_size = max_seg_size;
|
my_max_seg_size = max_seg_size;
|
||||||
contract->set_max_size(contract, my_max_attr_size,
|
contract->set_max_size(contract, my_max_attr_size,
|
||||||
my_max_seg_size);
|
my_max_seg_size);
|
||||||
contract->get_info_string(contract, buf, BUF_LEN);
|
contract->get_info_string(contract, buf, BUF_LEN, FALSE);
|
||||||
DBG2(DBG_IMC, "%s", buf);
|
DBG2(DBG_IMC, "%s", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ METHOD(imv_msg_t, receive, TNC_Result,
|
|||||||
max_seg_size, FALSE, this->src_id, FALSE);
|
max_seg_size, FALSE, this->src_id, FALSE);
|
||||||
contracts->add_contract(contracts, contract);
|
contracts->add_contract(contracts, contract);
|
||||||
}
|
}
|
||||||
contract->get_info_string(contract, buf, BUF_LEN);
|
contract->get_info_string(contract, buf, BUF_LEN, TRUE);
|
||||||
DBG2(DBG_IMV, "%s", buf);
|
DBG2(DBG_IMV, "%s", buf);
|
||||||
|
|
||||||
/* Determine maximum PA-TNC attribute segment size */
|
/* Determine maximum PA-TNC attribute segment size */
|
||||||
@@ -370,7 +370,6 @@ METHOD(imv_msg_t, receive, TNC_Result,
|
|||||||
{
|
{
|
||||||
max_seg_size = my_max_seg_size;
|
max_seg_size = my_max_seg_size;
|
||||||
contract->set_max_size(contract, max_attr_size, max_seg_size);
|
contract->set_max_size(contract, max_attr_size, max_seg_size);
|
||||||
contract->get_info_string(contract, buf, BUF_LEN);
|
|
||||||
DBG2(DBG_IMV, " lowered maximum segment size to %u bytes",
|
DBG2(DBG_IMV, " lowered maximum segment size to %u bytes",
|
||||||
max_seg_size);
|
max_seg_size);
|
||||||
}
|
}
|
||||||
@@ -404,7 +403,7 @@ METHOD(imv_msg_t, receive, TNC_Result,
|
|||||||
my_max_seg_size = max_seg_size;
|
my_max_seg_size = max_seg_size;
|
||||||
contract->set_max_size(contract, my_max_attr_size,
|
contract->set_max_size(contract, my_max_attr_size,
|
||||||
my_max_seg_size);
|
my_max_seg_size);
|
||||||
contract->get_info_string(contract, buf, BUF_LEN);
|
contract->get_info_string(contract, buf, BUF_LEN, FALSE);
|
||||||
DBG2(DBG_IMV, "%s", buf);
|
DBG2(DBG_IMV, "%s", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ METHOD(seg_contract_t, is_null, bool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
METHOD(seg_contract_t, get_info_string, void,
|
METHOD(seg_contract_t, get_info_string, void,
|
||||||
private_seg_contract_t *this, char *buf, size_t len)
|
private_seg_contract_t *this, char *buf, size_t len, bool request)
|
||||||
{
|
{
|
||||||
enum_name_t *pa_subtype_names;
|
enum_name_t *pa_subtype_names;
|
||||||
uint32_t msg_vid, msg_subtype;
|
uint32_t msg_vid, msg_subtype;
|
||||||
@@ -120,7 +120,7 @@ METHOD(seg_contract_t, get_info_string, void,
|
|||||||
/* nul-terminate the string buffer */
|
/* nul-terminate the string buffer */
|
||||||
buf[--len] = '\0';
|
buf[--len] = '\0';
|
||||||
|
|
||||||
if (this->is_issuer)
|
if (this->is_issuer && request)
|
||||||
{
|
{
|
||||||
written = snprintf(pos, len, "%s %d requests",
|
written = snprintf(pos, len, "%s %d requests",
|
||||||
this->is_imc ? "IMC" : "IMV", this->issuer_id);
|
this->is_imc ? "IMC" : "IMV", this->issuer_id);
|
||||||
@@ -136,8 +136,8 @@ METHOD(seg_contract_t, get_info_string, void,
|
|||||||
pos += written;
|
pos += written;
|
||||||
len -= written;
|
len -= written;
|
||||||
|
|
||||||
written = snprintf(pos, len, " a %ssegmentation contract ",
|
written = snprintf(pos, len, " a %ssegmentation contract%s ",
|
||||||
this->is_null ? "null" : "");
|
this->is_null ? "null" : "", request ? "" : " response");
|
||||||
if (written < 0 || written > len)
|
if (written < 0 || written > len)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -82,8 +82,10 @@ struct seg_contract_t {
|
|||||||
*
|
*
|
||||||
* @param buf String buffer of at least size len
|
* @param buf String buffer of at least size len
|
||||||
* @param len Size of string buffer
|
* @param len Size of string buffer
|
||||||
|
* @param request TRUE if contract request, FALSE if response
|
||||||
*/
|
*/
|
||||||
void (*get_info_string)(seg_contract_t *this, char *buf, size_t len);
|
void (*get_info_string)(seg_contract_t *this, char *buf, size_t len,
|
||||||
|
bool request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a seg_contract_t object.
|
* Destroys a seg_contract_t object.
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ METHOD(imv_agent_if_t, batch_ending, TNC_Result,
|
|||||||
/* Announce support of PA-TNC segmentation to IMC */
|
/* Announce support of PA-TNC segmentation to IMC */
|
||||||
contract = seg_contract_create(msg_types[0], max_attr_size,
|
contract = seg_contract_create(msg_types[0], max_attr_size,
|
||||||
max_seg_size, TRUE, imv_id, FALSE);
|
max_seg_size, TRUE, imv_id, FALSE);
|
||||||
contract->get_info_string(contract, buf, BUF_LEN);
|
contract->get_info_string(contract, buf, BUF_LEN, TRUE);
|
||||||
DBG2(DBG_IMV, "%s", buf);
|
DBG2(DBG_IMV, "%s", buf);
|
||||||
contracts = state->get_contracts(state);
|
contracts = state->get_contracts(state);
|
||||||
contracts->add_contract(contracts, contract);
|
contracts->add_contract(contracts, contract);
|
||||||
|
|||||||
Reference in New Issue
Block a user