pub fn encode_apn(apn: &str) -> Result<Vec<u8>, EncodeError>Expand description
Encode an APN as DNS-style labels: one length octet per label, no trailing root label (TS 23.003 §9.1, TS 29.060 §7.7.30).
Refuses a label past MAX_APN_LABEL_LEN rather than shortening it. Truncating here would
be worse than useless: a…a cut to 63 octets is a perfectly well-formed label naming a
different access point, so nothing downstream — not the decoder, not the peer, not the
operator reading a log — could tell that the APN it resolved was not the one asked for.
The length prefix is one octet and the limit is a hard format rule, so there is no
downstream recovery either.