Skip to content

Commit

Permalink
add helper to format IEs for lager
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schultz committed Aug 21, 2018
1 parent e1d35c4 commit 99ee214
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/pfcp_packet.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
-export([encode/1, encode_ies/1,
decode/1, decode/2, decode_ies/1, decode_ies/2,
msg_description_v1/1, to_map/1]).
-export([lager_pr/1]).

-compile([{parse_transform, cut}, bin_opt_info]).
-compile({inline,[decode_v1_grouped/1]}).
Expand Down Expand Up @@ -124,6 +125,50 @@ ies_to_map(IEs) when is_list(IEs) ->
ies_to_map(IEs) ->
IEs.

lager_pr(_, {Type, Group})
when Type =:= create_pdr orelse
Type =:= pdi orelse
Type =:= create_far orelse
Type =:= forwarding_parameters orelse
Type =:= duplicating_parameters orelse
Type =:= create_urr orelse
Type =:= create_qer orelse
Type =:= created_pdr orelse
Type =:= update_pdr orelse
Type =:= update_far orelse
Type =:= update_forwarding_parameters orelse
Type =:= update_bar_response orelse
Type =:= update_urr orelse
Type =:= update_qer orelse
Type =:= remove_pdr orelse
Type =:= remove_far orelse
Type =:= remove_urr orelse
Type =:= remove_qer orelse
Type =:= load_control_information orelse
Type =:= overload_control_information orelse
Type =:= application_id_pfds orelse
Type =:= pfd_context orelse
Type =:= application_detection_information orelse
Type =:= query_urr orelse
Type =:= usage_report_smr orelse
Type =:= usage_report_sdr orelse
Type =:= usage_report_srr orelse
Type =:= downlink_data_report orelse
Type =:= create_bar orelse
Type =:= update_bar_request orelse
Type =:= remove_bar orelse
Type =:= error_indication_report orelse
Type =:= user_plane_path_failure_report orelse
Type =:= update_duplicating_parameters ->
lager:pr({Type, lager_pr(Group)}, ?MODULE);
lager_pr(_, Value) ->
lager:pr(Value, ?MODULE).

lager_pr(IEs) when is_list(IEs) ->
lists:map(lager_pr('Key', _), IEs);
lager_pr(IEs) when is_map(IEs) ->
maps:map(fun lager_pr/2, IEs).

bool2int(false) -> 0;
bool2int(true) -> 1.

Expand Down

0 comments on commit 99ee214

Please sign in to comment.