diff --git a/src/pfcp_packet.erl b/src/pfcp_packet.erl index 4b1acb5..698d1be 100644 --- a/src/pfcp_packet.erl +++ b/src/pfcp_packet.erl @@ -14,7 +14,7 @@ -export([pretty_print/1]). -compile([{parse_transform, cut}, bin_opt_info]). --compile({inline,[maybe/4, +-compile({inline,['maybe'/4, decode_v1_grouped/1]}). -ifdef (TEST). @@ -196,9 +196,9 @@ bool2int(true) -> 1. %% ============================================= %% decoder funs for optional fields -maybe(Bin, 0, _Fun, IE) -> +'maybe'(Bin, 0, _Fun, IE) -> {IE, Bin}; -maybe(Bin, 1, Fun, IE) -> +'maybe'(Bin, 1, Fun, IE) -> Fun(Bin, IE). len(Bin, Size, Fun, Pos, IE) -> @@ -231,8 +231,8 @@ spare(Bin, Len, IE) -> %% bin(Rest, Len, Pos, IE). %% encoder funs for optional fields -maybe(true, Fun, IE) -> Fun(IE); -maybe(_, _, IE) -> IE. +'maybe'(true, Fun, IE) -> Fun(IE); +'maybe'(_, _, IE) -> IE. int(Int, Size, IE) -> <>. @@ -686,12 +686,12 @@ decode_outer_header_creation(<>, _Type) -> @@ -769,23 +769,23 @@ enum_v1_packet_rate_unit(X) when is_integer(X) -> X. decode_packet_rate(<<_:5, APRC:1, DL:1, UL:1, Rest0/binary>>, _Type) -> IE0 = #packet_rate{}, - {IE1, Rest1} = maybe(Rest0, UL, spare(_, 5, _), IE0), - {IE2, Rest2} = maybe(Rest1, UL, enum(_, 3, fun enum_v1_packet_rate_unit/1, + {IE1, Rest1} = 'maybe'(Rest0, UL, spare(_, 5, _), IE0), + {IE2, Rest2} = 'maybe'(Rest1, UL, enum(_, 3, fun enum_v1_packet_rate_unit/1, #packet_rate.ul_time_unit, _), IE1), - {IE3, Rest3} = maybe(Rest2, UL, int(_, 16, #packet_rate.ul_max_packet_rate, _), IE2), - {IE4, Rest4} = maybe(Rest3, DL, spare(_, 5, _), IE3), - {IE5, Rest5} = maybe(Rest4, DL, enum(_, 3, fun enum_v1_packet_rate_unit/1, + {IE3, Rest3} = 'maybe'(Rest2, UL, int(_, 16, #packet_rate.ul_max_packet_rate, _), IE2), + {IE4, Rest4} = 'maybe'(Rest3, DL, spare(_, 5, _), IE3), + {IE5, Rest5} = 'maybe'(Rest4, DL, enum(_, 3, fun enum_v1_packet_rate_unit/1, #packet_rate.dl_time_unit, _), IE4), - {IE6, Rest6} = maybe(Rest5, DL, int(_, 16, #packet_rate.dl_max_packet_rate, _), IE5), - {IE7, Rest7} = maybe(Rest6, APRC band UL, spare(_, 5, _), IE6), - {IE8, Rest8} = maybe(Rest7, APRC band UL, enum(_, 3, fun enum_v1_packet_rate_unit/1, + {IE6, Rest6} = 'maybe'(Rest5, DL, int(_, 16, #packet_rate.dl_max_packet_rate, _), IE5), + {IE7, Rest7} = 'maybe'(Rest6, APRC band UL, spare(_, 5, _), IE6), + {IE8, Rest8} = 'maybe'(Rest7, APRC band UL, enum(_, 3, fun enum_v1_packet_rate_unit/1, #packet_rate.additional_ul_time_unit, _), IE7), - {IE9, Rest9} = maybe(Rest8, APRC band UL, + {IE9, Rest9} = 'maybe'(Rest8, APRC band UL, int(_, 16, #packet_rate.additional_ul_max_packet_rate, _), IE8), - {IE10, Rest10} = maybe(Rest9, APRC band DL, spare(_, 5, _), IE9), - {IE11, Rest11} = maybe(Rest10, APRC band DL, enum(_, 3, fun enum_v1_packet_rate_unit/1, + {IE10, Rest10} = 'maybe'(Rest9, APRC band DL, spare(_, 5, _), IE9), + {IE11, Rest11} = 'maybe'(Rest10, APRC band DL, enum(_, 3, fun enum_v1_packet_rate_unit/1, #packet_rate.additional_dl_time_unit, _), IE10), - {IE12, _Rest} = maybe(Rest11, APRC band DL, + {IE12, _Rest} = 'maybe'(Rest11, APRC band DL, int(_, 16, #packet_rate.additional_dl_max_packet_rate, _), IE11), [packet_rate, IE12]. @@ -800,14 +800,14 @@ encode_packet_rate(#packet_rate{ FlagDL = DlUnit =/= undefined, FlagAPRC = (AddUlUnit =/= undefined) or (AddDlUnit =/= undefined), IE0 = <<0:5, (bool2int(FlagAPRC)):1, (bool2int(FlagDL)):1, (bool2int(FlagUL)):1>>, - IE1 = maybe(FlagUL, int(enum_v1_packet_rate_unit(UlUnit), 8, _), IE0), - IE2 = maybe(FlagUL, int(UlRate, 16, _), IE1), - IE3 = maybe(FlagDL, int(enum_v1_packet_rate_unit(DlUnit), 8, _), IE2), - IE4 = maybe(FlagDL, int(DlRate, 16, _), IE3), - IE5 = maybe(FlagAPRC and FlagUL, int(enum_v1_packet_rate_unit(AddUlUnit), 8, _), IE4), - IE6 = maybe(FlagAPRC and FlagUL, int(AddUlRate, 16, _), IE5), - IE7 = maybe(FlagAPRC and FlagDL, int(enum_v1_packet_rate_unit(AddDlUnit), 8, _), IE6), - _IE = maybe(FlagAPRC and FlagDL, int(AddDlRate, 16, _), IE7). + IE1 = 'maybe'(FlagUL, int(enum_v1_packet_rate_unit(UlUnit), 8, _), IE0), + IE2 = 'maybe'(FlagUL, int(UlRate, 16, _), IE1), + IE3 = 'maybe'(FlagDL, int(enum_v1_packet_rate_unit(DlUnit), 8, _), IE2), + IE4 = 'maybe'(FlagDL, int(DlRate, 16, _), IE3), + IE5 = 'maybe'(FlagAPRC and FlagUL, int(enum_v1_packet_rate_unit(AddUlUnit), 8, _), IE4), + IE6 = 'maybe'(FlagAPRC and FlagUL, int(AddUlRate, 16, _), IE5), + IE7 = 'maybe'(FlagAPRC and FlagDL, int(enum_v1_packet_rate_unit(AddDlUnit), 8, _), IE6), + _IE = 'maybe'(FlagAPRC and FlagDL, int(AddDlRate, 16, _), IE7). decode_dl_flow_level_marking(<<_:6, SCI:1, TTC:1, Rest0/binary>>, _Type) -> IE0 = #dl_flow_level_marking{}, @@ -944,9 +944,9 @@ encode_vlan_tag({_Type, PCP, DEI, VID}) -> decode_user_id(<<_:4, NAI:1, MSISDN:1, IMEI:1, IMSI:1, Rest0/binary>>, _Type) -> IE0 = #user_id{}, - {IE1, Rest1} = maybe(Rest0, IMSI, len(_, 8, fun decode_tbcd/1, #user_id.imsi, _), IE0), - {IE2, Rest2} = maybe(Rest1, IMEI, len(_, 8, fun decode_tbcd/1, #user_id.imei, _), IE1), - {IE3, Rest3} = maybe(Rest2, MSISDN, len(_, 8, fun decode_tbcd/1, #user_id.msisdn, _), IE2), + {IE1, Rest1} = 'maybe'(Rest0, IMSI, len(_, 8, fun decode_tbcd/1, #user_id.imsi, _), IE0), + {IE2, Rest2} = 'maybe'(Rest1, IMEI, len(_, 8, fun decode_tbcd/1, #user_id.imei, _), IE1), + {IE3, Rest3} = 'maybe'(Rest2, MSISDN, len(_, 8, fun decode_tbcd/1, #user_id.msisdn, _), IE2), {IE4, _Rest} = maybe_len_bin(Rest3, NAI, 8, #user_id.nai, IE3), [user_id, IE4]. @@ -957,10 +957,10 @@ encode_user_id(#user_id{imsi = IMSI, imei = IMEI, msisdn = MSISDN, nai = NAI}) - FlagNAI = is_binary(NAI), IE0 = <<0:4, (bool2int(FlagNAI)):1, (bool2int(FlagMSISDN)):1, (bool2int(FlagIMEI)):1, (bool2int(FlagIMSI)):1>>, - IE1 = maybe(FlagIMSI, len(8, encode_tbcd(IMSI), _), IE0), - IE2 = maybe(FlagIMEI, len(8, encode_tbcd(IMEI), _), IE1), - IE3 = maybe(FlagMSISDN, len(8, encode_tbcd(MSISDN), _), IE2), - _IE = maybe(FlagNAI, len(8, NAI, _), IE3). + IE1 = 'maybe'(FlagIMSI, len(8, encode_tbcd(IMSI), _), IE0), + IE2 = 'maybe'(FlagIMEI, len(8, encode_tbcd(IMEI), _), IE1), + IE3 = 'maybe'(FlagMSISDN, len(8, encode_tbcd(MSISDN), _), IE2), + _IE = 'maybe'(FlagNAI, len(8, NAI, _), IE3). decode_mac_addresses(<>, Type) -> Size = MACsCnt * 6, @@ -979,8 +979,8 @@ encode_mac_addresses({_Type, MACs, C_TAG, S_TAG}) -> decode_alternative_smf_ip_address(<<_:6, IPv4:1, IPv6:1, Rest0/binary>>, _Type) -> IE0 = #alternative_smf_ip_address{}, - {IE1, Rest1} = maybe(Rest0, IPv4, bin(_, 4, #alternative_smf_ip_address.ipv4, _), IE0), - {IE2, _Rest} = maybe(Rest1, IPv6, bin(_, 16, #alternative_smf_ip_address.ipv6, _), IE1), + {IE1, Rest1} = 'maybe'(Rest0, IPv4, bin(_, 4, #alternative_smf_ip_address.ipv4, _), IE0), + {IE2, _Rest} = 'maybe'(Rest1, IPv6, bin(_, 16, #alternative_smf_ip_address.ipv6, _), IE1), [alternative_smf_ip_address, IE2]. encode_alternative_smf_ip_address(#alternative_smf_ip_address{ipv4 = IPv4, ipv6 = IPv6}) -> @@ -988,13 +988,13 @@ encode_alternative_smf_ip_address(#alternative_smf_ip_address{ipv4 = IPv4, ipv6 FlagIPv6 = is_binary(IPv6), IE0 = <<0:6, (bool2int(FlagIPv4)):1, (bool2int(FlagIPv6)):1>>, - IE1 = maybe(FlagIPv4, bin(IPv4, 4, _), IE0), - _IE = maybe(FlagIPv6, bin(IPv6, 16, _), IE1). + IE1 = 'maybe'(FlagIPv4, bin(IPv4, 4, _), IE0), + _IE = 'maybe'(FlagIPv6, bin(IPv6, 16, _), IE1). decode_cp_pfcp_entity_ip_address(<<_:6, IPv4:1, IPv6:1, Rest0/binary>>, _Type) -> IE0 = #cp_pfcp_entity_ip_address{}, - {IE1, Rest1} = maybe(Rest0, IPv4, bin(_, 4, #cp_pfcp_entity_ip_address.ipv4, _), IE0), - {IE2, _Rest} = maybe(Rest1, IPv6, bin(_, 16, #cp_pfcp_entity_ip_address.ipv6, _), IE1), + {IE1, Rest1} = 'maybe'(Rest0, IPv4, bin(_, 4, #cp_pfcp_entity_ip_address.ipv4, _), IE0), + {IE2, _Rest} = 'maybe'(Rest1, IPv6, bin(_, 16, #cp_pfcp_entity_ip_address.ipv6, _), IE1), [cp_pfcp_entity_ip_address, IE2]. encode_cp_pfcp_entity_ip_address(#cp_pfcp_entity_ip_address{ipv4 = IPv4, ipv6 = IPv6}) -> @@ -1002,8 +1002,8 @@ encode_cp_pfcp_entity_ip_address(#cp_pfcp_entity_ip_address{ipv4 = IPv4, ipv6 = FlagIPv6 = is_binary(IPv6), IE0 = <<0:6, (bool2int(FlagIPv4)):1, (bool2int(FlagIPv6)):1>>, - IE1 = maybe(FlagIPv4, bin(IPv4, 4, _), IE0), - _IE = maybe(FlagIPv6, bin(IPv6, 16, _), IE1). + IE1 = 'maybe'(FlagIPv4, bin(IPv4, 4, _), IE0), + _IE = 'maybe'(FlagIPv6, bin(IPv6, 16, _), IE1). decode_ip_multicast_address(<<_:4, 1:1, _:1, 0:1, 0:1, _/binary>>, _Type) -> IE = #ip_multicast_address{ip = any}, @@ -1064,7 +1064,7 @@ encode_source_ip_address(IP, MPL) -> IE0 = <<0:5, (bool2int(FlagMPL)):1, (bool2int(IPv4v6)):1, (bool2int(not IPv4v6)):1, IP/binary>>, - _IE = maybe(FlagMPL, int(MPL, 8, _), IE0). + _IE = 'maybe'(FlagMPL, int(MPL, 8, _), IE0). encode_source_ip_address(#source_ip_address{ip = {IP, MPL}}) -> encode_source_ip_address(IP, MPL); @@ -1074,19 +1074,19 @@ encode_source_ip_address(#source_ip_address{ip = IP}) -> decode_packet_rate_status(<<_:5, APR:1, DL:1, UL:1, Rest0/binary>>, _Type) -> IE0 = #packet_rate_status{}, {IE1, Rest1} = - maybe(Rest0, UL, + 'maybe'(Rest0, UL, int(_, 16, #packet_rate_status.remaining_uplink_packets_allowed, _), IE0), {IE2, Rest2} = - maybe(Rest1, DL, + 'maybe'(Rest1, DL, int(_, 16, #packet_rate_status.remaining_downlink_packets_allowed, _), IE1), {IE3, Rest3} = - maybe(Rest2, UL band APR, + 'maybe'(Rest2, UL band APR, int(_, 16, #packet_rate_status.remaining_additional_uplink_packets_allowed, _), IE2), {IE4, Rest4} = - maybe(Rest3, DL band APR, + 'maybe'(Rest3, DL band APR, int(_, 16, #packet_rate_status.remaining_additional_downlink_packets_allowed, _), IE3), {IE5, _Rest} = - maybe(Rest4, UL bor DL, float(_, 32, #packet_rate_status.validity_time, _), IE4), + 'maybe'(Rest4, UL bor DL, float(_, 32, #packet_rate_status.validity_time, _), IE4), [packet_rate_status, IE5]. encode_packet_rate_status(#packet_rate_status{ @@ -1101,27 +1101,27 @@ encode_packet_rate_status(#packet_rate_status{ FlagAPR = is_integer(AUL) orelse is_integer(ADL), IE0 = <<0:5, (bool2int(FlagAPR)):1, (bool2int(FlagDL)):1, (bool2int(FlagUL)):1>>, - IE1 = maybe(FlagUL, int(UL, 16, _), IE0), - IE2 = maybe(FlagDL, int(DL, 16, _), IE1), - IE3 = maybe(FlagUL and FlagAPR, int(AUL, 16, _), IE2), - IE4 = maybe(FlagDL and FlagAPR, int(ADL, 16, _), IE3), - _IE = maybe(FlagUL or FlagDL, float(Time, 32, _), IE4). + IE1 = 'maybe'(FlagUL, int(UL, 16, _), IE0), + IE2 = 'maybe'(FlagDL, int(DL, 16, _), IE1), + IE3 = 'maybe'(FlagUL and FlagAPR, int(AUL, 16, _), IE2), + IE4 = 'maybe'(FlagDL and FlagAPR, int(ADL, 16, _), IE3), + _IE = 'maybe'(FlagUL or FlagDL, float(Time, 32, _), IE4). decode_tsn_bridge_id(<<_:7, MAC:1, Rest0/binary>>, _Type) -> IE0 = #tsn_bridge_id{}, - {IE1, _Rest} = maybe(Rest0, MAC, bin(_, 6, #tsn_bridge_id.mac, _), IE0), + {IE1, _Rest} = 'maybe'(Rest0, MAC, bin(_, 6, #tsn_bridge_id.mac, _), IE0), [tsn_bridge_id, IE1]. encode_tsn_bridge_id(#tsn_bridge_id{mac = MAC}) -> FlagMAC = is_binary(MAC), IE0 = <<0:7, (bool2int(FlagMAC)):1>>, - _IE = maybe(FlagMAC, bin(MAC, 6, _), IE0). + _IE = 'maybe'(FlagMAC, bin(MAC, 6, _), IE0). decode_mptcp_address_information(<<_:6, IPv6:1, IPv4:1, Type:8, Port:16, Rest0/binary>>, _Type) -> IE0 = #mptcp_address_information{proxy_type = Type, proxy_port = Port}, - {IE1, Rest1} = maybe(Rest0, IPv4, bin(_, 4, #mptcp_address_information.ipv4, _), IE0), - {IE2, _Rest} = maybe(Rest1, IPv6, bin(_, 16, #mptcp_address_information.ipv6, _), IE1), + {IE1, Rest1} = 'maybe'(Rest0, IPv4, bin(_, 4, #mptcp_address_information.ipv4, _), IE0), + {IE2, _Rest} = 'maybe'(Rest1, IPv6, bin(_, 16, #mptcp_address_information.ipv6, _), IE1), [mptcp_address_information, IE2]. encode_mptcp_address_information(#mptcp_address_information{ @@ -1131,15 +1131,15 @@ encode_mptcp_address_information(#mptcp_address_information{ FlagIPv6 = is_binary(IPv6), IE0 = <<0:6, (bool2int(FlagIPv6)):1, (bool2int(FlagIPv4)):1, Type, Port:16>>, - IE1 = maybe(FlagIPv4, bin(IPv4, 4, _), IE0), - _IE = maybe(FlagIPv6, bin(IPv6, 16, _), IE1). + IE1 = 'maybe'(FlagIPv4, bin(IPv4, 4, _), IE0), + _IE = 'maybe'(FlagIPv6, bin(IPv6, 16, _), IE1). decode_ue_link_specific_ip_address(<<_:4, NV6:1, NV4:1, V6:1, V4:1, Rest0/binary>>, _Type) -> IE0 = #ue_link_specific_ip_address{}, - {IE1, Rest1} = maybe(Rest0, V4, bin(_, 4, #ue_link_specific_ip_address.tgpp_ipv4, _), IE0), - {IE2, Rest2} = maybe(Rest1, V6, bin(_, 16, #ue_link_specific_ip_address.tgpp_ipv6, _), IE1), - {IE3, Rest3} = maybe(Rest2, NV4, bin(_, 4, #ue_link_specific_ip_address.non_tgpp_ipv4, _), IE2), - {IE4, _Rest} = maybe(Rest3, NV6, bin(_, 16, #ue_link_specific_ip_address.non_tgpp_ipv6, _), IE3), + {IE1, Rest1} = 'maybe'(Rest0, V4, bin(_, 4, #ue_link_specific_ip_address.tgpp_ipv4, _), IE0), + {IE2, Rest2} = 'maybe'(Rest1, V6, bin(_, 16, #ue_link_specific_ip_address.tgpp_ipv6, _), IE1), + {IE3, Rest3} = 'maybe'(Rest2, NV4, bin(_, 4, #ue_link_specific_ip_address.non_tgpp_ipv4, _), IE2), + {IE4, _Rest} = 'maybe'(Rest3, NV6, bin(_, 16, #ue_link_specific_ip_address.non_tgpp_ipv6, _), IE3), [ue_link_specific_ip_address, IE4]. encode_ue_link_specific_ip_address(#ue_link_specific_ip_address{ @@ -1152,19 +1152,19 @@ encode_ue_link_specific_ip_address(#ue_link_specific_ip_address{ IE0 = <<0:4, (bool2int(FlagNV6)):1, (bool2int(FlagNV4)):1, (bool2int(FlagV6)):1, (bool2int(FlagV4)):1>>, - IE1 = maybe(FlagV4, bin(V4, 4, _), IE0), - IE2 = maybe(FlagV6, bin(V6, 16, _), IE1), - IE3 = maybe(FlagNV4, bin(NV4, 4, _), IE2), - _IE = maybe(FlagNV6, bin(NV6, 16, _), IE3). + IE1 = 'maybe'(FlagV4, bin(V4, 4, _), IE0), + IE2 = 'maybe'(FlagV6, bin(V6, 16, _), IE1), + IE3 = 'maybe'(FlagNV4, bin(NV4, 4, _), IE2), + _IE = 'maybe'(FlagNV6, bin(NV6, 16, _), IE3). decode_pmf_address_information(<<_:5, MAC:1, V6:1, V4:1, Rest0/binary>>, _Type) -> IE0 = #pmf_address_information{}, - {IE1, Rest1} = maybe(Rest0, V4, bin(_, 4, #pmf_address_information.ipv4, _), IE0), - {IE2, Rest2} = maybe(Rest1, V6, bin(_, 16, #pmf_address_information.ipv6, _), IE1), - {IE3, Rest3} = maybe(Rest2, V4 bor V6, int(_, 16, #pmf_address_information.tgpp_port, _), IE2), - {IE4, Rest4} = maybe(Rest3, V4 bor V6, int(_, 16, #pmf_address_information.non_tgpp_port, _), IE3), - {IE5, Rest5} = maybe(Rest4, MAC, bin(_, 6, #pmf_address_information.tgpp_mac, _), IE4), - {IE6, _Rest} = maybe(Rest5, MAC, bin(_, 6, #pmf_address_information.non_tgpp_mac, _), IE5), + {IE1, Rest1} = 'maybe'(Rest0, V4, bin(_, 4, #pmf_address_information.ipv4, _), IE0), + {IE2, Rest2} = 'maybe'(Rest1, V6, bin(_, 16, #pmf_address_information.ipv6, _), IE1), + {IE3, Rest3} = 'maybe'(Rest2, V4 bor V6, int(_, 16, #pmf_address_information.tgpp_port, _), IE2), + {IE4, Rest4} = 'maybe'(Rest3, V4 bor V6, int(_, 16, #pmf_address_information.non_tgpp_port, _), IE3), + {IE5, Rest5} = 'maybe'(Rest4, MAC, bin(_, 6, #pmf_address_information.tgpp_mac, _), IE4), + {IE6, _Rest} = 'maybe'(Rest5, MAC, bin(_, 6, #pmf_address_information.non_tgpp_mac, _), IE5), [pmf_address_information, IE6]. encode_pmf_address_information(#pmf_address_information{ @@ -1176,23 +1176,23 @@ encode_pmf_address_information(#pmf_address_information{ FlagMAC = is_binary(TgppMAC) orelse is_binary(NonTgppMAC), IE0 = <<0:5, (bool2int(FlagMAC)):1, (bool2int(FlagV6)):1, (bool2int(FlagV4)):1>>, - IE1 = maybe(FlagV4, bin(V4, 4, _), IE0), - IE2 = maybe(FlagV6, bin(V6, 16, _), IE1), - IE3 = maybe(FlagV4 or FlagV6, int(TgppPort, 16, _), IE2), - IE4 = maybe(FlagV4 or FlagV6, int(NonTgppPort, 16, _), IE3), - IE5 = maybe(FlagMAC, bin(TgppMAC, 6, _), IE4), - _IE = maybe(FlagMAC, bin(NonTgppMAC, 6, _), IE5). + IE1 = 'maybe'(FlagV4, bin(V4, 4, _), IE0), + IE2 = 'maybe'(FlagV6, bin(V6, 16, _), IE1), + IE3 = 'maybe'(FlagV4 or FlagV6, int(TgppPort, 16, _), IE2), + IE4 = 'maybe'(FlagV4 or FlagV6, int(NonTgppPort, 16, _), IE3), + IE5 = 'maybe'(FlagMAC, bin(TgppMAC, 6, _), IE4), + _IE = 'maybe'(FlagMAC, bin(NonTgppMAC, 6, _), IE5). decode_packet_delay_thresholds(<<_:5, RP:1, UL:1, DL:1, Rest0/binary>>, _Type) -> IE0 = #packet_delay_thresholds{}, {IE1, Rest1} = - maybe(Rest0, DL, + 'maybe'(Rest0, DL, int(_, 32, #packet_delay_thresholds.downlink_packet_delay_threshold, _), IE0), {IE2, Rest2} = - maybe(Rest1, UL, + 'maybe'(Rest1, UL, int(_, 32, #packet_delay_thresholds.uplink_packet_delay_threshold, _), IE1), {IE3, _Rest} = - maybe(Rest2, RP, + 'maybe'(Rest2, RP, int(_, 32, #packet_delay_thresholds.round_trip_packet_delay_threshold, _), IE2), [packet_delay_thresholds, IE3]. @@ -1205,20 +1205,20 @@ encode_packet_delay_thresholds(#packet_delay_thresholds{ FlagRP = is_integer(RP), IE0 = <<0:5, (bool2int(FlagRP)):1, (bool2int(FlagUL)):1, (bool2int(FlagDL)):1>>, - IE1 = maybe(FlagDL, int(DL, 32, _), IE0), - IE2 = maybe(FlagUL, int(UL, 32, _), IE1), - _IE = maybe(FlagRP, int(RP, 32, _), IE2). + IE1 = 'maybe'(FlagDL, int(DL, 32, _), IE0), + IE2 = 'maybe'(FlagUL, int(UL, 32, _), IE1), + _IE = 'maybe'(FlagRP, int(RP, 32, _), IE2). decode_qos_monitoring_measurement(<<_:4, PLMF:1, RP:1, UL:1, DL:1, Rest0/binary>>, _Type) -> IE0 = #qos_monitoring_measurement{packet_delay_measurement_failure = (PLMF /= 0)}, {IE1, Rest1} = - maybe(Rest0, DL, + 'maybe'(Rest0, DL, int(_, 32, #qos_monitoring_measurement.downlink_packet_delay, _), IE0), {IE2, Rest2} = - maybe(Rest1, UL, + 'maybe'(Rest1, UL, int(_, 32, #qos_monitoring_measurement.uplink_packet_delay, _), IE1), {IE3, _Rest} = - maybe(Rest2, RP, + 'maybe'(Rest2, RP, int(_, 32, #qos_monitoring_measurement.round_trip_packet_delay, _), IE2), [qos_monitoring_measurement, IE3]. @@ -1233,9 +1233,9 @@ encode_qos_monitoring_measurement(#qos_monitoring_measurement{ IE0 = <<0:4, (bool2int(PLMF)):1, (bool2int(FlagRP)):1, (bool2int(FlagUL)):1, (bool2int(FlagDL)):1>>, - IE1 = maybe(FlagDL, int(DL, 32, _), IE0), - IE2 = maybe(FlagUL, int(UL, 32, _), IE1), - _IE = maybe(FlagRP, int(RP, 32, _), IE2). + IE1 = 'maybe'(FlagDL, int(DL, 32, _), IE0), + IE2 = 'maybe'(FlagUL, int(UL, 32, _), IE1), + _IE = 'maybe'(FlagRP, int(RP, 32, _), IE2). decode_number_of_ue_ip_addresses(<<_:6, IPv6:1, IPv4:1, Rest0/binary>>, _Type) -> IE0 = #number_of_ue_ip_addresses{}, @@ -1248,8 +1248,8 @@ encode_number_of_ue_ip_addresses(#number_of_ue_ip_addresses{ipv6 = IPv6, ipv4 = FlagIPv4 = is_integer(IPv4), IE0 = <<0:6, (bool2int(FlagIPv6)):1, (bool2int(FlagIPv4)):1>>, - IE1 = maybe(FlagIPv4, int(IPv4, 32, _), IE0), - _IE = maybe(FlagIPv6, int(IPv6, 32, _), IE1). + IE1 = 'maybe'(FlagIPv4, int(IPv4, 32, _), IE0), + _IE = 'maybe'(FlagIPv6, int(IPv6, 32, _), IE1). decode_ppp_protocol(<<_:5, Control:1, Data:1, Specific:1, Rest0/binary>>, _Type) -> IE0 = #ppp_protocol{ @@ -1265,7 +1265,7 @@ encode_ppp_protocol(#ppp_protocol{flags = Flags, protocol = Protocol}) -> IE0 = <<0:5, (bool2int(is_map_key(control, Flags))):1, (bool2int(is_map_key(data, Flags))):1, (bool2int(Specific)):1>>, - _IE = maybe(Specific, int(Protocol, 16, _), IE0). + _IE = 'maybe'(Specific, int(Protocol, 16, _), IE0). decode_l2tp_tunnel_endpoint(<<0:5, 1:1, 0:1, 0:1, Id:16, _IPv4:4/bytes, _IPv6:16/bytes, _/binary>>, _Type) -> IE = #l2tp_tunnel_endpoint{tunnel_id = Id, endpoint = choose},