libimcv: Added reserved field in SWIMA Inventory encoding
This commit is contained in:
parent
75181f4836
commit
27ec213d0b
|
@ -165,16 +165,40 @@ METHOD(pa_tnc_attr_t, set_noskip_flag,void,
|
|||
this->noskip_flag = noskip;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is shared with ietf_swima_attr_sw_inv.c
|
||||
**/
|
||||
void ietf_swima_attr_sw_ev_build_sw_record(bio_writer_t *writer,
|
||||
uint8_t action, swima_record_t *sw_record, bool has_record)
|
||||
{
|
||||
pen_type_t data_model;
|
||||
chunk_t sw_locator;
|
||||
|
||||
data_model = sw_record->get_data_model(sw_record);
|
||||
|
||||
writer->write_uint32(writer, sw_record->get_record_id(sw_record));
|
||||
writer->write_uint24(writer, data_model.vendor_id);
|
||||
writer->write_uint8 (writer, data_model.type);
|
||||
writer->write_uint8 (writer, sw_record->get_source_id(sw_record));
|
||||
writer->write_uint8 (writer, action);
|
||||
writer->write_data16(writer, sw_record->get_sw_id(sw_record, &sw_locator));
|
||||
writer->write_data16(writer, sw_locator);
|
||||
|
||||
if (has_record)
|
||||
{
|
||||
writer->write_data32(writer, sw_record->get_record(sw_record));
|
||||
}
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, build, void,
|
||||
private_ietf_swima_attr_sw_ev_t *this)
|
||||
{
|
||||
bio_writer_t *writer;
|
||||
swima_event_t *sw_event;
|
||||
swima_record_t *sw_record;
|
||||
chunk_t timestamp, sw_id, sw_locator, record;
|
||||
pen_type_t data_model;
|
||||
uint32_t eid, record_id, last_eid, last_consulted_eid, eid_epoch;
|
||||
uint8_t action, source_id;
|
||||
chunk_t timestamp;
|
||||
uint32_t last_eid, last_consulted_eid, eid_epoch;
|
||||
uint8_t action;
|
||||
enumerator_t *enumerator;
|
||||
|
||||
if (this->value.ptr)
|
||||
|
@ -195,29 +219,14 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||
enumerator = this->events->create_enumerator(this->events);
|
||||
while (enumerator->enumerate(enumerator, &sw_event))
|
||||
{
|
||||
eid = sw_event->get_eid(sw_event, ×tamp);
|
||||
action = sw_event->get_action(sw_event);
|
||||
sw_record = sw_event->get_sw_record(sw_event);
|
||||
record_id = sw_record->get_record_id(sw_record);
|
||||
data_model = sw_record->get_data_model(sw_record);
|
||||
source_id = sw_record->get_source_id(sw_record);
|
||||
sw_id = sw_record->get_sw_id(sw_record, &sw_locator);
|
||||
|
||||
writer->write_uint32(writer, eid);
|
||||
writer->write_uint32(writer, sw_event->get_eid(sw_event, ×tamp));
|
||||
writer->write_data (writer, timestamp);
|
||||
writer->write_uint32(writer, record_id);
|
||||
writer->write_uint24(writer, data_model.vendor_id);
|
||||
writer->write_uint8 (writer, data_model.type);
|
||||
writer->write_uint8 (writer, source_id);
|
||||
writer->write_uint8 (writer, action);
|
||||
writer->write_data16(writer, sw_id);
|
||||
writer->write_data16(writer, sw_locator);
|
||||
|
||||
if (this->type.type == IETF_ATTR_SW_EVENTS)
|
||||
{
|
||||
record = sw_record->get_record(sw_record);
|
||||
writer->write_data32(writer, record);
|
||||
}
|
||||
ietf_swima_attr_sw_ev_build_sw_record(writer, action, sw_record,
|
||||
this->type.type == IETF_ATTR_SW_EVENTS);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
|
@ -227,15 +236,56 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||
writer->destroy(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is shared with ietf_swima_attr_sw_inv.c
|
||||
**/
|
||||
bool ietf_swima_attr_sw_ev_process_sw_record(bio_reader_t *reader,
|
||||
uint8_t *action, swima_record_t **sw_record, bool has_record)
|
||||
{
|
||||
pen_type_t data_model;
|
||||
swima_record_t *sw_rec;
|
||||
uint32_t data_model_pen, record_id;
|
||||
uint8_t data_model_type, source_id, reserved;
|
||||
chunk_t sw_id, sw_locator, record = chunk_empty;
|
||||
|
||||
if (!reader->read_uint32(reader, &record_id) ||
|
||||
!reader->read_uint24(reader, &data_model_pen) ||
|
||||
!reader->read_uint8 (reader, &data_model_type) ||
|
||||
!reader->read_uint8 (reader, &source_id) ||
|
||||
!reader->read_uint8 (reader, &reserved) ||
|
||||
!reader->read_data16(reader, &sw_id) ||
|
||||
!reader->read_data16(reader, &sw_locator))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (action)
|
||||
{
|
||||
*action = reserved;
|
||||
}
|
||||
|
||||
if (has_record && !reader->read_data32(reader, &record))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
data_model = pen_type_create(data_model_pen, data_model_type);
|
||||
sw_rec = swima_record_create(record_id, sw_id, sw_locator);
|
||||
sw_rec->set_data_model(sw_rec, data_model);
|
||||
sw_rec->set_source_id(sw_rec, source_id);
|
||||
sw_rec->set_record(sw_rec, record);
|
||||
*sw_record = sw_rec;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(pa_tnc_attr_t, process, status_t,
|
||||
private_ietf_swima_attr_sw_ev_t *this, uint32_t *offset)
|
||||
{
|
||||
bio_reader_t *reader;
|
||||
uint32_t data_model_pen, record_id;
|
||||
uint32_t eid, eid_epoch, last_eid, last_consulted_eid;
|
||||
uint8_t data_model_type, source_id, action;
|
||||
pen_type_t data_model;
|
||||
chunk_t sw_id, sw_locator, record, timestamp;
|
||||
uint8_t action;
|
||||
chunk_t timestamp;
|
||||
swima_event_t *sw_event;
|
||||
swima_record_t *sw_record;
|
||||
status_t status = NEED_MORE;
|
||||
|
@ -273,38 +323,24 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||
{
|
||||
if (!reader->read_uint32(reader, &eid) ||
|
||||
!reader->read_data (reader, SW_EV_TIMESTAMP_SIZE, ×tamp) ||
|
||||
!reader->read_uint32(reader, &record_id) ||
|
||||
!reader->read_uint24(reader, &data_model_pen) ||
|
||||
!reader->read_uint8 (reader, &data_model_type) ||
|
||||
!reader->read_uint8 (reader, &source_id) ||
|
||||
!reader->read_uint8 (reader, &action) ||
|
||||
!reader->read_data16(reader, &sw_id) ||
|
||||
!reader->read_data16(reader, &sw_locator))
|
||||
!ietf_swima_attr_sw_ev_process_sw_record(reader, &action, &sw_record,
|
||||
this->type.type == IETF_ATTR_SW_EVENTS))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
record = chunk_empty;
|
||||
|
||||
if (action == 0 || action > SWIMA_EVENT_ACTION_LAST)
|
||||
if (action == SWIMA_EVENT_ACTION_NONE ||
|
||||
action > SWIMA_EVENT_ACTION_LAST)
|
||||
{
|
||||
DBG1(DBG_TNC, "invalid event action value for %N/%N", pen_names,
|
||||
PEN_IETF, ietf_attr_names, this->type.type);
|
||||
*offset = this->offset;
|
||||
sw_record->destroy(sw_record);
|
||||
reader->destroy(reader);
|
||||
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
if (this->type.type == IETF_ATTR_SW_EVENTS &&
|
||||
!reader->read_data32(reader, &record))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
data_model = pen_type_create(data_model_pen, data_model_type);
|
||||
sw_record = swima_record_create(record_id, sw_id, sw_locator);
|
||||
sw_record->set_data_model(sw_record, data_model);
|
||||
sw_record->set_source_id(sw_record, source_id);
|
||||
sw_record->set_record(sw_record, record);
|
||||
sw_event = swima_event_create(eid, timestamp, action, sw_record);
|
||||
this->events->add(this->events, sw_event);
|
||||
this->offset += this->value.len - reader->remaining(reader);
|
||||
|
|
|
@ -43,7 +43,9 @@ typedef struct private_ietf_swima_attr_sw_inv_t private_ietf_swima_attr_sw_inv_t
|
|||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Data Model Type PEN |Data Model Type|
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Source ID Num | Software Identifier Length |Software Id (v)|
|
||||
* | Source ID Num | Reserved | Software Identifier Length |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Software Identifier (Variable Length) |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Software Locator Length | Software Locator (Var. Len) |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
@ -148,15 +150,18 @@ METHOD(pa_tnc_attr_t, set_noskip_flag,void,
|
|||
this->noskip_flag = noskip;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is shared with ietf_swima_attr_sw_ev.c
|
||||
**/
|
||||
extern void ietf_swima_attr_sw_ev_build_sw_record(bio_writer_t *writer,
|
||||
uint8_t action, swima_record_t *sw_record, bool has_record);
|
||||
|
||||
METHOD(pa_tnc_attr_t, build, void,
|
||||
private_ietf_swima_attr_sw_inv_t *this)
|
||||
{
|
||||
bio_writer_t *writer;
|
||||
swima_record_t *sw_record;
|
||||
chunk_t sw_id, sw_locator, record;
|
||||
pen_type_t data_model;
|
||||
uint32_t record_id, last_eid, eid_epoch;
|
||||
uint8_t source_id;
|
||||
uint32_t last_eid, eid_epoch;
|
||||
enumerator_t *enumerator;
|
||||
|
||||
if (this->value.ptr)
|
||||
|
@ -175,23 +180,8 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||
enumerator = this->inventory->create_enumerator(this->inventory);
|
||||
while (enumerator->enumerate(enumerator, &sw_record))
|
||||
{
|
||||
record_id = sw_record->get_record_id(sw_record);
|
||||
data_model = sw_record->get_data_model(sw_record);
|
||||
source_id = sw_record->get_source_id(sw_record);
|
||||
sw_id = sw_record->get_sw_id(sw_record, &sw_locator);
|
||||
|
||||
writer->write_uint32(writer, record_id);
|
||||
writer->write_uint24(writer, data_model.vendor_id);
|
||||
writer->write_uint8 (writer, data_model.type);
|
||||
writer->write_uint8 (writer, source_id);
|
||||
writer->write_data16(writer, sw_id);
|
||||
writer->write_data16(writer, sw_locator);
|
||||
|
||||
if (this->type.type == IETF_ATTR_SW_INVENTORY)
|
||||
{
|
||||
record = sw_record->get_record(sw_record);
|
||||
writer->write_data32(writer, record);
|
||||
}
|
||||
ietf_swima_attr_sw_ev_build_sw_record(writer, 0x00, sw_record,
|
||||
this->type.type == IETF_ATTR_SW_INVENTORY);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
|
@ -201,14 +191,17 @@ METHOD(pa_tnc_attr_t, build, void,
|
|||
writer->destroy(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is shared with ietf_swima_attr_sw_ev.c
|
||||
**/
|
||||
extern bool ietf_swima_attr_sw_ev_process_sw_record(bio_reader_t *reader,
|
||||
uint8_t *action, swima_record_t **sw_record, bool has_record);
|
||||
|
||||
METHOD(pa_tnc_attr_t, process, status_t,
|
||||
private_ietf_swima_attr_sw_inv_t *this, uint32_t *offset)
|
||||
{
|
||||
bio_reader_t *reader;
|
||||
uint32_t data_model_pen, record_id, last_eid, eid_epoch;
|
||||
uint8_t data_model_type, source_id;
|
||||
pen_type_t data_model;
|
||||
chunk_t sw_id, sw_locator, record;
|
||||
uint32_t last_eid, eid_epoch;
|
||||
swima_record_t *sw_record;
|
||||
status_t status = NEED_MORE;
|
||||
|
||||
|
@ -241,27 +234,12 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
|||
|
||||
while (this->record_count)
|
||||
{
|
||||
if (!reader->read_uint32(reader, &record_id) ||
|
||||
!reader->read_uint24(reader, &data_model_pen) ||
|
||||
!reader->read_uint8 (reader, &data_model_type) ||
|
||||
!reader->read_uint8 (reader, &source_id) ||
|
||||
!reader->read_data16(reader, &sw_id) ||
|
||||
!reader->read_data16(reader, &sw_locator))
|
||||
if (!ietf_swima_attr_sw_ev_process_sw_record(reader, NULL, &sw_record,
|
||||
this->type.type == IETF_ATTR_SW_INVENTORY))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
record = chunk_empty;
|
||||
|
||||
if (this->type.type == IETF_ATTR_SW_INVENTORY &&
|
||||
!reader->read_data32(reader, &record))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
data_model = pen_type_create(data_model_pen, data_model_type);
|
||||
sw_record = swima_record_create(record_id, sw_id, sw_locator);
|
||||
sw_record->set_data_model(sw_record, data_model);
|
||||
sw_record->set_source_id(sw_record, source_id);
|
||||
sw_record->set_record(sw_record, record);
|
||||
this->inventory->add(this->inventory, sw_record);
|
||||
this->offset += this->value.len - reader->remaining(reader);
|
||||
this->value = reader->peek(reader);
|
||||
|
|
|
@ -268,67 +268,69 @@ static sw_inv_data_t sw_inv_data[] = {
|
|||
chunk_from_chars(
|
||||
0x00, 0x00, 0x00, 0x01, 0xAA, 0xBB, 0xCC, 0xD2, 0x12, 0x34,
|
||||
0x56, 0x78, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74, 0x72,
|
||||
0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F, 0x72,
|
||||
0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53, 0x77,
|
||||
0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x31, 0x3C, 0x53, 0x6F, 0x66, 0x74, 0x77,
|
||||
0x61, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74,
|
||||
0x79, 0x20, 0x74, 0x61, 0x67, 0x49, 0x64, 0x3D, 0x22, 0x61,
|
||||
0x62, 0x63, 0x22, 0x3E, 0x3C, 0x2F, 0x53, 0x6F, 0x66, 0x74,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74,
|
||||
0x72, 0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F,
|
||||
0x72, 0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53,
|
||||
0x77, 0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x31, 0x3C, 0x53, 0x6F, 0x66, 0x74,
|
||||
0x77, 0x61, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69,
|
||||
0x74, 0x79, 0x3E)
|
||||
0x74, 0x79, 0x20, 0x74, 0x61, 0x67, 0x49, 0x64, 0x3D, 0x22,
|
||||
0x61, 0x62, 0x63, 0x22, 0x3E, 0x3C, 0x2F, 0x53, 0x6F, 0x66,
|
||||
0x74, 0x77, 0x61, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74,
|
||||
0x69, 0x74, 0x79, 0x3E)
|
||||
},
|
||||
{ IETF_SWIMA_ATTR_SW_INV_FLAG_NONE, 0xaabbccd3, 0x12345678, 0x00000030,
|
||||
chunk_from_chars(
|
||||
0x00, 0x00, 0x00, 0x01, 0xAA, 0xBB, 0xCC, 0xD3, 0x12, 0x34,
|
||||
0x56, 0x78, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74, 0x72,
|
||||
0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F, 0x72,
|
||||
0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53, 0x77,
|
||||
0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00, 0x00)
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74,
|
||||
0x72, 0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F,
|
||||
0x72, 0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53,
|
||||
0x77, 0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00,
|
||||
0x00)
|
||||
},
|
||||
{ IETF_SWIMA_ATTR_SW_INV_FLAG_S_F, 0xaabbccd4, 0x12345678, 0x00000034,
|
||||
chunk_from_chars(
|
||||
0x80, 0x00, 0x00, 0x02, 0xAA, 0xBB, 0xCC, 0xD4, 0x12, 0x34,
|
||||
0x56, 0x78, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74, 0x72,
|
||||
0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F, 0x72,
|
||||
0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53, 0x77,
|
||||
0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x31, 0x3C, 0x53, 0x6F, 0x66, 0x74, 0x77,
|
||||
0x61, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74,
|
||||
0x79, 0x20, 0x74, 0x61, 0x67, 0x49, 0x64, 0x3D, 0x22, 0x61,
|
||||
0x62, 0x63, 0x22, 0x3E, 0x3C, 0x2F, 0x53, 0x6F, 0x66, 0x74,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74,
|
||||
0x72, 0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F,
|
||||
0x72, 0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53,
|
||||
0x77, 0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x31, 0x3C, 0x53, 0x6F, 0x66, 0x74,
|
||||
0x77, 0x61, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69,
|
||||
0x74, 0x79, 0x3E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0x2A,
|
||||
0x19, 0x11, 0x00, 0x33, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67,
|
||||
0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F, 0x72, 0x67, 0x5F, 0x36,
|
||||
0x32, 0x32, 0x35, 0x31, 0x61, 0x61, 0x36, 0x2D, 0x31, 0x61,
|
||||
0x30, 0x31, 0x2D, 0x34, 0x37, 0x39, 0x62, 0x2D, 0x61, 0x65,
|
||||
0x61, 0x36, 0x2D, 0x66, 0x33, 0x64, 0x63, 0x66, 0x30, 0x61,
|
||||
0x62, 0x31, 0x66, 0x31, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x31, 0x3C, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
|
||||
0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x20, 0x74,
|
||||
0x61, 0x67, 0x49, 0x64, 0x3D, 0x22, 0x64, 0x65, 0x66, 0x22,
|
||||
0x3E, 0x3C, 0x2F, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72,
|
||||
0x65, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79, 0x3E)
|
||||
0x74, 0x79, 0x20, 0x74, 0x61, 0x67, 0x49, 0x64, 0x3D, 0x22,
|
||||
0x61, 0x62, 0x63, 0x22, 0x3E, 0x3C, 0x2F, 0x53, 0x6F, 0x66,
|
||||
0x74, 0x77, 0x61, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74,
|
||||
0x69, 0x74, 0x79, 0x3E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90,
|
||||
0x2A, 0x19, 0x11, 0x00, 0x00, 0x33, 0x73, 0x74, 0x72, 0x6F,
|
||||
0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F, 0x72, 0x67,
|
||||
0x5F, 0x36, 0x32, 0x32, 0x35, 0x31, 0x61, 0x61, 0x36, 0x2D,
|
||||
0x31, 0x61, 0x30, 0x31, 0x2D, 0x34, 0x37, 0x39, 0x62, 0x2D,
|
||||
0x61, 0x65, 0x61, 0x36, 0x2D, 0x66, 0x33, 0x64, 0x63, 0x66,
|
||||
0x30, 0x61, 0x62, 0x31, 0x66, 0x31, 0x61, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x31, 0x3C, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61,
|
||||
0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x79,
|
||||
0x20, 0x74, 0x61, 0x67, 0x49, 0x64, 0x3D, 0x22, 0x64, 0x65,
|
||||
0x66, 0x22, 0x3E, 0x3C, 0x2F, 0x53, 0x6F, 0x66, 0x74, 0x77,
|
||||
0x61, 0x72, 0x65, 0x49, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x74,
|
||||
0x79, 0x3E)
|
||||
},
|
||||
{ IETF_SWIMA_ATTR_SW_INV_FLAG_S_F, 0xaabbccd5, 0x12345678, 0x00000034,
|
||||
chunk_from_chars(
|
||||
0x80, 0x00, 0x00, 0x02, 0xAA, 0xBB, 0xCC, 0xD5, 0x12, 0x34,
|
||||
0x56, 0x78, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74, 0x72,
|
||||
0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F, 0x72,
|
||||
0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53, 0x77,
|
||||
0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0x2A, 0x19, 0x11, 0x00,
|
||||
0x33, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61,
|
||||
0x6E, 0x2E, 0x6F, 0x72, 0x67, 0x5F, 0x36, 0x32, 0x32, 0x35,
|
||||
0x31, 0x61, 0x61, 0x36, 0x2D, 0x31, 0x61, 0x30, 0x31, 0x2D,
|
||||
0x34, 0x37, 0x39, 0x62, 0x2D, 0x61, 0x65, 0x61, 0x36, 0x2D,
|
||||
0x66, 0x33, 0x64, 0x63, 0x66, 0x30, 0x61, 0x62, 0x31, 0x66,
|
||||
0x31, 0x61, 0x00, 0x00)
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x73, 0x74,
|
||||
0x72, 0x6F, 0x6E, 0x67, 0x73, 0x77, 0x61, 0x6E, 0x2E, 0x6F,
|
||||
0x72, 0x67, 0x5F, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x53,
|
||||
0x77, 0x61, 0x6E, 0x5F, 0x35, 0x2E, 0x33, 0x2E, 0x33, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0x2A, 0x19, 0x11,
|
||||
0x00, 0x00, 0x33, 0x73, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x73,
|
||||
0x77, 0x61, 0x6E, 0x2E, 0x6F, 0x72, 0x67, 0x5F, 0x36, 0x32,
|
||||
0x32, 0x35, 0x31, 0x61, 0x61, 0x36, 0x2D, 0x31, 0x61, 0x30,
|
||||
0x31, 0x2D, 0x34, 0x37, 0x39, 0x62, 0x2D, 0x61, 0x65, 0x61,
|
||||
0x36, 0x2D, 0x66, 0x33, 0x64, 0x63, 0x66, 0x30, 0x61, 0x62,
|
||||
0x31, 0x66, 0x31, 0x61, 0x00, 0x00)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -445,15 +447,17 @@ END_TEST
|
|||
* 23 data_model_type
|
||||
* 24 segment 5 - 1 octet
|
||||
* 24 source_id
|
||||
* 25 sw_id
|
||||
* 26 segment 6 - 2 octets
|
||||
* 58 sw_locator
|
||||
* 59 segment 7 - 33 octets
|
||||
* 60 record
|
||||
* 62 segment 8 - 3 octets
|
||||
* 113 sw record 2
|
||||
* 114 segment 9 - 52 octets
|
||||
* 230 segment 10 - 116 octets
|
||||
* 25 segment 6 - 1 octet
|
||||
* 25 reserved
|
||||
* 26 sw_id
|
||||
* 27 segment 7 - 2 octets
|
||||
* 59 sw_locator
|
||||
* 60 segment 8 - 33 octets
|
||||
* 61 record
|
||||
* 63 segment 9 - 3 octets
|
||||
* 114 sw record 2
|
||||
* 115 segment 10 - 52 octets
|
||||
* 231 segment 11 - 117 octets
|
||||
*/
|
||||
|
||||
START_TEST(test_imcv_swima_sw_inv_trunc)
|
||||
|
@ -509,26 +513,32 @@ START_TEST(test_imcv_swima_sw_inv_trunc)
|
|||
attr->add_segment(attr, data);
|
||||
ck_assert(attr->process(attr, &offset) == NEED_MORE);
|
||||
|
||||
/* Segment 6 truncates sw_id */
|
||||
/* Segment 6 truncates reserved */
|
||||
data = chunk_skip(sw_inv_data[4].value, 24);
|
||||
data.len = 1;
|
||||
attr->add_segment(attr, data);
|
||||
ck_assert(attr->process(attr, &offset) == NEED_MORE);
|
||||
|
||||
/* Segment 7 truncates sw_id */
|
||||
data = chunk_skip(sw_inv_data[4].value, 25);
|
||||
data.len = 2;
|
||||
attr->add_segment(attr, data);
|
||||
ck_assert(attr->process(attr, &offset) == NEED_MORE);
|
||||
|
||||
/* Segment 7 truncates sw_locator */
|
||||
data = chunk_skip(sw_inv_data[4].value, 26);
|
||||
/* Segment 8 truncates sw_locator */
|
||||
data = chunk_skip(sw_inv_data[4].value, 27);
|
||||
data.len = 33;
|
||||
attr->add_segment(attr, data);
|
||||
ck_assert(attr->process(attr, &offset) == NEED_MORE);
|
||||
|
||||
/* Segment 8 truncates record */
|
||||
data = chunk_skip(sw_inv_data[4].value, 59);
|
||||
/* Segment 9 truncates record */
|
||||
data = chunk_skip(sw_inv_data[4].value, 60);
|
||||
data.len = 3;
|
||||
attr->add_segment(attr, data);
|
||||
ck_assert(attr->process(attr, &offset) == NEED_MORE);
|
||||
|
||||
/* Segment 9 truncates second sw_record */
|
||||
data = chunk_skip(sw_inv_data[4].value, 62);
|
||||
/* Segment 10 truncates second sw_record */
|
||||
data = chunk_skip(sw_inv_data[4].value, 63);
|
||||
data.len = 52;
|
||||
attr->add_segment(attr, data);
|
||||
ck_assert(attr->process(attr, &offset) == SUCCESS);
|
||||
|
@ -539,9 +549,9 @@ START_TEST(test_imcv_swima_sw_inv_trunc)
|
|||
ck_assert(sw_inv->get_count(sw_inv) == 1);
|
||||
c_attr->clear_inventory(c_attr);
|
||||
|
||||
/* Segment 10 truncates second sw_record */
|
||||
data = chunk_skip(sw_inv_data[4].value, 114);
|
||||
data.len = 116;
|
||||
/* Segment 11 truncates second sw_record */
|
||||
data = chunk_skip(sw_inv_data[4].value, 115);
|
||||
data.len = 117;
|
||||
attr->add_segment(attr, data);
|
||||
ck_assert(attr->process(attr, &offset) == SUCCESS);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <library.h>
|
||||
|
||||
#define SWIMA_EVENT_ACTION_NONE 0
|
||||
#define SWIMA_EVENT_ACTION_CREATION 1
|
||||
#define SWIMA_EVENT_ACTION_DELETION 2
|
||||
#define SWIMA_EVENT_ACTION_ALTERATION 3
|
||||
|
|
Loading…
Reference in New Issue