Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode DNN as Labels #708

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/lib/nas/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,24 @@ const char *EnumToString(EPduSessionType v)
IEDnn DnnFromApn(const std::string &apn)
{
IEDnn dnn;
int index = 0;
dnn.apn = OctetString::FromSpare(static_cast<int>(apn.length()) + 1);
dnn.apn.data()[0] = static_cast<uint8_t>(apn.length());
std::memcpy(dnn.apn.data() + 1, apn.data(), apn.length());
std::stringstream ss(apn);

std::string token;
std::vector<std::string> tokens;
char delimiter = '.';

while (getline(ss, token, delimiter)) {
tokens.push_back(token);
}

for (const auto& part : tokens) {
std::cout << part;
dnn.apn.data()[index] = static_cast<uint8_t>(part.length());
std::memcpy(dnn.apn.data() + index + 1, part.c_str(), part.length());
index = index + part.length() + 1;
}
return dnn;
}

Expand Down