% (C) 2023 by sysmocom
%
% All Rights Reserved
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU Affero General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU Affero General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
% Additional Permission under GNU AGPL version 3 section 7:
%
% If you modify this Program, or any covered work, by linking or
% combining it with runtime libraries of Erlang/OTP as released by
% Ericsson on http://www.erlang.org (or a modified version of these
% libraries), containing parts covered by the terms of the Erlang Public
% License (http://www.erlang.org/EPLICENSE), the licensors of this
% Program grant you additional permission to convey the resulting work
% without the need to license the runtime libraries of Erlang/OTP under
% the GNU Affero General Public License. Corresponding Source for a
% non-source form of such a combination shall include the source code
% for the parts of the runtime libraries of Erlang/OTP used as well as
% that of the covered work.
%
-hrl_name('gtp_utils.hrl').

-define(GTP2_CAUSE_RESERVED, 1).
-define(GTP2_CAUSE_LOCAL_DETACH, 2).
-define(GTP2_CAUSE_COMPLETE_DETACH, 3).
-define(GTP2_CAUSE_RAT_CHANGED_FROM_3GPP_TO_NON_3GPP, 4).
-define(GTP2_CAUSE_ISR_DEACTIVATION, 5).
-define(GTP2_CAUSE_ERROR_INDICATION_RECEIVED_FROM_RNC_ENODEB_S4_SGSN, 6).
-define(GTP2_CAUSE_IMSI_DETACH_ONLY, 7).
-define(GTP2_CAUSE_REACTIVATION_REQUESTED, 8).
-define(GTP2_CAUSE_PDN_RECONNECTION_TO_THIS_APN_DISALLOWED, 9).
-define(GTP2_CAUSE_ACCESS_CHANGED_FROM_NON_3GPP_TO_3GPP, 10).
-define(GTP2_CAUSE_PDN_CONNECTION_INACTIVITY_TIMER_EXPIRES, 11).
-define(GTP2_CAUSE_PGW_NOT_RESPONDING, 12).
-define(GTP2_CAUSE_NETWORK_FAILURE, 13).
-define(GTP2_CAUSE_QOS_PARAMETER_MISMATCH, 14).
-define(GTP2_CAUSE_REQUEST_ACCEPTED, 16).
-define(GTP2_CAUSE_REQUEST_ACCEPTED_PARTIALLY, 17).
-define(GTP2_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE, 18).
-define(GTP2_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY, 19).
-define(GTP2_CAUSE_CONTEXT_NOT_FOUND, 64).
-define(GTP2_CAUSE_INVALID_MESSAGE_FORMAT, 65).
-define(GTP2_CAUSE_VERSION_NOT_SUPPORTED_BY_NEXT_PEER, 66).
-define(GTP2_CAUSE_INVALID_LENGTH, 67).
-define(GTP2_CAUSE_SERVICE_NOT_SUPPORTED, 68).
-define(GTP2_CAUSE_MANDATORY_IE_INCORRECT, 69).
-define(GTP2_CAUSE_MANDATORY_IE_MISSING, 70).
-define(GTP2_CAUSE_SYSTEM_FAILURE, 72).
-define(GTP2_CAUSE_NO_RESOURCES_AVAILABLE, 73).
-define(GTP2_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION, 74).
-define(GTP2_CAUSE_SYNTACTIC_ERROR_IN_THE_TFT_OPERATION, 75).
-define(GTP2_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER, 76).
-define(GTP2_CAUSE_SYNTACTIC_ERRORS_IN_PACKET_FILTER, 77).
-define(GTP2_CAUSE_MISSING_OR_UNKNOWN_APN, 78).
-define(GTP2_CAUSE_GRE_KEY_NOT_FOUND, 80).
-define(GTP2_CAUSE_RELOCATION_FAILURE, 81).
-define(GTP2_CAUSE_DENIED_IN_RAT, 82).
-define(GTP2_CAUSE_PREFERRED_PDN_TYPE_NOT_SUPPORTED, 83).
-define(GTP2_CAUSE_ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED, 84).
-define(GTP2_CAUSE_UE_CONTEXT_WITHOUT_TFT_ALREADY_ACTIVATED, 85).
-define(GTP2_CAUSE_PROTOCOL_TYPE_NOT_SUPPORTED, 86).
-define(GTP2_CAUSE_UE_NOT_RESPONDING, 87).
-define(GTP2_CAUSE_UE_REFUSES, 88).
-define(GTP2_CAUSE_SERVICE_DENIED, 89).
-define(GTP2_CAUSE_UNABLE_TO_PAGE_UE, 90).
-define(GTP2_CAUSE_NO_MEMORY_AVAILABLE, 91).
-define(GTP2_CAUSE_USER_AUTHENTICATION_FAILED, 92).
-define(GTP2_CAUSE_APN_ACCESS_DENIED___NO_SUBSCRIPTION, 93).
-define(GTP2_CAUSE_REQUEST_REJECTED, 94).
-define(GTP2_CAUSE_P_TMSI_SIGNATURE_MISMATCH, 95).
-define(GTP2_CAUSE_IMSI_IMEI_NOT_KNOWN, 96).
-define(GTP2_CAUSE_SEMANTIC_ERROR_IN_THE_TAD_OPERATION, 97).
-define(GTP2_CAUSE_SYNTACTIC_ERROR_IN_THE_TAD_OPERATION, 98).
-define(GTP2_CAUSE_REMOTE_PEER_NOT_RESPONDING, 100).
-define(GTP2_CAUSE_COLLISION_WITH_NETWORK_INITIATED_REQUEST, 101).
-define(GTP2_CAUSE_UNABLE_TO_PAGE_UE_DUE_TO_SUSPENSION, 102).
-define(GTP2_CAUSE_CONDITIONAL_IE_MISSING, 103).
-define(GTP2_CAUSE_APN_RESTRICTION_TYPE_INCOMPATIBLE_WITH_CURRENTLY_ACTIVE_PDN_CONNECTION, 104).
-define(GTP2_CAUSE_INVALID_OVERALL_LENGTH_OF_THE_TRIGGERED_RESPONSE_MESSAGE_AND_A_PIGGYBACKED_INITIAL_MESSAGE, 105).
-define(GTP2_CAUSE_DATA_FORWARDING_NOT_SUPPORTED, 106).
-define(GTP2_CAUSE_INVALID_REPLY_FROM_REMOTE_PEER, 107).
-define(GTP2_CAUSE_FALLBACK_TO_GTPV1, 108).
-define(GTP2_CAUSE_INVALID_PEER, 109).
-define(GTP2_CAUSE_TEMPORARILY_REJECTED_DUE_TO_HANDOVER_TAU_RAU_PROCEDURE_IN_PROGRESS, 110).
-define(GTP2_CAUSE_MODIFICATIONS_NOT_LIMITED_TO_S1_U_BEARERS, 111).
-define(GTP2_CAUSE_REQUEST_REJECTED_FOR_A_PMIPV6_REASON, 112).
-define(GTP2_CAUSE_APN_CONGESTION, 113).
-define(GTP2_CAUSE_BEARER_HANDLING_NOT_SUPPORTED, 114).
-define(GTP2_CAUSE_UE_ALREADY_RE_ATTACHED, 115).
-define(GTP2_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED, 116).
-define(GTP2_CAUSE_TARGET_ACCESS_RESTRICTED_FOR_THE_SUBSCRIBER, 117).
-define(GTP2_CAUSE_MME_SGSN_REFUSES_DUE_TO_VPLMN_POLICY, 119).
-define(GTP2_CAUSE_GTP_C_ENTITY_CONGESTION, 120).
-define(GTP2_CAUSE_LATE_OVERLAPPING_REQUEST, 121).
-define(GTP2_CAUSE_TIMED_OUT_REQUEST, 122).
-define(GTP2_CAUSE_UE_IS_TEMPORARILY_NOT_REACHABLE_DUE_TO_POWER_SAVING, 123).
-define(GTP2_CAUSE_RELOCATION_FAILURE_DUE_TO_NAS_MESSAGE_REDIRECTION, 124).
-define(GTP2_CAUSE_UE_NOT_AUTHORISED_BY_OCS_OR_EXTERNAL_AAA_SERVER, 125).
-define(GTP2_CAUSE_MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED, 126).
-define(GTP2_CAUSE_REQUEST_REJECTED_DUE_TO_UE_CAPABILITY, 127).
-define(GTP2_CAUSE_S1_U_PATH_FAILURE, 128).
-define(GTP2_CAUSE_5GC_NOT_ALLOWED, 129).

-define(GTP_PDP_ADDR_TYPE_NR_IPv4, 16#21).
-define(GTP_PDP_ADDR_TYPE_NR_IPv6, 16#57).
-define(GTP_PDP_ADDR_TYPE_NR_IPv4v6, 16#8d).