Reformat gtpv1uSend(), shorten buf/len variable names
This commit is contained in:
@@ -286,38 +286,47 @@ static int gtpv1uCreateAndSendMsg(int h,
|
|||||||
return !GTPNOK;
|
return !GTPNOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gtpv1uSend(instance_t instance, gtpv1u_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) {
|
static void gtpv1uSend(instance_t instance, gtpv1u_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag)
|
||||||
uint8_t *buffer=req->buffer+req->offset;
|
{
|
||||||
size_t length=req->length;
|
uint8_t *buf = req->buffer + req->offset;
|
||||||
ue_id_t ue_id=req->ue_id;
|
size_t len = req->length;
|
||||||
int bearer_id=req->bearer_id;
|
ue_id_t ue_id = req->ue_id;
|
||||||
|
int bearer_id = req->bearer_id;
|
||||||
|
|
||||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||||
getInstRetVoid(compatInst(instance));
|
getInstRetVoid(compatInst(instance));
|
||||||
getUeRetVoid(inst, ue_id);
|
getUeRetVoid(inst, ue_id);
|
||||||
|
|
||||||
auto ptr2=ptrUe->second.bearers.find(bearer_id);
|
auto ptr2 = ptrUe->second.bearers.find(bearer_id);
|
||||||
|
|
||||||
if ( ptr2 == ptrUe->second.bearers.end() ) {
|
if (ptr2 == ptrUe->second.bearers.end()) {
|
||||||
LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant UE:RAB: %lx/%x\n", instance, ue_id, bearer_id);
|
LOG_E(GTPU, "[%ld] GTP-U instance: sending a packet to a non existant UE:RAB: %lx/%x\n", instance, ue_id, bearer_id);
|
||||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_D(GTPU,"[%ld] sending a packet to UE:RAB:teid %lx/%x/%x, len %lu, oldseq %d, oldnum %d\n",
|
LOG_D(GTPU,
|
||||||
instance, ue_id, bearer_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum );
|
"[%ld] sending a packet to UE:RAB:teid %lx/%x/%x, len %lu, oldseq %d, oldnum %d\n",
|
||||||
|
instance,
|
||||||
|
ue_id,
|
||||||
|
bearer_id,
|
||||||
|
ptr2->second.teid_outgoing,
|
||||||
|
len,
|
||||||
|
ptr2->second.seqNum,
|
||||||
|
ptr2->second.npduNum);
|
||||||
|
|
||||||
if(seqNumFlag)
|
if (seqNumFlag)
|
||||||
ptr2->second.seqNum++;
|
ptr2->second.seqNum++;
|
||||||
|
|
||||||
if(npduNumFlag)
|
if (npduNumFlag)
|
||||||
ptr2->second.npduNum++;
|
ptr2->second.npduNum++;
|
||||||
|
|
||||||
// copy to release the mutex
|
// copy to release the mutex
|
||||||
gtpv1u_bearer_t tmp=ptr2->second;
|
gtpv1u_bearer_t tmp = ptr2->second;
|
||||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||||
|
|
||||||
if (tmp.outgoing_qfi != -1) {
|
if (tmp.outgoing_qfi != -1) {
|
||||||
Gtpv1uExtHeaderT ext = { 0 };
|
Gtpv1uExtHeaderT ext = {0};
|
||||||
ext.ExtHeaderLen = 1; // in quad bytes EXT_HDR_LNTH_OCTET_UNITS
|
ext.ExtHeaderLen = 1; // in quad bytes EXT_HDR_LNTH_OCTET_UNITS
|
||||||
ext.pdusession_cntr.spare = 0;
|
ext.pdusession_cntr.spare = 0;
|
||||||
ext.pdusession_cntr.PDU_type = UL_PDU_SESSION_INFORMATION;
|
ext.pdusession_cntr.PDU_type = UL_PDU_SESSION_INFORMATION;
|
||||||
@@ -331,8 +340,8 @@ static void gtpv1uSend(instance_t instance, gtpv1u_tunnel_data_req_t *req, bool
|
|||||||
tmp.outgoing_port,
|
tmp.outgoing_port,
|
||||||
GTP_GPDU,
|
GTP_GPDU,
|
||||||
tmp.teid_outgoing,
|
tmp.teid_outgoing,
|
||||||
buffer,
|
buf,
|
||||||
length,
|
len,
|
||||||
seqNumFlag,
|
seqNumFlag,
|
||||||
npduNumFlag,
|
npduNumFlag,
|
||||||
tmp.seqNum,
|
tmp.seqNum,
|
||||||
@@ -341,8 +350,20 @@ static void gtpv1uSend(instance_t instance, gtpv1u_tunnel_data_req_t *req, bool
|
|||||||
(uint8_t *)&ext,
|
(uint8_t *)&ext,
|
||||||
sizeof(ext));
|
sizeof(ext));
|
||||||
} else {
|
} else {
|
||||||
gtpv1uCreateAndSendMsg(
|
gtpv1uCreateAndSendMsg(compatInst(instance),
|
||||||
compatInst(instance), tmp.outgoing_ip_addr, tmp.outgoing_port, GTP_GPDU, tmp.teid_outgoing, buffer, length, seqNumFlag, npduNumFlag, tmp.seqNum, tmp.npduNum, NO_MORE_EXT_HDRS, NULL, 0);
|
tmp.outgoing_ip_addr,
|
||||||
|
tmp.outgoing_port,
|
||||||
|
GTP_GPDU,
|
||||||
|
tmp.teid_outgoing,
|
||||||
|
buf,
|
||||||
|
len,
|
||||||
|
seqNumFlag,
|
||||||
|
npduNumFlag,
|
||||||
|
tmp.seqNum,
|
||||||
|
tmp.npduNum,
|
||||||
|
NO_MORE_EXT_HDRS,
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user