• Guido Casati's avatar
    Refactor NAS 5GMM messages structs definitions · 63d7f26c
    Guido Casati authored
    as per legacy code, the NAS functions in nr_nas_msg.c were encoding
    the header in the plain header contained in MM_msg
    (e.g. plain -> mm_msg -> header in fgs_nas_message_t). The same
    header was encoded in the mobility management message contained
    in the same struct (e.g. plain -> mm_msg -> registration_request
    -> protocoldiscriminator). As this was more complicated than
    necessary, the goal of this commit is to simplify the code and
    improve readability. Namely:
    
    * Refactor MM_msg into fgmm_nas_message_plain_t to contain
      (1) 5GMM Header
      (2) 5GMM Payload union
    * Use fgmm_nas_message_plain_t and fgmm_nas_msg_security_protected_t
      in the 5GMM NAS procedures
    * Remove NAS header IEs from 5GMM messages structs and use
      the header in fgs_nas_message_plain_t.
      This reduce also the repetitions of header members in each
      of the 5GMM messages structs.
    * Rename struct to distinguish between 5GMM and 5GSM
    * Remove fgs_nas_message_t and nas_msg_header_t,
      use directly basic 5GS struct definitions, simplify the code
    * The callbacks in nr_nas_msg.c are now doing
      (1) encode header with the common NAS lib
      (2) encode contents with the 5GMM libs
    * improve code readibility in the process
    63d7f26c
nr_nas_msg.c 50.9 KB