Documentation
¶
Index ¶
- Constants
- func ConvertToProtoTimestamp(unixTime *time.Time) *timestamp.Timestamp
- func GetEventTriggersRelatedInfo(eventTriggers []EventTrigger, revalidationTime *time.Time) ([]protos.EventTrigger, *timestamp.Timestamp)
- func GetGxClientConfiguration() []*diameter.DiameterClientConfig
- func GetIPCANType(pRATType protos.RATType) credit_control.IPCANType
- func GetPCRFConfiguration() []*diameter.DiameterServerConfig
- func GetRATType(pRATType protos.RATType) credit_control.RATType
- func Ipv6PrefixFromMAC(mac net.HardwareAddr) []byte
- func ParseRuleInstallAVPs(policyDBClient policydb.PolicyDBClient, ruleInstalls []*RuleInstallAVP) ([]*protos.StaticRuleInstall, []*protos.DynamicRuleInstall)
- func ParseRuleRemoveAVPs(policyDBClient policydb.PolicyDBClient, rulesToRemoveAVP []*RuleRemoveAVP) []string
- type CCADiameterMessage
- type ChargingRuleReport
- type CreditControlAnswer
- type CreditControlRequest
- type EventTrigger
- type FlowInformation
- type GxClient
- func (gxClient *GxClient) DisableConnections(period time.Duration)
- func (gxClient *GxClient) EnableConnections() error
- func (gxClient *GxClient) IgnoreAnswer(request *CreditControlRequest)
- func (gxClient *GxClient) SendCreditControlRequest(server *diameter.DiameterServerConfig, done chan interface{}, ...) error
- type GxGlobalConfig
- type MonitoringLevel
- type PolicyClient
- type PolicyReAuthAnswer
- type PolicyReAuthHandler
- type PolicyReAuthRequest
- type QosInformation
- type QosRequestInfo
- type RedirectInformation
- type RuleDefinition
- type RuleFailureCode
- type RuleInstallAVP
- type RuleRemoveAVP
- type UsageMonitoringInfo
- type UsageReport
Constants ¶
const ( PCRFAddrEnv = "PCRF_ADDR" GxNetworkEnv = "GX_NETWORK" GxDiamHostEnv = "GX_DIAM_HOST" GxDiamRealmEnv = "GX_DIAM_REALM" GxDiamProductEnv = "GX_DIAM_PRODUCT" GxLocalAddr = "GX_LOCAL_ADDR" PCRFHostEnv = "PCRF_HOST" PCRFRealmEnv = "PCRF_REALM" PCRF91CompliantEnv = "PCRF_91_COMPLIANT" DisableDestHostEnv = "DISABLE_DEST_HOST" OverwriteDestHostEnv = "GX_OVERWRITE_DEST_HOST" DisableEUIIPv6IfNoIPEnv = "DISABLE_EUI64_IPV6_IF_NO_IP" FramedIPv4AddrRequiredEnv = "FRAMED_IPV4_ADDR_REQUIRED" DefaultFramedIPv4AddrEnv = "DEFAULT_FRAMED_IPV4_ADDR" GxSupportedVendorIDsEnv = "GX_SUPPORTED_VENDOR_IDS" PCRF91CompliantFlag = "pcrf_91_compliant" DisableEUIIPv6IfNoIPFlag = "disable_eui64_ipv6_prefix" )
PCRF Environment Variables
Variables ¶
This section is empty.
Functions ¶
func ConvertToProtoTimestamp ¶
func GetEventTriggersRelatedInfo ¶
func GetEventTriggersRelatedInfo( eventTriggers []EventTrigger, revalidationTime *time.Time, ) ([]protos.EventTrigger, *timestamp.Timestamp)
func GetGxClientConfiguration ¶
func GetGxClientConfiguration() []*diameter.DiameterClientConfig
GetGxClientConfiguration returns a slice containing all client diameter configuration
func GetIPCANType ¶
func GetIPCANType(pRATType protos.RATType) credit_control.IPCANType
Since we don't specify the IP CAN type at session initialization, and we only support WLAN and EUTRAN, we will infer the IP CAN type from RAT type.
func GetPCRFConfiguration ¶
func GetPCRFConfiguration() []*diameter.DiameterServerConfig
TODO: refactor those functions to make it more simple GetPCRFConfiguration returns a slice containing all configuration for all known PCRF
func GetRATType ¶
func GetRATType(pRATType protos.RATType) credit_control.RATType
func Ipv6PrefixFromMAC ¶
func Ipv6PrefixFromMAC(mac net.HardwareAddr) []byte
Ipv6PrefixFromMAC creates a unique local EUI-64 based IPv6 address from given MAC address see: https://www.rfc-editor.org/rfc/rfc4193.html
func ParseRuleInstallAVPs ¶
func ParseRuleInstallAVPs( policyDBClient policydb.PolicyDBClient, ruleInstalls []*RuleInstallAVP, ) ([]*protos.StaticRuleInstall, []*protos.DynamicRuleInstall)
func ParseRuleRemoveAVPs ¶
func ParseRuleRemoveAVPs(policyDBClient policydb.PolicyDBClient, rulesToRemoveAVP []*RuleRemoveAVP) []string
Types ¶
type CCADiameterMessage ¶
type CCADiameterMessage struct { SessionID string `avp:"Session-Id"` RequestNumber uint32 `avp:"CC-Request-Number"` ResultCode uint32 `avp:"Result-Code"` OriginHost string `avp:"Origin-Host"` ExperimentalResult struct { VendorId uint32 `avp:"Vendor-Id"` ExperimentalResultCode uint32 `avp:"Experimental-Result-Code"` } `avp:"Experimental-Result"` RequestType uint32 `avp:"CC-Request-Type"` RuleInstalls []*RuleInstallAVP `avp:"Charging-Rule-Install"` RuleRemovals []*RuleRemoveAVP `avp:"Charging-Rule-Remove"` UsageMonitors []*UsageMonitoringInfo `avp:"Usage-Monitoring-Information"` EventTriggers []EventTrigger `avp:"Event-Trigger"` RevalidationTime *time.Time `avp:"Revalidation-Time"` }
CCADiameterMessage is a gx CCA message as defined in 3GPP 29.212
type ChargingRuleReport ¶
type ChargingRuleReport struct { RuleNames []string `avp:"Charging-Rule-Name"` RuleBaseNames []string `avp:"Charging-Rule-Base-Name"` FailureCode RuleFailureCode `avp:"Rule-Failure-Code"` }
Charging-Rule-Report ::= < AVP Header: 1018 >
*[ Charging-Rule-Name ] *[ Charging-Rule-Base-Name ] [ Bearer-Identifier ] [ PCC-Rule-Status ] [ Rule-Failure-Code ] [ Final-Unit-Indication ] *[ RAN-NAS-Release-Cause ] *[ Content-Version ] *[ AVP ]
type CreditControlAnswer ¶
type CreditControlAnswer struct { ResultCode uint32 ExperimentalResultCode uint32 SessionID string OriginHost string RequestNumber uint32 RuleInstallAVP []*RuleInstallAVP RuleRemoveAVP []*RuleRemoveAVP UsageMonitors []*UsageMonitoringInfo EventTriggers []EventTrigger RevalidationTime *time.Time }
CreditControlAnswer represents the gx CCA message we're expecting
func GetAnswer ¶
func GetAnswer(done <-chan interface{}) *CreditControlAnswer
GetAnswer returns a *CreditControlAnswer from the given interface channel
type CreditControlRequest ¶
type CreditControlRequest struct { SessionID string Type credit_control.CreditRequestType IMSI string RequestNumber uint32 IPAddr string SpgwIPV4 string Apn string Msisdn []byte Imei string PlmnID string UserLocation []byte GcID string Qos *QosRequestInfo UsageReports []*UsageReport HardwareAddr []byte IPCANType credit_control.IPCANType RATType credit_control.RATType TgppCtx *protos.TgppContext EventTrigger EventTrigger }
CreditControlRequest represents a call over gx
func (*CreditControlRequest) FromUsageMonitorUpdate ¶
func (ccr *CreditControlRequest) FromUsageMonitorUpdate(update *protos.UsageMonitoringUpdateRequest) *CreditControlRequest
type EventTrigger ¶
type EventTrigger uint32
const ( RevalidationTimeout EventTrigger = 17 UsageReportTrigger EventTrigger = 33 PCRF91UsageReportTrigger EventTrigger = 26 )
type FlowInformation ¶
type FlowInformation struct {
FlowDescription string `avp:"Flow-Description"`
}
Flow-Information ::= < AVP Header: 1058 >
[ Flow-Description ] [ Packet-Filter-Identifier ] [ Packet-Filter-Usage ] [ ToS-Traffic-Class ] [ Security-Parameter-Index ] [ Flow-Label ] [ Flow-Direction ]
Only Flow-Description is supported right now
type GxClient ¶
type GxClient struct {
// contains filtered or unexported fields
}
GxClient is a client to send Gx Credit Control Request messages over diameter And receive Gx Credit Control Answer messages in response Although Gy and Gx both send Credit Control Requests, their Application IDs, allowed AVPs, and purposes are different
func NewConnectedGxClient ¶
func NewConnectedGxClient( diamClient *diameter.Client, serverCfg *diameter.DiameterServerConfig, reAuthHandler PolicyReAuthHandler, cloudRegistry service_registry.GatewayRegistry, gxGlobalConfig *GxGlobalConfig, ) *GxClient
NewConnectedGxClient contructs a new GxClient with the magma diameter settings
func NewGxClient ¶
func NewGxClient( clientCfg *diameter.DiameterClientConfig, serverCfg *diameter.DiameterServerConfig, reAuthHandler PolicyReAuthHandler, cloudRegistry service_registry.GatewayRegistry, globalConfig *GxGlobalConfig, ) *GxClient
NewGxClient contructs a new GxClient with the magma diameter settings
func (*GxClient) DisableConnections ¶
func (*GxClient) EnableConnections ¶
func (*GxClient) IgnoreAnswer ¶
func (gxClient *GxClient) IgnoreAnswer(request *CreditControlRequest)
IgnoreAnswer removes tracked requests in the request manager to ensure the request mapping does not leak. For example, if 10 requests are sent out, and 2 time out given the user's timeout duration, then those 2 requests should be ignored so that they don't leak
func (*GxClient) SendCreditControlRequest ¶
func (gxClient *GxClient) SendCreditControlRequest( server *diameter.DiameterServerConfig, done chan interface{}, request *CreditControlRequest, ) error
SendCreditControlRequest sends a Gx Credit Control Requests to the given connection Input: DiameterServerConfig containing info about where to send messages
chan<- *CreditControlAnswer to send answers to CreditControlRequest with the request to send
Output: error if server connection failed
type GxGlobalConfig ¶
func GetGxGlobalConfig ¶
func GetGxGlobalConfig() *GxGlobalConfig
type MonitoringLevel ¶
type MonitoringLevel uint8
const ( SessionLevel MonitoringLevel = 0x0 RuleLevel MonitoringLevel = 0x1 )
type PolicyClient ¶
type PolicyClient interface { SendCreditControlRequest( server *diameter.DiameterServerConfig, done chan interface{}, request *CreditControlRequest, ) error IgnoreAnswer(request *CreditControlRequest) EnableConnections() error DisableConnections(period time.Duration) }
PolicyClient is an interface to define something that sends requests over Gx. This can be used to stub out requests
type PolicyReAuthAnswer ¶
type PolicyReAuthAnswer struct { SessionID string `avp:"Session-Id"` ResultCode uint32 `avp:"Result-Code"` RuleReports []*ChargingRuleReport `avp:"Charging-Rule-Report"` }
<RA-Answer> ::= < Diameter Header: 258, PXY >
< Session-Id > [ DRMP ] { Origin-Host } { Origin-Realm } [ Result-Code ] [ Experimental-Result ] [ Origin-State-Id ] [ OC-Supported-Features ] [ OC-OLR ] [ IP-CAN-Type ] [ RAT-Type ] [ AN-Trusted ] 0*2 [ AN-GW-Address ] [ 3GPP-SGSN-MCC-MNC ] [ 3GPP-SGSN-Address ] [ 3GPP-SGSN-Ipv6-Address ] [ RAI ] [ 3GPP-User-Location-Info ] [ User-Location-Info-Time ] [ NetLoc-Access-Support ] [ User-CSG-Information ] [ 3GPP-MS-TimeZone ] [ Default-QoS-Information ] *[ Charging-Rule-Report] [ Error-Message ] [ Error-Reporting-Host ] [ Failed-AVP ] *[ Proxy-Info ] *[ AVP ]
func (*PolicyReAuthAnswer) FromProto ¶
func (raa *PolicyReAuthAnswer) FromProto(sessionID string, answer *protos.PolicyReAuthAnswer) *PolicyReAuthAnswer
type PolicyReAuthHandler ¶
type PolicyReAuthHandler func(request *PolicyReAuthRequest) *PolicyReAuthAnswer
func GetGxReAuthHandler ¶
func GetGxReAuthHandler(cloudRegistry service_registry.GatewayRegistry, policyDBClient policydb.PolicyDBClient) PolicyReAuthHandler
Factory function for a RAR message handler which relays to the corresponding gateway.
type PolicyReAuthRequest ¶
type PolicyReAuthRequest struct { SessionID string `avp:"Session-Id"` OriginHost string `avp:"Origin-Host"` RulesToRemove []*RuleRemoveAVP `avp:"Charging-Rule-Remove"` RulesToInstall []*RuleInstallAVP `avp:"Charging-Rule-Install"` Qos *QosInformation `avp:"QoS-Information"` UsageMonitors []*UsageMonitoringInfo `avp:"Usage-Monitoring-Information"` EventTriggers []EventTrigger `avp:"Event-Trigger"` RevalidationTime *time.Time `avp:"Revalidation-Time"` }
<RA-Request> ::= < Diameter Header: 258, REQ, PXY >
< Session-Id > [ DRMP ] { Auth-Application-Id } { Origin-Host } { Origin-Realm } { Destination-Realm } { Destination-Host } { Re-Auth-Request-Type } [ Session-Release-Cause ] [ Origin-State-Id ] [ OC-Supported-Features ] *[ Event-Trigger ] [ Event-Report-Indication ] *[ Charging-Rule-Remove ] *[ Charging-Rule-Install ] [ Default-EPS-Bearer-QoS ] *[ QoS-Information ] [ Default-QoS-Information ] [ Revalidation-Time ] *[ Usage-Monitoring-Information ] [ PCSCF-Restoration-Indication ] 0*4[ Conditional-Policy-Information ] [ Removal-Of-Access ] [ IP-CAN-Type ] [ PRA-Install ] [ PRA-Remove ] *[ Proxy-Info ] *[ Route-Record ] *[ AVP ]
func (*PolicyReAuthRequest) ToProto ¶
func (rar *PolicyReAuthRequest) ToProto(imsi, sid string, policyDBClient policydb.PolicyDBClient) *protos.PolicyReAuthRequest
type QosInformation ¶
type QosInformation struct { BearerIdentifier string `avp:"Bearer-Identifier"` MaxReqBwUL *uint32 `avp:"Max-Requested-Bandwidth-UL"` MaxReqBwDL *uint32 `avp:"Max-Requested-Bandwidth-DL"` GbrDL *uint32 `avp:"Guaranteed-Bitrate-DL"` GbrUL *uint32 `avp:"Guaranteed-Bitrate-UL"` Qci *uint32 `avp:"QoS-Class-Identifier"` }
QoS per service date flow message
func (*QosInformation) ToProto ¶
func (q *QosInformation) ToProto() *protos.FlowQos
type QosRequestInfo ¶
type QosRequestInfo struct { ApnAggMaxBitRateUL uint32 ApnAggMaxBitRateDL uint32 QosClassIdentifier uint32 PriLevel uint32 PreCapability uint32 PreVulnerability uint32 }
func (*QosRequestInfo) FromProtos ¶
func (qos *QosRequestInfo) FromProtos(pQos *protos.QosInformationRequest) *QosRequestInfo
type RedirectInformation ¶
type RedirectInformation struct { RedirectSupport uint32 `avp:"Redirect-Support"` RedirectAddressType uint32 `avp:"Redirect-Address-Type"` RedirectServerAddress string `avp:"Redirect-Server-Address"` }
RedirectInformation represents Information needed for redirection setup
func (*RedirectInformation) ToProto ¶
func (r *RedirectInformation) ToProto() *protos.RedirectInformation
type RuleDefinition ¶
type RuleDefinition struct { RuleName string `avp:"Charging-Rule-Name"` RatingGroup *uint32 `avp:"Rating-Group"` Precedence uint32 `avp:"Precedence"` MonitoringKey []byte `avp:"Monitoring-Key"` FlowDescriptions []string `avp:"Flow-Description"` FlowInformations []*FlowInformation `avp:"Flow-Information"` RedirectInformation *RedirectInformation `avp:"Redirect-Information"` Qos *QosInformation `avp:"QoS-Information"` ServiceIdentifier *uint32 `avp:"Service-Identifier"` }
func (*RuleDefinition) GetFlowList ¶
func (rd *RuleDefinition) GetFlowList() []*protos.FlowDescription
func (*RuleDefinition) GetTrackingType ¶
func (rd *RuleDefinition) GetTrackingType() protos.PolicyRule_TrackingType
func (*RuleDefinition) ToProto ¶
func (rd *RuleDefinition) ToProto() *protos.PolicyRule
type RuleFailureCode ¶
type RuleFailureCode uint32
const ( UnknownRuleName RuleFailureCode = 1 RatingGroupError RuleFailureCode = 2 ServiceIdentifierError RuleFailureCode = 3 GwPCEFMalfunction RuleFailureCode = 4 ResourcesLimitation RuleFailureCode = 5 MaxNrBearersReached RuleFailureCode = 6 UnknownBearerID RuleFailureCode = 7 MissingBearerID RuleFailureCode = 8 MissingFlowInformation RuleFailureCode = 9 ResourceAllocationFailure RuleFailureCode = 10 UnsuccessfulQoSValidation RuleFailureCode = 11 IncorrectFlowInformation RuleFailureCode = 12 PsToCsHandover RuleFailureCode = 13 TDFApplicationIdentifierError RuleFailureCode = 14 NoBearerFound RuleFailureCode = 15 FilterRestrictions RuleFailureCode = 16 ANGWFailed RuleFailureCode = 17 MissingRedirectServerAddress RuleFailureCode = 18 CMEndUserServiceDenied RuleFailureCode = 19 CMCreditControlNotApplicable RuleFailureCode = 20 CMAuthorizationRejected RuleFailureCode = 21 CMUserUnknown RuleFailureCode = 22 CMRatingFailed RuleFailureCode = 23 RoutingRuleRejection RuleFailureCode = 24 UnknownRoutingAccessInformation RuleFailureCode = 25 NoNBIFOMSupport RuleFailureCode = 26 )
type RuleInstallAVP ¶
type RuleInstallAVP struct { RuleNames []string `avp:"Charging-Rule-Name"` RuleBaseNames []string `avp:"Charging-Rule-Base-Name"` RuleDefinitions []*RuleDefinition `avp:"Charging-Rule-Definition"` RuleActivationTime *time.Time `avp:"Rule-Activation-Time"` RuleDeactivationTime *time.Time `avp:"Rule-Deactivation-Time"` }
RuleInstallAVP represents a policy rule to install. It can hold one of rule name, base name or definition
type RuleRemoveAVP ¶
type UsageMonitoringInfo ¶
type UsageMonitoringInfo struct { MonitoringKey []byte `avp:"Monitoring-Key"` GrantedServiceUnit *credit_control.GrantedServiceUnit `avp:"Granted-Service-Unit"` Level MonitoringLevel `avp:"Usage-Monitoring-Level"` }
func (*UsageMonitoringInfo) ToUsageMonitoringCredit ¶
func (monitor *UsageMonitoringInfo) ToUsageMonitoringCredit() *protos.UsageMonitoringCredit
type UsageReport ¶
type UsageReport struct { MonitoringKey []byte Level MonitoringLevel InputOctets uint64 OutputOctets uint64 TotalOctets uint64 }
func (*UsageReport) FromUsageMonitorUpdate ¶
func (report *UsageReport) FromUsageMonitorUpdate(update *protos.UsageMonitorUpdate) *UsageReport