Use asn_copy() over encode/decode
This commit is contained in:
parent
c895fbd345
commit
df1d559775
12
src/cam.c
12
src/cam.c
|
|
@ -931,8 +931,10 @@ enum CAM_CHECK_R check_cam_v1(EIS_BTPPacketIndication_t *bpi, EI1_CAM_t* cam, ui
|
|||
mreq->choice.attributes.choice.set.protectedZones->list.size = lightship->protected_zones.pz_len * sizeof(void*);
|
||||
mreq->choice.attributes.choice.set.protectedZones->list.array = calloc(lightship->protected_zones.pz_len, sizeof(void*));
|
||||
for (int p = 0; p < lightship->protected_zones.pz_len; ++p) {
|
||||
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_ProtectedCommunicationZone, NULL, lightship->protected_zones.pz[p], b_oer, 512);
|
||||
oer_decode(NULL, &asn_DEF_EIS_ProtectedCommunicationZone, (void**) &mreq->choice.attributes.choice.set.protectedZones->list.array[p], b_oer, enc.encoded);
|
||||
asn_copy(&asn_DEF_EIS_ProtectedCommunicationZone,
|
||||
(void**) &mreq->choice.attributes.choice.set.protectedZones->list.array[p],
|
||||
lightship->protected_zones.pz[p]
|
||||
);
|
||||
}
|
||||
|
||||
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_ManagementRequest, NULL, mreq, b_oer, 512);
|
||||
|
|
@ -1140,8 +1142,10 @@ enum CAM_CHECK_R check_cam_v2(EIS_BTPPacketIndication_t *bpi, EI2_CAM_t* cam, ui
|
|||
mreq->choice.attributes.choice.set.protectedZones->list.size = lightship->protected_zones.pz_len * sizeof(void*);
|
||||
mreq->choice.attributes.choice.set.protectedZones->list.array = calloc(lightship->protected_zones.pz_len, sizeof(void*));
|
||||
for (int p = 0; p < lightship->protected_zones.pz_len; ++p) {
|
||||
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_ProtectedCommunicationZone, NULL, lightship->protected_zones.pz[p], b_oer, 512);
|
||||
oer_decode(NULL, &asn_DEF_EIS_ProtectedCommunicationZone, (void**) &mreq->choice.attributes.choice.set.protectedZones->list.array[p], b_oer, enc.encoded);
|
||||
asn_copy(&asn_DEF_EIS_ProtectedCommunicationZone,
|
||||
(void**) &mreq->choice.attributes.choice.set.protectedZones->list.array[p],
|
||||
lightship->protected_zones.pz[p]
|
||||
);
|
||||
}
|
||||
|
||||
asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_EIS_ManagementRequest, NULL, mreq, b_oer, 512);
|
||||
|
|
|
|||
Loading…
Reference in New Issue