- if filter.ApiVersion != nil {
- for _, version := range profile.Versions {
- if *filter.ApiVersion == version.ApiVersion {
- match = true
- }
+ if filter.AefId != nil {
+ aefIdMatch = *filter.AefId == profile.AefId
+ }
+ if filter.ApiVersion != nil || filter.CommType != nil {
+ versionMatch = checkVersionAndCommType(profile, filter.ApiVersion, filter.CommType)
+ }
+ if filter.Protocol != nil {
+ protocolMatch = profile.Protocol != nil && *filter.Protocol == *profile.Protocol
+ }
+ if filter.DataFormat != nil {
+ dataFormatMatch = profile.DataFormat != nil && *filter.DataFormat == *profile.DataFormat
+ }
+ if aefIdMatch && versionMatch && protocolMatch && dataFormatMatch {
+ return true
+ }
+ }
+ return false
+}
+
+func checkVersionAndCommType(profile publishapi.AefProfile, wantedVersion *string, commType *publishapi.CommunicationType) bool {
+ match := false
+ if wantedVersion != nil {
+ for _, version := range profile.Versions {
+ match = checkVersion(version, wantedVersion, commType)
+ if match {
+ break