comparison doc/Arch-design @ 3:b084a9542471

doc/Arch-design: planned design of local socket interface
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 22 Dec 2023 09:29:21 +0000
parents b203ebebe9b3
children da97e78a5586
comparison
equal deleted inserted replaced
2:b203ebebe9b3 3:b084a9542471
525 for an earlier message which is still active, i.e., still queued for delivery 525 for an earlier message which is still active, i.e., still queued for delivery
526 to its destination. Instead of adding such duplicates to the queue, it is 526 to its destination. Instead of adding such duplicates to the queue, it is
527 desirable to be able to detect and suppress them. The details remain to be 527 desirable to be able to detect and suppress them. The details remain to be
528 worked out. 528 worked out.
529 529
530 2.5. Local socket interface between SMSC components
531
532 There will be an ad hoc local UNIX domain socket interface between different
533 components of ThemWi-SMSC. themwi-smsc-core will be the single server for this
534 local socket i/f, and all other components will connect to it as clients.
535 Local socket clients will be able to function in two fundamental ways on this
536 internal interface:
537
538 a) Irrespective of any other function, each local socket client will be able to
539 execute "pure client" exchanges with themwi-smsc-core, such as
540 SMSC_REQ_SUBMIT and SMSC_REQ_CANCEL.
541
542 b) Long-lived SMSC components that perform certain specific roles (IMSI lookup
543 role, GSM MT delivery role, SMPP peer delivery role for each upstream or
544 downstream peer) will register with themwi-smsc-core as role-handlers for
545 these specific roles.
546
547 The architectural model of this internal socket i/f is that of request-response
548 exchanges: each message is either a request or a response, with responses
549 matched to requests. There are two possible directions for such exchanges:
550
551 * For "pure client" operations and role-handler (RH) registration exchanges,
552 requests flow from the connected client to themwi-smsc-core;
553
554 * Once an RH has successfully registered and declared itself to be in "service
555 up" state, themwi-smsc-core will initiate certain requests toward this RH,
556 as detailed in this section.
557
558 2.5.1. Pure client exchanges
559
560 All exchanges listed in this section consist of a request issued by the client
561 toward themwi-smsc-core and a response message in the reverse direction. These
562 commands will be sent by standalone clients like themwi-smsc-submit and also by
563 role-handler components: the same process that acts as RH for GSM MT delivery
564 will need to submit SMs coming from GSM MO activity, the same process that acts
565 as RH for delivery to a given SMPP peer will need to submit SMs coming from
566 that peer, etc.
567
568 2.5.1.1. SMSC_REQ_SUBMIT
569
570 This command submits or enters or injects a new SM into the SMSC. The client
571 will send a struct sm_record, and themwi-smsc-core takes over from there. All
572 processing described in section 2.4 happens upon this command; failure at any
573 of the steps detailed there will result in an error response to the issuing
574 client in this exchange. A successful response indicates that the new SM has
575 been written into PMS and accepted by the SMSC.
576
577 2.5.1.2. SMSC_REQ_CANCEL
578
579 This command requests that an active (not yet delivered or timed out) SM be
580 canceled. The SM to be canceled can be identified by its absolute index
581 (0-based absolute position in PMS) or by a tuple of {OA, DA, MR} - the latter
582 option is needed for implementation of cancel operation via SMS-COMMAND from
583 GSM MO side.
584
585 2.5.1.3. SMSC_REQ_CHANGE_SRR
586
587 This command is similar to SMSC_REQ_CANCEL (supports the same ways of
588 identifying the target message), but instead of cancelling the message, it
589 changes the state of Status Report Requested flag.
590
591 2.5.2. Role handler registration and service state
592
593 These exchanges flow in the same direction as those listed in section 2.5.1
594 (from the connected client to themwi-smsc-core), but are issued only by specific
595 long-lived processes that serve as specific role-handlers.
596
597 2.5.2.1. SMSC_RH_REGISTER
598
599 The long-lived connected client process sending this request is asking to
600 register for its specific role. The following 3 roles are possible:
601
602 * ROLE_IMSI_LOOKUP
603 * ROLE_GSM_MT_DELIVERY
604 * ROLE_PEER_DELIVERY
605
606 If the role type is ROLE_PEER_DELIVERY, there is an additional argument naming
607 the specific peer; non-empty names identify downstream peers and the special
608 name "" (null string) identifies the upstream peer. For the other two role
609 types, there is no such extra argument: there is only one ROLE_IMSI_LOOKUP and
610 only one ROLE_GSM_MT_DELIVERY.
611
612 Only one client can be registered for each role: one for ROLE_IMSI_LOOKUP, one
613 for ROLE_GSM_MT_DELIVERY and one for each peer. Registration attempts for an
614 already-claimed role will result in an error response.
615
616 2.5.2.2. SMSC_RH_SERVICE_STATE
617
618 The service state of a given RH may be up or down. If the RH process is running
619 but unable to perform its job (e.g., the upstream peer connection is down), its
620 service state is down; in order for an RH to receive requests for processing
621 from themwi-smsc-core, it needs to not only register for its role, but also
622 declare itself to be in "service up" state. The present exchange makes the
623 declaration of service state being up or down.
624
625 2.5.3. Exchanges with the IMSI resolver RH
626
627 SMSC_MT_FIND_IMSI: request direction is from themwi-smsc-core to the registered
628 IMSI resolver RH. The request message carries an MSISDN; the matching response
629 carries the corresponding IMSI or an error.
630
631 2.5.4. Exchanges with the GSM MT delivery RH
632
633 2.5.4.1. SMSC_MT_TRANSFER
634
635 Request direction is from themwi-smsc-core to the registered GSM MT delivery RH.
636 This exchange transfers a given SM (intended for GSM MT delivery) into temporary
637 custody of themwi-smsc-gsmif process, which is the RH for this role.
638 themwi-smsc-gsmif retains custody of this SM, and themwi-smsc-core regards this
639 SM as being in the custody of themwi-smsc-gsmif, until one of the following two
640 outcomes:
641
642 a) The SM is discharged: delivered, canceled or times out as determined by
643 themwi-smsc-gsmif, with an attendant SMSC_MT_DISCHARGE exchange;
644
645 b) The service goes down (socket client disconnects or declares itself down via
646 SMSC_RH_SERVICE_STATE). In this case themwi-smsc-core retakes custody of
647 all still-active SMs that were previously handed over to themwi-smsc-gsmif
648 via SMSC_MT_TRANSFER.
649
650 2.5.4.2. SMSC_MT_CANCEL
651
652 Request direction is from themwi-smsc-core to the registered GSM MT delivery RH,
653 which is themwi-smsc-gsmif. themwi-smsc-core issues this request toward
654 themwi-smsc-gsmif whenever it receives SMSC_REQ_CANCEL for an SM that has been
655 handed over to themwi-smsc-gsmif via SMSC_MT_TRANSFER.
656
657 2.5.4.3. SMSC_MT_DISCHARGE
658
659 themwi-smsc-gsmif sends this request to themwi-smsc-core to indicate the
660 discharge (successful delivery, cancellation or validity period expiry) of an
661 SM that has previously been transferred via SMSC_MT_TRANSFER.
662
663 2.5.5. Exchanges with peer delivery role handlers
664
665 SMSC_DELIVER_TO_PEER: request direction is from themwi-smsc-core to the
666 registered RH for this peer. The request carries an SM (struct sm_record);
667 the response carries success or failure.
668
530 3. SMS communication via direct shell access 669 3. SMS communication via direct shell access
531 670
532 To be filled. 671 To be filled.
533 672
534 4. Interface to local Osmocom GSM network 673 4. Interface to local Osmocom GSM network