@@ -35,10 +35,12 @@ import (
35
35
36
36
// maps of named clients and servers
37
37
var clientMap map [int ]* Client
38
+
38
39
var serverMap map [int ]* Server
39
40
40
41
// maps of named SAPs and ASEs
41
42
var serviceMap map [int ]* ServiceAccessPoint
43
+
42
44
var elementMap map [int ]* ApplicationServiceElement
43
45
44
46
func init () {
@@ -356,12 +358,12 @@ type ServiceAccessPointRequirements interface {
356
358
SapRequest (Args , KWArgs ) error
357
359
SapIndication (Args , KWArgs ) error
358
360
SapResponse (Args , KWArgs ) error
359
- _setServiceElement (serviceElement _ApplicationServiceElement )
361
+ _setServiceElement (serviceElement ApplicationServiceElementContract )
360
362
}
361
363
362
364
type ServiceAccessPoint struct {
363
365
serviceID * int
364
- serviceElement _ApplicationServiceElement
366
+ serviceElement ApplicationServiceElementContract
365
367
366
368
log zerolog.Logger
367
369
}
@@ -419,6 +421,7 @@ func (s *ServiceAccessPoint) SapRequest(args Args, kwargs KWArgs) error {
419
421
}
420
422
421
423
func (s * ServiceAccessPoint ) SapIndication (Args , KWArgs ) error {
424
+ // TODO: we should remove this asap to check where we have actual caps because we can compile here
422
425
panic ("this should be implemented by outer struct" )
423
426
}
424
427
@@ -432,15 +435,20 @@ func (s *ServiceAccessPoint) SapResponse(args Args, kwargs KWArgs) error {
432
435
}
433
436
434
437
func (s * ServiceAccessPoint ) SapConfirmation (Args , KWArgs ) error {
438
+ // TODO: we should remove this asap to check where we have actual caps because we can compile here
435
439
panic ("this should be implemented by outer struct" )
436
440
}
437
441
438
- func (s * ServiceAccessPoint ) _setServiceElement (serviceElement _ApplicationServiceElement ) {
442
+ func (s * ServiceAccessPoint ) _setServiceElement (serviceElement ApplicationServiceElementContract ) {
439
443
s .serviceElement = serviceElement
440
444
}
441
445
442
- // _ApplicationServiceElement is an interface used for documentation
443
- type _ApplicationServiceElement interface {
446
+ type ApplicationServiceElementRequirements interface {
447
+ Confirmation (args Args , kwargs KWArgs ) error
448
+ }
449
+
450
+ // ApplicationServiceElementContract is an interface used for documentation
451
+ type ApplicationServiceElementContract interface {
444
452
Request (args Args , kwargs KWArgs ) error
445
453
Indication (args Args , kwargs KWArgs ) error
446
454
Response (args Args , kwargs KWArgs ) error
@@ -455,7 +463,7 @@ type ApplicationServiceElement struct {
455
463
log zerolog.Logger
456
464
}
457
465
458
- func NewApplicationServiceElement (localLog zerolog.Logger , rootStruct _ApplicationServiceElement , opts ... func (* ApplicationServiceElement )) (* ApplicationServiceElement , error ) {
466
+ func NewApplicationServiceElement (localLog zerolog.Logger , requirements ApplicationServiceElementRequirements , opts ... func (* ApplicationServiceElement )) (* ApplicationServiceElement , error ) {
459
467
a := & ApplicationServiceElement {
460
468
log : localLog ,
461
469
}
@@ -476,8 +484,8 @@ func NewApplicationServiceElement(localLog zerolog.Logger, rootStruct _Applicati
476
484
return nil , errors .Errorf ("service access point %d already bound" , aseID )
477
485
}
478
486
479
- // Note: we need to pass the rootStruct (which should contain a as delegate) here
480
- if err := Bind (localLog , rootStruct , service ); err != nil {
487
+ // Note: we need to pass the requirements (which should contain us as a delegate) here
488
+ if err := Bind (localLog , requirements , service ); err != nil {
481
489
return nil , errors .Wrap (err , "error binding" )
482
490
}
483
491
}
@@ -502,6 +510,7 @@ func (a *ApplicationServiceElement) Request(args Args, kwargs KWArgs) error {
502
510
}
503
511
504
512
func (a * ApplicationServiceElement ) Indication (Args , KWArgs ) error {
513
+ // TODO: we should remove this asap to check where we have actual caps because we can compile here
505
514
panic ("this should be implemented by outer struct" )
506
515
}
507
516
@@ -516,6 +525,7 @@ func (a *ApplicationServiceElement) Response(args Args, kwargs KWArgs) error {
516
525
}
517
526
518
527
func (a * ApplicationServiceElement ) Confirmation (Args , KWArgs ) error {
528
+ // TODO: we should remove this asap to check where we have actual caps because we can compile here
519
529
panic ("this should be implemented by outer struct" )
520
530
}
521
531
@@ -608,7 +618,7 @@ func Bind(localLog zerolog.Logger, args ...any) error {
608
618
// make sure we're binding clients and servers
609
619
clientCast , okClient := left .(_Client )
610
620
serverCast , okServer := right .(_Server )
611
- elementServiceCast , okElementService := left .(_ApplicationServiceElement )
621
+ elementServiceCast , okElementService := left .(ApplicationServiceElementContract )
612
622
serviceAccessPointCast , okServiceAccessPoint := right .(ServiceAccessPointRequirements )
613
623
if okClient && okServer {
614
624
localLog .Trace ().Msg ("linking client-server" )
0 commit comments