diff --git a/openair-cn/NAS/EURECOM-NAS/COPYING b/openair-cn/NAS/EURECOM-NAS/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/Makefile b/openair-cn/NAS/EURECOM-NAS/Makefile deleted file mode 100644 index c4a02b99d7c3bb07e3262a40f8dd80012281db00..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -# To be run as: make or make PROCESS=UE or make PROCESS=MME -# make and make PROCESS=UE build ./bin/UEprocess -# make PROCESS=MME builds ./bin/MMEprocess - -include Makerules -include Makefile.inc - -export PROJDIR = $(CURDIR) - -all: -ifeq ($(PROCESS), UE) - @$(CD) $(SECUDIR) && $(MAKE) -f Makefile.NAS -endif - @$(CD) $(UTILDIR) && $(MAKE) - @$(CD) $(APIDIR) && $(MAKE) - @$(CD) $(IESDIR) && $(MAKE) - @$(CD) $(EMMDIR) && $(MAKE) - @$(CD) $(ESMDIR) && $(MAKE) - @$(CD) $(SRCDIR) && $(MAKE) -ifeq ($(PROCESS), UE) - @$(CD) $(TOOLSDIR) && $(MAKE) - @$(CD) $(USRTSTDIR) && $(MAKE) -endif -ifeq ($(PROCESS), MME) - @$(CD) $(NETTSTDIR) && $(MAKE) - @$(CD) $(ASSIMUDIR) && $(MAKE) -endif -# SR include all objects in a single archive - $(AR) rcs libUE/libNasUE.a `find . -name *.o` `find $(OPENAIRCN_DIR)/SECU -name *.o` - -clean: - @$(CD) $(SRCDIR) && $(MAKE) $@ - @$(CD) $(APIDIR) && $(MAKE) $@ - @$(CD) $(EMMDIR) && $(MAKE) $@ - @$(CD) $(ESMDIR) && $(MAKE) $@ - -veryclean: clean - @$(CD) $(SRCDIR) && $(MAKE) $@ - @$(CD) $(APIDIR) && $(MAKE) $@ - @$(CD) $(EMMDIR) && $(MAKE) $@ - @$(CD) $(ESMDIR) && $(MAKE) $@ - @$(CD) $(UTILDIR) && $(MAKE) $@ - @$(CD) $(IESDIR) && $(MAKE) $@ - @$(CD) $(TOOLSDIR) && $(MAKE) $@ - @$(CD) $(USRTSTDIR) && $(MAKE) $@ - @$(CD) $(NETTSTDIR) && $(MAKE) $@ - @$(CD) $(ASSIMUDIR) && $(MAKE) $@ - @$(RM) libUE/libNasUE.a - -veryveryclean: veryclean - @$(CD) $(BINDIR) && $(RM) * .*.nvram - @$(CD) $(LIBDIR) && $(RM) * - @$(CD) $(LIBDIR)UE && $(RM) * - @$(CD) $(LIBDIR)MME && $(RM) * - -depend: - @$(CD) $(SRCDIR) && $(MAKE) depend - @$(CD) $(APIDIR) && $(MAKE) depend - @$(CD) $(EMMDIR) && $(MAKE) depend - @$(CD) $(ESMDIR) && $(MAKE) depend - @$(CD) $(UTILDIR) && $(MAKE) depend - @$(CD) $(IESDIR) && $(MAKE) depend - @$(CD) $(TOOLSDIR) && $(MAKE) depend - @$(CD) $(USRTSTDIR) && $(MAKE) depend - @$(CD) $(NETTSTDIR) && $(MAKE) depend - @$(CD) $(ASSIMUDIR) && $(MAKE) depend - -# DO NOT DELETE diff --git a/openair-cn/NAS/EURECOM-NAS/Makefile.inc b/openair-cn/NAS/EURECOM-NAS/Makefile.inc deleted file mode 100644 index 6244567e3d963d8874c4415187dedc1b6715b317..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/Makefile.inc +++ /dev/null @@ -1,68 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -# list of generated libraries -LIBUTIL = libutil -LIBAPI = libapi -LIBIES = libies -LIBEMMMSG = libEMMmsg -LIBEMMSAP = libEMMsap -LIBESMMSG = libESMmsg -LIBESMSAP = libESMsap - -# Binary directories -BINDIR = $(PROJDIR)/bin -LIBDIR = $(PROJDIR)/lib -LIBPROCESS = $(LIBDIR)$(PROCESS) - -# Source directories -SECUDIR = $(OPENAIRCN_DIR)/SECU -SRCDIR = $(PROJDIR)/src -INCDIR = $(SRCDIR)/include -UTILDIR = $(SRCDIR)/util -APIDIR = $(SRCDIR)/api -USERAPIDIR = $(APIDIR)/user -NETAPIDIR = $(APIDIR)/network -USIMAPIDIR = $(APIDIR)/usim -MMEAPIDIR = $(APIDIR)/mme -IESDIR = $(SRCDIR)/ies -EMMDIR = $(SRCDIR)/emm -ESMDIR = $(SRCDIR)/esm -EMMMSGDIR = $(EMMDIR)/msg -EMMSAPDIR = $(EMMDIR)/sap -ESMMSGDIR = $(ESMDIR)/msg -ESMSAPDIR = $(ESMDIR)/sap - -# Tools directory -TOOLSDIR = $(PROJDIR)/tools - -# Test directories -TSTDIR = $(PROJDIR)/tst -USRTSTDIR = $(TSTDIR)/user -NETTSTDIR = $(TSTDIR)/network -ASSIMUDIR = $(TSTDIR)/as_simulator diff --git a/openair-cn/NAS/EURECOM-NAS/Makerules b/openair-cn/NAS/EURECOM-NAS/Makerules deleted file mode 100644 index c3e2f765fe207e2dca80bde10fc5f8394296effb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/Makerules +++ /dev/null @@ -1,61 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -CC = gcc -RM = rm -f -CP = cp -p -LD = /usr/bin/ld -AR = /usr/bin/ar -CD = cd -MAKE = make - -# machine hardware name -HARDWARE_NAME = $(shell uname -m) -ifeq ($(HARDWARE_NAME), x86_64) - CFLAGS = $(INCLUDES) $(DEFINES) -fPIC -g -pthread -else - CFLAGS = $(INCLUDES) $(DEFINES) -g -pthread -endif -DEFINES = -DLINUX -D_REENTRANT -Wall -O -std=gnu99 - -SVN_REV = $(shell svnversion -n .) -DATE_REV = $(shell date '+%F %T') - -# Default builds UEprocess -ifeq ($(PROCESS), MME) - DEFINES += -DNAS_MME -else - PROCESS = UE - DEFINES += -DNAS_UE -endif - -LDFLAGS = -pthread -L$(LIBDIR) -L$(LIBPROCESS) -lrt - -SRCS = $(wildcard *.c) -OBJS = $(SRCS:.c=.o) - diff --git a/openair-cn/NAS/EURECOM-NAS/bin/COPYING b/openair-cn/NAS/EURECOM-NAS/bin/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/bin/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/lib/COPYING b/openair-cn/NAS/EURECOM-NAS/lib/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/lib/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/libMME/COPYING b/openair-cn/NAS/EURECOM-NAS/libMME/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/libMME/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/libUE/COPYING b/openair-cn/NAS/EURECOM-NAS/libUE/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/libUE/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/COPYING b/openair-cn/NAS/EURECOM-NAS/src/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/MMEprocess.c b/openair-cn/NAS/EURECOM-NAS/src/MMEprocess.c deleted file mode 100644 index abd29a0c14dec44da02ea436d53d700390d23e06..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/MMEprocess.c +++ /dev/null @@ -1,345 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - Source MMEprocess.c - - Version 0.1 - - Date 2013/02/26 - - Product NAS stack - - Subsystem MME NAS main process - - Author Frederic Maurel - - Description Implements the Non-Access Stratum protocol for Evolved Packet - system (EPS) running at the Network side. - - *****************************************************************************/ - -#include "commonDef.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "network_api.h" -#include "nas_network.h" -#include "nas_parser.h" - -#include <stdlib.h> // exit -#include <poll.h> // poll -#include <string.h> // memset -#include <signal.h> // sigaction -#include <pthread.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#define NAS_SLEEP_TIMEOUT 1000 /* 1 second */ - -static void *_nas_network_mngr(void *); - -static int _nas_set_signal_handler(int signal, void (handler)(int)); -static void _nas_signal_handler(int signal); - -static void _nas_clean(int net_fd); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/****************************************************************************/ -int main(int argc, const char *argv[]) -{ - /* - * Get the command line options - */ - if (nas_parser_get_options (argc, argv) != RETURNok) { - nas_parser_print_usage (FIRMWARE_VERSION); - exit (EXIT_FAILURE); - } - - /* - * Initialize logging trace utility - */ - nas_log_init (nas_parser_get_trace_level ()); - - const char *nhost = nas_parser_get_network_host (); - const char *nport = nas_parser_get_network_port (); - - LOG_TRACE (INFO, "MME-MAIN - %s -nhost %s -nport %s -trace 0x%x", argv[0], - nhost, nport, - nas_parser_get_trace_level ()); - - /* - * Initialize the Network interface - */ - if (network_api_initialize (nhost, nport) != RETURNok) { - LOG_TRACE (ERROR, "MME-MAIN - network_api_initialize() failed"); - exit (EXIT_FAILURE); - } - - int network_fd = network_api_get_fd (); - - /* - * Initialize the NAS contexts - */ - nas_network_initialize (); - - /* - * Initialize NAS timer handlers - */ - nas_timer_init (); - - /* - * Set up signal handlers - */ - (void) _nas_set_signal_handler (SIGINT, _nas_signal_handler); - (void) _nas_set_signal_handler (SIGTERM, _nas_signal_handler); - - pthread_attr_t attr; - pthread_attr_init (&attr); - pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - - /* - * Start thread use to manage the network connection endpoint - */ - pthread_t network_mngr; - - if (pthread_create (&network_mngr, &attr, _nas_network_mngr, - &network_fd) != 0) { - LOG_TRACE (ERROR, "MME-MAIN - " - "Failed to create the network management thread"); - network_api_close (network_fd); - exit (EXIT_FAILURE); - } - - pthread_attr_destroy (&attr); - - /* - * Suspend execution of the main process until the network connection - * endpoint is still active - */ - while (network_fd != -1) { - poll (NULL, 0, NAS_SLEEP_TIMEOUT); - network_fd = network_api_get_fd (); - } - - /* Termination cleanup */ - _nas_clean (network_fd); - - LOG_TRACE - (WARNING, "MME-MAIN - NAS main process exited"); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _nas_network_mngr() ** - ** ** - ** Description: Manages the connection endpoint use to communicate with ** - ** the network sublayer ** - ** ** - ** Inputs: fd: The descriptor of the network connection ** - ** endpoint ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_nas_network_mngr(void *args) -{ - LOG_FUNC_IN; - - int ret_code; - int network_message_id; - int bytes; - - int *fd = (int *) args; - - LOG_TRACE (INFO, "MME-MAIN - Network connection manager started (%d)", *fd); - - /* Network receiving loop */ - while (TRUE) { - /* Read the network data message */ - bytes = network_api_read_data (*fd); - - if (bytes == RETURNerror) { - /* Failed to read data from the network sublayer; - * exit from the receiving loop */ - LOG_TRACE (ERROR, "MME-MAIN - " - "Failed to read data from the network sublayer"); - break; - } - - if (bytes == 0) { - /* A signal was caught before any data were available */ - continue; - } - - /* Decode the network data message */ - network_message_id = network_api_decode_data (bytes); - - if (network_message_id == RETURNerror) { - /* Failed to decode data read from the network sublayer */ - continue; - } - - /* Process the network data message */ - ret_code = nas_network_process_data (network_message_id, - network_api_get_data ()); - - if (ret_code != RETURNok) { - /* The network data message has not been successfully - * processed */ - LOG_TRACE - (WARNING, "MME-MAIN - " - "The network procedure call 0x%x failed", - network_message_id); - } - } - - /* Close the connection to the network sublayer */LOG_TRACE (WARNING, - "MME-MAIN - " - "The network connection endpoint manager exited"); - - LOG_FUNC_RETURN(NULL); -} - -/**************************************************************************** - ** ** - ** Name: _nas_set_signal_handler() ** - ** ** - ** Description: Set up a signal handler ** - ** ** - ** Inputs: signal: Signal number ** - ** handler: Signal handler ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_set_signal_handler(int signal, void (handler)(int)) -{ - LOG_FUNC_IN; - - struct sigaction act; - - /* Initialize signal set */ - (void) memset (&act, 0, sizeof(act)); - (void) sigfillset (&act.sa_mask); - (void) sigdelset (&act.sa_mask, SIGHUP); - (void) sigdelset (&act.sa_mask, SIGINT); - (void) sigdelset (&act.sa_mask, SIGTERM); - (void) sigdelset (&act.sa_mask, SIGILL); - (void) sigdelset (&act.sa_mask, SIGTRAP); - (void) sigdelset (&act.sa_mask, SIGIOT); -#ifndef LINUX - (void) sigdelset (&act.sa_mask, SIGEMT); -#endif - (void) sigdelset (&act.sa_mask, SIGFPE); - (void) sigdelset (&act.sa_mask, SIGBUS); - (void) sigdelset (&act.sa_mask, SIGSEGV); - (void) sigdelset (&act.sa_mask, SIGSYS); - - /* Initialize signal handler */ - act.sa_handler = handler; - - if (sigaction (signal, &act, 0) < 0) { - return RETURNerror; - } - - LOG_TRACE (INFO, "MME-MAIN - Handler successfully set for signal %d", signal); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _nas_signal_handler() ** - ** ** - ** Description: Signal handler ** - ** ** - ** Inputs: signal: Signal number ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void _nas_signal_handler(int signal) -{ - LOG_FUNC_IN; - - LOG_TRACE (WARNING, "MME-MAIN - Signal %d received", signal); - _nas_clean (network_api_get_fd ()); - exit (EXIT_SUCCESS); - - LOG_FUNC_OUT - ; -} - -/**************************************************************************** - ** ** - ** Name: _nas_clean() ** - ** ** - ** Description: Performs termination cleanup ** - ** ** - ** Inputs: net_fd: Network's connection file descriptor ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void _nas_clean(int net_fd) -{ - LOG_FUNC_IN; - - LOG_TRACE (INFO, "MME-MAIN - Perform EMM and ESM cleanup"); - nas_network_cleanup (); - - LOG_TRACE (INFO, "MME-MAIN - Closing network connection %d", net_fd); - network_api_close (net_fd); - - LOG_FUNC_OUT - ; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/Makefile b/openair-cn/NAS/EURECOM-NAS/src/Makefile deleted file mode 100644 index e9b2e87b81011c35f6031b3b89c1f01869874511..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -export LD_RUN_PATH = $(LIBDIR):$(LIBPROCESS) - -TARGET = $(PROCESS)process - -# Define the version number -DEFINES += -D'FIRMWARE_VERSION="$(SVN_REV) - $(DATE_REV)"' - -ifeq ($(TARGET), MMEprocess) - SRCS = MMEprocess.c nas_network.c nas_parser.c nas_proc.c -endif -ifeq ($(TARGET), UEprocess) - SRCS = UEprocess.c nas_network.c nas_parser.c nas_proc.c nas_user.c -endif - -LIBS = -lutil -lapi -lEMMmsg -lESMmsg -lEMMsap -lESMsap -lies -lrt -lnettle -lcrypto -lm -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(USERAPIDIR) -I$(NETAPIDIR) \ - -I$(EMMDIR) -I$(EMMMSGDIR) -I$(EMMSAPDIR) \ - -I$(ESMDIR) -I$(ESMMSGDIR) -I$(ESMSAPDIR) \ - -I$(IESDIR) -I$(MMEAPIDIR) - -.PHONY: $(TARGET) - -%.o: %.c Makefile $(PROJDIR)/Makerules $(PROJDIR)/Makefile.inc - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $^ $(EMMDIR)/*.o $(ESMDIR)/*.o $(SECUDIR)/*.o $(LIBS) - @echo Replacing $@ to $(BINDIR) - @$(RM) $(BINDIR)/$@ - @$(CP) $@ $(BINDIR) - -# Always build the main object file which contains the version number -$(TARGET).o: .FORCE -.FORCE: - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) UE$(TARGET) MME$(TARGET) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/src/UEprocess.c b/openair-cn/NAS/EURECOM-NAS/src/UEprocess.c deleted file mode 100644 index d42699eddb6f7c5f4984789f3248f31bc44b851f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/UEprocess.c +++ /dev/null @@ -1,424 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - Source UEprocess.c - - Version 0.1 - - Date 2012/02/27 - - Product NAS stack - - Subsystem UE NAS main process - - Author Frederic Maurel - - Description Implements the Non-Access Stratum protocol for Evolved Packet - system (EPS) running at the User Equipment side. - - *****************************************************************************/ - -#include "commonDef.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "user_api.h" -#include "network_api.h" -#include "nas_user.h" -#include "nas_network.h" -#include "nas_parser.h" - -#include <stdlib.h> // exit -#include <poll.h> // poll -#include <string.h> // memset -#include <signal.h> // sigaction -#include <pthread.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#define NAS_SLEEP_TIMEOUT 1000 /* 1 second */ - -static void *_nas_user_mngr(void *); -static void *_nas_network_mngr(void *); - -static int _nas_set_signal_handler(int signal, void (handler)(int)); -static void _nas_signal_handler(int signal); - -static void _nas_clean(int usr_fd, int net_fd); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/****************************************************************************/ -int main(int argc, const char *argv[]) -{ - /* - * Get the command line options - */ - if (nas_parser_get_options (argc, argv) != RETURNok) { - nas_parser_print_usage (FIRMWARE_VERSION); - exit (EXIT_FAILURE); - } - - /* - * Initialize logging trace utility - */ - nas_log_init (nas_parser_get_trace_level ()); - - const char *uhost = nas_parser_get_user_host (); - const char *uport = nas_parser_get_user_port (); - const char *devpath = nas_parser_get_device_path (); - const char *devparams = nas_parser_get_device_params (); - const char *nhost = nas_parser_get_network_host (); - const char *nport = nas_parser_get_network_port (); - - LOG_TRACE (INFO, - "UE-MAIN - %s -ueid %d -uhost %s -uport %s -nhost %s -nport %s -dev %s -params %s -trace 0x%x", - argv[0], nas_parser_get_ueid (), uhost, uport, nhost, nport, devpath, devparams, - nas_parser_get_trace_level ()); - - /* - * Initialize the User interface - */ - if (user_api_initialize (uhost, uport, devpath, devparams) != RETURNok) { - LOG_TRACE (ERROR, "UE-MAIN - user_api_initialize() failed"); - exit (EXIT_FAILURE); - } - - int user_fd = user_api_get_fd (); - - /* - * Initialize the Network interface - */ - if (network_api_initialize (nhost, nport) != RETURNok) { - LOG_TRACE (ERROR, "UE-MAIN - network_api_initialize() failed"); - user_api_close (user_fd); - exit (EXIT_FAILURE); - } - - int network_fd = network_api_get_fd (); - - /* - * Initialize the NAS contexts - */ - nas_user_initialize (&user_api_emm_callback, &user_api_esm_callback, - FIRMWARE_VERSION); - nas_network_initialize (); - - /* - * Initialize NAS timer handlers - */ - nas_timer_init (); - - /* - * Set up signal handlers - */ - (void) _nas_set_signal_handler (SIGINT, _nas_signal_handler); - (void) _nas_set_signal_handler (SIGTERM, _nas_signal_handler); - - pthread_attr_t attr; - pthread_attr_init (&attr); - pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - - /* - * Start thread use to manage the user connection endpoint - */ - pthread_t user_mngr; - - if (pthread_create (&user_mngr, &attr, _nas_user_mngr, &user_fd) != 0) { - LOG_TRACE (ERROR, "UE-MAIN - " - "Failed to create the user management thread"); - user_api_close (user_fd); - network_api_close (network_fd); - exit (EXIT_FAILURE); - } - - /* - * Start thread use to manage the network connection endpoint - */ - pthread_t network_mngr; - - if (pthread_create (&network_mngr, &attr, _nas_network_mngr, - &network_fd) != 0) { - LOG_TRACE (ERROR, "UE-MAIN - " - "Failed to create the network management thread"); - user_api_close (user_fd); - network_api_close (network_fd); - exit (EXIT_FAILURE); - } - - pthread_attr_destroy (&attr); - - /* - * Suspend execution of the main process until all connection - * endpoints are still active - */ - while ((user_fd != -1) && (network_fd != -1)) { - poll (NULL, 0, NAS_SLEEP_TIMEOUT); - user_fd = user_api_get_fd (); - network_fd = network_api_get_fd (); - } - - /* Termination cleanup */ - _nas_clean (user_fd, network_fd); - - LOG_TRACE - (WARNING, "UE-MAIN - NAS main process exited"); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _nas_user_mngr() ** - ** ** - ** Description: Manages the connection endpoint use to communicate with ** - ** the user application layer ** - ** ** - ** Inputs: fd: The descriptor of the user connection end- ** - ** point ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_nas_user_mngr(void *args) -{ - LOG_FUNC_IN; - - int exit_loop = FALSE; - - int *fd = (int *) args; - - LOG_TRACE (INFO, "UE-MAIN - User connection manager started (%d)", *fd); - - /* User receiving loop */ - while (!exit_loop) { - exit_loop = nas_user_receive_and_process(fd, NULL); - } - - /* Close the connection to the user application layer */ - user_api_close (*fd); - LOG_TRACE (WARNING, "UE-MAIN - " - "The user connection endpoint manager exited"); - - LOG_FUNC_RETURN(NULL); -} - -/**************************************************************************** - ** ** - ** Name: _nas_network_mngr() ** - ** ** - ** Description: Manages the connection endpoint use to communicate with ** - ** the network sublayer ** - ** ** - ** Inputs: fd: The descriptor of the network connection ** - ** endpoint ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_nas_network_mngr(void *args) -{ - LOG_FUNC_IN; - - int ret_code; - int network_message_id; - int bytes; - - int *fd = (int *) args; - - LOG_TRACE (INFO, "UE-MAIN - Network connection manager started (%d)", *fd); - - /* Network receiving loop */ - while (TRUE) { - /* Read the network data message */ - bytes = network_api_read_data (*fd); - - if (bytes == RETURNerror) { - /* Failed to read data from the network sublayer; - * exit from the receiving loop */ - LOG_TRACE (ERROR, "UE-MAIN - " - "Failed to read data from the network sublayer"); - break; - } - - if (bytes == 0) { - /* A signal was caught before any data were available */ - continue; - } - - /* Decode the network data message */ - network_message_id = network_api_decode_data (bytes); - - if (network_message_id == RETURNerror) { - /* Failed to decode data read from the network sublayer */ - continue; - } - - /* Process the network data message */ - ret_code = nas_network_process_data (network_message_id, - network_api_get_data ()); - - if (ret_code != RETURNok) { - /* The network data message has not been successfully - * processed */ - LOG_TRACE - (WARNING, "UE-MAIN - " - "The network procedure call 0x%x failed", - network_message_id); - } - } - - /* Close the connection to the network sublayer */ - network_api_close (*fd); - LOG_TRACE (WARNING, "UE-MAIN - " - "The network connection endpoint manager exited"); - - LOG_FUNC_RETURN(NULL); -} - -/**************************************************************************** - ** ** - ** Name: _nas_set_signal_handler() ** - ** ** - ** Description: Set up a signal handler ** - ** ** - ** Inputs: signal: Signal number ** - ** handler: Signal handler ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_set_signal_handler(int signal, void (handler)(int)) -{ - LOG_FUNC_IN; - - struct sigaction act; - - /* Initialize signal set */ - (void) memset (&act, 0, sizeof(act)); - (void) sigfillset (&act.sa_mask); - (void) sigdelset (&act.sa_mask, SIGHUP); - (void) sigdelset (&act.sa_mask, SIGINT); - (void) sigdelset (&act.sa_mask, SIGTERM); - (void) sigdelset (&act.sa_mask, SIGILL); - (void) sigdelset (&act.sa_mask, SIGTRAP); - (void) sigdelset (&act.sa_mask, SIGIOT); -#ifndef LINUX - (void) sigdelset (&act.sa_mask, SIGEMT); -#endif - (void) sigdelset (&act.sa_mask, SIGFPE); - (void) sigdelset (&act.sa_mask, SIGBUS); - (void) sigdelset (&act.sa_mask, SIGSEGV); - (void) sigdelset (&act.sa_mask, SIGSYS); - - /* Initialize signal handler */ - act.sa_handler = handler; - - if (sigaction (signal, &act, 0) < 0) { - return RETURNerror; - } - - LOG_TRACE (INFO, "UE-MAIN - Handler successfully set for signal %d", signal); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _nas_signal_handler() ** - ** ** - ** Description: Signal handler ** - ** ** - ** Inputs: signal: Signal number ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void _nas_signal_handler(int signal) -{ - LOG_FUNC_IN; - - LOG_TRACE (WARNING, "UE-MAIN - Signal %d received", signal); - _nas_clean (user_api_get_fd (), network_api_get_fd ()); - exit (EXIT_SUCCESS); - - LOG_FUNC_OUT - ; -} - -/**************************************************************************** - ** ** - ** Name: _nas_clean() ** - ** ** - ** Description: Performs termination cleanup ** - ** ** - ** Inputs: usr_fd: User's connection file descriptor ** - ** net_fd: Network's connection file descriptor ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void _nas_clean(int usr_fd, int net_fd) -{ - LOG_FUNC_IN; - - LOG_TRACE (INFO, "UE-MAIN - Perform EMM and ESM cleanup"); - nas_network_cleanup (); - - LOG_TRACE (INFO, "UE-MAIN - " - "Closing user connection %d and network connection %d", - usr_fd, net_fd); - user_api_close (usr_fd); - network_api_close (net_fd); - - LOG_FUNC_OUT - ; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/COPYING b/openair-cn/NAS/EURECOM-NAS/src/api/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/Makefile b/openair-cn/NAS/EURECOM-NAS/src/api/Makefile deleted file mode 100644 index cc4ae1eb252a2010278ee703c29c777e4328d41a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -export PROJDIR = $(PWD)/../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -export INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) \ - -I$(EMMDIR) \ - -I$(ESMDIR) \ - -I$(EMMMSGDIR) \ - -I$(ESMMSGDIR) \ - -I$(SRCDIR) \ - -I$(OPENAIRCN_DIR)/COMMON \ - -I$(OPENAIRCN_DIR)/SECU - -TARGET = $(LIBAPI) -TARGETS = $(TARGET).a $(TARGET).so -OBJS = $(USERAPIDIR)/*.o $(NETAPIDIR)/*.o $(USIMAPIDIR)/*.o $(MMEAPIDIR)/*.o - -all: - @$(CD) $(NETAPIDIR) && $(MAKE) - @$(CD) $(USERAPIDIR) && $(MAKE) - @$(CD) $(USIMAPIDIR) && $(MAKE) - @$(CD) $(MMEAPIDIR) && $(MAKE) - @$(MAKE) $(TARGETS) - -$(TARGET).a: $(OBJS) - @echo target.a - @$(RM) $@ - @$(AR) $(ARFLAGS) $@ $^ - @echo Replacing $@ to $(LIBPROCESS) - @$(RM) $(LIBPROCESS)/$@ - @$(CP) $@ $(LIBPROCESS) - -$(TARGET).so: $(OBJS) - @$(LD) -G -o $@ $^ - @echo Replacing $@ to $(LIBPROCESS) - @$(RM) $(LIBPROCESS)/$@ - @$(CP) $@ $(LIBPROCESS) - -clean: - $(RM) *.bak *~ - @$(CD) $(USERAPIDIR) && $(MAKE) $@ - @$(CD) $(NETAPIDIR) && $(MAKE) $@ - @$(CD) $(USIMAPIDIR) && $(MAKE) $@ - @$(CD) $(MMEAPIDIR) && $(MAKE) $@ - -veryclean: clean - $(RM) $(TARGETS) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/COPYING b/openair-cn/NAS/EURECOM-NAS/src/api/mme/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/mme/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/Makefile b/openair-cn/NAS/EURECOM-NAS/src/api/mme/Makefile deleted file mode 100644 index 7c92861153628481124495a6d0c12774c21e7cc6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/mme/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -all: $(OBJS) - -%.o: %.c Makefile - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -clean: - $(RM) $(OBJS) *.bak *~ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.c b/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.c deleted file mode 100644 index dd0ff9c2f6766265433a6e575bea6d91a61c6bfb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.c +++ /dev/null @@ -1,572 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source mme_api.c - -Version 0.1 - -Date 2013/02/28 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer running in the MME - to interact with a Mobility Management Entity - -*****************************************************************************/ - -#ifdef NAS_MME - -#include "mme_api.h" -#include "nas_log.h" -#include "assertions.h" - -#include <string.h> // memcpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* Maximum number of PDN connections the MME may simultaneously support */ -#define MME_API_PDN_MAX 10 - -/* MME group identifier */ -#define MME_API_MME_GID 0x0102 - -/* MME code */ -#define MME_API_MME_CODE 0x12 - -/* Default APN */ -static const OctetString mme_api_default_apn = { - /* LW: apn seems to be coded using a one byte size field before each part of the name */ -#if 1 - 15, (uint8_t *)("\x0e" "www.eurecom.fr") -#else - 35, (uint8_t *)("\x08" "internet" - "\x02" "v4" - "\x03" "pft" - "\x06" "mnc092" - "\x06" "mcc208" - "\x04" "gprs") -#endif -}; - -/* APN configured for emergency bearer services */ -static const OctetString mme_api_emergency_apn = { - 19, (uint8_t *)("\x12" "www.eurecom_sos.fr") -}; - -/* Public Land Mobile Network identifier */ -static const plmn_t mme_api_plmn = {0, 2, 0xf, 8, 0, 1}; // 20810 - -/* Number of concecutive tracking areas */ -#define MME_API_NB_TACS 4 -/* Code of the first tracking area belonging to the PLMN */ -#define MME_API_FIRST_TAC 0x0001 - - -/* Authentication parameter RAND */ -static const UInt8_t _mme_api_rand[AUTH_RAND_SIZE] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x02, 0x03, 0x04 -}; - -/* Authentication parameter AUTN */ -static const UInt8_t _mme_api_autn[AUTH_AUTN_SIZE] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x05, 0x04, 0x03, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -/* Authentication response parameter */ -static const UInt8_t _mme_api_xres[AUTH_XRES_SIZE] = { - 0x67, 0x70, 0x3a, 0x31, 0xf2, 0x2a, 0x2d, 0x51, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -static mme_api_ip_version_t _mme_api_ip_capability = MME_API_IPV4V6_ADDR; - -/* Pool of IPv4 addresses */ -static uint8_t _mme_api_ipv4_addr[MME_API_PDN_MAX][4] = { - {0xC0, 0xA8, 0x02, 0x3C}, /* 192.168.02.60 */ - {0xC0, 0xA8, 0x0C, 0xBB}, /* 192.168.12.187 */ - {0xC0, 0xA8, 0x0C, 0xBC}, /* 192.168.12.188 */ - {0xC0, 0xA8, 0x0C, 0xBD}, /* 192.168.12.189 */ - {0xC0, 0xA8, 0x0C, 0xBE}, /* 192.168.12.190 */ - {0xC0, 0xA8, 0x0C, 0xBF}, /* 192.168.12.191 */ - {0xC0, 0xA8, 0x0C, 0xC0}, /* 192.168.12.192 */ - {0xC0, 0xA8, 0x0C, 0xC1}, /* 192.168.12.193 */ - {0xC0, 0xA8, 0x0C, 0xC2}, /* 192.168.12.194 */ - {0xC0, 0xA8, 0x0C, 0xC3}, /* 192.168.12.195 */ -}; -/* Pool of IPv6 addresses */ -static uint8_t _mme_api_ipv6_addr[MME_API_PDN_MAX][8] = { - /* FE80::221:70FF:C0A8:023C/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x02, 0x3C}, - /* FE80::221:70FF:C0A8:0CBB/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBB}, - /* FE80::221:70FF:C0A8:0CBC/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBC}, - /* FE80::221:70FF:C0A8:0CBD/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBD}, - /* FE80::221:70FF:C0A8:0CBE/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBE}, - /* FE80::221:70FF:C0A8:0CBF/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBF}, - /* FE80::221:70FF:C0A8:0CC0/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC0}, - /* FE80::221:70FF:C0A8:0CC1/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC1}, - /* FE80::221:70FF:C0A8:0CC2/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC2}, - /* FE80::221:70FF:C0A8:0CC3/64 */ - {0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC3}, -}; -/* Pool of IPv4v6 addresses */ -static uint8_t _mme_api_ipv4v6_addr[MME_API_PDN_MAX][12] = { - /* 192.168.02.60, FE80::221:70FF:C0A8:023C/64 */ - {0xC0, 0xA8, 0x02, 0x3C, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x02, 0x3C}, - /* 192.168.12.187, FE80::221:70FF:C0A8:0CBB/64 */ - {0xC0, 0xA8, 0x0C, 0xBB, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBB}, - /* 192.168.12.188, FE80::221:70FF:C0A8:0CBC/64 */ - {0xC0, 0xA8, 0x0C, 0xBC, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBC}, - /* 192.168.12.189, FE80::221:70FF:C0A8:0CBD/64 */ - {0xC0, 0xA8, 0x0C, 0xBD, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBD}, - /* 192.168.12.189, FE80::221:70FF:C0A8:0CBE/64 */ - {0xC0, 0xA8, 0x0C, 0xBD, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBE}, - /* 192.168.12.189, FE80::221:70FF:C0A8:0CBF/64 */ - {0xC0, 0xA8, 0x0C, 0xBD, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBF}, - /* 192.168.12.189, FE80::221:70FF:C0A8:0CC0/64 */ - {0xC0, 0xA8, 0x0C, 0xBD, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC0}, - /* 192.168.12.189, FE80::221:70FF:C0A8:0CC1/64 */ - {0xC0, 0xA8, 0x0C, 0xBD, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC1}, - /* 192.168.12.189, FE80::221:70FF:C0A8:0CC2/64 */ - {0xC0, 0xA8, 0x0C, 0xBD, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC2}, - /* 192.168.12.189, FE80::221:70FF:C0A8:0CC3/64 */ - {0xC0, 0xA8, 0x0C, 0xBD, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xC3}, -}; -static const OctetString _mme_api_pdn_addr[MME_API_ADDR_MAX][MME_API_PDN_MAX] = { - { /* IPv4 network capability */ - {4, _mme_api_ipv4_addr[0]}, - {4, _mme_api_ipv4_addr[1]}, - {4, _mme_api_ipv4_addr[2]}, - {4, _mme_api_ipv4_addr[3]}, - {4, _mme_api_ipv4_addr[4]}, - {4, _mme_api_ipv4_addr[5]}, - {4, _mme_api_ipv4_addr[6]}, - {4, _mme_api_ipv4_addr[7]}, - {4, _mme_api_ipv4_addr[8]}, - {4, _mme_api_ipv4_addr[9]}, - }, - { /* IPv6 network capability */ - {8, _mme_api_ipv6_addr[0]}, - {8, _mme_api_ipv6_addr[1]}, - {8, _mme_api_ipv6_addr[2]}, - {8, _mme_api_ipv6_addr[3]}, - {8, _mme_api_ipv6_addr[4]}, - {8, _mme_api_ipv6_addr[5]}, - {8, _mme_api_ipv6_addr[6]}, - {8, _mme_api_ipv6_addr[7]}, - {8, _mme_api_ipv6_addr[8]}, - {8, _mme_api_ipv6_addr[9]}, - }, - { /* IPv4v6 network capability */ - {12, _mme_api_ipv4v6_addr[0]}, - {12, _mme_api_ipv4v6_addr[1]}, - {12, _mme_api_ipv4v6_addr[2]}, - {12, _mme_api_ipv4v6_addr[3]}, - {12, _mme_api_ipv4v6_addr[4]}, - {12, _mme_api_ipv4v6_addr[5]}, - {12, _mme_api_ipv4v6_addr[6]}, - {12, _mme_api_ipv4v6_addr[7]}, - {12, _mme_api_ipv4v6_addr[8]}, - {12, _mme_api_ipv4v6_addr[9]}, - }, -}; - -/* Subscribed QCI */ -#define MME_API_QCI 3 - -/* Data bit rates */ -#define MME_API_BIT_RATE_64K 0x40 -#define MME_API_BIT_RATE_128K 0x48 -#define MME_API_BIT_RATE_512K 0x78 -#define MME_API_BIT_RATE_1024K 0x87 - -/* Total number of PDN connections (should not exceed MME_API_PDN_MAX) */ -static int _mme_api_pdn_id = 0; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: mme_api_get_emm_config() ** - ** ** - ** Description: Retreives MME configuration data related to EPS mobility ** - ** management ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -#if defined(NAS_BUILT_IN_EPC) -int mme_api_get_emm_config(mme_api_emm_config_t *config, - mme_config_t *mme_config_p) -#else -int mme_api_get_emm_config(mme_api_emm_config_t *config) -#endif -{ -#if defined(NAS_BUILT_IN_EPC) - int i; -#endif - LOG_FUNC_IN; - AssertFatal(mme_config_p->gummei.nb_plmns >= 1, "No PLMN configured"); - AssertFatal(mme_config_p->gummei.nb_mmec >= 1, "No MME Code configured"); - AssertFatal(mme_config_p->gummei.nb_mme_gid >= 1, "No MME Group ID configured"); - - config->gummei.plmn.MCCdigit1 = (mme_config_p->gummei.plmn_mcc[0]/100)%10; - config->gummei.plmn.MCCdigit2 = (mme_config_p->gummei.plmn_mcc[0]/10)%10; - config->gummei.plmn.MCCdigit3 = mme_config_p->gummei.plmn_mcc[0]%10; - - if (mme_config_p->gummei.plmn_mnc_len[0] == 2) { - config->gummei.plmn.MNCdigit1 = (mme_config_p->gummei.plmn_mnc[0]/10)%10; - config->gummei.plmn.MNCdigit2 = mme_config_p->gummei.plmn_mnc[0]%10; - config->gummei.plmn.MNCdigit3 = 0xf; - } else if (mme_config_p->gummei.plmn_mnc_len[0] == 3) { - config->gummei.plmn.MNCdigit1 = (mme_config_p->gummei.plmn_mnc[0]/100)%10; - config->gummei.plmn.MNCdigit2 = (mme_config_p->gummei.plmn_mnc[0]/10)%10; - config->gummei.plmn.MNCdigit3 = mme_config_p->gummei.plmn_mnc[0]%10; - } else { - AssertFatal((mme_config_p->gummei.plmn_mnc_len[0] >= 2) && - (mme_config_p->gummei.plmn_mnc_len[0] <= 3), "BAD MNC length for GUMMEI"); - } - - config->gummei.MMEgid = mme_config_p->gummei.mme_gid[0]; - config->gummei.MMEcode = mme_config_p->gummei.mmec[0]; -#if defined(NAS_BUILT_IN_EPC) - - /* SR: this config param comes from MME global config */ - if (mme_config_p->emergency_attach_supported != 0) { - config->features |= MME_API_EMERGENCY_ATTACH; - } - - if (mme_config_p->unauthenticated_imsi_supported != 0) { - config->features |= MME_API_UNAUTHENTICATED_IMSI; - } - - for (i = 0 ; i < 8; i++) { - config->prefered_integrity_algorithm[i] = mme_config_p->nas_config.prefered_integrity_algorithm[i]; - config->prefered_ciphering_algorithm[i] = mme_config_p->nas_config.prefered_ciphering_algorithm[i]; - } - -#else - config->features = MME_API_EMERGENCY_ATTACH | MME_API_UNAUTHENTICATED_IMSI; -#endif - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: mme_api_get_config() ** - ** ** - ** Description: Retreives MME configuration data related to EPS session ** - ** management ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int mme_api_get_esm_config(mme_api_esm_config_t *config) -{ - LOG_FUNC_IN; - - if (_mme_api_ip_capability == MME_API_IPV4_ADDR) { - config->features = MME_API_IPV4; - } else if (_mme_api_ip_capability == MME_API_IPV6_ADDR) { - config->features = MME_API_IPV6; - } else if (_mme_api_ip_capability == MME_API_IPV4V6_ADDR) { - config->features = MME_API_IPV4 | MME_API_IPV6; - } else { - config->features = 0; - } - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: mme_api_identify_guti() ** - ** ** - ** Description: Requests the MME to identify the UE using the specified ** - ** GUTI. If the UE is known by the MME (a Mobility Manage- ** - ** ment context exists for this UE in the MME), its se- ** - ** curity context is returned. ** - ** ** - ** Inputs: guti: EPS Globally Unique Temporary UE Identity ** - ** Others: None ** - ** ** - ** Outputs: vector: The EPS authentication vector of the UE if ** - ** known by the network; NULL otherwise. ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int mme_api_identify_guti(const GUTI_t *guti, auth_vector_t *vector) -{ - int rc = RETURNerror; - - LOG_FUNC_IN; - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: mme_api_identify_imsi() ** - ** ** - ** Description: Requests the MME to identify the UE using the specified ** - ** IMSI. If the UE is known by the MME (a Mobility Manage- ** - ** ment context exists for this UE in the MME), its se- ** - ** curity context is returned. ** - ** ** - ** Inputs: imsi: International Mobile Subscriber Identity ** - ** Others: None ** - ** ** - ** Outputs: vector: The EPS authentication vector of the UE if ** - ** known by the network; NULL otherwise. ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int mme_api_identify_imsi(const imsi_t *imsi, auth_vector_t *vector) -{ - int rc = RETURNok; - - LOG_FUNC_IN; - AssertFatal(0, "Hardcoded values"); - - memcpy(vector->rand, _mme_api_rand, AUTH_RAND_SIZE); - memcpy(vector->autn, _mme_api_autn, AUTH_AUTN_SIZE); - memcpy(vector->xres, _mme_api_xres, AUTH_XRES_SIZE); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: mme_api_identify_imei() ** - ** ** - ** Description: Requests the MME to identify the UE using the specified ** - ** IMEI. If the UE is known by the MME (a Mobility Manage- ** - ** ment context exists for this UE in the MME), its se- ** - ** curity context is returned. ** - ** ** - ** Inputs: imei: International Mobile Equipment Identity ** - ** Others: None ** - ** ** - ** Outputs: vector: The EPS authentication vector of the UE if ** - ** known by the network; NULL otherwise. ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int mme_api_identify_imei(const imei_t *imei, auth_vector_t *vector) -{ - int rc = RETURNerror; - - LOG_FUNC_IN; - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: mme_api_new_guti() ** - ** ** - ** Description: Requests the MME to assign a new GUTI to the UE identi- ** - ** fied by the given IMSI. ** - ** ** - ** Description: Requests the MME to assign a new GUTI to the UE identi- ** - ** fied by the given IMSI and returns the list of consecu- ** - ** tive tracking areas the UE is registered to. ** - ** ** - ** Inputs: imsi: International Mobile Subscriber Identity ** - ** Others: None ** - ** ** - ** Outputs: guti: The new assigned GUTI ** - ** tac: Code of the first tracking area belonging ** - ** to the PLMN ** - ** n_tacs: Number of concecutive tracking areas ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int mme_api_new_guti(const imsi_t *imsi, GUTI_t *guti, tac_t *tac, int *n_tacs) -{ - int rc = RETURNok; - - static unsigned int tmsi = 1; - - LOG_FUNC_IN; - AssertFatal(0, "Hardcoded values"); - - guti->gummei.plmn = mme_api_plmn; - guti->gummei.MMEgid = MME_API_MME_GID; - guti->gummei.MMEcode = MME_API_MME_CODE; - guti->m_tmsi = tmsi++; - - *tac = MME_API_FIRST_TAC; - *n_tacs = MME_API_NB_TACS; - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: mme_api_subscribe() ** - ** ** - ** Description: Requests the MME to check whether connectivity with the ** - ** requested PDN can be established using the specified APN. ** - ** If accepted the MME returns PDN subscription context con- ** - ** taining EPS subscribed QoS profile, the default APN if ** - ** required and UE's IPv4 address and/or the IPv6 prefix. ** - ** ** - ** Inputs: apn: If not NULL, Access Point Name of the PDN ** - ** to connect to ** - ** is_emergency: TRUE if the PDN connectivity is requested ** - ** for emergency bearer services ** - ** Others: None ** - ** ** - ** Outputs: apn: If NULL, default APN or APN configured for ** - ** emergency bearer services ** - ** pdn_addr: PDN connection IPv4 address or IPv6 inter- ** - ** face identifier to be used to build the ** - ** IPv6 link local address ** - ** qos: EPS subscribed QoS profile ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int mme_api_subscribe(OctetString *apn, mme_api_ip_version_t mme_pdn_index, OctetString *pdn_addr, - int is_emergency, mme_api_qos_t *qos) -{ - int rc = RETURNok; - - LOG_FUNC_IN; - - if ( apn && (apn->length == 0) ) { - /* PDN connectivity to default APN */ - if (is_emergency) { - apn->length = mme_api_emergency_apn.length; - apn->value = mme_api_emergency_apn.value; - } else { - apn->length = mme_api_default_apn.length; - apn->value = mme_api_default_apn.value; - } - } - - /* Assign PDN address */ - if ( pdn_addr && (_mme_api_pdn_id < MME_API_PDN_MAX) ) { - pdn_addr->length = - _mme_api_pdn_addr[mme_pdn_index][_mme_api_pdn_id].length; - pdn_addr->value = - _mme_api_pdn_addr[mme_pdn_index][_mme_api_pdn_id].value; - /* Increment the total number of PDN connections */ - _mme_api_pdn_id += 1; - } else { - /* Maximum number of PDN connections exceeded */ - rc = RETURNerror; - } - - /* Setup EPS subscribed QoS profile */ - if (qos) { - qos->qci = MME_API_QCI; - /* Uplink bit rate */ - qos->gbr[MME_API_UPLINK] = MME_API_BIT_RATE_64K; - qos->mbr[MME_API_UPLINK] = MME_API_BIT_RATE_128K; - /* Downlink bit rate */ - qos->gbr[MME_API_DOWNLINK] = MME_API_BIT_RATE_512K; - qos->mbr[MME_API_DOWNLINK] = MME_API_BIT_RATE_1024K; - } else { - rc = RETURNerror; - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: mme_api_unsubscribe() ** - ** ** - ** Description: Requests the MME to release connectivity with the reques- ** - ** ted PDN using the specified APN. ** - ** ** - ** Inputs: apn: Access Point Name of the PDN to disconnect ** - ** from ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int mme_api_unsubscribe(OctetString *apn) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - /* Decrement the total number of PDN connections */ - _mme_api_pdn_id -= 1; - - LOG_FUNC_RETURN(rc); -} - -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.h b/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.h deleted file mode 100644 index 4614da420b516fe5c756455dfd5836a1057c8594..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/mme/mme_api.h +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source mme_api.h - -Version 0.1 - -Date 2013/02/28 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer running in the MME - to interact with a Mobility Management Entity - -*****************************************************************************/ -#ifndef __MME_API_H__ -#define __MME_API_H__ - -#ifdef NAS_MME -# if defined(NAS_BUILT_IN_EPC) -# include "mme_config.h" -# endif -#include "commonDef.h" -#include "securityDef.h" -#include "OctetString.h" -#endif - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Maximum number of UEs the MME may simultaneously support */ -#define MME_API_NB_UE_MAX 1 - -#ifdef NAS_MME - -/* Features supported by the MME */ -typedef enum mme_api_feature_s { - MME_API_NO_FEATURE_SUPPORTED = 0, - MME_API_EMERGENCY_ATTACH = (1<<0), - MME_API_UNAUTHENTICATED_IMSI = (1<<1), - MME_API_IPV4 = (1<<2), - MME_API_IPV6 = (1<<3), - MME_API_SINGLE_ADDR_BEARERS = (1<<4), -} mme_api_feature_t; - -/* Network IP version capability */ -typedef enum mme_api_ip_version_e { - MME_API_IPV4_ADDR, - MME_API_IPV6_ADDR, - MME_API_IPV4V6_ADDR, - MME_API_ADDR_MAX -} mme_api_ip_version_t; - -/* - * EPS Mobility Management configuration data - * ------------------------------------------ - */ -typedef struct mme_api_emm_config_s { - mme_api_feature_t features; /* Supported features */ - gummei_t gummei; /* EPS Globally Unique MME Identity */ - uint8_t prefered_integrity_algorithm[8];// choice in NAS_SECURITY_ALGORITHMS_EIA0, etc - uint8_t prefered_ciphering_algorithm[8];// choice in NAS_SECURITY_ALGORITHMS_EEA0, etc -} mme_api_emm_config_t; - -/* - * EPS Session Management configuration data - * ----------------------------------------- - */ -typedef struct mme_api_esm_config_s { - mme_api_feature_t features; /* Supported features */ - uint8_t dns_prim_ipv4[4]; /* Network byte order */ - uint8_t dns_sec_ipv4[4]; /* Network byte order */ -} mme_api_esm_config_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* EPS subscribed QoS profile */ -typedef struct mme_api_qos_s { -#define MME_API_UPLINK 0 -#define MME_API_DOWNLINK 1 -#define MME_API_DIRECTION 2 - int gbr[MME_API_DIRECTION]; /* Guaranteed Bit Rate */ - int mbr[MME_API_DIRECTION]; /* Maximum Bit Rate */ - int qci; /* QoS Class Identifier */ -} mme_api_qos_t; - -/* Traffic Flow Template */ -typedef struct mme_api_tft_s { -} mme_api_tft_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#if defined(NAS_BUILT_IN_EPC) -int mme_api_get_emm_config(mme_api_emm_config_t *config, - mme_config_t *mme_config_p); -#else -int mme_api_get_emm_config(mme_api_emm_config_t *config); -#endif -int mme_api_get_esm_config(mme_api_esm_config_t *config); - -int mme_api_identify_guti(const GUTI_t *guti, auth_vector_t *vector); -int mme_api_identify_imsi(const imsi_t *imsi, auth_vector_t *vector); -int mme_api_identify_imei(const imei_t *imei, auth_vector_t *vector); -int mme_api_new_guti(const imsi_t *imsi, GUTI_t *guti, tac_t *tac, int *n_tacs); - -int mme_api_subscribe(OctetString *apn, mme_api_ip_version_t mme_pdn_index, OctetString *pdn_addr, - int is_emergency, mme_api_qos_t *qos); -int mme_api_unsubscribe(OctetString *apn); - -#endif // NAS_MME - -#endif /* __MME_API_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/COPYING b/openair-cn/NAS/EURECOM-NAS/src/api/network/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/Makefile b/openair-cn/NAS/EURECOM-NAS/src/api/network/Makefile deleted file mode 100644 index cce6a240eef0a4eee336b7f48677462db7c9d1ca..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) -I$(EMMMSGDIR) -I$(ESMMSGDIR) -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -all: $(OBJS) - -%.o: %.c Makefile - @echo Compiling $< - @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ - -clean: - $(RM) $(OBJS) *.bak *~ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.c b/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.c deleted file mode 100644 index b0f07f937d77d77da81d01795554757af57dd6b5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.c +++ /dev/null @@ -1,374 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source as_message.c - -Version 0.1 - -Date 2012/11/06 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the messages supported by the Access Stratum sublayer - protocol (usually RRC and S1AP for E-UTRAN) and functions used - to encode and decode - -*****************************************************************************/ - -#include "as_message.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <string.h> // memcpy -#include <stdlib.h> // free - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: as_message_decode() ** - ** ** - ** Description: Decode AS message and accordingly fills data structure ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the ** - ** message ** - ** length: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: msg: AS message structure to be filled ** - ** Return: The AS message identifier when the buffer ** - ** has been successfully decoded; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int as_message_decode(const char* buffer, as_message_t* msg, int length) -{ - LOG_FUNC_IN; - - int bytes; - Byte_t** data = NULL; - - /* Get the message type */ - msg->msgID = *(UInt16_t*)(buffer); - bytes = sizeof(UInt16_t); - - switch (msg->msgID) { - case AS_NAS_ESTABLISH_REQ: - /* NAS signalling connection establish request */ - bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*); - data = &msg->msg.nas_establish_req.initialNasMsg.data; - break; - - case AS_NAS_ESTABLISH_IND: - /* NAS signalling connection establishment indication */ - bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); - data = &msg->msg.nas_establish_ind.initialNasMsg.data; - break; - - case AS_NAS_ESTABLISH_RSP: - /* NAS signalling connection establishment response */ - bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*); - data = &msg->msg.nas_establish_rsp.nasMsg.data; - break; - - case AS_NAS_ESTABLISH_CNF: - /* NAS signalling connection establishment confirm */ - bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); - data = &msg->msg.nas_establish_cnf.nasMsg.data; - break; - - case AS_UL_INFO_TRANSFER_REQ: - /* Uplink L3 data transfer request */ - bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*); - data = &msg->msg.ul_info_transfer_req.nasMsg.data; - break; - - case AS_UL_INFO_TRANSFER_IND: - /* Uplink L3 data transfer indication */ - bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*); - data = &msg->msg.ul_info_transfer_ind.nasMsg.data; - break; - - case AS_DL_INFO_TRANSFER_REQ: - /* Downlink L3 data transfer request */ - bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*); - data = &msg->msg.dl_info_transfer_req.nasMsg.data; - break; - - case AS_DL_INFO_TRANSFER_IND: - /* Downlink L3 data transfer indication */ - bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*); - data = &msg->msg.dl_info_transfer_ind.nasMsg.data; - break; - - case AS_BROADCAST_INFO_IND: - case AS_CELL_INFO_REQ: - case AS_CELL_INFO_CNF: - case AS_CELL_INFO_IND: - case AS_PAGING_REQ: - case AS_PAGING_IND: - case AS_NAS_RELEASE_REQ: - case AS_UL_INFO_TRANSFER_CNF: - case AS_DL_INFO_TRANSFER_CNF: - case AS_NAS_RELEASE_IND: - case AS_RAB_ESTABLISH_REQ: - case AS_RAB_ESTABLISH_IND: - case AS_RAB_ESTABLISH_RSP: - case AS_RAB_ESTABLISH_CNF: - case AS_RAB_RELEASE_REQ: - case AS_RAB_RELEASE_IND: - /* Messages without dedicated NAS information */ - bytes = length; - break; - - default: - bytes = 0; - LOG_TRACE(WARNING, "NET-API - AS message 0x%x is not valid", - msg->msgID); - break; - } - - if (bytes > 0) { - if (data) { - /* Set the pointer to dedicated NAS information */ - *data = (Byte_t*)(buffer + bytes); - } - - /* Decode the message */ - memcpy(msg, (as_message_t*)buffer, bytes); - LOG_FUNC_RETURN (msg->msgID); - } - - LOG_TRACE(WARNING, "NET-API - Failed to decode AS message 0x%x", - msg->msgID); - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: as_message_encode() ** - ** ** - ** Description: Encode AS message ** - ** ** - ** Inputs: msg: AS message structure to encode ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters in the buffer ** - ** when data have been successfully encoded; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int as_message_encode(char* buffer, as_message_t* msg, int length) -{ - LOG_FUNC_IN; - - int bytes = sizeof(msg->msgID); - as_nas_info_t* nas_msg = NULL; - - switch (msg->msgID) { - case AS_BROADCAST_INFO_IND: - /* Broadcast information */ - bytes += sizeof(broadcast_info_ind_t); - break; - - case AS_CELL_INFO_REQ: - /* Cell information request */ - bytes += sizeof(cell_info_req_t); - break; - - case AS_CELL_INFO_CNF: - /* Cell information response */ - bytes += sizeof(cell_info_cnf_t); - break; - - case AS_CELL_INFO_IND: - /* Cell information indication */ - bytes += sizeof(cell_info_ind_t); - break; - - case AS_PAGING_REQ: - /* Paging information request */ - bytes += sizeof(paging_req_t); - break; - - case AS_PAGING_IND: - /* Paging information indication */ - bytes += sizeof(paging_ind_t); - break; - - case AS_NAS_ESTABLISH_REQ: - /* NAS signalling connection establish request */ - bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.nas_establish_req.initialNasMsg; - break; - - case AS_NAS_ESTABLISH_IND: - /* NAS signalling connection establish indication */ - bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.nas_establish_ind.initialNasMsg; - break; - - case AS_NAS_ESTABLISH_RSP: - /* NAS signalling connection establish response */ - bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.nas_establish_rsp.nasMsg; - break; - - case AS_NAS_ESTABLISH_CNF: - /* NAS signalling connection establish confirm */ - bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.nas_establish_cnf.nasMsg; - break; - - case AS_NAS_RELEASE_REQ: - /* NAS signalling connection release request */ - bytes += sizeof(nas_release_req_t); - break; - - case AS_NAS_RELEASE_IND: - /* NAS signalling connection release indication */ - bytes += sizeof(nas_release_ind_t); - break; - - case AS_UL_INFO_TRANSFER_REQ: - /* Uplink L3 data transfer request */ - bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.ul_info_transfer_req.nasMsg; - break; - - case AS_UL_INFO_TRANSFER_CNF: - /* Uplink L3 data transfer confirm */ - bytes += sizeof(ul_info_transfer_cnf_t); - break; - - case AS_UL_INFO_TRANSFER_IND: - /* Uplink L3 data transfer indication */ - bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.ul_info_transfer_ind.nasMsg; - break; - - case AS_DL_INFO_TRANSFER_REQ: - /* Downlink L3 data transfer */ - bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.dl_info_transfer_req.nasMsg; - break; - - case AS_DL_INFO_TRANSFER_CNF: - /* Downlink L3 data transfer confirm */ - bytes += sizeof(dl_info_transfer_cnf_t); - break; - - case AS_DL_INFO_TRANSFER_IND: - /* Downlink L3 data transfer indication */ - bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*); - nas_msg = &msg->msg.dl_info_transfer_ind.nasMsg; - break; - - case AS_RAB_ESTABLISH_REQ: - /* Radio Access Bearer establishment request */ - bytes += sizeof(rab_establish_req_t); - break; - - case AS_RAB_ESTABLISH_IND: - /* Radio Access Bearer establishment indication */ - bytes += sizeof(rab_establish_ind_t); - break; - - case AS_RAB_ESTABLISH_RSP: - /* Radio Access Bearer establishment response */ - bytes += sizeof(rab_establish_rsp_t); - break; - - case AS_RAB_ESTABLISH_CNF: - /* Radio Access Bearer establishment confirm */ - bytes += sizeof(rab_establish_cnf_t); - break; - - case AS_RAB_RELEASE_REQ: - /* Radio Access Bearer release request */ - bytes += sizeof(rab_release_req_t); - break; - - case AS_RAB_RELEASE_IND: - /* Radio Access Bearer release indication */ - bytes += sizeof(rab_release_ind_t); - break; - - default: - LOG_TRACE(WARNING, "NET-API - AS message 0x%x is not valid", - msg->msgID); - bytes = length; - break; - } - - if (length > bytes) { - /* Encode the AS message */ - memcpy(buffer, (unsigned char*)msg, bytes); - - if ( nas_msg && (nas_msg->length > 0) ) { - /* Copy the NAS message */ - memcpy(buffer + bytes, nas_msg->data, nas_msg->length); - bytes += nas_msg->length; - /* Release NAS message memory */ - free(nas_msg->data); - nas_msg->length = 0; - nas_msg->data = NULL; - } - - LOG_FUNC_RETURN (bytes); - } - - LOG_TRACE(WARNING, "NET-API - Failed to encode AS message 0x%x", - msg->msgID); - LOG_FUNC_RETURN (RETURNerror); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.h b/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.h deleted file mode 120000 index 91405a472beff90ec0d8bf4ed269e39f4761d53d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/as_message.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../openair2/COMMON/as_message.h \ No newline at end of file diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/l2_message.h b/openair-cn/NAS/EURECOM-NAS/src/api/network/l2_message.h deleted file mode 100644 index ced2b54bc378624da2f719fa203c6ee02dbb458e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/l2_message.h +++ /dev/null @@ -1,309 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source as_message.h - -Version 0.1 - -Date 2012/10/18 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the messages supported by the Access Stratum sublayer - protocol (usually RRC and S1AP for E-UTRAN) and functions used - to encode and decode - -*****************************************************************************/ -#ifndef __AS_MESSAGE_H__ -#define __AS_MESSAGE_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Access Stratum Message types */ -#define AS_REQUEST 0x0100 -#define AS_RESPONSE 0x0200 -#define AS_INDICATION 0x0400 -#define AS_CONFIRM 0x0800 - -/* - * Access Stratum Message identifiers - * ---------------------------------- - */ - -/* Cell information relevant for cell selection processing */ -#define AS_CELL_INFO 0x01 -#define AS_CELL_INFO_REQ (AS_CELL_INFO | AS_REQUEST) -#define AS_CELL_INFO_RSP (AS_CELL_INFO | AS_RESPONSE) -#define AS_CELL_INFO_IND (AS_CELL_INFO | AS_INDICATION) - -/* Security mode control */ -#define AS_SECURITY 0x02 -#define AS_SECURITY_REQ (AS_SECURITY | AS_REQUEST) -#define AS_SECURITY_RSP (AS_SECURITY | AS_RESPONSE) - -/* Paging information */ -#define AS_PAGING 0x03 -#define AS_PAGING_IND (AS_PAGING | AS_INDICATION) - -/* NAS signalling connection establishment */ -#define AS_NAS_ESTABLISH 0x04 -#define AS_NAS_ESTABLISH_REQ (AS_NAS_ESTABLISH | AS_REQUEST) -#define AS_NAS_ESTABLISH_RSP (AS_NAS_ESTABLISH | AS_RESPONSE) - -/* NAS signalling connection release */ -#define AS_NAS_RELEASE 0x05 -#define AS_NAS_RELEASE_REQ (AS_NAS_RELEASE | AS_REQUEST) -#define AS_NAS_RELEASE_IND (AS_NAS_RELEASE | AS_INDICATION) - -/* NAS information transfer */ -#define AS_INFO_TRANSFER 0x10 -#define AS_UL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_REQUEST) -#define AS_DL_INFO_TRANSFER (AS_INFO_TRANSFER | AS_INDICATION) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Available PLMNs and cell Information - * -------------------------------------------------------------------------- - */ - -/* Radio access technologies supported by the network */ -#define AS_GSM (1 << NET_ACCESS_GSM) -#define AS_COMPACT (1 << NET_ACCESS_COMPACT) -#define AS_UTRAN (1 << NET_ACCESS_UTRAN) -#define AS_EGPRS (1 << NET_ACCESS_EGPRS) -#define AS_HSDPA (1 << NET_ACCESS_HSDPA) -#define AS_HSUPA (1 << NET_ACCESS_HSUPA) -#define AS_HSDUPA (1 << NET_ACCESS_HSDUPA) -#define AS_EUTRAN (1 << NET_ACCESS_EUTRAN) - -/* - * NAS->AS - Cell Information request - * NAS request AS to search for a suitable cell belonging to the selected - * PLMN to camp on. - */ -typedef struct { - plmn_t plmnID; /* PLMN identifier */ - Byte_t rat; /* Bitmap - set of radio access technologies */ -} cell_info_req_t; - -/* - * AS->NAS - Cell Information response - * AS search for a suitable cell and respond to NAS. If found, the cell - * is selected to camp on. - */ -typedef struct { - plmn_t plmnID; /* PLMN identifier */ - TAC_t tac; /* identifies a tracking area the PLMN belongs to */ - CI_t cellID; /* identifies a cell within a PLMN */ - AcT_t rat; /* radio access technology supported by the cell */ -} cell_info_rsp_t; - -/* - * AS->NAS - Cell Information indication - * AS Reports available PLMNs with associated Radio Access Technologies - * to NAS on request from NAS or autonomously. - */ -typedef struct { -#define PLMN_LIST_MAX_SIZE 6 - PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */ - Byte_t rat[PLMN_LIST_MAX_SIZE]; /* Radio access technologies */ - TAC_t tac; /* identifies a tracking area within a scope of PLMNs */ - CI_t cellID; /* identifies a cell within a PLMN */ -} cell_info_ind_t; - -/* - * -------------------------------------------------------------------------- - * Security mode control - * -------------------------------------------------------------------------- - */ - -/* - * TODO: NAS->AS - Security command request - */ -typedef struct {} security_req_t; - - -/* - * TODO: AS->NAS - Security command response - */ -typedef struct {} security_rsp_t; - - -/* - * -------------------------------------------------------------------------- - * Paging information - * -------------------------------------------------------------------------- - */ - -/* - * TODO: AS->NAS - Paging Information indication - */ -typedef struct {} paging_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection establishment - * -------------------------------------------------------------------------- - */ - -/* Cause of RRC connection establishment */ -#define AS_CAUSE_EMERGENCY (NET_ESTABLISH_CAUSE_EMERGENCY) -#define AS_CAUSE_HIGH_PRIO (NET_ESTABLISH_CAUSE_HIGH_PRIO) -#define AS_CAUSE_MT_ACCESS (NET_ESTABLISH_CAUSE_MT_ACCESS) -#define AS_CAUSE_MO_SIGNAL (NET_ESTABLISH_CAUSE_MO_SIGNAL) -#define AS_CAUSE_MO_DATA (NET_ESTABLISH_CAUSE_MO_DATA) -#define AS_CAUSE_V1020 (NET_ESTABLISH_CAUSE_V1020) - -/* Type of the call associated to the RRC connection establishment */ -#define AS_TYPE_ORIGINATING_SIGNAL (NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL) -#define AS_TYPE_EMERGENCY_CALLS (NET_ESTABLISH_TYPE_EMERGENCY_CALLS) -#define AS_TYPE_ORIGINATING_CALLS (NET_ESTABLISH_TYPE_ORIGINATING_CALLS) -#define AS_TYPE_TERMINATING_CALLS (NET_ESTABLISH_TYPE_TERMINATING_CALLS) -#define AS_TYPE_MO_CS_FALLBACK (NET_ESTABLISH_TYPE_MO_CS_FALLBACK) - - -/* Structure of the SAE Temporary Mobile Subscriber Identity */ -typedef struct { - UInt8_t MMEcode; /* MME code that allocated the GUTI */ - UInt32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */ -} as_stmsi_t; - -/* Structure of the dedicated NAS information */ -typedef struct { - UInt32_t length; /* Length of the NAS information data */ - Byte_t* data; /* Dedicated NAS information data container */ -} as_nas_info_t; - -/* - * NAS->AS - NAS signalling connection establishment request - * NAS request AS to perform the RRC connection establishment procedure - * to transfer initial NAS message to the network while UE is in IDLE mode. - */ -typedef struct { - UInt8_t cause; /* Connection establishment cause */ - UInt8_t type; /* Associated call type */ - plmn_t plmnID; /* Identifier of the selected PLMN */ - as_stmsi_t s_tmsi; /* SAE Temporary Mobile Subscriber Identity */ - as_nas_info_t initialNasMsg;/* Initial NAS message to transfer */ -} nas_establish_req_t; - -/* - * TODO: AS->NAS - NAS signalling connection establishment response - */ -typedef struct {} nas_establish_rsp_t; - -/* - * -------------------------------------------------------------------------- - * NAS signalling connection release - * -------------------------------------------------------------------------- - */ - -/* - * TODO: NAS->AS - NAS signalling connection release request - */ -typedef struct {} nas_release_req_t; - -/* - * TODO: AS->NAS - NAS signalling connection release indication - */ -typedef struct {} nas_release_ind_t; - -/* - * -------------------------------------------------------------------------- - * NAS information transfer - * -------------------------------------------------------------------------- - */ - -/* - * AS->NAS - Downlink data transfer - * AS notifies upper layer that NAS or non-3GPP dedicated downlink information - * has to be transfered to NAS. -*/ -typedef as_nas_info_t dl_info_transfer_t; - -/* - * NAS->AS - Uplink data transfer request - * NAS requests under layer to transfer NAS or non-3GPP dedicated uplink - * information to AS. - */ -typedef as_nas_info_t ul_info_transfer_t; - -/* - * -------------------------------------------------------------------------- - * Structure of the AS messages handled by the network sublayer - * -------------------------------------------------------------------------- - */ -typedef struct { - UInt16_t msgID; - union { - cell_info_req_t cell_info_req; - cell_info_rsp_t cell_info_rsp; - cell_info_ind_t cell_info_ind; - security_req_t security_req; - security_rsp_t security_rsp; - paging_ind_t paging_ind; - nas_establish_req_t nas_establish_req; - nas_establish_rsp_t nas_establish_rsp; - nas_release_req_t nas_release_req; - nas_release_ind_t nas_release_ind; - ul_info_transfer_t ul_info_transfer; - dl_info_transfer_t dl_info_transfer; - } __attribute__((__packed__)) msg; -} as_message_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int as_message_decode(const char* buffer, int length, as_message_t* msg); - -int as_message_encode(char* buffer, int length, const as_message_t* msg); - -/* Implemented in the network_api.c body file */ -int as_message_send(as_message_t* as_msg, const void* nas_msg); - -#endif /* __AS_MESSAGE_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.c b/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.c deleted file mode 100644 index 9896ebfde06cca3539ac47789c26e69b6e5a679d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.c +++ /dev/null @@ -1,1436 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source nas_message.h - -Version 0.1 - -Date 2012/26/09 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the layer 3 messages supported by the NAS sublayer - protocol and functions used to encode and decode - -*****************************************************************************/ - -#include "nas_message.h" -#include "nas_log.h" - -#include "TLVDecoder.h" -#include "TLVEncoder.h" - -#include <stdlib.h> // malloc, free -#include <string.h> // memcpy - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) -# include "nas_itti_messaging.h" -#endif -#include "secu_defs.h" -#include "emmData.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - - -/* Functions used to decode layer 3 NAS messages */ -static int _nas_message_header_decode(const char* buffer, - nas_message_security_header_t* header, int length); -static int _nas_message_plain_decode(const char* buffer, - const nas_message_security_header_t* header, - nas_message_plain_t* msg, int length); -static int _nas_message_protected_decode(const char* buffer, - nas_message_security_header_t* header, - nas_message_plain_t* msg, int length, - const emm_security_context_t * const emm_security_context); - -/* Functions used to encode layer 3 NAS messages */ -static int _nas_message_header_encode(char* buffer, - const nas_message_security_header_t* header, int length); -static int _nas_message_plain_encode(char* buffer, - const nas_message_security_header_t* header, - const nas_message_plain_t* msg, int length); - -static int _nas_message_protected_encode( - char *buffer, - const nas_message_security_protected_t *msg, - int length, - void *security); - -/* Functions used to decrypt and encrypt layer 3 NAS messages */ -static int _nas_message_decrypt( - char* dest, - const char* src, - UInt8_t type, - UInt32_t code, - UInt8_t seq, - int length, - const emm_security_context_t * const emm_security_context); - - -static int -_nas_message_encrypt( - char *dest, - const char *src, - UInt8_t type, - UInt32_t code, - UInt8_t seq, - int const direction, - int length, - const emm_security_context_t * const emm_security_context); - -/* Functions used for integrity protection of layer 3 NAS messages */ -static UInt32_t _nas_message_get_mac( - const char * const buffer, - int const length, - int const direction, - const emm_security_context_t * const emm_security_context); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: nas_message_encrypt() ** - ** ** - ** Description: Encripts plain NAS message into security protected NAS ** - ** message ** - ** ** - ** Inputs: inbuf: Input buffer containing plain NAS message ** - ** header: Security protected header to be applied ** - ** length: Number of bytes that should be encrypted ** - ** Others: None ** - ** ** - ** Outputs: outbuf: Output buffer containing security protec- ** - ** ted message ** - ** Return: The number of bytes in the output buffer ** - ** if the input buffer has been successfully ** - ** encrypted; Negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int -nas_message_encrypt( - const char *inbuf, - char *outbuf, - const nas_message_security_header_t *header, - int length, - void *security) -{ - LOG_FUNC_IN; - emm_security_context_t *emm_security_context = (emm_security_context_t*)security; - int bytes = length; - - /* Encode the header */ - int size = _nas_message_header_encode(outbuf, header, length); - - if (size < 0) { - LOG_FUNC_RETURN (TLV_ENCODE_BUFFER_TOO_SHORT); - } else if (size > 1) { - /* Encrypt the plain NAS message */ - bytes = _nas_message_encrypt(outbuf + size, inbuf, - header->security_header_type, - header->message_authentication_code, - header->sequence_number, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - length - size, - emm_security_context); - - /* Integrity protected the NAS message */ - if (bytes > 0) { - /* Compute offset of the sequence number field */ - int offset = size - sizeof(UInt8_t); - /* Compute the NAS message authentication code */ - UInt32_t mac = _nas_message_get_mac( - outbuf + offset, - bytes + size - offset, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - emm_security_context); - /* Set the message authentication code of the NAS message */ - *(UInt32_t*)(outbuf + sizeof(UInt8_t)) = htonl(mac); - } - } else { - /* The input buffer does not need to be encrypted */ - memcpy(outbuf, inbuf, length); - } - -#ifdef NAS_MME - /* TS 124.301, section 4.4.3.1 - * The NAS sequence number part of the NAS COUNT shall be - * exchanged between the UE and the MME as part of the - * NAS signalling. After each new or retransmitted outbound - * security protected NAS message, the sender shall increase - * the NAS COUNT number by one. Specifically, on the sender - * side, the NAS sequence number shall be increased by one, - * and if the result is zero (due to wrap around), the NAS - * overflow counter shall also be incremented by one (see - * subclause 4.4.3.5). - */ - emm_security_context->dl_count.seq_num += 1; - - if ( ! emm_security_context->dl_count.seq_num) { - emm_security_context->dl_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.dl_count.seq_num -> %u", - emm_security_context->dl_count.seq_num); -#else - emm_security_context->ul_count.seq_num += 1; - - if ( ! emm_security_context->ul_count.seq_num) { - emm_security_context->ul_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.ul_count.seq_num -> %u", - emm_security_context->ul_count.seq_num); -#endif - - if (bytes < 0) { - LOG_FUNC_RETURN (bytes); - } - - if (size > 1) { - LOG_FUNC_RETURN (size + bytes); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: nas_message_decrypt() ** - ** ** - ** Description: Decripts security protected NAS message into plain NAS ** - ** message ** - ** ** - ** Inputs: inbuf: Input buffer containing security protected ** - ** NAS message ** - ** length: Number of bytes that should be decrypted ** - ** Others: None ** - ** ** - ** Outputs: outbuf: Output buffer containing plain NAS message ** - ** header: Security protected header applied ** - ** Return: The number of bytes in the output buffer ** - ** if the input buffer has been successfully ** - ** decrypted; Negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_message_decrypt( - const char *inbuf, - char *outbuf, - nas_message_security_header_t *header, - int length, - void *security) -{ - LOG_FUNC_IN; - - emm_security_context_t *emm_security_context = (emm_security_context_t*)security; - int bytes = length; - - /* Decode the header */ - int size = _nas_message_header_decode(inbuf, header, length); - - if (size < 0) { - LOG_TRACE(DEBUG, "MESSAGE TOO SHORT"); - LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); - } else if (size > 1) { - if (emm_security_context) { -#if defined(NAS_MME) - - if (emm_security_context->ul_count.seq_num > header->sequence_number) { - emm_security_context->ul_count.overflow += 1; - } - - emm_security_context->ul_count.seq_num = header->sequence_number; -#else - - if (emm_security_context->dl_count.seq_num > header->sequence_number) { - emm_security_context->dl_count.overflow += 1; - } - - emm_security_context->dl_count.seq_num = header->sequence_number; -#endif - } - - /* Compute offset of the sequence number field */ - int offset = size - sizeof(UInt8_t); - /* Compute the NAS message authentication code */ - UInt32_t mac = _nas_message_get_mac( - inbuf + offset, - length - offset, -#ifdef NAS_MME - SECU_DIRECTION_UPLINK, -#else - SECU_DIRECTION_DOWNLINK, -#endif - emm_security_context); - - /* Check NAS message integrity */ - if (mac != header->message_authentication_code) { - - LOG_TRACE(DEBUG, - "MAC Failure MSG:%08X(%u) <> INT ALGO:%08X(%u) Type of security context %u", - header->message_authentication_code,header->message_authentication_code, - mac,mac, (emm_security_context!=NULL)?emm_security_context->type:88); -#if defined(NAS_MME) - LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); -#else -#warning "added test on integrity algorithm because of SECURITY_MODE_COMMAND not correctly handled in UE (check integrity)" - - if (emm_security_context->selected_algorithms.integrity != - NAS_SECURITY_ALGORITHMS_EIA0) { - LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); - } else { - LOG_TRACE(WARNING, - "MAC failure but continue due to EIA0 selected"); - } - -#endif - } else { - LOG_TRACE(DEBUG, "Integrity: MAC Success"); - } - - /* Decrypt the security protected NAS message */ - header->protocol_discriminator = - _nas_message_decrypt(outbuf, inbuf + size, - header->security_header_type, - header->message_authentication_code, - header->sequence_number, - length - size, - emm_security_context); - bytes = length - size; - } else { - LOG_TRACE(DEBUG, "Plain NAS message found"); - /* The input buffer contains a plain NAS message */ - memcpy(outbuf, inbuf, length); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: nas_message_decode() ** - ** ** - ** Description: Decode layer 3 NAS message ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing layer 3 ** - ** NAS message data ** - ** length: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: msg: L3 NAS message structure to be filled ** - ** Return: The number of bytes in the buffer if the ** - ** data have been successfully decoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_message_decode( - const char* const buffer, - nas_message_t *msg, - int length, - void *security) -{ - LOG_FUNC_IN; - emm_security_context_t *emm_security_context = (emm_security_context_t*)security; - int bytes; - - /* Decode the header */ - int size = _nas_message_header_decode(buffer, &msg->header, length); - - if (size < 0) { - LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); - } else if (size > 1) { - if (emm_security_context) { -#if defined(NAS_MME) - - if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) { - emm_security_context->ul_count.overflow += 1; - } - - emm_security_context->ul_count.seq_num = msg->header.sequence_number; - -#else - - if (emm_security_context->dl_count.seq_num > msg->header.sequence_number) { - emm_security_context->dl_count.overflow += 1; - } - - emm_security_context->dl_count.seq_num = msg->header.sequence_number; -#endif - } - - /* Compute offset of the sequence number field */ - int offset = size - sizeof(UInt8_t); - /* Compute the NAS message authentication code */ - UInt32_t mac = _nas_message_get_mac( - buffer + offset, - length - offset, -#ifdef NAS_MME - SECU_DIRECTION_UPLINK, -#else - SECU_DIRECTION_DOWNLINK, -#endif - emm_security_context - ); - -#define NAS_CODE_TO_BE_MODIFIED 1 -#ifdef NAS_CODE_TO_BE_MODIFIED - - // According to 3GPP TS 24.301 version 10.15.0 Release 10, 4.4.4.3 Integrity checking of NAS signalling messages in the MME - if ((!emm_security_context) && (mac == 0) && (msg->header.message_authentication_code != 0)) { - // force mac to be the same, but we should check for message types. - // TODO Reverse order of processing in NAS code: decode message type then check MAC - LOG_TRACE(DEBUG, - "Forced computed MAC to be the MSG MAC %04x", - msg->header.message_authentication_code); - mac = msg->header.message_authentication_code; - LOG_TRACE(DEBUG, - "Forced computed MAC to be the same as MAC in message %04x", - msg->header.message_authentication_code); - } - -#endif - - /* Check NAS message integrity */ - if (mac != msg->header.message_authentication_code) { - LOG_TRACE(DEBUG, - "msg->header.message_authentication_code = %04X computed = %04X", - msg->header.message_authentication_code, - mac); - LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); - } - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Log message header */ -#endif - - /* Decode security protected NAS message */ - bytes = _nas_message_protected_decode(buffer + size, - &msg->header, - &msg->plain, - length - size, - emm_security_context); - } else { - /* Decode plain NAS message */ - bytes = _nas_message_plain_decode(buffer, - &msg->header, - &msg->plain, - length); - } - - if (bytes < 0) { - LOG_FUNC_RETURN (bytes); - } - - if (size > 1) { - LOG_FUNC_RETURN (size + bytes); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: nas_message_encode() ** - ** ** - ** Description: Encode layer 3 NAS message ** - ** ** - ** Inputs msg: L3 NAS message structure to encode ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if the ** - ** data have been successfully encoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_message_encode( - char *buffer, - const nas_message_t *const msg, - int length, - void *security) -{ - LOG_FUNC_IN; - - emm_security_context_t *emm_security_context = (emm_security_context_t*)security; - int bytes; - - - /* Encode the header */ - int size = _nas_message_header_encode(buffer, &msg->header, length); - - if (size < 0) { - LOG_FUNC_RETURN (TLV_ENCODE_BUFFER_TOO_SHORT); - } else if (size > 1) { - /* Encode security protected NAS message */ - bytes = _nas_message_protected_encode( - buffer + size, - &msg->security_protected, - length - size, - emm_security_context); - - /* Integrity protect the NAS message */ - if (bytes > 0) { - /* Compute offset of the sequence number field */ - int offset = size - sizeof(UInt8_t); - /* Compute the NAS message authentication code */ - LOG_TRACE(DEBUG, - "offset %d = %d - %d, hdr encode = %d, length = %d bytes = %d", - offset, size, sizeof(UInt8_t), - size, length, bytes); - UInt32_t mac = _nas_message_get_mac( - buffer + offset, - bytes + size - offset, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - emm_security_context); - /* Set the message authentication code of the NAS message */ - *(UInt32_t*)(buffer + sizeof(UInt8_t)) = htonl(mac); - - if (emm_security_context) { -#ifdef NAS_MME - /* TS 124.301, section 4.4.3.1 - * The NAS sequence number part of the NAS COUNT shall be - * exchanged between the UE and the MME as part of the - * NAS signalling. After each new or retransmitted outbound - * security protected NAS message, the sender shall increase - * the NAS COUNT number by one. Specifically, on the sender - * side, the NAS sequence number shall be increased by one, - * and if the result is zero (due to wrap around), the NAS - * overflow counter shall also be incremented by one (see - * subclause 4.4.3.5). - */ - - emm_security_context->dl_count.seq_num += 1; - - if ( ! emm_security_context->dl_count.seq_num) { - emm_security_context->dl_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.dl_count.seq_num -> %u", - emm_security_context->dl_count.seq_num); -#else - emm_security_context->ul_count.seq_num += 1; - - if ( ! emm_security_context->ul_count.seq_num) { - emm_security_context->ul_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.ul_count.seq_num -> %u", - emm_security_context->ul_count.seq_num); -#endif - } else { - LOG_TRACE(DEBUG, - "Did not increment emm_security_context.dl_count.seq_num because no security context"); - } - } - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Log message header */ -#endif - } else { - /* Encode plain NAS message */ - bytes = _nas_message_plain_encode(buffer, &msg->header, - &msg->plain, length); - } - - if (bytes < 0) { - LOG_FUNC_RETURN (bytes); - } - - if (size > 1) { - LOG_FUNC_RETURN (size + bytes); - } - - LOG_FUNC_RETURN (bytes); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Functions used to decode layer 3 NAS messages - * ----------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _nas_message_header_decode() ** - ** ** - ** Description: Decode header of a security protected NAS message ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing layer 3 ** - ** message data ** - ** length: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: header: Security header structure to be filled ** - ** Return: The size in bytes of the security header ** - ** if data have been successfully decoded; ** - ** 1, if the header is not a security header ** - ** (header of plain NAS message); ** - ** -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int -_nas_message_header_decode( - const char *buffer, - nas_message_security_header_t *header, - int length) -{ - LOG_FUNC_IN; - - int size = 0; - - /* Decode the first octet of the header (security header type or EPS bearer - * identity, and protocol discriminator) */ - DECODE_U8(buffer, *(UInt8_t*)(header), size); - - if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { - if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { - if (length < NAS_MESSAGE_SECURITY_HEADER_SIZE) { - /* The buffer is not big enough to contain security header */ - LOG_TRACE(WARNING, "NET-API - The size of the header (%u) " - "exceeds the buffer length (%u)", - NAS_MESSAGE_SECURITY_HEADER_SIZE, length); - LOG_FUNC_RETURN (-1); - } - - /* Decode the message authentication code */ - DECODE_U32(buffer+size, header->message_authentication_code, size); - /* Decode the sequence number */ - DECODE_U8(buffer+size, header->sequence_number, size); - } - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: _nas_message_plain_decode() ** - ** ** - ** Description: Decode plain NAS message ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing plain NAS ** - ** message data ** - ** header: Header of the plain NAS message ** - ** length: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: msg: Decoded NAS message ** - ** Return: The number of bytes in the buffer if the ** - ** data have been successfully decoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int -_nas_message_plain_decode( - const char *buffer, - const nas_message_security_header_t *header, - nas_message_plain_t *msg, - int length) -{ - LOG_FUNC_IN; - - int bytes = TLV_DECODE_PROTOCOL_NOT_SUPPORTED; - - if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { - /* Decode EPS Mobility Management L3 message */ - bytes = emm_msg_decode(&msg->emm, (uint8_t *)buffer, length); - } else if (header->protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) { - /* Decode EPS Session Management L3 message */ - bytes = esm_msg_decode(&msg->esm, (uint8_t *)buffer, length); - } else { - /* Discard L3 messages with not supported protocol discriminator */ - LOG_TRACE(WARNING,"NET-API - Protocol discriminator 0x%x is " - "not supported", header->protocol_discriminator); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _nas_message_protected_decode() ** - ** ** - ** Description: Decode security protected NAS message ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the secu- ** - ** rity protected NAS message data ** - ** header: Header of the security protected NAS message ** - ** length: Number of bytes that should be decoded ** - ** emm_security_context: security context ** - ** Others: None ** - ** ** - ** Outputs: msg: Decoded NAS message ** - ** Return: The number of bytes in the buffer if the ** - ** data have been successfully decoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_message_protected_decode( - const char *buffer, - nas_message_security_header_t *header, - nas_message_plain_t *msg, - int length, - const emm_security_context_t * const emm_security_context) -{ - LOG_FUNC_IN; - - int bytes = TLV_DECODE_BUFFER_TOO_SHORT; - - char* plain_msg = (char*)calloc(1,length); - - if (plain_msg) { - /* Decrypt the security protected NAS message */ - header->protocol_discriminator = - _nas_message_decrypt(plain_msg, - buffer, - header->security_header_type, - header->message_authentication_code, - header->sequence_number, - length, - emm_security_context); - /* Decode the decrypted message as plain NAS message */ - bytes = _nas_message_plain_decode(plain_msg, header, msg, length); - free(plain_msg); - } - - LOG_FUNC_RETURN (bytes); -} - -/* - * ----------------------------------------------------------------------------- - * Functions used to encode layer 3 NAS messages - * ----------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _nas_message_header_encode() ** - ** ** - ** Description: Encode header of a security protected NAS message ** - ** ** - ** Inputs header: Security header structure to encode ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if the ** - ** data have been successfully encoded; ** - ** 1, if the header is not a security header ** - ** (header of plain NAS message); ** - ** -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_message_header_encode( - char *buffer, - const nas_message_security_header_t *header, - int length) -{ - LOG_FUNC_IN; - - int size = 0; - - /* Encode the first octet of the header (security header type or EPS bearer - * identity, and protocol discriminator) */ - ENCODE_U8(buffer, *(UInt8_t*)(header), size); - - if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { - if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { - //static uint8_t seq = 0; - if (length < NAS_MESSAGE_SECURITY_HEADER_SIZE) { - /* The buffer is not big enough to contain security header */ - LOG_TRACE(WARNING, "NET-API - The size of the header (%u) " - "exceeds the buffer length (%u)", - NAS_MESSAGE_SECURITY_HEADER_SIZE, length); - LOG_FUNC_RETURN (-1); - } - - /* Encode the message authentication code */ - ENCODE_U32(buffer+size, header->message_authentication_code, size); - /* Encode the sequence number */ - ENCODE_U8(buffer+size, header->sequence_number, size); - //ENCODE_U8(buffer+size, seq, size); - //seq++; - } - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: _nas_message_plain_encode() ** - ** ** - ** Description: Encode plain NAS message ** - ** ** - ** Inputs: pd: Protocol discriminator of the NAS message ** - ** to encode ** - ** msg: Plain NAS message structure to encode ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if the ** - ** data have been successfully encoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_message_plain_encode( - char *buffer, - const nas_message_security_header_t *header, - const nas_message_plain_t *msg, - int length) -{ - LOG_FUNC_IN; - - int bytes = TLV_ENCODE_PROTOCOL_NOT_SUPPORTED; - - if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { - /* Encode EPS Mobility Management L3 message */ - bytes = emm_msg_encode((EMM_msg*)(&msg->emm), (uint8_t*)buffer, length); - } else if (header->protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) { - /* Encode EPS Session Management L3 message */ - bytes = esm_msg_encode((ESM_msg*)(&msg->esm), (uint8_t*)buffer, length); - } else { - /* Discard L3 messages with not supported protocol discriminator */ - LOG_TRACE(WARNING,"NET-API - Protocol discriminator 0x%x is " - "not supported", header->protocol_discriminator); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _nas_message_protected_encode() ** - ** ** - ** Description: Encode security protected NAS message ** - ** ** - ** Inputs msg: Security protected NAS message structure ** - ** to encode ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if the ** - ** data have been successfully encoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_message_protected_encode( - char *buffer, - const nas_message_security_protected_t *msg, - int length, - void *security) -{ - LOG_FUNC_IN; - - emm_security_context_t *emm_security_context = (emm_security_context_t*)security; - int bytes = TLV_ENCODE_BUFFER_TOO_SHORT; - - char* plain_msg = (char*)calloc(1,length); - - if (plain_msg) { - /* Encode the security protected NAS message as plain NAS message */ - int size = _nas_message_plain_encode(plain_msg, &msg->header, - &msg->plain, length); - - if (size > 0) { - //static uint8_t seq = 0; - /* Encrypt the encoded plain NAS message */ - bytes = _nas_message_encrypt(buffer, - plain_msg, - msg->header.security_header_type, - msg->header.message_authentication_code, - msg->header.sequence_number, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - size, - emm_security_context); - //seq, size); - //seq ++; - } - - free(plain_msg); - } - - LOG_FUNC_RETURN (bytes); -} - -/* - * ----------------------------------------------------------------------------- - * Functions used to decrypt and encrypt layer 3 NAS messages - * ----------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _nas_message_decrypt() ** - ** ** - ** Description: Decrypt security protected NAS message ** - ** ** - ** Inputs src: Pointer to the encrypted data buffer ** - ** security_header_type: The security header type ** - ** code: The message authentication code ** - ** seq: The sequence number ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: dest: Pointer to the decrypted data buffer ** - ** Return: The protocol discriminator of the message ** - ** that has been decrypted; ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_message_decrypt( - char *dest, - const char *src, - UInt8_t security_header_type, - UInt32_t code, - UInt8_t seq, - int length, - const emm_security_context_t * const emm_security_context) -{ - nas_stream_cipher_t stream_cipher; - uint32_t count; - uint8_t direction; - - LOG_FUNC_IN; - - int size = 0; - nas_message_security_header_t header; - -#ifdef NAS_MME - direction = SECU_DIRECTION_UPLINK; -#else - direction = SECU_DIRECTION_DOWNLINK; -#endif - - switch (security_header_type) { - case SECURITY_HEADER_TYPE_NOT_PROTECTED: - case SECURITY_HEADER_TYPE_SERVICE_REQUEST: - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED: - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW: - LOG_TRACE(DEBUG, - "No decryption of message length %u according to security header type 0x%02x", - length, security_header_type); - memcpy(dest, src, length); - DECODE_U8(dest, *(UInt8_t*)(&header), size); - LOG_FUNC_RETURN (header.protocol_discriminator); - //LOG_FUNC_RETURN (length); - break; - - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED: - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW: - switch (emm_security_context->selected_algorithms.encryption) { - - case NAS_SECURITY_ALGORITHMS_EEA1: { - if (direction == SECU_DIRECTION_UPLINK) { - count = 0x00000000 || - ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->ul_count.seq_num & 0x000000FF); - } else { - count = 0x00000000 || - ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->dl_count.seq_num & 0x000000FF); - } - - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EEA1 dir %s count.seq_num %u count %u", - (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", - (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, - count); - stream_cipher.key = emm_security_context->knas_enc.value; - stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; - stream_cipher.count = count; - stream_cipher.bearer = 0x00; //33.401 section 8.1.1 - stream_cipher.direction = direction; - stream_cipher.message = src; - /* length in bits */ - stream_cipher.blength = length << 3; - nas_stream_encrypt_eea1(&stream_cipher, dest); - /* Decode the first octet (security header type or EPS bearer identity, - * and protocol discriminator) */ - DECODE_U8(dest, *(UInt8_t*)(&header), size); - - LOG_FUNC_RETURN (header.protocol_discriminator); - - } - break; - - case NAS_SECURITY_ALGORITHMS_EEA2: { - if (direction == SECU_DIRECTION_UPLINK) { - count = 0x00000000 || - ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->ul_count.seq_num & 0x000000FF); - } else { - count = 0x00000000 || - ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->dl_count.seq_num & 0x000000FF); - } - - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EEA2 dir %s count.seq_num %u count %u", - (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", - (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, - count); - stream_cipher.key = emm_security_context->knas_enc.value; - stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; - stream_cipher.count = count; - stream_cipher.bearer = 0x00; //33.401 section 8.1.1 - stream_cipher.direction = direction; - stream_cipher.message = src; - /* length in bits */ - stream_cipher.blength = length << 3; - nas_stream_encrypt_eea1(&stream_cipher, dest); - /* Decode the first octet (security header type or EPS bearer identity, - * and protocol discriminator) */ - DECODE_U8(dest, *(UInt8_t*)(&header), size); - - LOG_FUNC_RETURN (header.protocol_discriminator); - } - break; - - case NAS_SECURITY_ALGORITHMS_EEA0: - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EEA0 dir %d ul_count.seq_num %d dl_count.seq_num %d", - direction, - emm_security_context->ul_count.seq_num, - emm_security_context->dl_count.seq_num); - memcpy(dest, src, length); - /* Decode the first octet (security header type or EPS bearer identity, - * and protocol discriminator) */ - DECODE_U8(dest, *(UInt8_t*)(&header), size); - - LOG_FUNC_RETURN (header.protocol_discriminator); - - break; - - default: - LOG_TRACE(ERROR, - "Unknown Cyphering protection algorithm %d", - emm_security_context->selected_algorithms.encryption); - memcpy(dest, src, length); - /* Decode the first octet (security header type or EPS bearer identity, - * and protocol discriminator) */ - DECODE_U8(dest, *(UInt8_t*)(&header), size); - - LOG_FUNC_RETURN (header.protocol_discriminator); - break; - } - - break; - - default: - LOG_TRACE(ERROR, - "Unknown security header type %u", security_header_type); - LOG_FUNC_RETURN (0); - }; - -} - -/**************************************************************************** - ** ** - ** Name: _nas_message_encrypt() ** - ** ** - ** Description: Encrypt plain NAS message ** - ** ** - ** Inputs src: Pointer to the decrypted data buffer ** - ** security_header_type: The security header type ** - ** code: The message authentication code ** - ** seq: The sequence number ** - ** direction: The sequence number ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: dest: Pointer to the encrypted data buffer ** - ** Return: The number of bytes in the output buffer ** - ** if data have been successfully encrypted; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_message_encrypt( - char *dest, - const char *src, - UInt8_t security_header_type, - UInt32_t code, - UInt8_t seq, - int const direction, - int length, - const emm_security_context_t * const emm_security_context) -{ - nas_stream_cipher_t stream_cipher; - uint32_t count; - LOG_FUNC_IN; - - if (!emm_security_context) { - LOG_TRACE(ERROR, - "No security context set for encryption protection algorithm"); - LOG_FUNC_RETURN (0); - } - - switch (security_header_type) { - case SECURITY_HEADER_TYPE_NOT_PROTECTED: - case SECURITY_HEADER_TYPE_SERVICE_REQUEST: - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED: - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW: - LOG_TRACE(DEBUG, - "No encryption of message according to security header type 0x%02x", - security_header_type); - memcpy(dest, src, length); - LOG_FUNC_RETURN (length); - break; - - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED: - case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW: - switch (emm_security_context->selected_algorithms.encryption) { - - case NAS_SECURITY_ALGORITHMS_EEA1: { - if (direction == SECU_DIRECTION_UPLINK) { - count = 0x00000000 || - ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->ul_count.seq_num & 0x000000FF); - } else { - count = 0x00000000 || - ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->dl_count.seq_num & 0x000000FF); - } - - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EEA1 dir %s count.seq_num %u count %u", - (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", - (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, - count); - stream_cipher.key = emm_security_context->knas_enc.value; - stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; - stream_cipher.count = count; - stream_cipher.bearer = 0x00; //33.401 section 8.1.1 - stream_cipher.direction = direction; - stream_cipher.message = src; - /* length in bits */ - stream_cipher.blength = length << 3; - nas_stream_encrypt_eea1(&stream_cipher, dest); - - LOG_FUNC_RETURN (length); - - } - break; - - case NAS_SECURITY_ALGORITHMS_EEA2: { - if (direction == SECU_DIRECTION_UPLINK) { - count = 0x00000000 || - ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->ul_count.seq_num & 0x000000FF); - } else { - count = 0x00000000 || - ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->dl_count.seq_num & 0x000000FF); - } - - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EEA2 dir %s count.seq_num %u count %u", - (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", - (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, - count); - stream_cipher.key = emm_security_context->knas_enc.value; - stream_cipher.key_length = AUTH_KNAS_ENC_SIZE; - stream_cipher.count = count; - stream_cipher.bearer = 0x00; //33.401 section 8.1.1 - stream_cipher.direction = direction; - stream_cipher.message = src; - /* length in bits */ - stream_cipher.blength = length << 3; - nas_stream_encrypt_eea2(&stream_cipher, dest); - - LOG_FUNC_RETURN (length); - - } - break; - - case NAS_SECURITY_ALGORITHMS_EEA0: - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EEA0 dir %d ul_count.seq_num %d dl_count.seq_num %d", - direction, - emm_security_context->ul_count.seq_num, - emm_security_context->dl_count.seq_num); - memcpy(dest, src, length); - LOG_FUNC_RETURN (length); - - break; - - default: - LOG_TRACE(ERROR, - "Unknown Cyphering protection algorithm %d", - emm_security_context->selected_algorithms.encryption); - break; - } - - break; - - default: - LOG_TRACE(ERROR, - "Unknown security header type %u", security_header_type); - LOG_FUNC_RETURN (0); - } - - LOG_FUNC_RETURN (length); -} - -/* - * ----------------------------------------------------------------------------- - * Functions used for integrity protection of layer 3 NAS messages - * ----------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _nas_message_get_mac() ** - ** ** - ** Description: Run integrity algorithm onto cyphered or uncyphered NAS ** - ** message encoded in the input buffer and return the compu- ** - ** ted message authentication code ** - ** ** - ** Inputs buffer: Pointer to the integrity protected data ** - ** buffer ** - ** count: Value of the uplink NAS counter ** - ** length: Length of the input buffer ** - ** direction ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The message authentication code ** - ** Others: None ** - ** ** - ***************************************************************************/ -static UInt32_t _nas_message_get_mac( - const char * const buffer, - int const length, - int const direction, - const emm_security_context_t * const emm_security_context) -{ - - LOG_FUNC_IN; - - if (!emm_security_context) { - LOG_TRACE(DEBUG, - "No security context set for integrity protection algorithm"); -#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) - LOG_FUNC_RETURN (0); -#else - LOG_FUNC_RETURN (0xabababab); -#endif - } - - switch (emm_security_context->selected_algorithms.integrity) { - - case NAS_SECURITY_ALGORITHMS_EIA1: { - UInt8_t mac[4]; - nas_stream_cipher_t stream_cipher; - UInt32_t count; - UInt32_t *mac32; - - int i,bytes = 0; - - if (direction == SECU_DIRECTION_UPLINK) { - count = 0x00000000 || - ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->ul_count.seq_num & 0x000000FF); - } else { - count = 0x00000000 || - ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->dl_count.seq_num & 0x000000FF); - } - - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EIA1 dir %s count.seq_num %u count %u", - (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", - (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, - count); - - fprintf(stderr, "\n[NAS]\t"); - - for (i=0; i < length; i++) { - fprintf(stderr, "%.2hx ", (const unsigned char) buffer[i]); - - /* Add new line when the number of displayed bytes exceeds - * the line's size */ - if ( ++bytes > (16 - 1) ) { - bytes = 0; - fprintf(stderr, "\n[NAS]\t"); - } - } - - if (bytes % 16) { - fprintf(stderr, "\n"); - } - - fprintf(stderr, "\n"); - fflush(stderr); - - stream_cipher.key = emm_security_context->knas_int.value; - stream_cipher.key_length = AUTH_KNAS_INT_SIZE; - stream_cipher.count = count; - stream_cipher.bearer = 0x00; //33.401 section 8.1.1 - stream_cipher.direction = direction; - stream_cipher.message = buffer; - /* length in bits */ - stream_cipher.blength = length << 3; - - nas_stream_encrypt_eia1( - &stream_cipher, - mac); - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EIA1 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d", - mac[0], mac[1], mac[2],mac[3], - *((UInt32_t*)&mac), - length, - direction, - count); - mac32 = (UInt32_t*)&mac; - LOG_FUNC_RETURN (ntohl(*mac32)); - } - break; - - case NAS_SECURITY_ALGORITHMS_EIA2: { - UInt8_t mac[4]; - nas_stream_cipher_t stream_cipher; - UInt32_t count; - UInt32_t *mac32; - - if (direction == SECU_DIRECTION_UPLINK) { - count = 0x00000000 || - ((emm_security_context->ul_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->ul_count.seq_num & 0x000000FF); - } else { - count = 0x00000000 || - ((emm_security_context->dl_count.overflow && 0x0000FFFF) << 8) || - (emm_security_context->dl_count.seq_num & 0x000000FF); - } - - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EIA2 dir %s count.seq_num %u count %u", - (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", - (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, - count); - - stream_cipher.key = emm_security_context->knas_int.value; - stream_cipher.key_length = AUTH_KNAS_INT_SIZE; - stream_cipher.count = count; - stream_cipher.bearer = 0x00; //33.401 section 8.1.1 - stream_cipher.direction = direction; - stream_cipher.message = buffer; - /* length in bits */ - stream_cipher.blength = length << 3; - - nas_stream_encrypt_eia2( - &stream_cipher, - mac); - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EIA2 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d", - mac[0], mac[1], mac[2],mac[3], - *((UInt32_t*)&mac), - length, - direction, - count); - mac32 = (UInt32_t*)&mac; - LOG_FUNC_RETURN (ntohl(*mac32)); - } - break; - - case NAS_SECURITY_ALGORITHMS_EIA0: - LOG_TRACE(DEBUG, - "NAS_SECURITY_ALGORITHMS_EIA0 dir %s count.seq_num %u", - (direction == SECU_DIRECTION_UPLINK) ? "UPLINK":"DOWNLINK", - (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num - ); - -#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) - LOG_FUNC_RETURN (0); -#else - LOG_FUNC_RETURN (0xabababab); -#endif - break; - - default: - LOG_TRACE(ERROR, - "Unknown integrity protection algorithm %d", - emm_security_context->selected_algorithms.integrity); - break; - } - - LOG_FUNC_RETURN (0); -} - - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.h b/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.h deleted file mode 100644 index d7d09f11456683b1d023adf565956b506976f374..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/nas_message.h +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source nas_message.h - -Version 0.1 - -Date 2012/26/09 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the layer 3 messages supported by the NAS sublayer - protocol and functions used to encode and decode - -*****************************************************************************/ -#ifndef __NAS_MESSAGE_H__ -#define __NAS_MESSAGE_H__ - -#include "commonDef.h" -#include "emm_msg.h" -#if defined(NAS_BUILT_IN_EPC) -#include "emmData.h" -#endif -#include "esm_msg.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -#define NAS_MESSAGE_SECURITY_HEADER_SIZE 6 - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* Structure of security protected header */ -typedef struct { -#ifdef __LITTLE_ENDIAN_BITFIELD - eps_protocol_discriminator_t protocol_discriminator:4; - UInt8_t security_header_type:4; -#endif -#ifdef __BIG_ENDIAN_BITFIELD - UInt8_t security_header_type:4; - UInt8_t protocol_discriminator:4; -#endif - UInt32_t message_authentication_code; - UInt8_t sequence_number; -} nas_message_security_header_t; - -/* Structure of plain NAS message */ -typedef union { - EMM_msg emm; /* EPS Mobility Management messages */ - ESM_msg esm; /* EPS Session Management messages */ -} nas_message_plain_t; - -/* Structure of security protected NAS message */ -typedef struct { - nas_message_security_header_t header; - nas_message_plain_t plain; -} nas_message_security_protected_t; - -/* - * Structure of a layer 3 NAS message - */ -typedef union { - nas_message_security_header_t header; - nas_message_security_protected_t security_protected; - nas_message_plain_t plain; -} nas_message_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int nas_message_encrypt( - const char *inbuf, - char *outbuf, - const nas_message_security_header_t *header, - int length, - void *security); - -int nas_message_decrypt(const char *inbuf, - char *outbuf, - nas_message_security_header_t *header, - int length, - void *security); - -int nas_message_decode( - const char * const buffer, - nas_message_t *msg, - int length, - void *security); - -int nas_message_encode( - char *buffer, - const nas_message_t * const msg, - int length, - void *security); - -#endif /* __NAS_MESSAGE_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.c b/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.c deleted file mode 100644 index 61814c3e11c36c6312e9646fbf439321fd936f06..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.c +++ /dev/null @@ -1,447 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source network_api.c - -Version 0.1 - -Date 2012/03/01 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer to send/receive - message to/from the network sublayer - -*****************************************************************************/ - -#include "network_api.h" -#include "commonDef.h" -#include "nas_log.h" -#include "socket.h" - -#include "as_message.h" - -#include <string.h> // strerror, memset -#include <netdb.h> // gai_strerror -#include <errno.h> // errno -#include <unistd.h> // gethostname - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* ------------------- - * Connection endpoint - * ------------------- - * The connection endpoint is used to send/receive data to/from the - * network sublayer. Its definition depends on the underlaying mechanism - * chosen to communicate (network socket, I/O terminal device, async FIFO). - * A connection endpoint is handled using an identifier, and functions - * used to retreive the file descriptor actually allocated by the system, - * to receive data, to send data, and to perform clean up when connection - * is shut down. - * Only one single end to end connection with the network sublayer is - * managed at a time. - */ -static struct { - /* Connection endpoint reference */ - void* endpoint; - /* Connection endpoint handlers */ - void* (*open) (int, const char*, const char*); - int (*getfd)(const void*); - ssize_t (*recv) (void*, char*, size_t); - ssize_t (*send) (const void*, const char*, size_t); - void (*close)(void*); -} _network_api_id; - -#define NETWORK_API_OPEN(a, b, c) _network_api_id.open(a, b, c) -#define NETWORK_API_GETFD() _network_api_id.getfd(_network_api_id.endpoint) -#define NETWORK_API_RECV(a, b) _network_api_id.recv(_network_api_id.endpoint, a, b) -#define NETWORK_API_SEND(a, b) _network_api_id.send(_network_api_id.endpoint, a, b) -#define NETWORK_API_CLOSE() _network_api_id.close(_network_api_id.endpoint) - -/* - * The buffer used to receive data from the network sublayer - */ -#define NETWORK_API_RECV_BUFFER_SIZE 4096 -static char _network_api_recv_buffer[NETWORK_API_RECV_BUFFER_SIZE]; - -/* - * The buffer used to send data to the network sublayer - */ -#define NETWORK_API_SEND_BUFFER_SIZE NETWORK_API_RECV_BUFFER_SIZE -static char _network_api_send_buffer[NETWORK_API_SEND_BUFFER_SIZE]; - -/* - * The decoded data received from the network sublayer - */ -static as_message_t _as_data = {}; /* Access Stratum message */ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: network_api_initialize() ** - ** ** - ** Description: Initializes the network API from which the NAS layer ** - ** will send/receive messages to/from the network sublayer ** - ** ** - ** Inputs: host: The name of the host from which the net- ** - ** work sublayer will connect ** - ** port: The local port number ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: _network_api_id ** - ** ** - ***************************************************************************/ -int network_api_initialize(const char* host, const char* port) -{ - LOG_FUNC_IN; - - /* Initialize network socket handlers */ - _network_api_id.open = socket_udp_open; - _network_api_id.getfd = socket_get_fd; - _network_api_id.recv = socket_recv; - _network_api_id.send = socket_send; - _network_api_id.close = socket_close; - /* Initialize UDP communication channel with the network layer */ -#ifdef NAS_UE - _network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_CLIENT, host, port); -#endif -#ifdef NAS_MME - _network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_SERVER, NULL, port); -#endif - - if (_network_api_id.endpoint == NULL) { - const char* error = ( (errno < 0) ? - gai_strerror(errno) : strerror(errno) ); - LOG_TRACE(ERROR, "NET-API - Failed to open connection endpoint, %s", - error); - LOG_FUNC_RETURN (RETURNerror); - } - - gethostname(_network_api_send_buffer, NETWORK_API_SEND_BUFFER_SIZE); - LOG_TRACE(INFO, "NET-API - Network's UDP socket %d is BOUND to %s/%s", - network_api_get_fd(), _network_api_send_buffer, port); - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: network_api_get_fd() ** - ** ** - ** Description: Get the file descriptor of the connection endpoint used ** - ** to send/receive messages to/from the network sublayer ** - ** ** - ** Inputs: None ** - ** Others: _network_api_id ** - ** ** - ** Outputs: Return: The file descriptor of the connection end- ** - ** point used by the network sublayer ** - ** Others: None ** - ** ** - ***************************************************************************/ -int network_api_get_fd(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (NETWORK_API_GETFD()); -} - -/**************************************************************************** - ** ** - ** Name: network_api_get_data() ** - ** ** - ** Description: Get a generic pointer to the network data structure. ** - ** Casting to the proper type is necessary before its usage. ** - ** ** - ** Inputs: None ** - ** Others: _as_data ** - ** ** - ** Outputs: Return: A generic pointer to the network data ** - ** structure ** - ** Others: None ** - ** ** - ***************************************************************************/ -const void* network_api_get_data(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN ((void*)(&_as_data)); -} - -/**************************************************************************** - ** ** - ** Name: network_api_read_data() ** - ** ** - ** Description: Read data received from the network sublayer ** - ** ** - ** Inputs: fd: File descriptor of the connection endpoint ** - ** from which data have been received ** - ** Others: _network_api_id ** - ** ** - ** Outputs: Return: The number of bytes read when success; ** - ** RETURNerror otherwise ** - ** Others: _network_api_recv_buffer, _network_api_id ** - ** ** - ***************************************************************************/ -int network_api_read_data(int fd) -{ - LOG_FUNC_IN; - - int rbytes; - - /* Sanity check */ - int sfd = network_api_get_fd(); - - if (fd != sfd) { - LOG_TRACE(ERROR, "NET-API - Endpoint %d is not the one created for communication with the network sublayer (%d)", fd, sfd); - LOG_FUNC_RETURN (RETURNerror); - } - - memset(_network_api_recv_buffer, 0, NETWORK_API_RECV_BUFFER_SIZE); - - /* Receive data from the network sublayer */ - rbytes = NETWORK_API_RECV(_network_api_recv_buffer, - NETWORK_API_RECV_BUFFER_SIZE); - - if (rbytes == RETURNerror) { - LOG_TRACE(ERROR, "NET-API - recv() failed, %s", strerror(errno)); - LOG_FUNC_RETURN (RETURNerror); - } else if (rbytes == 0) { - LOG_TRACE(WARNING, "NET-API - A signal was caught"); - } else { - LOG_TRACE(INFO, "NET-API - %d bytes received from the network " - "sublayer", rbytes); - LOG_DUMP(_network_api_recv_buffer, rbytes); - } - - LOG_FUNC_RETURN (rbytes); -} - -/**************************************************************************** - ** ** - ** Name: network_api_send_data() ** - ** ** - ** Description: Send data to the network sublayer ** - ** ** - ** Inputs: fd: File descriptor of the connection endpoint ** - ** to which data have to be sent ** - ** length: Number of bytes to send ** - ** Others: _network_api_send_buffer, _network_api_id ** - ** ** - ** Outputs: Return: The number of bytes sent when success; ** - ** RETURNerror otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -int network_api_send_data(int fd, int length) -{ - LOG_FUNC_IN; - - int sbytes; - - /* Sanity check */ - int sfd = network_api_get_fd(); - - if (fd != sfd) { - LOG_TRACE(ERROR, "NET-API - Endpoint %d is not the one created for communication with the network sublayer (%d)", fd, sfd); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Send data to the network sublayer */ - sbytes = NETWORK_API_SEND(_network_api_send_buffer, length); - - if (sbytes == RETURNerror) { - LOG_TRACE(ERROR, "NET-API - send() failed, %s", strerror(errno)); - LOG_FUNC_RETURN (RETURNerror); - } else if (sbytes == 0) { - LOG_TRACE(WARNING, "NET-API - A signal was caught"); - } else { - LOG_TRACE(INFO, "NET-API - %d bytes sent to the network sublayer", - sbytes); - LOG_DUMP(_network_api_send_buffer, sbytes); - } - - LOG_FUNC_RETURN (sbytes); -} - -/**************************************************************************** - ** ** - ** Name: network_api_close() ** - ** ** - ** Description: Clean the network API from which the NAS layer sent/recei-** - ** ved messages to/from the network sublayer ** - ** ** - ** Inputs: fd: File descriptor of the connection endpoint ** - ** allocated by the system to communicate ** - ** with the network sublayer ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: _network_api_id ** - ** ** - ***************************************************************************/ -void network_api_close(int fd) -{ - LOG_FUNC_IN; - - /* Sanity check */ - int sfd = network_api_get_fd(); - - if (fd != sfd) { - LOG_TRACE(ERROR, "NET-API - Endpoint %d is not the one created for communication with the network sublayer (%d)", fd, sfd); - LOG_FUNC_OUT; - return; - } - - /* Cleanup the connection endpoint */ - NETWORK_API_CLOSE(); - _network_api_id.endpoint = NULL; - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: network_api_decode_data() ** - ** ** - ** Description: Decodes the message received from the network and fills ** - ** the corresponding network data structure. ** - ** ** - ** Inputs: length: Number of bytes to decode ** - ** Others: _network_api_recv_buffer ** - ** ** - ** Outputs: Return: The identifier of the received AS ** - ** message when successfully decoded; ** - ** RETURNerror otherwise ** - ** Others: _as_data ** - ** ** - ***************************************************************************/ -int network_api_decode_data(int length) -{ - LOG_FUNC_IN; - - /* Decode the Access Stratum message received from the network */ - int as_id = as_message_decode(_network_api_recv_buffer, &_as_data, length); - - if (as_id != RETURNerror) { - LOG_TRACE(INFO, "NET-API - AS message id=0x%x successfully decoded", - as_id); - } - - LOG_FUNC_RETURN (as_id); -} - -/**************************************************************************** - ** ** - ** Name: network_api_encode_data() ** - ** ** - ** Description: Encodes Access Stratum message to be sent to the network ** - ** ** - ** Inputs data: Generic pointer to the AS data to encode ** - ** Others: None ** - ** ** - ** Outputs: Return: The number of characters that have been ** - ** successfully encoded; ** - ** RETURNerror otherwise. ** - ** Others: _network_api_send_buffer ** - ** ** - ***************************************************************************/ -int network_api_encode_data(void* data) -{ - LOG_FUNC_IN; - - /* Encode the Access Stratum message */ - int bytes = as_message_encode(_network_api_send_buffer, - (as_message_t*)(data), - NETWORK_API_SEND_BUFFER_SIZE); - - if (bytes != RETURNerror) { - LOG_TRACE(INFO, "NET-API - %d bytes encoded", bytes); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: as_message_send() ** - ** ** - ** Description: Service provided to the EPS Mobility Management protocol ** - ** at the EMMAS Access Point (EMMAS-SAP) to send AS messages ** - ** to the Access Stratum sublayer. ** - ** ** - ** Inputs: as_msg: The AS message to send ** - ** Others: _network_api_send_buffer, _network_api_id ** - ** ** - ** Outputs: Return: The number of bytes sent when success; ** - ** RETURNerror Otherwise ** - ** Others: _network_api_send_buffer ** - ** ** - ***************************************************************************/ -int as_message_send(as_message_t* as_msg) -{ - int bytes; - LOG_FUNC_IN; - - LOG_TRACE(INFO, "NET-API - Send message 0x%.4x to the Access Stratum " - "layer", as_msg->msgID); - - /* Encode the AS message */ - bytes = network_api_encode_data(as_msg); - - if (bytes > 0) { - /* Get the network file descriptor */ - int fd = network_api_get_fd(); - - if (fd != RETURNerror) { - /* Send the AS message to the network */ - bytes = network_api_send_data(fd, bytes); - } - } - - LOG_FUNC_RETURN (bytes); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.h b/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.h deleted file mode 100644 index f9b04371fe88621c04f3157813b8dc9111089784..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/network/network_api.h +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source network_api.h - -Version 0.1 - -Date 2012/03/01 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer to send/receive - message to/from the network layer - -*****************************************************************************/ -#ifndef __NETWORK_API_H__ -#define __NETWORK_API_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int network_api_initialize(const char* host, const char* port); - -int network_api_get_fd(void); -const void* network_api_get_data(void); - -int network_api_read_data(int fd); -int network_api_send_data(int fd, int length); -void network_api_close(int fd); - -int network_api_decode_data(int length); -int network_api_encode_data(void* data); - -#endif /* __NETWORK_API_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/COPYING b/openair-cn/NAS/EURECOM-NAS/src/api/user/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/Makefile b/openair-cn/NAS/EURECOM-NAS/src/api/user/Makefile deleted file mode 100644 index 8e7c24a4c4b8098d06c90571ee82ef2b499f18d6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) -I$(EMMMSGDIR) -I$(ESMMSGDIR) -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -all: $(OBJS) - -%.o: %.c Makefile - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -clean: - $(RM) $(OBJS) *.bak *~ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.c b/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.c deleted file mode 100644 index c6f26a4b1b5cd5edcb574d3c70854f4b6ddc1e5a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.c +++ /dev/null @@ -1,1879 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source at_command.c - -Version 0.1 - -Date 2012/03/07 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel, Baris Demiray - -Description Defines the ATtention (AT) command set supported by the NAS - sublayer protocol - -*****************************************************************************/ - -#include "at_command.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "at_error.h" - -#include <ctype.h> // isspace, isdigit -#include <stdlib.h> // strtol, malloc, free -#include <string.h> // strncpy, strstr, strchr, strcmp, strncasecmp -// strlen, memmove, strdup, strtok -#include <stdarg.h> // va_start, va_arg, va_end - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -extern int at_response_format_v1; -extern int at_error_code_suppression_q1; -extern at_error_format_t at_error_format; - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* Handlers used to parse AT commands */ -static int parse_e0(const char*, int, at_command_t*); -static int parse_e1(const char*, int, at_command_t*); -static int parse_q0(const char*, int, at_command_t*); -static int parse_q1(const char*, int, at_command_t*); -static int parse_v0(const char*, int, at_command_t*); -static int parse_v1(const char*, int, at_command_t*); -static int parse_cgsn(const char*, int, at_command_t*); -static int parse_cgsn_test(const char*, int, at_command_t*); -static int parse_cgmi(const char*, int, at_command_t*); -static int parse_cgmi_test(const char*, int, at_command_t*); -static int parse_cgmm(const char*, int, at_command_t*); -static int parse_cgmm_test(const char*, int, at_command_t*); -static int parse_cgmr(const char*, int, at_command_t*); -static int parse_cgmr_test(const char*, int, at_command_t*); -static int parse_cimi(const char*, int, at_command_t*); -static int parse_cimi_test(const char*, int, at_command_t*); -static int parse_cfun_set(const char*, int, at_command_t*); -static int parse_cfun_get(const char*, int, at_command_t*); -static int parse_cfun_test(const char*, int, at_command_t*); -static int parse_cpin_set(const char*, int, at_command_t*); -static int parse_cpin_get(const char*, int, at_command_t*); -static int parse_cpin_test(const char*, int, at_command_t*); -static int parse_csq(const char*, int, at_command_t*); -static int parse_csq_test(const char*, int, at_command_t*); -static int parse_cesq(const char*, int, at_command_t*); -static int parse_cesq_test(const char*, int, at_command_t*); -static int parse_clac(const char*, int, at_command_t*); -static int parse_clac_test(const char*, int, at_command_t*); -static int parse_cmee_set(const char*, int, at_command_t*); -static int parse_cmee_get(const char*, int, at_command_t*); -static int parse_cmee_test(const char*, int, at_command_t*); -static int parse_cnum(const char*, int, at_command_t*); -static int parse_cnum_test(const char*, int, at_command_t*); -static int parse_clck_set(const char*, int, at_command_t*); -static int parse_clck_test(const char*, int, at_command_t*); -static int parse_cops_set(const char*, int, at_command_t*); -static int parse_cops_get(const char*, int, at_command_t*); -static int parse_cops_test(const char*, int, at_command_t*); -static int parse_creg_set(const char*, int, at_command_t*); -static int parse_creg_get(const char*, int, at_command_t*); -static int parse_creg_test(const char*, int, at_command_t*); -static int parse_cgatt_set(const char*, int, at_command_t*); -static int parse_cgatt_get(const char*, int, at_command_t*); -static int parse_cgatt_test(const char*, int, at_command_t*); -static int parse_cgreg_set(const char*, int, at_command_t*); -static int parse_cgreg_get(const char*, int, at_command_t*); -static int parse_cgreg_test(const char*, int, at_command_t*); -static int parse_cereg_set(const char*, int, at_command_t*); -static int parse_cereg_get(const char*, int, at_command_t*); -static int parse_cereg_test(const char*, int, at_command_t*); -static int parse_cgdcont_set(const char*, int, at_command_t*); -static int parse_cgdcont_get(const char*, int, at_command_t*); -static int parse_cgdcont_test(const char*, int, at_command_t*); -static int parse_cgact_set(const char*, int, at_command_t*); -static int parse_cgact_get(const char*, int, at_command_t*); -static int parse_cgact_test(const char*, int, at_command_t*); -static int parse_cgpaddr_set(const char*, int, at_command_t*); -static int parse_cgpaddr_test(const char*, int, at_command_t*); - -/* List of AT command handlers */ -typedef struct { - char *command; - int (*handler)(const char *, int, at_command_t*); - at_command_type_t type; -} at_command_handler_t; - -static const at_command_handler_t _at_command_handler[] = { - /* TE-TA interface commands */ - { "E0", parse_e0, AT_COMMAND_ACT }, - { "E1", parse_e1, AT_COMMAND_ACT }, - { "Q0", parse_q0, AT_COMMAND_ACT }, - { "Q1", parse_q1, AT_COMMAND_ACT }, - { "V0", parse_v0, AT_COMMAND_ACT }, - { "V1", parse_v1, AT_COMMAND_ACT }, - { "E0Q0V0", parse_v0, AT_COMMAND_ACT }, - { "E0Q0V1", parse_v1, AT_COMMAND_ACT }, - { "E1Q0V0", parse_v0, AT_COMMAND_ACT }, - { "E1Q0V1", parse_v1, AT_COMMAND_ACT }, - /* Request Product Serial Number identification (IMEI) */ - { "+CGSN", parse_cgsn, AT_COMMAND_ACT }, - { "+CGSN=?", parse_cgsn_test, AT_COMMAND_TST }, - /* Request manufacturer identification */ - { "+CGMI", parse_cgmi, AT_COMMAND_ACT }, - { "+CGMI=?", parse_cgmi_test, AT_COMMAND_TST }, - /* Request model identification */ - { "+CGMM", parse_cgmm, AT_COMMAND_ACT }, - { "+CGMM=?", parse_cgmm_test, AT_COMMAND_TST }, - /* Request revision identification */ - { "+CGMR", parse_cgmr, AT_COMMAND_ACT }, - { "+CGMR=?", parse_cgmr_test, AT_COMMAND_TST }, - /* Request International Mobile Subscriber Identity */ - { "+CIMI", parse_cimi, AT_COMMAND_ACT }, - { "+CIMI=?", parse_cimi_test, AT_COMMAND_TST }, - /* Set phone functionality */ - { "+CFUN=", parse_cfun_set, AT_COMMAND_SET }, - { "+CFUN?", parse_cfun_get, AT_COMMAND_GET }, - { "+CFUN=?", parse_cfun_test, AT_COMMAND_TST }, - /* Enter PIN */ - { "+CPIN=", parse_cpin_set, AT_COMMAND_SET }, - { "+CPIN?", parse_cpin_get, AT_COMMAND_GET }, - { "+CPIN=?", parse_cpin_test, AT_COMMAND_TST }, - /* Signal quality */ - { "+CSQ", parse_csq, AT_COMMAND_ACT }, - { "+CSQ=?", parse_csq_test, AT_COMMAND_TST }, - /* Extended signal quality */ - { "+CESQ", parse_cesq, AT_COMMAND_ACT }, - { "+CESQ=?", parse_cesq_test, AT_COMMAND_TST }, - /* List all available AT commands */ - { "+CLAC", parse_clac, AT_COMMAND_ACT }, - { "+CLAC=?", parse_clac_test, AT_COMMAND_TST }, - /* Report mobile termination error */ - { "+CMEE=", parse_cmee_set, AT_COMMAND_SET }, - { "+CMEE?", parse_cmee_get, AT_COMMAND_GET }, - { "+CMEE=?", parse_cmee_test, AT_COMMAND_TST }, - /* Subscriber number */ - { "+CNUM", parse_cnum, AT_COMMAND_ACT }, - { "+CNUM=?", parse_cnum_test, AT_COMMAND_TST }, - /* Facility lock */ - { "+CLCK=", parse_clck_set, AT_COMMAND_SET }, - { "+CLCK=?", parse_clck_test, AT_COMMAND_TST }, - /* PLMN selection */ - { "+COPS=", parse_cops_set, AT_COMMAND_SET }, - { "+COPS?", parse_cops_get, AT_COMMAND_GET }, - { "+COPS=?", parse_cops_test, AT_COMMAND_TST }, - /* Network registration */ - { "+CREG=", parse_creg_set, AT_COMMAND_SET }, - { "+CREG?", parse_creg_get, AT_COMMAND_GET }, - { "+CREG=?", parse_creg_test, AT_COMMAND_TST }, - /* GPRS service attach/detach */ - { "+CGATT=", parse_cgatt_set, AT_COMMAND_SET }, - { "+CGATT?", parse_cgatt_get, AT_COMMAND_GET }, - { "+CGATT=?", parse_cgatt_test, AT_COMMAND_TST }, - /* GPRS network registration status */ - { "+CGREG=", parse_cgreg_set, AT_COMMAND_SET }, - { "+CGREG?", parse_cgreg_get, AT_COMMAND_GET }, - { "+CGREG=?", parse_cgreg_test, AT_COMMAND_TST }, - /* EPS network registration status */ - { "+CEREG=", parse_cereg_set, AT_COMMAND_SET }, - { "+CEREG?", parse_cereg_get, AT_COMMAND_GET }, - { "+CEREG=?", parse_cereg_test, AT_COMMAND_TST }, - /* Define PDP Context */ - { "+CGDCONT=", parse_cgdcont_set, AT_COMMAND_SET }, - { "+CGDCONT?", parse_cgdcont_get, AT_COMMAND_GET }, - { "+CGDCONT=?", parse_cgdcont_test, AT_COMMAND_TST }, - /* PDP context activate or deactivate */ - { "+CGACT=", parse_cgact_set, AT_COMMAND_SET }, - { "+CGACT?", parse_cgact_get, AT_COMMAND_GET }, - { "+CGACT=?", parse_cgact_test, AT_COMMAND_TST }, - /* Show PDP address(es) */ - { "+CGPADDR=", parse_cgpaddr_set, AT_COMMAND_SET }, - { "+CGPADDR=?", parse_cgpaddr_test, AT_COMMAND_TST }, - - { "null", NULL } -}; - -static int ParseString(char * at_str, at_command_t* at_command); -static int ParseCommand(const unsigned char *str, const char *format, ...); -static size_t GrabString(const unsigned char *str, char **output); -static unsigned int NumberOfParameters(const unsigned char* str); -static unsigned int IsNumeric(const char* str, size_t len); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: at_command_decode() ** - ** ** - ** Description: Parses AT command line and accordingly fills data struc- ** - ** ture. The main functions of the AT command parser are: ** - ** - check the AT command syntax ** - ** - fill parameter values into the data structure ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing AT com- ** - ** mand line ** - ** length: Number of bytes that should be processed ** - ** Others: None ** - ** ** - ** Outputs: at_command: AT command data structure to be filled ** - ** Return: The number of AT commands successfully ** - ** decoded; RETURNerror if an error occurred ** - ** Others: None ** - ** ** - ***************************************************************************/ -int at_command_decode(const char* buffer, int length, at_command_t* at_command) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - if (length < 3) { - /* Minimum size to carry an AT command is 3 */ - LOG_TRACE(ERROR, "USR-API - Input is short of size to carry an AT command!"); - return RETURNerror; - } else if (strncasecmp(buffer, "AT", 2) != 0) { - /* There must be AT initials in input... */ - LOG_TRACE(ERROR, "USR-API - There is no proper initials (AT) in input!"); - return RETURNerror; - } else if (buffer[length - 1] != '\r') { - /* And there must be CR at the end */ - LOG_TRACE(ERROR, "USR-API - There is no Carriage Return at the end!"); - return RETURNerror; - } else if (strcasecmp(buffer, "AT\r") == 0) { - /* AT command alone; just return OK */ - at_command->id = 0; - at_command->mask = AT_COMMAND_NO_PARAM; - return (1); - } - - /* Parse the AT command line */ - int i; - char* buf = strdup(buffer+2); - char* cmd = strtok(buf, ";"); - - for (i=0; cmd && (rc != RETURNerror); i++) { - rc = ParseString(cmd, &at_command[i]); - cmd = strtok(NULL, ";"); - } - - free(buf); - - if (rc != RETURNerror) { - LOG_FUNC_RETURN (i); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: at_command_get_list() ** - ** ** - ** Description: Returns the list of supported AT commands. ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the ** - ** string representaton of the first AT com- ** - ** mand that is supported by the NAS sublayer ** - ** n_max: Maximum number of AT commands the buffer ** - ** may contain ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of AT commands actually suppor- ** - ** ted by the NAS sublayer ** - ** Others: None ** - ** ** - ***************************************************************************/ -int at_command_get_list(const char** buffer, int n_max) -{ - LOG_FUNC_IN; - - int handler_index = 0; - - while ( (strcmp(_at_command_handler[handler_index].command, "null") != 0) && - (handler_index < n_max) ) { - *buffer++ = _at_command_handler[handler_index++].command; - } - - LOG_FUNC_RETURN (handler_index); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: ParseString() ** - ** ** - ** Description: Calls the appropriate parsing handler after having ** - ** successfully parsed the AT command prefix. ** - ** ** - ** Inputs: at_str: Pointer to the buffer containing AT com- ** - ** mand line ** - ** Others: None ** - ** ** - ** Outputs: at_command: AT command structure to be filled ** - ** Return: The AT command identifier when the buffer ** - ** has been successfully processed; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int ParseString(char * at_str, at_command_t* at_command) -{ - char* terminal_character_index = NULL; - int num_of_chars_to_compare = -1; - int handler_index; - int handler_found = FALSE; - int check_for_carriage_return_index = 0; - - /* - * Find the number of characters we should be comparing against - * the command list - */ - if ((terminal_character_index = strstr(at_str, "=?")) != NULL) { - /* `test' command */ - num_of_chars_to_compare = terminal_character_index - at_str + 2; - check_for_carriage_return_index = 1; - at_command->type = AT_COMMAND_TST; - } else if ((terminal_character_index = strchr(at_str, '?')) != NULL) { - /* `read' command */ - num_of_chars_to_compare = terminal_character_index - at_str + 1; - check_for_carriage_return_index = 1; - at_command->type = AT_COMMAND_GET; - } else if ((terminal_character_index = strchr(at_str, '=')) != NULL) { - /* `set' command */ - num_of_chars_to_compare = terminal_character_index - at_str + 1; - at_command->type = AT_COMMAND_SET; - } else if ((terminal_character_index = strchr(at_str, '\r')) != NULL) { - /* Basic/action command */ - num_of_chars_to_compare = terminal_character_index - at_str; - check_for_carriage_return_index = 1; - at_command->type = AT_COMMAND_ACT; - } else { - /* One action command among many commands */ - num_of_chars_to_compare = strchr(at_str, '\0') - at_str; - at_command->type = AT_COMMAND_ACT; - } - - /* - * The AT command strings in `Commands' list (that we compare the incoming - * command against) don't have CR at the end. So we have to ensure that CR - * comes just after characters like = and ? - */ - if (check_for_carriage_return_index == 1) { - if ( (at_str[num_of_chars_to_compare] != '\0') && - (at_str[num_of_chars_to_compare] != '\r') ) { - LOG_TRACE(ERROR, "USR-API - Carriage return is not at where it should be!"); - return RETURNerror; - } - } - - /* Check if this command has a relevant command handler */ - for (handler_index=0; - strcmp(_at_command_handler[handler_index].command, "null") != 0; - handler_index++) { - /* First match the command types... */ - if (at_command->type != _at_command_handler[handler_index].type) - continue; - - /* Match the command length... */ - if (strlen(_at_command_handler[handler_index].command) != - num_of_chars_to_compare) continue; - - /* Now do string comparison... */ - if (strncasecmp(at_str, _at_command_handler[handler_index].command, - num_of_chars_to_compare) != 0) continue; - - handler_found = TRUE; - break; - } - - /* Call the relevant handler or return with error */ - if (!handler_found) { - LOG_TRACE(ERROR, "USR-API - Unsupported or invalid command!"); - return RETURNerror; - } - - return _at_command_handler[handler_index].handler(at_str, - num_of_chars_to_compare, - at_command); -} - -/**************************************************************************** - ** ** - ** Name: ParseCommand() ** - ** ** - ** Description: Parses the input string on the basis of the format string ** - ** provided. ** - ** ** - ** Inputs: str: The string to be parsed ** - ** format: The format of the input string ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int ParseCommand(const unsigned char *str, const char *format, ...) -{ - const unsigned char *fmt = (unsigned char*) format; - const char *inp = (char*) str; - char *endptr; - char *out_us; - char *buffer; - size_t length; - size_t storage_size; - int *out_i; - long int *out_l; - va_list ap; - int error = RETURNok; - - va_start(ap, format); - - while (*fmt) { - switch (*fmt++) { - case '@': - if (*fmt == 0) { - /* Invalid format string */ - LOG_TRACE(ERROR, "USR-API - Invalid format string!"); - error = RETURNerror; - goto end; - } - - switch (*fmt++) { - case 'i': - out_i = va_arg(ap, int *); - *out_i = strtol(inp, &endptr, 10); - - if (endptr == inp) { - error = RETURNerror; - goto end; - } - - inp = endptr; - break; - - case 'I': - out_i = va_arg(ap, int *); - *out_i = strtol(inp, &endptr, 10); - - if (endptr == inp) { - /* Number empty */ - /* optional parameter ??? */ - LOG_TRACE(WARNING, "USR-API - Number empty!"); - *out_i = 0; - } else { - inp = endptr; - } - - break; - - case 'l': - out_l = va_arg(ap, long int *); - *out_l = strtol(inp, &endptr, 10); - - if (endptr == inp) { - error = RETURNerror; - goto end; - } - - inp = endptr; - break; - - case 'r': - out_us = va_arg(ap, char *); - storage_size = va_arg(ap, size_t); - length = GrabString((unsigned char*) inp, &buffer); - - if (strlen(buffer) > storage_size) { - free(buffer); - error = RETURNerror; - goto end; - } - - strcpy(out_us, buffer); - free(buffer); - inp += length; - break; - - case '@': - if (*inp++ != '@') { - error = RETURNerror; - goto end; - } - - break; - - case '0': - /* Just skip the rest */ - goto end; - - default: - /* Invalid format string */ - error = RETURNerror; - goto end; - } - - break; - - case ' ': - while (isspace(*inp)) - inp++; - - break; - - default: - if (*inp++ != *(fmt - 1)) { - error = RETURNerror; - goto end; - } - - break; - } - } - - /* Ignore trailing spaces */ - while (isspace(*inp)) - inp++; - - if (*inp != 0) { - error = RETURNerror; - goto end; - } - -end: - va_end(ap); - - return error; -} - -/**************************************************************************** - ** ** - ** Name: GrabString() ** - ** ** - ** Description: Grabs single string, removing possible quotes. ** - ** ** - ** Inputs: str: The string to be parsed ** - ** Others: None ** - ** ** - ** Outputs: output: Allocated output string buffer ** - ** Return: Length of parsed string ** - ** Others: None ** - ** ** - ***************************************************************************/ -static size_t GrabString(const unsigned char *str, char **output) -{ - size_t size = 4, position = 0; - int inside_quotes = 0; - - /* Allocate initial buffer in case string is empty */ - *output = malloc(size); - - if (*output == NULL) { - return 0; - } - - while (inside_quotes || (*str != ',' && *str != ')' && - *str != 0x0d && *str != 0x0a && *str != 0x00)) { - /* Check for quotes */ - if (*str == '"') { - inside_quotes = !inside_quotes; - } - - /* We also allocate space for trailing zero */ - if (position + 2 > size) { - size += 10; - *output = realloc(*output, size); - - if (*output == NULL) { - return 0; - } - } - - /* Copy to output */ - (*output)[position] = *str; - position++; - str++; - } - - (*output)[position] = 0; - - /* Strip quotes */ - if ((*output)[0] == '"' && (*output)[position - 1]) { - memmove(*output, (*output) + 1, position - 2); - (*output)[position - 2] = 0; - } - - return position; -} - -/**************************************************************************** - ** ** - ** Name: NumberOfParameters() ** - ** ** - ** Description: Returns the number of parameters found in the given AT ** - ** command line. ** - ** ** - ** Inputs: str: The string to be parsed ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of parameter delimiter (comma) ** - ** found in the input string buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static unsigned int NumberOfParameters(const unsigned char* str) -{ - if (*str == '\r') - return 0; - - int count = 1; - - while (*str) { - if (*str++ == ',') { - ++count; - } - } - - return count; -} - -/**************************************************************************** - ** ** - ** Name: IsNumeric() ** - ** ** - ** Description: Checks whether the input string buffer has all digits ** - ** ** - ** Inputs: str: The string to be parsed ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: TRUE, FALSE ** - ** Others: None ** - ** ** - ***************************************************************************/ -static unsigned int IsNumeric(const char* str, size_t len) -{ - while (len-- > 0) { - if (!isdigit(str[len])) { - return FALSE; - } - } - - return TRUE; -} - -/****************************************************************************/ -/******************** Handlers used to parse AT commands ********************/ -/****************************************************************************/ - -static int parse_e0(const char* string, int position, at_command_t* at_command) -{ - /* Command echo E0 */ - at_command->id = 0; - at_command->mask = AT_COMMAND_NO_PARAM; - return at_command->id; -} - -static int parse_e1(const char* string, int position, at_command_t* at_command) -{ - /* Command echo E1 */ - at_command->id = 0; - at_command->mask = AT_COMMAND_NO_PARAM; - return at_command->id; -} - -static int parse_q0(const char* string, int position, at_command_t* at_command) -{ - /* Result code suppression Q0 */ - at_error_code_suppression_q1 = FALSE; - at_command->id = 0; - at_command->mask = AT_COMMAND_NO_PARAM; - return at_command->id; -} - -static int parse_q1(const char* string, int position, at_command_t* at_command) -{ - /* Result code suppression Q1 */ - at_error_code_suppression_q1 = TRUE; - at_command->id = 0; - at_command->mask = AT_COMMAND_NO_PARAM; - return at_command->id; -} - -static int parse_v0(const char* string, int position, at_command_t* at_command) -{ - /* Response format V0 (numeric result code + limited header) */ - at_error_format = AT_ERROR_NUMERIC; - at_response_format_v1 = FALSE; - at_command->id = 0; - at_command->mask = AT_COMMAND_NO_PARAM; - return at_command->id; -} - -static int parse_v1(const char* string, int position, at_command_t* at_command) -{ - /* Response format V1 (verbose result code + full header) */ - at_error_format = AT_ERROR_VERBOSE; - at_response_format_v1 = TRUE; - at_command->id = 0; - at_command->mask = AT_COMMAND_NO_PARAM; - return at_command->id; -} - -static int parse_cgsn(const char* string, int position, at_command_t* at_command) -{ - /* CGSN action command - No parameter */ - at_command->id = AT_CGSN; - at_command->mask = AT_COMMAND_CGSN_MASK; - return at_command->id; -} - -static int parse_cgsn_test(const char* string, int position, at_command_t* at_command) -{ - /* CGSN test command - No parameter */ - at_command->id = AT_CGSN; - return at_command->id; -} - -static int parse_cgmi(const char* string, int position, at_command_t* at_command) -{ - /* CGMI action command - No parameter */ - at_command->id = AT_CGMI; - at_command->mask = AT_COMMAND_CGMI_MASK; - return at_command->id; -} - -static int parse_cgmi_test(const char* string, int position, at_command_t* at_command) -{ - /* CGMI test command - No parameter */ - at_command->id = AT_CGMI; - return at_command->id; -} - -static int parse_cgmm(const char* string, int position, at_command_t* at_command) -{ - /* CGMM action command - No parameter */ - at_command->id = AT_CGMM; - at_command->mask = AT_COMMAND_CGMM_MASK; - return at_command->id; -} - -static int parse_cgmm_test(const char* string, int position, at_command_t* at_command) -{ - /* CGMM test command - No parameter */ - at_command->id = AT_CGMM; - return at_command->id; -} - -static int parse_cgmr(const char* string, int position, at_command_t* at_command) -{ - /* CGMR action command - No parameter */ - at_command->id = AT_CGMR; - at_command->mask = AT_COMMAND_CGMR_MASK; - return at_command->id; -} - -static int parse_cgmr_test(const char* string, int position, at_command_t* at_command) -{ - /* CGMR test command - No parameter */ - at_command->id = AT_CGMR; - return at_command->id; -} - -static int parse_cimi(const char* string, int position, at_command_t* at_command) -{ - /* CIMI action command - No parameter */ - at_command->id = AT_CIMI; - at_command->mask = AT_COMMAND_CIMI_MASK; - return at_command->id; -} - -static int parse_cimi_test(const char* string, int position, at_command_t* at_command) -{ - /* CIMI test command - No parameter */ - at_command->id = AT_CIMI; - return at_command->id; -} - -static int parse_cfun_set(const char* string, int position, at_command_t* at_command) -{ - /* CFUN parameter command - Parameters [<fun>[,<rst>]] */ - at_command->id = AT_CFUN; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+CFUN= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <fun> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cfun.fun) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CFUN=<fun> command failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CFUN=<fun> command succeed (fun:%d)", at_command->command.cfun.fun); - - at_command->mask = AT_CFUN_FUN_MASK; - break; - - case 2: // <fun>,<rst> parameters are present - if (ParseCommand(parameter_start_index, "@i,@i", - &at_command->command.cfun.fun, - &at_command->command.cfun.rst) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CFUN=<fun>,<rst> command failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CFUN=<fun>,<rst> command succeed (fun:%d, rst:%d)", at_command->command.cfun.fun, at_command->command.cfun.rst); - - at_command->mask = AT_CFUN_FUN_MASK | AT_CFUN_RST_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cfun_get(const char* string, int position, at_command_t* at_command) -{ - /* CFUN action command - No parameter */ - at_command->id = AT_CFUN; - return at_command->id; -} - -static int parse_cfun_test(const char* string, int position, at_command_t* at_command) -{ - /* CFUN test command - No parameter */ - at_command->id = AT_CFUN; - return at_command->id; -} - -static int parse_cpin_set(const char* string, int position, at_command_t* at_command) -{ - /* CPIN parameter command - Parameters <pin>[,<newpin>] */ - at_command->id = AT_CPIN; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 1: // Only <pin> parameter is present - if (ParseCommand(parameter_start_index, "@r", - at_command->command.cpin.pin, AT_CPIN_SIZE) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CPIN=<pin> command failed"); - return RETURNerror; - } - - if (!IsNumeric(at_command->command.cpin.pin, AT_CPIN_SIZE)) { - LOG_TRACE(ERROR, "USR-API - Incoming parameter is not a valid PIN code!"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CPIN=<pin> command succeed (pin:%s)", at_command->command.cpin.pin); - - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 2: // <pin>,<newpin> parameters are present - if (ParseCommand(parameter_start_index, "@r,@r", - at_command->command.cpin.pin, AT_CPIN_SIZE, - at_command->command.cpin.newpin, AT_CPIN_SIZE) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CPIN=<pin>,<newpin> command failed"); - return RETURNerror; - } - - if (!IsNumeric(at_command->command.cpin.pin, AT_CPIN_SIZE) || - !IsNumeric(at_command->command.cpin.newpin, AT_CPIN_SIZE)) { - LOG_TRACE(ERROR, "USR-API - Incoming parameter is not a valid PIN code!"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CPIN=<pin>,<newpin> command succeed (pin:%s, newpin:%s)", at_command->command.cpin.pin, at_command->command.cpin.newpin); - - at_command->mask = AT_CPIN_NEWPIN_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cpin_get(const char* string, int position, at_command_t* at_command) -{ - /* CPIN action command - No parameter */ - at_command->id = AT_CPIN; - return at_command->id; -} - -static int parse_cpin_test(const char* string, int position, at_command_t* at_command) -{ - /* CPIN test command - No parameter */ - at_command->id = AT_CPIN; - return at_command->id; -} - -static int parse_csq(const char* string, int position, at_command_t* at_command) -{ - /* CSQ action command - No parameter */ - at_command->id = AT_CSQ; - at_command->mask = AT_COMMAND_CSQ_MASK; - return at_command->id; -} - -static int parse_csq_test(const char* string, int position, at_command_t* at_command) -{ - /* CSQ test command - No parameter */ - at_command->id = AT_CSQ; - return at_command->id; -} - -static int parse_cesq(const char* string, int position, at_command_t* at_command) -{ - /* CESQ action command - No parameter */ - at_command->id = AT_CESQ; - at_command->mask = AT_COMMAND_CESQ_MASK; - return at_command->id; -} - -static int parse_cesq_test(const char* string, int position, at_command_t* at_command) -{ - /* CESQ test command - No parameter */ - at_command->id = AT_CESQ; - return at_command->id; -} - -static int parse_clac(const char* string, int position, at_command_t* at_command) -{ - /* CLAC action command - No parameter */ - at_command->id = AT_CLAC; - at_command->mask = AT_COMMAND_CLAC_MASK; - return at_command->id; -} - -static int parse_clac_test(const char* string, int position, at_command_t* at_command) -{ - /* CLAC test command - No parameter */ - at_command->id = AT_CLAC; - return at_command->id; -} - -static int parse_cmee_set(const char* string, int position, at_command_t* at_command) -{ - /* CMEE parameter command - Parameter [<n>] */ - at_command->id = AT_CMEE; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+CMEE= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <n> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cmee.n) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CMEE=<n> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CMEE=<n> command succeed (n:%d)", at_command->command.cmee.n); - - at_command->mask = AT_CMEE_N_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cmee_get(const char* string, int position, at_command_t* at_command) -{ - /* CMEE read command - No parameter */ - at_command->id = AT_CMEE; - return at_command->id; -} - -static int parse_cmee_test(const char* string, int position, at_command_t* at_command) -{ - /* CMEE test command - No parameter */ - at_command->id = AT_CMEE; - return at_command->id; -} - -static int parse_cnum(const char* string, int position, at_command_t* at_command) -{ - /* CNUM action command - No parameter */ - at_command->id = AT_CNUM; - at_command->mask = AT_COMMAND_CNUM_MASK; - return at_command->id; -} - -static int parse_cnum_test(const char* string, int position, at_command_t* at_command) -{ - /* CNUM test command - No parameter */ - at_command->id = AT_CNUM; - return at_command->id; -} - -static int parse_clck_set(const char* string, int position, at_command_t* at_command) -{ - /* CLCK action command - Parameters <fac>,<mode>[,<passwd>] */ - at_command->id = AT_CLCK; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - switch (number_of_parameters) { - case 2: // <fac>,<mode> parameters are present - if (ParseCommand(parameter_start_index, "@r,@i", - &at_command->command.clck.fac, AT_CLCK_FAC_SIZE, - &at_command->command.clck.mode) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CLCK=<fac>,<mode> " - "failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CLCK=<fac>,<mode> " - "succeed (fac:%s, mode:%d)", - at_command->command.clck.fac, - at_command->command.clck.mode); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 3: // <fac>,<mode>,<passwd> parameters are present - if (ParseCommand(parameter_start_index, "@r,@i,@r", - &at_command->command.clck.fac, AT_CLCK_FAC_SIZE, - &at_command->command.clck.mode, - &at_command->command.clck.passwd, - AT_CLCK_PASSWD_SIZE) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CLCK=<fac>,<mode>" - "<passwd> failed"); - return RETURNerror; - } - - if (!IsNumeric(at_command->command.clck.passwd,AT_CLCK_PASSWD_SIZE)) { - LOG_TRACE(ERROR, "USR-API - Incoming parameter is not a valid password!"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CLCK=<fac>,<mode>" - "<passwd> succeed (fac:%s, mode:%d, passwd:%s)", - at_command->command.clck.fac, - at_command->command.clck.mode, - at_command->command.clck.passwd); - at_command->mask = AT_CLCK_PASSWD_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return -1; - } - - return at_command->id; -} - -static int parse_clck_test(const char* string, int position, at_command_t* at_command) -{ - /* CLCK test command - No parameter */ - at_command->id = AT_CLCK; - return at_command->id; -} - -static int parse_cops_set(const char* string, int position, at_command_t* at_command) -{ - /* COPS parameter command - Parameters [<mode>[,<format>[,<oper>[,<AcT>]]]] */ - at_command->id = AT_COPS; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - char oper_value[AT_COPS_NUM_SIZE]; - - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <mode> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cops.mode) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+COPS=<mode> command failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS=<mode> command succeed (mode:%d)", at_command->command.cops.mode); - - at_command->mask = AT_COPS_MODE_MASK; - break; - - case 2: // <mode>,<format> parameters are present - if (ParseCommand(parameter_start_index, "@i,@i", - &at_command->command.cops.mode, - &at_command->command.cops.format) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+COPS=<mode>,<format> command failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS=<mode>,<format> command succeed (mode:%d, format:%d)", at_command->command.cops.mode, at_command->command.cops.format); - - at_command->mask = AT_COPS_MODE_MASK | AT_COPS_FORMAT_MASK; - break; - - case 3: // <mode>,<format>,<oper> parameters are present - if (ParseCommand(parameter_start_index, "@i,@i,@r", - &at_command->command.cops.mode, - &at_command->command.cops.format, - oper_value, NET_FORMAT_MAX_SIZE) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper> command failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper> command succeed (mode:%d, format:%d)", at_command->command.cops.mode, at_command->command.cops.format); - - /* Now, process <oper> parameter according to the specified <format> parameter */ - switch (at_command->command.cops.format) { - case AT_COPS_LONG: /* long format alphanumeric <oper> */ - strncpy((char*) at_command->command.cops.plmn.id.alpha_long, - oper_value, AT_COPS_LONG_SIZE); - LOG_TRACE(INFO, "USR-API - <oper> parameter's value is '%s'", at_command->command.cops.plmn.id.alpha_long); - break; - - case AT_COPS_SHORT: /* short format alphanumeric <oper> */ - strncpy((char*) at_command->command.cops.plmn.id.alpha_short, oper_value, AT_COPS_SHORT_SIZE); - LOG_TRACE(INFO, "USR-API - <oper> parameter's value is '%s'", at_command->command.cops.plmn.id.alpha_short); - break; - - case AT_COPS_NUM: /* numeric <oper> */ - strncpy((char*) at_command->command.cops.plmn.id.num, - oper_value, AT_COPS_NUM_SIZE); - LOG_TRACE(INFO, "USR-API - <oper> parameter's value is '%s'", at_command->command.cops.plmn.id.num); - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid format value (%d)", - at_command->command.cops.format); - return RETURNerror; - } - - at_command->mask = AT_COPS_MODE_MASK | AT_COPS_FORMAT_MASK | AT_COPS_OPER_MASK; - break; - - case 4: // <mode>,<format>,<oper>,<AcT> parameters are present - if (ParseCommand(parameter_start_index, "@i,@i,@0", - &at_command->command.cops.mode, - &at_command->command.cops.format) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+COPS=<mode>,<format> command failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper> command succeed (mode:%d, format:%d)", at_command->command.cops.mode, at_command->command.cops.format); - - /* Now, process <oper> parameter according to the specified <format> parameter */ - switch (at_command->command.cops.format) { - case AT_COPS_LONG: /* long format alphanumeric <oper> */ - if (ParseCommand(parameter_start_index, "@i,@i,@r,@i", - &at_command->command.cops.mode, - &at_command->command.cops.format, - oper_value, AT_COPS_LONG_SIZE, - &at_command->command.cops.AcT) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper>,<AcT> command failed"); - return RETURNerror; - } - - strncpy((char*) at_command->command.cops.plmn.id.alpha_long, - oper_value, AT_COPS_LONG_SIZE); - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper>,<AcT> command succeed (oper:%s, Act:%d)", at_command->command.cops.plmn.id.alpha_long, at_command->command.cops.AcT); - break; - - case AT_COPS_SHORT: /* short format alphanumeric <oper> */ - if (ParseCommand(parameter_start_index, "@i,@i,@r,@i", - &at_command->command.cops.mode, - &at_command->command.cops.format, - oper_value, AT_COPS_SHORT_SIZE, - &at_command->command.cops.AcT) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper>,<AcT> command failed"); - return RETURNerror; - } - - strncpy((char*) at_command->command.cops.plmn.id.alpha_short, - oper_value, AT_COPS_SHORT_SIZE); - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper>,<AcT> command succeed (oper:%s, Act:%d)", - at_command->command.cops.plmn.id.alpha_short, - at_command->command.cops.AcT); - break; - - case AT_COPS_NUM: /* numeric <oper> */ - if (ParseCommand(parameter_start_index, "@i,@i,@r,@i", - &at_command->command.cops.mode, - &at_command->command.cops.format, - oper_value, AT_COPS_NUM_SIZE, - &at_command->command.cops.AcT) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper>,<AcT> command failed"); - return RETURNerror; - } - - strncpy((char*) at_command->command.cops.plmn.id.num, - oper_value, AT_COPS_NUM_SIZE); - LOG_TRACE(INFO, "USR-API - Parsing of AT+COPS=<mode>,<format>,<oper>,<AcT> command succeed (oper:%s, Act:%d)", - at_command->command.cops.plmn.id.num, - at_command->command.cops.AcT); - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid format value (%d)", - at_command->command.cops.format); - return RETURNerror; - } - - at_command->mask = AT_COPS_MODE_MASK | AT_COPS_FORMAT_MASK | AT_COPS_OPER_MASK | AT_COPS_ACT_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cops_get(const char* string, int position, at_command_t* at_command) -{ - /* COPS test command - No parameter */ - at_command->id = AT_COPS; - return at_command->id; -} - -static int parse_cops_test(const char* string, int position, at_command_t* at_command) -{ - /* COPS test command - No parameter */ - at_command->id = AT_COPS; - return at_command->id; -} - -static int parse_creg_set(const char* string, int position, at_command_t* at_command) -{ - /* CREG parameter command - Parameter [<n>] */ - at_command->id = AT_CREG; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+CREG= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <n> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.creg.n) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CREG=<n> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CREG=<n> command succeed (n:%d)", at_command->command.creg.n); - - at_command->mask = AT_CREG_N_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_creg_get(const char* string, int position, at_command_t* at_command) -{ - /* CREG read command - No parameter */ - at_command->id = AT_CREG; - return at_command->id; -} - -static int parse_creg_test(const char* string, int position, at_command_t* at_command) -{ - /* CREG test command - No parameter */ - at_command->id = AT_CREG; - return at_command->id; -} - -static int parse_cgatt_set(const char* string, int position, at_command_t* at_command) -{ - /* CGATT parameter command - Parameter [<state>] */ - at_command->id = AT_CGATT; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGATT= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <state> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cgatt.state) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGATT=<state> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGATT=<state> command succeed (state:%d)", at_command->command.cgatt.state); - - at_command->mask = AT_CGATT_STATE_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cgatt_get(const char* string, int position, at_command_t* at_command) -{ - /* CGATT read command - No parameter */ - at_command->id = AT_CGATT; - return at_command->id; -} - -static int parse_cgatt_test(const char* string, int position, at_command_t* at_command) -{ - /* CGATT test command - No parameter */ - at_command->id = AT_CGATT; - return at_command->id; -} - -static int parse_cgreg_set(const char* string, int position, at_command_t* at_command) -{ - /* CGREG parameter command - Parameter [<n>] */ - at_command->id = AT_CGREG; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGREG= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <n> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cgreg.n) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGREG=<n> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGREG=<n> command succeed (n:%d)", at_command->command.cgreg.n); - - at_command->mask = AT_CGREG_N_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cgreg_get(const char* string, int position, at_command_t* at_command) -{ - /* CGREG read command - No parameter */ - at_command->id = AT_CGREG; - return at_command->id; -} - -static int parse_cgreg_test(const char* string, int position, at_command_t* at_command) -{ - /* CGREG test command - No parameter */ - at_command->id = AT_CGREG; - return at_command->id; -} - -static int parse_cereg_set(const char* string, int position, at_command_t* at_command) -{ - /* CEREG parameter command - Parameter [<n>] */ - at_command->id = AT_CEREG; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+CEREG= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <n> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cereg.n) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CEREG=<n> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CEREG=<n> command succeed (n:%d)", at_command->command.cereg.n); - - at_command->mask = AT_CEREG_N_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cereg_get(const char* string, int position, at_command_t* at_command) -{ - /* CEREG read command - No parameter */ - at_command->id = AT_CEREG; - return at_command->id; -} - -static int parse_cereg_test(const char* string, int position, at_command_t* at_command) -{ - /* CEREG test command - No parameter */ - at_command->id = AT_CEREG; - return at_command->id; -} - -static int parse_cgdcont_set(const char* string, int position, at_command_t* at_command) -{ - /* CGDCONT parameter command - Parameters [<cid>[,<PDP_type>[,<APN>[,<PDP_addr>[,<d_comp>[,<h_comp>[,<IPv4AddrAlloc>[,<emergency indication>[,<P-CSCF_discovery>[,<IM_CN_Signalling_Flag_Ind>]]]]]]]]]] */ - at_command->id = AT_CGDCONT; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - /* Parse the parameters */ - switch (number_of_parameters) { - case 1: // Only <cid> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cgdcont.cid) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGDCONT=<cid> command succeed (cid:%d)", at_command->command.cgdcont.cid); - - at_command->mask = AT_CGDCONT_CID_MASK; - break; - - case 2: // <cid>,<PDP_type> parameters are present - if (ParseCommand(parameter_start_index, "@i,@r", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type> succeed (cid:%d, pdp_type:%s)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK; - break; - - case 3: // <cid>,<PDP_type>,<APN> parameters are present - if (ParseCommand(parameter_start_index, "@i,@r,@r", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN> succeed (cid:%d, pdp_type:%s, apn:%s)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK; - break; - - case 4: // <cid>,<PDP_type>,<APN>,<PDP_addr> parameters are present - if (ParseCommand(parameter_start_index, "@i,@r,@r,@r", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE, - &at_command->command.cgdcont.PDP_addr, AT_CGDCONT_ADDR_SIZE) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr> succeed (cid:%d, pdp_type:%s, apn:%s, pdp_addr:%s)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN, - at_command->command.cgdcont.PDP_addr); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK | AT_CGDCONT_PDP_ADDR_MASK; - break; - - case 5: // <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp> parameters are present - if (ParseCommand(parameter_start_index, "@i,@r,@r,@r,@i", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE, - &at_command->command.cgdcont.PDP_addr, AT_CGDCONT_ADDR_SIZE, - &at_command->command.cgdcont.d_comp) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp> succeed (cid:%d, pdp_type:%s, apn:%s, pdp_addr:%s, d_comp:%d)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN, - at_command->command.cgdcont.PDP_addr, - at_command->command.cgdcont.d_comp); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK | AT_CGDCONT_PDP_ADDR_MASK | AT_CGDCONT_D_COMP_MASK; - break; - - case 6: // <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp> parameters are present - if (ParseCommand(parameter_start_index, "@i,@r,@r,@r,@i,@i", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE, - &at_command->command.cgdcont.PDP_addr, AT_CGDCONT_ADDR_SIZE, - &at_command->command.cgdcont.d_comp, - &at_command->command.cgdcont.h_comp) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp> succeed (cid:%d, pdp_type:%s, apn:%s, pdp_addr:%s, d_comp:%d, h_comp:%d)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN, - at_command->command.cgdcont.PDP_addr, - at_command->command.cgdcont.d_comp, - at_command->command.cgdcont.h_comp); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK | AT_CGDCONT_PDP_ADDR_MASK | AT_CGDCONT_D_COMP_MASK | AT_CGDCONT_H_COMP_MASK; - break; - - case 7: // <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc> parameters are present - if (ParseCommand(parameter_start_index, "@i,@r,@r,@r,@i,@i,@i", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE, - &at_command->command.cgdcont.PDP_addr, AT_CGDCONT_ADDR_SIZE, - &at_command->command.cgdcont.d_comp, - &at_command->command.cgdcont.h_comp, - &at_command->command.cgdcont.IPv4AddrAlloc) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, - "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc> succeed (cid:%d, pdp_type:%s, apn:%s, pdp_addr:%s, d_comp:%d, h_comp:%d, ipv4addralloc:%d)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN, - at_command->command.cgdcont.PDP_addr, - at_command->command.cgdcont.d_comp, - at_command->command.cgdcont.h_comp, - at_command->command.cgdcont.IPv4AddrAlloc); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK | AT_CGDCONT_PDP_ADDR_MASK | AT_CGDCONT_D_COMP_MASK | AT_CGDCONT_H_COMP_MASK | AT_CGDCONT_IPV4ADDRALLOC_MASK; - break; - - case 8: // <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc>,<emergency indication> parameters are present - if (ParseCommand(parameter_start_index, "@i,@r,@r,@r,@i,@i,@i,@i", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE, - &at_command->command.cgdcont.PDP_addr, AT_CGDCONT_ADDR_SIZE, - &at_command->command.cgdcont.d_comp, - &at_command->command.cgdcont.h_comp, - &at_command->command.cgdcont.IPv4AddrAlloc, - &at_command->command.cgdcont.emergency_indication) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc>,<emergency indication> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, - "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc>,<emergency indication> succeed (cid:%d, pdp_type:%s, apn:%s, pdp_addr:%s, d_comp:%d, h_comp:%d, ipv4addralloc:%d, emergency_indication:%d)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN, - at_command->command.cgdcont.PDP_addr, - at_command->command.cgdcont.d_comp, - at_command->command.cgdcont.h_comp, - at_command->command.cgdcont.IPv4AddrAlloc, - at_command->command.cgdcont.emergency_indication); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK | AT_CGDCONT_PDP_ADDR_MASK | AT_CGDCONT_D_COMP_MASK | AT_CGDCONT_H_COMP_MASK | AT_CGDCONT_IPV4ADDRALLOC_MASK | - AT_CGDCONT_EMERGECY_INDICATION_MASK; - break; - - case 9: /* <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>, - * <IPv4AddrAlloc>,<emergency indication>,<P-CSCF_discovery> - * parameters are present */ - if (ParseCommand(parameter_start_index, "@i,@r,@r,@r,@i,@i,@i,@i,@i", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE, - &at_command->command.cgdcont.PDP_addr, AT_CGDCONT_ADDR_SIZE, - &at_command->command.cgdcont.d_comp, - &at_command->command.cgdcont.h_comp, - &at_command->command.cgdcont.IPv4AddrAlloc, - &at_command->command.cgdcont.emergency_indication, - &at_command->command.cgdcont.P_CSCF_discovery) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc>,<emergency indication>,<P-CSCF_discovery> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, - "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc>,<emergency indication>,<P-CSCF_discovery> succeed (cid:%d, pdp_type:%s, apn:%s, pdp_addr:%s, d_comp:%d, h_comp:%d, ipv4addralloc:%d, emergency_indication:%d, p_cscf_discovery:%d)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN, - at_command->command.cgdcont.PDP_addr, - at_command->command.cgdcont.d_comp, - at_command->command.cgdcont.h_comp, - at_command->command.cgdcont.IPv4AddrAlloc, - at_command->command.cgdcont.emergency_indication, - at_command->command.cgdcont.P_CSCF_discovery); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK | AT_CGDCONT_PDP_ADDR_MASK | AT_CGDCONT_D_COMP_MASK | AT_CGDCONT_H_COMP_MASK | AT_CGDCONT_IPV4ADDRALLOC_MASK | - AT_CGDCONT_EMERGECY_INDICATION_MASK | AT_CGDCONT_P_CSCF_DISCOVERY_MASK; - break; - - case 10: /* <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>, - * <IPv4AddrAlloc>,<emergency indication>,<P-CSCF_discovery>, - * <IM_CN_Signalling_Flag_Ind> parameters are present */ - if (ParseCommand(parameter_start_index, "@i,@r,@r,@r,@i,@i,@i,@i,@i,@i", - &at_command->command.cgdcont.cid, - &at_command->command.cgdcont.PDP_type, AT_CGDCONT_PDP_SIZE, - &at_command->command.cgdcont.APN, AT_CGDCONT_APN_SIZE, - &at_command->command.cgdcont.PDP_addr, AT_CGDCONT_ADDR_SIZE, - &at_command->command.cgdcont.d_comp, - &at_command->command.cgdcont.h_comp, - &at_command->command.cgdcont.IPv4AddrAlloc, - &at_command->command.cgdcont.emergency_indication, - &at_command->command.cgdcont.P_CSCF_discovery, - &at_command->command.cgdcont.IM_CN_Signalling_Flag_Ind) != RETURNok) { - LOG_TRACE(ERROR, - "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc>,<emergency indication>,<P-CSCF_discovery>, <IM_CN_Signalling_Flag_Ind> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, - "USR-API - Parsing of AT+CGDCONT=<cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>,<h_comp>,<IPv4AddrAlloc>,<emergency indication>,<P-CSCF_discovery>, <IM_CN_Signalling_Flag_Ind> succeed (cid:%d, pdp_type:%s, apn:%s, pdp_addr:%s, d_comp:%d, h_comp:%d, ipv4addralloc:%d, emergency_indication:%d, p_cscf_discovery:%d, im_cn_signalling_flag:%d)", - at_command->command.cgdcont.cid, - at_command->command.cgdcont.PDP_type, - at_command->command.cgdcont.APN, - at_command->command.cgdcont.PDP_addr, - at_command->command.cgdcont.d_comp, - at_command->command.cgdcont.h_comp, - at_command->command.cgdcont.IPv4AddrAlloc, - at_command->command.cgdcont.emergency_indication, - at_command->command.cgdcont.P_CSCF_discovery, - at_command->command.cgdcont.IM_CN_Signalling_Flag_Ind); - - at_command->mask = AT_CGDCONT_CID_MASK | AT_CGDCONT_PDP_TYPE_MASK | AT_CGDCONT_APN_MASK | AT_CGDCONT_PDP_ADDR_MASK | AT_CGDCONT_D_COMP_MASK | AT_CGDCONT_H_COMP_MASK | AT_CGDCONT_IPV4ADDRALLOC_MASK | - AT_CGDCONT_EMERGECY_INDICATION_MASK | AT_CGDCONT_P_CSCF_DISCOVERY_MASK | AT_CGDCONT_IM_CN_SIGNALLING_FLAG_IND_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return RETURNerror; - } - - return at_command->id; -} - -static int parse_cgdcont_get(const char* string, int position, at_command_t* at_command) -{ - /* CGDCONT read command - No parameter */ - at_command->id = AT_CGDCONT; - return at_command->id; -} - -static int parse_cgdcont_test(const char* string, int position, at_command_t* at_command) -{ - /* CGDCONT test command - No parameter */ - at_command->id = AT_CGDCONT; - return at_command->id; -} - -static int parse_cgact_set(const char* string, int position, at_command_t* at_command) -{ - /* CGACT parameter command - Parameters <state>[,<cid>] */ - at_command->id = AT_CGACT; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - switch (number_of_parameters) { - case 1: // Only <state> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cgact.state) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGACT=<state> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGACT=<state> succeed (state:%d)", at_command->command.cgact.state); - at_command->mask = AT_CGACT_STATE_MASK; - break; - - case 2: // <state>,<cid> parameters are present - if (ParseCommand(parameter_start_index, "@i,@i", - &at_command->command.cgact.state, - &at_command->command.cgact.cid) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGACT=<state>,<cid> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGACT=<state>,<cid> succeed (state:%d, cid:%d)", - at_command->command.cgact.state, - at_command->command.cgact.cid); - - at_command->mask = AT_CGACT_STATE_MASK | AT_CGACT_CID_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return -1; - } - - return at_command->id; -} - -static int parse_cgact_get(const char* string, int position, at_command_t* at_command) -{ - /* CGACT read command - No parameter */ - at_command->id = AT_CGACT; - return at_command->id; -} - -static int parse_cgact_test(const char* string, int position, at_command_t* at_command) -{ - /* CGACT test command - No parameter */ - at_command->id = AT_CGACT; - return at_command->id; -} - -static int parse_cgpaddr_set(const char* string, int position, at_command_t* at_command) -{ - /* CGPADDR parameter command - Parameters [<cid>] */ - at_command->id = AT_CGPADDR; - unsigned char* parameter_start_index = (unsigned char*) string + position; - - /* Check the number of parameters */ - unsigned number_of_parameters = NumberOfParameters(parameter_start_index); - - switch (number_of_parameters) { - case 0: // No any parameter - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGPADDR= command succeed"); - at_command->mask = AT_COMMAND_NO_PARAM; - break; - - case 1: // Only <cid> parameter is present - if (ParseCommand(parameter_start_index, "@i", - &at_command->command.cgpaddr.cid) != RETURNok) { - LOG_TRACE(ERROR, "USR-API - Parsing of AT+CGPADDR=<state> failed"); - return RETURNerror; - } - - LOG_TRACE(INFO, "USR-API - Parsing of AT+CGPADDR=<cid> succeed (cid:%d)", at_command->command.cgpaddr.cid); - at_command->mask = AT_CGPADDR_CID_MASK; - break; - - default: - LOG_TRACE(ERROR, "USR-API - Invalid number of parameters (%d)", number_of_parameters); - return -1; - } - - return at_command->id; -} - -static int parse_cgpaddr_test(const char* string, int position, at_command_t* at_command) -{ - /* CGPADDR test command - No parameter */ - at_command->id = AT_CGPADDR; - return at_command->id; -} diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.h b/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.h deleted file mode 100644 index d1b74dc4c37211f227dfd35a253131cf9ca8281a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_command.h +++ /dev/null @@ -1,865 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source at_command.h - -Version 0.1 - -Date 2012/03/07 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines the ATtention (AT) command set supported by the NAS - sublayer protocol - -*****************************************************************************/ -#ifndef __AT_COMMAND_H__ -#define __AT_COMMAND_H__ - -#include "userDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Bit masks indicating presence of AT command's optional parameters */ -#define AT_COMMAND_PARAM0 0x0000 /* no any parameter is present */ -#define AT_COMMAND_PARAM1 0x0001 /* first parameter is present */ -#define AT_COMMAND_PARAM2 0x0002 /* 2nd parameter is present */ -#define AT_COMMAND_PARAM3 0x0004 /* 3rd parameter is present */ -#define AT_COMMAND_PARAM4 0x0008 /* 4th parameter is present */ -#define AT_COMMAND_PARAM5 0x0010 /* 5th parameter is present */ -#define AT_COMMAND_PARAM6 0x0020 /* 6th parameter is present */ -#define AT_COMMAND_PARAM7 0x0040 /* 7th parameter is present */ -#define AT_COMMAND_PARAM8 0x0080 /* 8th parameter is present */ -#define AT_COMMAND_PARAM9 0x0100 /* 9th parameter is present */ -#define AT_COMMAND_PARAM10 0x0200 /* 10th parameter is present */ -#define AT_COMMAND_PARAM11 0x0400 /* 11th parameter is present */ -#define AT_COMMAND_PARAM12 0x0800 /* 12th parameter is present */ -#define AT_COMMAND_PARAM13 0x1000 /* 13th parameter is present */ -#define AT_COMMAND_PARAM14 0x2000 /* 14th parameter is present */ -#define AT_COMMAND_PARAM15 0x4000 /* 15th parameter is present */ -#define AT_COMMAND_PARAM16 0x8000 /* 16th parameter is present */ - -/* Value of the mask parameter for AT commands without any parameters */ -#define AT_COMMAND_NO_PARAM AT_COMMAND_PARAM0 - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * AT command identifiers - * ---------------------- - * Those currently supported by our Mobile Equipment (ME) - */ -typedef enum { - /* - * General commands - * ---------------- - */ - AT_CGSN=1, /* Request Product Serial Number identification (IMEI) */ - AT_CGMI, /* Request manufacturer identification */ - AT_CGMM, /* Request model identification */ - AT_CGMR, /* Request revision identification */ - AT_CIMI, /* Request International Mobile Subscriber Identity */ - /* - * Mobile Termination control and status commands - * ---------------------------------------------- - */ - AT_CFUN, /* Set phone functionality */ - AT_CPIN, /* Enter PIN */ - AT_CSQ, /* Signal quality */ - AT_CESQ, /* Extented signal quality */ - AT_CLAC, /* List all available AT commands */ - /* - * Mobile Termination errors - * ------------------------- - */ - AT_CMEE, /* Report mobile termination error */ - /* - * Network service related commands - * --------------------------------- - */ - AT_CNUM, /* Subscriber number */ - AT_CLCK, /* Facility lock */ - AT_COPS, /* PLMN selection */ - AT_CREG, /* Network registration */ - /* - * Commands for Packet Domain - * --------------------------- - */ - AT_CGATT, /* PS attach/detach */ - AT_CGREG, /* GPRS network registration status */ - AT_CEREG, /* EPS network registration status */ - AT_CGDCONT, /* Define PDP Context */ - AT_CGACT, /* PDP context activate or deactivate */ - AT_CGPADDR, /* Show PDP address(es) */ - AT_CGEV, /* Packet Domain event unsolicited result code */ - AT_COMMAND_ID_MAX -} at_command_id_t; - -/* - * AT command types - * ---------------- - * - AT action command, used to execute a particular function, which - * generally involves more than the simple storage of a value. - * - AT set parameter command, used to store a value or values of - * subparameters. - * - AT read parameter command, used to check the current values of - * subparameters. - * - AT test parameter command, used to test the existence of the - * command and to give information about the type of its subparameters. - */ -typedef enum { - AT_COMMAND_ACT, /* AT action command (ATCMD) */ - AT_COMMAND_SET, /* AT set parameter command (ATCMD=) */ - AT_COMMAND_GET, /* AT read parameter command (ATCMD?) */ - AT_COMMAND_TST, /* AT test parameter command (ATCMD=?) */ - AT_COMMAND_TYPE_MAX -} at_command_type_t; - -/* - * ================ - * General commands - * ================ - */ - -/* CGSN: Request Product Serial Number identification (IMEI) - * --------------------------------------------------------- - * Returns information text intended to permit the user to identify the - * individual Mobile Equipment to which it is connected to. - * Action command: - * no parameters - */ - -/* CGSN AT command type */ -#define AT_COMMAND_CGSN_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgsn_s {} at_cgsn_t; - -/* CGMI: Request manufacturer identification - * ----------------------------------------- - * Returns information text intended to permit the user to identify the - * manufacturer of the Mobile Equipment to which it is connected to. - * Action command: - * no parameters - */ - -/* CGMI AT command type */ -#define AT_COMMAND_CGMI_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgmi_s {} at_cgmi_t; - -/* CGMM: Request model identification - * ---------------------------------- - * Returns information text intended to permit the user to identify the - * specific model of the Mobile Equipment to which it is connected to. - * Action command: - * no parameters - */ - -/* CGMM AT command type */ -#define AT_COMMAND_CGMM_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgmm_s {} at_cgmm_t; - -/* CGMR: Request revision identification - * ------------------------------------- - * Returns information text intended to permit the user to identify the - * version, revision level or date, or other pertinent information of the - * Mobile Equipment to which it is connected to. - * Action command: - * no parameters - */ - -/* CGMR AT command type */ -#define AT_COMMAND_CGMR_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgmr_s {} at_cgmr_t; - -/* CIMI: Request International Mobile Subscriber Identity - * ------------------------------------------------------ - * Returns <IMSI>, which is intended to permit the user to identify the - * individual SIM card or active application in the UICC (GSM or USIM) - * which is attached to the Mobile Equipment to which it is connected to. - * Action command: - * no parameters - */ - -/* CIMI AT command type */ -#define AT_COMMAND_CIMI_MASK AT_COMMAND_NO_PARAM -typedef struct at_cimi_s {} at_cimi_t; - -/* - * ============================================== - * Mobile Termination control and status commands - * ============================================== - */ -/* CFUN: Set phone functionality - * ----------------------------- - * Used to set the Mobile Equipment to different power consumption states - * Parameter command: - * +CFUN=[<fun>[,<rst>]] - * <fun> level of functionality - * <rst> resetting parameter - */ - -/* Functionality levels */ -#define AT_CFUN_MIN 0 /* minimum functionality */ -#define AT_CFUN_FULL 1 /* full functionality */ -#define AT_CFUN_SEND 2 /* disable phone transmit RF circuits only */ -#define AT_CFUN_RECV 3 /* disable phone receive RF circuits only */ -#define AT_CFUN_BOTH 4 /* disable phone both transmit and receive - * RF circuits */ -#define AT_CFUN_MAX AT_CFUN_BOTH -/* Maximum value of supported functionality - * level */ -#define AT_CFUN_FUN_DEFAULT AT_CFUN_MIN -/* Default functionality level applied when - * no value is given */ -/* Resetting parameter values */ -#define AT_CFUN_NORST 0 /* do not reset the ME before setting it - * to <fun> power level (default when <rst> - * is not given) */ -#define AT_CFUN_RST 1 /* reset the ME before setting it to <fun> - * power level */ -#define AT_CFUN_RST_DEFAULT AT_CFUN_NORST -/* Default resetting action applied when - * no value is given */ -/* Optional parameter bitmask */ -#define AT_CFUN_FUN_MASK AT_COMMAND_PARAM1 -#define AT_CFUN_RST_MASK AT_COMMAND_PARAM2 - -/* CFUN AT command type */ -typedef struct { - int fun; - int rst; -} at_cfun_t; - -/* CPIN: Enter PIN - * --------------- - * Used to enter MT passwords which are needed before any other - * functionality of the MT can be used - * Parameter command: - * +CPIN=<pin>[,<newpin>] - * <pin> personal identification number - * <newpin> new personal identification number - */ - -/* Optional parameter bitmask */ -#define AT_CPIN_NEWPIN_MASK AT_COMMAND_PARAM2 - -/* CPIN AT command type */ -typedef struct { -#define AT_CPIN_SIZE USER_PIN_SIZE /* Number of characters in pin parameter */ - char pin[AT_CPIN_SIZE+1]; - char newpin[AT_CPIN_SIZE+1]; -} at_cpin_t; - -/* CSQ: Signal quality - * ------------------- - * Returns received signal strength indication and channel bit error rate - * from the Mobile Equipment - * Action command: - * no parameters - */ - -/* CSQ AT command type */ -#define AT_COMMAND_CSQ_MASK AT_COMMAND_NO_PARAM -typedef struct at_csq_s {} at_csq_t; - -/* CESQ: Extented signal quality - * ----------------------------- - * Returns received signal quality parameters. - * Action command: - * no parameters - */ - -/* CESQ AT command type */ -#define AT_COMMAND_CESQ_MASK AT_COMMAND_NO_PARAM -typedef struct at_cesq_s {} at_cesq_t; - -/* CLAC: List all available AT commands - * ------------------------------------ - * Returns one or more lines of AT Commands that are available for the user. - * Action command: - * no parameters - */ - -/* CLAC AT command type */ -#define AT_COMMAND_CLAC_MASK AT_COMMAND_NO_PARAM -typedef struct at_clac_s {} at_clac_t; - -/* - * ========================= - * Mobile Termination errors - * ========================= - */ -/* - * CMEE: Report mobile termination error - * ------------------------------------- - * Disables or enables the use of final result code +CME ERROR: <err> as an - * indication of an error relating to the functionality of the MT. - * <n> = 0, disables result code and displays ERROR instead. - * <n> = 1, enables result code and displays numeric <err> - * <n> = 2, enables result code and displays verbose <err> - * Parameter command: - * +CMEE=[<n>] - * <n> numeric parameter - */ - -/* Numeric parameter values */ -#define AT_CMEE_OFF 0 /* disable result code */ -#define AT_CMEE_NUMERIC 1 /* enable numeric result code */ -#define AT_CMEE_VERBOSE 2 /* enable verbose result code */ -#define AT_CMEE_N_MIN AT_CMEE_OFF -/* Minimum value of supported numeric parameter */ -#define AT_CMEE_N_MAX AT_CMEE_VERBOSE -/* Maximum value of supported numeric parameter */ -#define AT_CMEE_N_DEFAULT AT_CMEE_OFF -/* Default value of supported numeric parameter */ - -/* Optional parameter bitmask */ -#define AT_CMEE_N_MASK AT_COMMAND_PARAM1 - -/* CMEE AT command type */ -typedef struct { - int n; -} at_cmee_t; - -/* - * ================================ - * Network service related commands - * ================================ - */ -/* CNUM: Subscriber number - * ----------------------- - * Returns the MSISDNs related to the subscriber. - * Action command: - * no parameters - */ - -/* CNUM AT command type */ -#define AT_COMMAND_CNUM_MASK AT_COMMAND_NO_PARAM -typedef struct at_cnum_s {} at_cnum_t; - -/* CLCK: Facility lock - * ------------------- - * Used to lock, unlock or interrogate a MT or a network facility <fac>. - * Action command: - * +CLCK=<fac>,<mode>[,<passwd>] - * <fac> facility value - * <mode> operation mode - * <passwd> password (pin code) - */ - -/* Facility values */ -#define AT_CLCK_SC "SC" /* SIM lock/unlock */ - -/* Operation mode */ -#define AT_CLCK_UNLOCK 0 /* Unlock (enable) a service */ -#define AT_CLCK_LOCK 1 /* Lock (disable) a service */ -#define AT_CLCK_STATUS 2 /* Query the status of a network service */ - -/* Optional parameter bitmask */ -#define AT_CLCK_PASSWD_MASK AT_COMMAND_PARAM3 - -/* CLCK AT command type */ -typedef struct { -#define AT_CLCK_FAC_SIZE 2 - char fac[AT_CLCK_FAC_SIZE+1]; - int mode; -#define AT_CLCK_PASSWD_SIZE USER_PIN_SIZE - char passwd[AT_CLCK_PASSWD_SIZE+1]; -} at_clck_t; - -/* COPS: PLMN selection - * -------------------- - * Forces an attempt to select and register the GSM/UMTS/EPS network operator - * using the SIM/USIM card installed in the currently selected card slot. - * Parameter command: - * +COPS=[<mode>[,<format>[,<oper>[,<AcT>]]]] - * <mode> operation mode of the network selection - * <format> representation format of the network operator - * <oper> APN operator identifier - * <AcT> access technology - */ - -/* Network selection operation modes */ -#define AT_COPS_AUTO 0 /* automatic mode */ -#define AT_COPS_MANUAL 1 /* manual mode */ -#define AT_COPS_DEREG 2 /* deregister from network */ -#define AT_COPS_FORMAT 3 /* set only <format> for read command +COPS? */ -#define AT_COPS_MANAUTO 4 /* manual/automatic mode; if manual selection - * fails, automatic mode is entered */ -#define AT_COPS_MODE_DEFAULT AT_COPS_AUTO -/* Default operation mode applied when no - * value is given */ -/* Representation formats */ -#define AT_COPS_LONG NET_FORMAT_LONG /* long format alphanumeric */ -#define AT_COPS_SHORT NET_FORMAT_SHORT /* short format alphanumeric */ -#define AT_COPS_NUM NET_FORMAT_NUM /* numeric */ -#define AT_COPS_FORMAT_MIN AT_COPS_LONG -/* Minimum value of supported representation - * format */ -#define AT_COPS_FORMAT_MAX AT_COPS_NUM -/* Maximum value of supported representation - * format */ -#define AT_COPS_FORMAT_DEFAULT AT_COPS_LONG -/* Default representation format applied when - * no value is given */ -/* Access technology indicators */ -#define AT_COPS_GSM NET_ACCESS_GSM /* GSM */ -#define AT_COPS_COMPACT NET_ACCESS_COMPACT /* GSM Compact */ -#define AT_COPS_UTRAN NET_ACCESS_UTRAN /* UTRAN */ -#define AT_COPS_EGPRS NET_ACCESS_EGPRS /* GSM w/EGPRS */ -#define AT_COPS_HSDPA NET_ACCESS_HSDPA /* UTRAN w/HSDPA */ -#define AT_COPS_HSUPA NET_ACCESS_HSUPA /* UTRAN w/HSUPA */ -#define AT_COPS_HSDUPA NET_ACCESS_HSDUPA /* w/HSDPA and HSUPA */ -#define AT_COPS_EUTRAN NET_ACCESS_EUTRAN /* E-UTRAN */ -#define AT_COPS_ACT_MIN AT_COPS_GSM -/* Minimum value of supported access - * technology */ -#define AT_COPS_ACT_MAX AT_COPS_EUTRAN -/* Maximum value of supported access - * technology */ -#define AT_COPS_ACT_DEFAULT AT_COPS_GSM -/* Default access technology applied when - * no value is given */ - -/* Optional parameter bitmask */ -#define AT_COPS_MODE_MASK AT_COMMAND_PARAM1 -#define AT_COPS_FORMAT_MASK AT_COMMAND_PARAM2 -#define AT_COPS_OPER_MASK AT_COMMAND_PARAM3 -#define AT_COPS_ACT_MASK AT_COMMAND_PARAM4 - -/* COPS AT command type */ -typedef struct { - int mode; - int format; -#define AT_COPS_NUM_SIZE NET_FORMAT_NUM_SIZE - /* Size of numeric representation format */ -#define AT_COPS_LONG_SIZE NET_FORMAT_LONG_SIZE - /* Size of long alphanumeric representation format */ -#define AT_COPS_SHORT_SIZE NET_FORMAT_SHORT_SIZE - /* Size of short alphanumeric representation format */ - network_plmn_t plmn; - int AcT; -} at_cops_t; - -/* CREG: network registration - * -------------------------- - * When <n>=1, returns +CREG: <stat>, the Mobile Equipment's circuit mode - * network registration status in GERA/UTRA/E-UTRA Network. - * When <n>=2, returns +CREG: <stat>[,<lac>,<ci>[,<AcT>]], the Mobile - * Equipment's circuit mode network registration status and location information - * in GERA/UTRA/E-UTRA Network. - * Parameter command: - * +CREG=[<n>] - * <n> numeric parameter - */ - -/* Numeric parameter values */ -#define AT_CREG_OFF 0 /* disable network registration unsolicited - * result code */ -#define AT_CREG_ON 1 /* enable network registration unsolicited - * result code +CREG: <stat> */ -#define AT_CREG_BOTH 2 /* enable network registration and location - * information unsolicited result code - * +CREG: <stat>[,<lac>,<ci>[,<AcT>]] */ -#define AT_CREG_N_MIN AT_CREG_OFF -/* Minimum value of supported unsolicited - * result code */ -#define AT_CREG_N_MAX AT_CREG_BOTH -/* Maximum value of supported unsolicited - * result code */ -#define AT_CREG_N_DEFAULT AT_CREG_OFF -/* Default unsolicited result code applied - * when no value is given */ - -/* Optional parameter bitmask */ -#define AT_CREG_N_MASK AT_COMMAND_PARAM1 - -/* CREG AT command type */ -typedef struct { - int n; -} at_creg_t; - -/* - * ========================== - * Commands for Packet Domain - * ========================== - */ -/* CGATT: EPS service attach/detach - * -------------------------------- - * Used to attach the MT to, or detach the MT from, the EPS service. - * Action command (with optional parameters): - * +CGATT=[<state>] - * <state> numeric parameter that indicates the state of EPS attachment - */ - -/* PS attachment status */ -#define AT_CGATT_DETACHED 0 /* To detach from EPS service */ -#define AT_CGATT_ATTACHED 1 /* To attach from EPS service */ -#define AT_CGATT_STATE_MIN AT_CGATT_DETACHED -/* Minimum value of EPS attachment code */ -#define AT_CGATT_STATE_MAX AT_CGATT_ATTACHED -/* Maximum value of EPS attachment code */ - -/* Optional parameter bitmask */ -#define AT_CGATT_STATE_MASK AT_COMMAND_PARAM1 - -/* CGATT AT command type */ -typedef struct { - int state; -} at_cgatt_t; - -/* CGREG: GPRS network registration status - * --------------------------------------- - * When <n>=1, returns +CGREG: <stat>, the Mobile Equipment's GPRS network - * registration status in GERA/UTRA Network. - * When <n>=2, returns +CGREG: <stat>[,<lac>,<ci>[,<AcT>,<rac>]], the Mobile - * Equipment's GPRS network registration status and location information in - * GERA/UTRA Network. - * Parameter command: - * +CGREG=[<n>] - * <n> numeric parameter - */ - -/* Numeric parameter values */ -#define AT_CGREG_OFF 0 /* disable network registration unsolicited - * result code */ -#define AT_CGREG_ON 1 /* enable network registration unsolicited - * result code +CGREG: <stat> */ -#define AT_CGREG_BOTH 2 /* enable network registration and location - * information unsolicited result code - * +CGREG: <stat>[,<lac>,<ci>[,<AcT>,<rac>]] */ -#define AT_CGREG_N_MIN AT_CGREG_OFF -/* Minimum value of supported unsolicited - * result code */ -#define AT_CGREG_N_MAX AT_CGREG_BOTH -/* Maximum value of supported unsolicited - * result code */ -#define AT_CGREG_N_DEFAULT AT_CGREG_OFF -/* Default unsolicited result code applied - * when no value is given */ - -/* Optional parameter bitmask */ -#define AT_CGREG_N_MASK AT_COMMAND_PARAM1 - -/* CGREG AT command type */ -typedef struct { - int n; -} at_cgreg_t; - -/* CEREG: EPS network registration status - * -------------------------------------- - * When <n>=1, returns +CEREG: <stat>, the Mobile Equipment's EPS services - * registration status in EUTRA Network. - * When <n>=2, returns +CEREG: <stat>[,<tac>,<ci>[,<AcT>]], the Mobile - * Equipment's EPS services registration status and location information in - * EUTRA Network. - * Parameter command: - * +CEREG=[<n>] - * <n> numeric parameter - */ - -/* Numeric parameter values */ -#define AT_CEREG_OFF 0 /* disable network registration unsolicited - * result code */ -#define AT_CEREG_ON 1 /* enable network registration unsolicited - * result code +CEREG: <stat> */ -#define AT_CEREG_BOTH 2 /* enable network registration and location - * information unsolicited result code - * +CEREG: <stat>[,<tac>,<ci>[,<AcT>]] */ -#define AT_CEREG_N_MIN AT_CEREG_OFF -/* Minimum value of supported unsolicited - * result code */ -#define AT_CEREG_N_MAX AT_CEREG_BOTH -/* Maximum value of supported unsolicited - * result code */ -#define AT_CEREG_N_DEFAULT AT_CEREG_OFF -/* Default unsolicited result code applied - * when no value is given */ - -/* Optional parameter bitmask */ -#define AT_CEREG_N_MASK AT_COMMAND_PARAM1 - -/* CEREG AT command type */ -typedef struct { - int n; -} at_cereg_t; - -/* CGDCONT: Define PDP Context - * --------------------------- - * Specifies PDP context parameter values for a PDP context identified by - * the (local) context identification parameter, <cid>. - * Parameter command: - * +CGDCONT=[<cid>[,<PDP_type>[,<APN>[,<PDP_addr>[,<d_comp>[,<h_comp> - * [,<IPv4AddrAlloc>[,<emergency indication>[,<P-CSCF_discovery> - * [,<IM_CN_Signalling_Flag_Ind>]]]]]]]]]] - * <cid> a numeric parameter which specifies a particular PDP - * context definition - * <PDP_type> type of packet data protocol ("IP", "IPV6", "IPV4V6") - * <APN> Access Point logical Name - * <PDP_addr> Mobile Equipment PDP address (not applicable to EPS) - * <d_comp> PDP data compression parameter - * <h_comp> PDP header compression parameter - * <IPv4AddrAlloc> IPv4 address allocation parameter - * <emergency indication> emergency bearer services support indication - * <P-CSCF_discovery> P-CSCF address discovery parameter - * <IM_CN_Signalling_Flag_Ind> IM CN subsystem-related signalling - * support indication - */ - -/* PDP context identifier */ -#define AT_CGDCONT_CID_MIN 1 /* Minimum value of context identifier */ -#define AT_CGDCONT_CID_DEFAULT AT_CGDCONT_CID_MIN -/* PDP data compression parameter values */ -#define AT_CGDCONT_D_COMP_OFF 0 /* PDP data compression is disabled */ -#define AT_CGDCONT_D_COMP_ON 1 /* manufacturer preferred compression */ -#define AT_CGDCONT_D_COMP_V42B 2 /* V.42bis */ -#define AT_CGDCONT_D_COMP_V44 3 /* V.44 */ -#define AT_CGDCONT_D_COMP_MIN AT_CGDCONT_D_COMP_OFF -#define AT_CGDCONT_D_COMP_MAX AT_CGDCONT_D_COMP_V44 -#define AT_CGDCONT_D_COMP_DEFAULT AT_CGDCONT_D_COMP_OFF -/* PDP header compression parameter values */ -#define AT_CGDCONT_H_COMP_OFF 0 /* PDP header compression is disabled */ -#define AT_CGDCONT_H_COMP_ON 1 /* manufacturer preferred compression */ -#define AT_CGDCONT_H_COMP_1144 2 /* RFC1144 (applicable for SNDCP only) */ -#define AT_CGDCONT_H_COMP_2507 3 /* RFC2507 */ -#define AT_CGDCONT_H_COMP_3095 4 /* RFC3095 (applicable for PDCP only) */ -#define AT_CGDCONT_H_COMP_MIN AT_CGDCONT_H_COMP_OFF -#define AT_CGDCONT_H_COMP_MAX AT_CGDCONT_H_COMP_3095 -#define AT_CGDCONT_H_COMP_DEFAULT AT_CGDCONT_H_COMP_OFF -/* IPv4AddrAlloc parameter values */ -#define AT_CGDCONT_IPV4_NAS 0 /* IPv4 Address Allocation through NAS - * Signalling */ -#define AT_CGDCONT_IPV4_DHCP 1 /* IPv4 Address Allocation through DHCP */ -#define AT_CGDCONT_IPV4_MIN AT_CGDCONT_IPV4_NAS -#define AT_CGDCONT_IPV4_MAX AT_CGDCONT_IPV4_DHCP -#define AT_CGDCONT_IPV4_DEFAULT AT_CGDCONT_IPV4_NAS -/* emergency_indication parameter values */ -#define AT_CGDCONT_EBS_OFF 0 /* PDP context is not for emergency bearer - * services */ -#define AT_CGDCONT_EBS_ON 1 /* PDP context is for emergency bearer - * services */ -#define AT_CGDCONT_EBS_MIN AT_CGDCONT_EBS_OFF -#define AT_CGDCONT_EBS_MAX AT_CGDCONT_EBS_ON -#define AT_CGDCONT_EBS_DEFAULT AT_CGDCONT_EBS_OFF -/* P_CSCF_discovery parameter values */ -#define AT_CGDCONT_PCSCF_OFF 0 /* Preference of P-CSCF address discovery - * not influenced by +CGDCONTPDP */ -#define AT_CGDCONT_PCSCF_NAS 1 /* Preference of P-CSCF address discovery - * through NAS Signalling */ -#define AT_CGDCONT_PCSCF_DHCP 2 /* Preference of P-CSCF address discovery - * through DHCP */ -#define AT_CGDCONT_PCSCF_MIN AT_CGDCONT_PCSCF_OFF -#define AT_CGDCONT_PCSCF_MAX AT_CGDCONT_PCSCF_DHCP -#define AT_CGDCONT_PCSCF_DEFAULT AT_CGDCONT_PCSCF_OFF -/* IM_CN_Signalling_Flag_Ind parameter values */ -#define AT_CGDCONT_IM_CN_OFF 0 /* UE indicates that the PDP context is not - * for IM CN subsystem-related signalling - * only */ -#define AT_CGDCONT_IM_CN_ON 1 /* UE indicates that the PDP context is for - * IM CN subsystem-related signalling - * only */ -#define AT_CGDCONT_IM_CM_MIN AT_CGDCONT_IM_CN_OFF -#define AT_CGDCONT_IM_CM_MAX AT_CGDCONT_IM_CN_ON -#define AT_CGDCONT_IM_CM_DEFAULT AT_CGDCONT_IM_CN_OFF - -/* Optional parameter bitmask */ -#define AT_CGDCONT_CID_MASK AT_COMMAND_PARAM1 -#define AT_CGDCONT_PDP_TYPE_MASK AT_COMMAND_PARAM2 -#define AT_CGDCONT_APN_MASK AT_COMMAND_PARAM3 -#define AT_CGDCONT_PDP_ADDR_MASK AT_COMMAND_PARAM4 -#define AT_CGDCONT_D_COMP_MASK AT_COMMAND_PARAM5 -#define AT_CGDCONT_H_COMP_MASK AT_COMMAND_PARAM6 -#define AT_CGDCONT_IPV4ADDRALLOC_MASK AT_COMMAND_PARAM7 -#define AT_CGDCONT_EMERGECY_INDICATION_MASK AT_COMMAND_PARAM8 -#define AT_CGDCONT_P_CSCF_DISCOVERY_MASK AT_COMMAND_PARAM9 -#define AT_CGDCONT_IM_CN_SIGNALLING_FLAG_IND_MASK AT_COMMAND_PARAM10 - -/* CGDCONT AT command type */ -typedef struct { - int cid; -#define AT_CGDCONT_PDP_SIZE 6 /* PDP_type may be "IP", "IPV6", "IPV4V6" */ - char PDP_type[AT_CGDCONT_PDP_SIZE+1]; -#define AT_CGDCONT_APN_SIZE 100 /* number of characters in APN parameter */ - char APN[AT_CGDCONT_APN_SIZE+1]; -#define AT_CGDCONT_ADDR_SIZE 63 /* number of characters in PDP addr - * parameter (IPv6 address notation) */ - char PDP_addr[AT_CGDCONT_ADDR_SIZE+1]; /* Does not apply to EPS */ - int d_comp; - int h_comp; - int IPv4AddrAlloc; - int emergency_indication; - int P_CSCF_discovery; - int IM_CN_Signalling_Flag_Ind; -} at_cgdcont_t; - -/* CGACT: PDP context activate or deactivate - * ----------------------------------------- - * Used to activate or deactivate the specified PDP context(s). - * Action command (with optional parameters): - * +CGACT=[<state>[,<cid>[,<cid>[,...]]]] - * <state> numeric parameter that indicates the state of PDP context - * activation - * <cid> a numeric parameter which specifies a particular PDP context - * definition - */ - -/* PDP context identifier */ -#define AT_CGACT_CID_MIN 1 /* Minimum value of context identifier */ -/* PDP context activation status */ -#define AT_CGACT_DEACTIVATED 0 /* To deactivate the PDP context */ -#define AT_CGACT_ACTIVATED 1 /* To activate the PDP context */ -#define AT_CGACT_STATE_MIN AT_CGACT_DEACTIVATED -#define AT_CGACT_STATE_MAX AT_CGACT_ACTIVATED -#define AT_CGACT_STATE_DEFAULT AT_CGACT_DEACTIVATED - -/* Optional parameter bitmask */ -#define AT_CGACT_STATE_MASK AT_COMMAND_PARAM1 -#define AT_CGACT_CID_MASK AT_COMMAND_PARAM2 - -/* CGACT AT command type */ -typedef struct { - int state; - int cid; -} at_cgact_t; - -/* CGPADDR: Show PDP address(es) - * ----------------------------- - * Returns a list of PDP addresses for the specified context identifiers. - * +CGPADDR=[<cid>[,<cid>[,...]]] - * <cid> a numeric parameter which specifies a particular PDP - * context definition - */ - -/* PDP context identifier */ -#define AT_CGPADDR_CID_MIN 1 /* Minimum value of context identifier */ - -/* Optional parameter bitmask */ -#define AT_CGPADDR_CID_MASK AT_COMMAND_PARAM1 - -/* CGPADDR AT command type */ -typedef struct { - int cid; -} at_cgpaddr_t; - -/* - * ================================= - * Global AT command type definition - * ================================= - */ - -/* AT command type */ -typedef struct { - at_command_id_t id; /* AT command identifier */ - at_command_type_t type; /* AT command type */ - int mask; /* Optional parameter bitmask */ - union { - at_cgsn_t cgsn; - at_cgmm_t cgmm; - at_cgmr_t cgmr; - at_cimi_t cimi; - at_cfun_t cfun; - at_cpin_t cpin; - at_csq_t csq; - at_cesq_t cesq; - at_clac_t clac; - at_cmee_t cmee; - at_cnum_t cnum; - at_clck_t clck; - at_cops_t cops; - at_cgatt_t cgatt; - at_creg_t creg; - at_cgreg_t cgreg; - at_cereg_t cereg; - at_cgdcont_t cgdcont; - at_cgact_t cgact; - at_cgpaddr_t cgpaddr; - } command; -} at_command_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: at_command_decode() ** - ** ** - ** Description: Parses AT command line and accordingly fills data struc- ** - ** ture. The main functions of the AT command parser are: ** - ** - check the AT command syntax ** - ** - fill parameter values into the data structure ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing AT com- ** - ** mand line ** - ** length: Number of bytes that should be processed ** - ** Others: None ** - ** ** - ** Outputs: at_command: AT command data structure to be filled ** - ** Return: The number of AT commands successfully ** - ** decoded; RETURNerror if an error occurred ** - ** Others: None ** - ** ** - ***************************************************************************/ -int at_command_decode(const char* buffer, int length, at_command_t* at_command); - -/**************************************************************************** - ** ** - ** Name: at_command_get_list() ** - ** ** - ** Description: Returns the list of supported AT commands. ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the ** - ** string representaton of the first AT com- ** - ** mand that is supported by the NAS sublayer ** - ** n_max: Maximum number of AT commands the buffer ** - ** may contain ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of AT commands actually suppor- ** - ** ted by the NAS sublayer ** - ** Others: None ** - ** ** - ***************************************************************************/ -int at_command_get_list(const char** buffer, int n_max); - -#endif /* __AT_COMMAND_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.c b/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.c deleted file mode 100644 index 440db34d9fe1f57111fa8f734b7ee84202de3941..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.c +++ /dev/null @@ -1,438 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source at_error.c - -Version 0.1 - -Date 2012/03/12 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines error codes returned when execution of AT command - failed. - -*****************************************************************************/ - -#include "at_error.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <string.h> // strcpy -#include <stdio.h> // sprintf - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -extern int at_response_format_v1; - -/* - * Result code suppression indicator (set by ATQ0 and ATQ1) - * ------------------------------------------------------- - * FALSE - Result codes are transmitted to the user application - * TRUE - Result codes are suppressed and not transmitted - */ -int at_error_code_suppression_q1 = FALSE; - -/* - * Verbose mode indicator (set by ATV0, ATV1 and AT+CMEE) - * ------------------------------------------------------ - */ -at_error_format_t at_error_format = AT_ERROR_OFF; - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * General errors - * -------------- - */ -static const char * _at_error_str[] = { - "phone failure", - "no connection to phone", - "phone-adaptor link reserved", - "operation not allowed", - "operation not supported", - "PH-SIM PIN required", - "PH-FSIM PIN required", - "PH-FSIM PUK required", - NULL, - NULL, - "SIM not inserted", - "SIM PIN required", - "SIM PUK required", - "SIM failure", - "SIM busy", - "SIM wrong", - "incorrect password", - "SIM PIN2 required", - "SIM PUK2 required", - NULL, - "memory full", - "invalid index", - "not found", - "memory failure", - "text string too long", - "invalid characters in text string", - "dial string too long", - "invalid characters in dial string", - NULL, - NULL, - "no network service", - "network timeout", - "network not allowed - emergency calls only", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "network personalization PIN required", - "network personalization PUK required", - "network subset personalization PIN required", - "network subset personalization PUK required", - "service provider personalization PIN required", - "service provider personalization PUK required", - "corporate personalization PIN required", - "corporate personalization PUK required", - "hidden key required", - "EAP method not supported", - "Incorrect parameters", -}; - -/* - * GPRS-related errors - * ------------------- - */ -static const char* _at_error_gprs[] = { - "Illegal MS", - NULL, - NULL, - "Illegal ME", - "GPRS services not allowed", - NULL, - NULL, - NULL, - "PLMN not allowed", - "Location area not allowed", - "Roaming not allowed in this location area", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "service option not supported", - "requested service option not subscribed", - "service option temporarily out of order", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "unspecified GPRS error", - "PDP authentication failure", - "invalid mobile class", - "Last PDN disconnection not allowed", -}; - -/* - * VBS / VGCS and eMLPP -related errors - * ------------------------------------ - */ -static const char* _at_error_vbs[] = { - /* 151 "VBS/VGCS not supported by the network" */ - "No service subscription on SIM", - "No subscription for group ID", - "Group Id not activated on SIM", - "No matching notification", - "VBS/VGCS call already present", - "Congestion", - "Network failure", - "Uplink busy", - "No access rights for SIM file", - "No subscription for priority", - "operation not applicable or not possible", - "Group Id prefixes not supported", - "Group Id prefixes not usable for VBS", - "Group Id prefix value invalid", -}; - -/* Returns the verbose value of AT command error */ -static const char* _at_error_to_string(int error); - -static int _at_error_encode_ok(char* buffer); -static int _at_error_encode_ko(char* buffer, at_error_type_t type, int error); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: at_error_set_format() ** - ** ** - ** Description: Sets the format of the error code ** - ** ** - ** Inputs: format: Format of the error code ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: at_error_format ** - ** ** - ***************************************************************************/ -void at_error_set_format(at_error_format_t format) -{ - LOG_FUNC_IN; - - at_error_format = format; - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: at_error_get_format() ** - ** ** - ** Description: Gets the format of the error code ** - ** ** - ** Inputs: format: Format of the error code ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: at_error_format ** - ** ** - ***************************************************************************/ -at_error_format_t at_error_get_format(void) -{ - LOG_FUNC_IN; - - LOG_FUNC_RETURN (at_error_format); -} - -/**************************************************************************** - ** ** - ** Name: at_error_encode() ** - ** ** - ** Description: Encodes result code returned when AT command has been ** - ** processed. Result code can be OK or 0, if the command ** - ** succeed, ERROR or 4, if the command failed; depending of ** - ** the response format selected by the user. ** - ** ** - ** Inputs type: Type of the error code to encode ** - ** error: Error code to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters that have been ** - ** successfully encoded; ** - ** Others: None ** - ** ** - ***************************************************************************/ -int at_error_encode(char* buffer, at_error_type_t type, int error) -{ - LOG_FUNC_IN; - - int bytes = 0; - - /* Result code suppression (ATQ0, ATQ1) */ - if (at_error_code_suppression_q1) { - LOG_FUNC_RETURN (0); - } - - if (type == AT_ERROR_OK) { - /* Encode success return code */ - bytes = _at_error_encode_ok(buffer); - } else { - /* Encode failure return code */ - bytes = _at_error_encode_ko(buffer, type, error); - } - - LOG_FUNC_RETURN (bytes); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _at_error_encode_ok() ** - ** ** - ** Description: Encodes AT command success result code message ** - ** ** - ** Inputs None ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters that have been ** - ** successfully encoded; ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_error_encode_ok(char* buffer) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer + offset, "OK\r\n"); - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_error_encode_ko() ** - ** ** - ** Description: Encodes AT command error code message ** - ** ** - ** Inputs type: Type of the error code to encode ** - ** error: Error code to encode ** - ** Others: at_error_format ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters that have been ** - ** successfully encoded; ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_error_encode_ko(char* buffer, at_error_type_t type, int error) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - /* Result code is disabled */ - if (at_error_format == AT_ERROR_OFF) { - offset += sprintf(buffer + offset, "ERROR\r\n"); - } else { - /* Error related to execution of AT command operation */ - if (type == AT_ERROR_CME) { - offset += sprintf(buffer + offset, "+CME ERROR: "); - } - - /* Result code is enabled for numeric values */ - if (at_error_format == AT_ERROR_NUMERIC) { - offset += sprintf(buffer + offset, "%d\r\n", error); - } - - /* Result code is enabled for verbose values */ - else { - const char* error_str = _at_error_to_string(error); - - if (error_str != NULL) { - offset += sprintf(buffer + offset, "%s\r\n", error_str); - } else { - /* Error code is not valid */ - offset += sprintf(buffer + offset, "invalid error code\r\n"); - } - } - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: at_error_to_string() ** - ** ** - ** Description: Returns the verbose value of AT command error ** - ** ** - ** Inputs: error: AT command error identifier ** - ** Others: None ** - ** ** - ** Outputs: Return: The error's verbose value ** - ** NULL if the error code is not valid ** - ** Others: None ** - ** ** - ***************************************************************************/ -static const char* _at_error_to_string(int error) -{ - if (error < AT_ERROR_LAST_GENERAL_ERROR + 1) { - /* General errors */ - if (error > AT_ERROR_FIRST_GENERAL_ERROR - 1) { - return _at_error_str[error]; - } else { - return NULL; - } - } else if (error < AT_ERROR_LAST_GPRS_RELATED_ERROR + 1) { - /* GPRS-related errors */ - if (error > AT_ERROR_FIRST_GPRS_RELATED_ERROR - 1) { - return _at_error_gprs[error - AT_ERROR_FIRST_GPRS_RELATED_ERROR]; - } else { - return NULL; - } - } else if (error < AT_ERROR_LAST_VBS_RELATED_ERROR + 1) { - /* VBS / VGCS and eMLPP -related errors */ - if (error > AT_ERROR_FIRST_VBS_RELATED_ERROR - 1) { - return _at_error_vbs[error - AT_ERROR_FIRST_VBS_RELATED_ERROR]; - } else { - return NULL; - } - } - - return NULL; -} diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.h b/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.h deleted file mode 100644 index d03896a383a20bd95a9edf92dc9dc17d67fbc978..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_error.h +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source at_error.h - -Version 0.1 - -Date 2012/03/12 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines error codes returned when execution of AT command - failed. - -*****************************************************************************/ -#ifndef __AT_ERROR_H__ -#define __AT_ERROR_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Cause code used to notify that the NAS procedure has been successfully - * processed - */ -#define AT_ERROR_SUCCESS (-1) - -/* - * General errors - * -------------- - */ -#define AT_ERROR_FIRST_GENERAL_ERROR AT_ERROR_PHONE_FAILURE - -#define AT_ERROR_PHONE_FAILURE 0 -#define AT_ERROR_NO_CONNECTION_TO_PHONE 1 -#define AT_ERROR_PHONE_ADAPTOR_LINK_RESERVED 2 -#define AT_ERROR_OPERATION_NOT_ALLOWED 3 -#define AT_ERROR_OPERATION_NOT_SUPPORTED 4 -#define AT_ERROR_PHSIM_PIN_REQUIRED 5 -#define AT_ERROR_PHFSIM_PIN_REQUIRED 6 -#define AT_ERROR_PHFSIM_PUK_REQUIRED 7 - -#define AT_ERROR_SIM_NOT_INSERTED 10 -#define AT_ERROR_SIM_PIN_REQUIRED 11 -#define AT_ERROR_SIM_PUK_REQUIRED 12 -#define AT_ERROR_SIM_FAILURE 13 -#define AT_ERROR_SIM_BUSY 14 -#define AT_ERROR_SIM_WRONG 15 -#define AT_ERROR_INCORRECT_PASSWD 16 -#define AT_ERROR_SIM_PIN2_REQUIRED 17 -#define AT_ERROR_SIM_PUK2_REQUIRED 18 - -#define AT_ERROR_MEMORY_FULL 20 -#define AT_ERROR_INVALID_INDEX 21 -#define AT_ERROR_NOT_FOUND 22 -#define AT_ERROR_MEMORY_FAILURE 23 -#define AT_ERROR_TEXT_STRING_TOO_LONG 24 -#define AT_ERROR_TEXT_STRING_INVALID_CHAR 25 -#define AT_ERROR_DIAL_STRING_TOO_LONG 26 -#define AT_ERROR_DIAL_STRING_INVALID_CHAR 27 - -#define AT_ERROR_NO_NETWORK_SERVICE 30 -#define AT_ERROR_TIMEOUT 31 -#define AT_ERROR_NETWORK_NOT_ALLOWED 32 - -#define AT_ERROR_NETWORK_PERSO_PIN_REQUIRED 40 -#define AT_ERROR_NETWORK_PERSO_PUK_REQUIRED 41 -#define AT_ERROR_NETWORK_SUBNET_PERSO_PIN_REQUIRED 42 -#define AT_ERROR_SUBNET_PERSO_PUK_REQUIRED 43 -#define AT_ERROR_PROVIDER_PERSO_PIN_REQUIRED 44 -#define AT_ERROR_PROVIDER_PERSO_PUK_REQUIRED 45 -#define AT_ERROR_CORPORATE_PERSO_PIN_REQUIRED 46 -#define AT_ERROR_CORPORATE_PERSO_PUK_REQUIRED 47 -#define AT_ERROR_HIDDEN_KEY_REQUIRED 48 -#define AT_ERROR_EAP_METHOD_NOT_SUPPORTED 49 -#define AT_ERROR_INCORRECT_PARAMETERS 50 - -#define AT_ERROR_LAST_GENERAL_ERROR AT_ERROR_INCORRECT_PARAMETERS - -#define AT_ERROR_UNKNOWN 100 - -/* - * GPRS-related errors - * ------------------- - */ -/* Errors related to a failure to perform an attach */ -#define AT_ERROR_FIRST_GPRS_RELATED_ERROR AT_ERROR_ILLEGAL_MS - -#define AT_ERROR_ILLEGAL_MS 103 -#define AT_ERROR_ILLEGAL_ME 106 -#define AT_ERROR_GPRS_NOT_ALLOWED 107 -#define AT_ERROR_PLMN_NOT_ALLOWED 111 -#define AT_ERROR_LOCATION_AREA_NOT_ALLOWED 112 -#define AT_ERROR_ROAMING_NOT_ALLOWED 113 -/* Errors related to a failure to activate a context */ -#define AT_ERROR_OPTION_NOT_SUPPORTED 132 -#define AT_ERROR_OPTION_NOT_SUBSCRIBED 133 -#define AT_ERROR_OPTION_TEMPORARILY_OUT_OF_ORDER 134 -#define AT_ERROR_PDP_AUTHENTICATION_FAILURE 149 -/* Errors related to a failure to disconnect a PDN */ -#define AT_ERROR_LAST_PDP_DISCONNECT_NOT_ALLOWED 151 -/* Other GPRS errors */ -#define AT_ERROR_UNSPECIFIED_GPRS_ERROR 148 -#define AT_ERROR_INVALID_MOBILE_CLASS 150 - -#define AT_ERROR_LAST_GPRS_RELATED_ERROR AT_ERROR_LAST_PDP_DISCONNECT_NOT_ALLOWED - -/* - * VBS / VGCS and eMLPP -related errors - * ------------------------------------ - */ -#define AT_ERROR_FIRST_VBS_RELATED_ERROR AT_ERROR_NO_SERVICE_SUBSCRIPTION_ON_SIM - -/* AT_ERROR_VBS_VGCS_NOT_SUPPORTED=151,*/ /* !!! Conflict with AT_ERROR_LAST_PDP_DISCONNECT_NOT_ALLOWED !!! */ -#define AT_ERROR_NO_SERVICE_SUBSCRIPTION_ON_SIM 152 -#define AT_ERROR_NO_SUBSCRIPTION_FOR_GROUP_ID 153 -#define AT_ERROR_GROUP_ID_NOT_ACTIVATED_ON_SIM 154 -#define AT_ERROR_NO_MATCHING_NOTIFICATION 155 -#define AT_ERROR_VBS_VGCS_CALL_ALREADY_PRESENT 156 -#define AT_ERROR_CONGESTION 157 -#define AT_ERROR_NETWORK_FAILURE 158 -#define AT_ERROR_UPLINK_BUSY 159 -#define AT_ERROR_NO_ACCESS_RIGHTS_FOR_SIM_FILE 160 -#define AT_ERROR_NO_SUBSCRIPTION_FOR_PRIORITY 161 -#define AT_ERROR_OPERATION_NOT_APPLICABLE_OR_NOT_POSSIBLE 162 -#define AT_ERROR_GROUP_ID_PREFIXES_NOT_SUPPORTED 163 -#define AT_ERROR_GROUP_ID_PREFIXES_NOT_USABLE_FOR_VBS 164 -#define AT_ERROR_GROUP_ID_PREFIX_VALUE_INVALID 165 - -#define AT_ERROR_LAST_VBS_RELATED_ERROR AT_ERROR_GROUP_ID_PREFIX_VALUE_INVALID - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Error type identifiers - */ -typedef enum { - AT_ERROR_NONE, /* No error code displayed */ - AT_ERROR_OK, /* AT command successfully processed */ - AT_ERROR_SYNTAX, /* AT command syntax error */ - AT_ERROR_CME, /* Error related to execution of AT command - * operation */ -} at_error_type_t; - -/* - * Error code format identifiers - */ -typedef enum { - AT_ERROR_OFF, /* disable result code and use ERROR instead */ - AT_ERROR_NUMERIC, /* enable result code and use numeric error values */ - AT_ERROR_VERBOSE, /* enable result code and use verbose error values */ -} at_error_format_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void at_error_set_format(at_error_format_t format); -at_error_format_t at_error_get_format(void); - -int at_error_encode(char* buffer, at_error_type_t type, int error); - -#endif /* __AT_ERROR_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.c b/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.c deleted file mode 100644 index 7d067d1cfcff64bfa48eac21fc822b204bbc713a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.c +++ /dev/null @@ -1,1194 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source at_response.c - -Version 0.1 - -Date 2012/03/13 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines structure of the AT command response returned after - completion of AT command processing. - -*****************************************************************************/ - -#include "at_response.h" -#include "nas_log.h" - -#include <stdio.h> // sprintf, snprintf -#include <string.h> // strncpy -#include <assert.h> // assert - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/* - * Response format indicator (set by ATV0 and ATV1) - * ----------------------------------------------- - * TRUE - <CR><LF><text><CR><LF>, <CR><LF><verbose code><CR><LF> - * FALSE - <text><CR><LF>, <numeric code><CR><LF> - */ -int at_response_format_v1 = TRUE; - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -static int _at_response_encode_cgsn (char* buffer, const at_response_t* data); -static int _at_response_encode_cgmi (char* buffer, const at_response_t* data); -static int _at_response_encode_cgmm (char* buffer, const at_response_t* data); -static int _at_response_encode_cgmr (char* buffer, const at_response_t* data); -static int _at_response_encode_cimi (char* buffer, const at_response_t* data); -static int _at_response_encode_cfun (char* buffer, const at_response_t* data); -static int _at_response_encode_cpin (char* buffer, const at_response_t* data); -static int _at_response_encode_csq (char* buffer, const at_response_t* data); -static int _at_response_encode_cesq (char* buffer, const at_response_t* data); -static int _at_response_encode_clac (char* buffer, const at_response_t* data); -static int _at_response_encode_cmee (char* buffer, const at_response_t* data); -static int _at_response_encode_cnum (char* buffer, const at_response_t* data); -static int _at_response_encode_clck (char* buffer, const at_response_t* data); -static int _at_response_encode_cops (char* buffer, const at_response_t* data); -static int _at_response_encode_cgatt (char* buffer, const at_response_t* data); -static int _at_response_encode_creg (char* buffer, const at_response_t* data); -static int _at_response_encode_cgreg (char* buffer, const at_response_t* data); -static int _at_response_encode_cereg (char* buffer, const at_response_t* data); -static int _at_response_encode_cgdcont(char* buffer, const at_response_t* data); -static int _at_response_encode_cgact (char* buffer, const at_response_t* data); -static int _at_response_encode_cgpaddr(char* buffer, const at_response_t* data); -static int _at_response_encode_cgev (char* buffer, const at_response_t* data); - -/* Encoding functions for AT command response messages */ -typedef int (*_at_response_encode_function_t) (char* buffer, const at_response_t*); - -static _at_response_encode_function_t _at_response_encode_function[AT_RESPONSE_ID_MAX] = { - NULL, - _at_response_encode_cgsn, /* CGSN */ - _at_response_encode_cgmi, /* CGMI */ - _at_response_encode_cgmm, /* CGMM */ - _at_response_encode_cgmr, /* CGMR */ - _at_response_encode_cimi, /* CIMI */ - _at_response_encode_cfun, /* CFUN */ - _at_response_encode_cpin, /* CPIN */ - _at_response_encode_csq, /* CSQ */ - _at_response_encode_cesq, /* CESQ */ - _at_response_encode_clac, /* CLAC */ - _at_response_encode_cmee, /* CMEE */ - _at_response_encode_cnum, /* CNUM */ - _at_response_encode_clck, /* CLCK */ - _at_response_encode_cops, /* COPS */ - _at_response_encode_creg, /* CREG */ - _at_response_encode_cgatt, /* CGATT */ - _at_response_encode_cgreg, /* CGREG */ - _at_response_encode_cereg, /* CEREG */ - _at_response_encode_cgdcont, /* CGDCONT */ - _at_response_encode_cgact, /* CGACT */ - _at_response_encode_cgpaddr, /* CGPADDR */ - _at_response_encode_cgev, /* CGEV: unsolicited result */ -}; - -/* String representation of Packet Domain events (cf. network_pdn_state_t) */ -static const char* _at_response_event_str[] = { - "UNKNOWN EVENT", - "ME PDN ACT", - "NW PDN DEACT", - "ME PDN DEACT", - "NW ACT", - "ME ACT", - "NW DEACT", - "ME DEACT", -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: at_response_encode() ** - ** ** - ** Description: Encodes AT command response message ** - ** ** - ** Inputs at_response: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters in the buffer ** - ** when data have been successfully encoded; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int at_response_encode(char* buffer, const at_response_t* at_response) -{ - LOG_FUNC_IN; - - int bytes = RETURNerror; - _at_response_encode_function_t encode; - - if (at_response->id < AT_RESPONSE_ID_MAX) { - /* Call encoding function applicable to the AT command response */ - encode = _at_response_encode_function[at_response->id]; - - if (encode != NULL) { - bytes = (*encode)(buffer, at_response); - } else { - /* Generic encoding: OK, ERROR */ - bytes = 0; - } - } - - LOG_FUNC_RETURN (bytes); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgsn() ** - ** ** - ** Description: Encodes AT CGSN command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgsn(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - const at_cgsn_resp_t * cgsn = &(data->response.cgsn); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGSN: %s\r\n", cgsn->sn); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgmi() ** - ** ** - ** Description: Encodes AT CGMI command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgmi(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - const at_cgmi_resp_t * cgmi = &(data->response.cgmi); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGMI: %s\r\n", cgmi->manufacturer); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgmm() ** - ** ** - ** Description: Encodes AT CGMM command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgmm(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - const at_cgmm_resp_t * cgmm = &(data->response.cgmm); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGMM: %s\r\n", cgmm->model); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgmr() ** - ** ** - ** Description: Encodes AT CGMR command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgmr(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - const at_cgmr_resp_t * cgmr = &(data->response.cgmr); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGMR: %s\r\n", cgmr->revision); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cimi() ** - ** ** - ** Description: Encodes AT CIMI command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cimi(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - const at_cimi_resp_t * cimi = &(data->response.cimi); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CIMI: %s\r\n", cimi->IMSI); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cfun() ** - ** ** - ** Description: Encodes AT CFUN command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cfun(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - const at_cfun_resp_t * cfun = &(data->response.cfun); - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CFUN: %d\r\n", cfun->fun); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CFUN: (%d-%d),(%d,%d)\r\n", - AT_CFUN_MIN, AT_CFUN_MAX, AT_CFUN_NORST, AT_CFUN_RST); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cpin() ** - ** ** - ** Description: Encodes AT CPIN command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cpin(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_cpin_resp_t * cpin = &(data->response.cpin); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CPIN: %s\r\n", cpin->code); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_csq() ** - ** ** - ** Description: Encodes AT CSQ command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_csq(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - const at_csq_resp_t * csq = &(data->response.csq); - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CSQ: %d,%d\r\n", - csq->rssi, csq->ber); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CSQ: (%d-%d),(%d-%d)\r\n", - AT_CSQ_RSSI_0, AT_CSQ_RSSI_31, - AT_CSQ_BER_0, AT_CSQ_BER_7); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cesq() ** - ** ** - ** Description: Encodes AT CESQ command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cesq(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - const at_cesq_resp_t * cesq = &(data->response.cesq); - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CESQ: %d,%d,%d,%d,%d,%d\r\n", - cesq->rssi, cesq->ber, cesq->rscp, - cesq->ecno, cesq->rsrq, cesq->rsrp); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CESQ: (%d-%d),(%d-%d),(%d-%d)," - "(%d-%d),(%d-%d),(%d-%d)\r\n", - AT_CESQ_RSSI_0, AT_CESQ_RSSI_31, - AT_CESQ_BER_0, AT_CESQ_BER_7, - AT_CESQ_RSCP_0, AT_CESQ_RSCP_96, - AT_CESQ_ECNO_0, AT_CESQ_ECNO_49, - AT_CESQ_RSRQ_0, AT_CESQ_RSRQ_34, - AT_CESQ_RSRP_0, AT_CESQ_RSRP_97); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_clac() ** - ** ** - ** Description: Encodes AT CLAC command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_clac(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - const at_clac_resp_t * clac = &(data->response.clac); - int offset = 0; - int i; - - if (data->type == AT_COMMAND_ACT) { - if (clac->n_acs > 0) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "%s", clac->ac[0]); - - for (i = 1; i < clac->n_acs; i++) { - offset += sprintf(buffer+offset, "\r\n%s", clac->ac[i]); - } - } - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cnum() ** - ** ** - ** Description: Encodes AT CNUM command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cnum(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_ACT) { - const at_cnum_resp_t * cnum = &(data->response.cnum); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CNUM: ,%s,%u\r\n", - cnum->number, cnum->type); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_clck() ** - ** ** - ** Description: Encodes AT CLCK command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_clck(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - const at_clck_resp_t * clck = &(data->response.clck); - int offset = 0; - - if (data->type == AT_COMMAND_SET) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CLCK: %d\r\n", clck->status); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CLCK: %s\r\n", AT_CLCK_SC); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cops() ** - ** ** - ** Description: Encodes AT COPS command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cops(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_cops_get_t * cops = &(data->response.cops.get); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+COPS: %d", cops->mode); - - if (data->mask & AT_COPS_RESP_OPER_MASK) { - /* If <oper> is present <format> must be given */ - assert(data->mask & AT_COPS_RESP_FORMAT_MASK); - offset += sprintf(buffer+offset, ",%d", cops->format); - - if (cops->format == AT_COPS_LONG) { - offset += sprintf(buffer+offset, ",%s", - (char*)cops->plmn.id.alpha_long); - } else if (cops->format == AT_COPS_SHORT) { - offset += sprintf(buffer+offset, ",%s", - (char*)cops->plmn.id.alpha_short); - } else if (cops->format == AT_COPS_NUM) { - offset += sprintf(buffer+offset, ",%s", - (char*)cops->plmn.id.num); - } - } - - if (data->mask & AT_COPS_RESP_ACT_MASK) { - offset += sprintf(buffer+offset, ",%d", cops->AcT); - } - - offset += sprintf(buffer+offset, "\r\n"); - } else if (data->type == AT_COMMAND_TST) { - const at_cops_tst_t * cops = &(data->response.cops.tst); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+COPS: "); - - /* Display the list of operators present in the network */ - strncpy(buffer+offset, cops->data, cops->size); - offset += cops->size; - - /* Display the list of supported network registration modes and - * supported representation formats of network operators */ - //offset += sprintf(buffer+offset, ",,(%d-%d),(%d,%d,%d)", - // AT_COPS_AUTO, AT_COPS_MANAUTO, - // AT_COPS_LONG, AT_COPS_SHORT, AT_COPS_NUM); - offset += sprintf(buffer+offset, "\r\n"); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgatt() ** - ** ** - ** Description: Encodes AT CGATT command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgatt(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_cgatt_resp_t * cgatt = &(data->response.cgatt); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGATT: %d\r\n", cgatt->state); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGATT: (%d,%d)\r\n", - AT_CGATT_STATE_MIN, AT_CGATT_STATE_MAX); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_creg() ** - ** ** - ** Description: Encodes AT CGREG command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_creg(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_creg_resp_t * creg = &(data->response.creg); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CREG: %d,%d", - creg->n, creg->stat); - - if (data->mask & AT_CREG_RESP_LAC_MASK) { - offset += sprintf(buffer+offset, ",%s", creg->lac); - } - - if (data->mask & AT_CREG_RESP_CI_MASK) { - offset += sprintf(buffer+offset, ",%s", creg->ci); - } - - if (data->mask & AT_CREG_RESP_ACT_MASK) { - offset += sprintf(buffer+offset, ",%d", creg->AcT); - } - - offset += sprintf(buffer+offset, "\r\n"); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CREG: (%d-%d)\r\n", - AT_CREG_N_MIN, AT_CREG_N_MAX); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgreg() ** - ** ** - ** Description: Encodes AT CGREG command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgreg(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_cgreg_resp_t * cgreg = &(data->response.cgreg); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGREG: %d,%d", - cgreg->n, cgreg->stat); - - if (data->mask & AT_CGREG_RESP_LAC_MASK) { - offset += sprintf(buffer+offset, ",%s", cgreg->lac); - } - - if (data->mask & AT_CGREG_RESP_CI_MASK) { - offset += sprintf(buffer+offset, ",%s", cgreg->ci); - } - - if (data->mask & AT_CGREG_RESP_ACT_MASK) { - offset += sprintf(buffer+offset, ",%d", cgreg->AcT); - } - - if (data->mask & AT_CGREG_RESP_RAC_MASK) { - offset += sprintf(buffer+offset, ",%s", cgreg->rac); - } - - offset += sprintf(buffer+offset, "\r\n"); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGREG: (%d-%d)\r\n", - AT_CGREG_N_MIN, AT_CGREG_N_MAX); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cereg() ** - ** ** - ** Description: Encodes AT CEREG command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cereg(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_cereg_resp_t * cereg = &(data->response.cereg); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CEREG: %d,%d", - cereg->n, cereg->stat); - - if (data->mask & AT_CEREG_RESP_TAC_MASK) { - offset += sprintf(buffer+offset, ",%s", cereg->tac); - } - - if (data->mask & AT_CEREG_RESP_CI_MASK) { - offset += sprintf(buffer+offset, ",%s", cereg->ci); - } - - if (data->mask & AT_CEREG_RESP_ACT_MASK) { - offset += sprintf(buffer+offset, ",%d", cereg->AcT); - } - - offset += sprintf(buffer+offset, "\r\n"); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CEREG: (%d-%d)\r\n", - AT_CEREG_N_MIN, AT_CEREG_N_MAX); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgdcont() ** - ** ** - ** Description: Encodes AT CGDCONT command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgdcont(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - int i; - - if (data->type == AT_COMMAND_GET) { - const at_cgdcont_get_t * cgdcont = &(data->response.cgdcont.get); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - /* Display the list of defined PDN contexts */ - for (i = 0; i < cgdcont->n_pdns; i++) { - offset += sprintf(buffer+offset, "+CGDCONT: %u", cgdcont->cid[i]); - - if (cgdcont->PDP_type[i] == NET_PDN_TYPE_IPV4) { - offset += sprintf(buffer+offset, ",IP"); - } else if (cgdcont->PDP_type[i] == NET_PDN_TYPE_IPV6) { - offset += sprintf(buffer+offset, ",IPV6"); - } else if (cgdcont->PDP_type[i] == NET_PDN_TYPE_IPV4V6) { - offset += sprintf(buffer+offset, ",IPV4V6"); - } - - offset += sprintf(buffer+offset, ",%s", cgdcont->APN[i]); - /* No data/header compression */ - offset += sprintf(buffer+offset, ",%u,%u\r\n", - AT_CGDCONT_D_COMP_OFF, AT_CGDCONT_H_COMP_OFF); - } - } else if (data->type == AT_COMMAND_TST) { - const at_cgdcont_tst_t * cgdcont = &(data->response.cgdcont.tst); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - /* IPv4 PDN type */ - offset += sprintf(buffer+offset, "+CGDCONT: "); - offset += sprintf(buffer+offset, "(1-%u),IP,,,(%u-%u),(%u-%u)", - cgdcont->n_cid, - AT_CGDCONT_D_COMP_MIN, AT_CGDCONT_D_COMP_MAX, - AT_CGDCONT_H_COMP_MIN, AT_CGDCONT_H_COMP_MAX); - /* IPv6 PDN type */ - offset += sprintf(buffer+offset, "\r\n+CGDCONT: "); - offset += sprintf(buffer+offset, "(1-%u),IPV6,,,(%u-%u),(%u-%u)", - cgdcont->n_cid, - AT_CGDCONT_D_COMP_MIN, AT_CGDCONT_D_COMP_MAX, - AT_CGDCONT_H_COMP_MIN, AT_CGDCONT_H_COMP_MAX); - /* IPv4v6 PDN type */ - offset += sprintf(buffer+offset, "\r\n+CGDCONT: "); - offset += sprintf(buffer+offset, "(1-%u),IPV4V6,,,(%u-%u),(%u-%u)", - cgdcont->n_cid, - AT_CGDCONT_D_COMP_MIN, AT_CGDCONT_D_COMP_MAX, - AT_CGDCONT_H_COMP_MIN, AT_CGDCONT_H_COMP_MAX); - - offset += sprintf(buffer+offset, "\r\n"); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgact() ** - ** ** - ** Description: Encodes AT CGACT command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgact(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - int i; - - if (data->type == AT_COMMAND_GET) { - const at_cgact_resp_t * cgact = &(data->response.cgact); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - /* Display the list of defined PDN status */ - for (i = 0; i < cgact->n_pdns; i++) { - offset += sprintf(buffer+offset, "+CGACT: %u,%u\r\n", - cgact->cid[i], cgact->state[i]); - } - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGACT: (%d,%d)\r\n", - AT_CGACT_STATE_MIN, AT_CGACT_STATE_MAX); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgpaddr() ** - ** ** - ** Description: Encodes AT CGPADDR command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgpaddr(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - const at_cgpaddr_resp_t * cgpaddr = &(data->response.cgpaddr); - int i; - - if (data->type == AT_COMMAND_SET) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - /* Display the list of IP addresses assigned to each defined PDN - * connections */ - for (i = 0; i < cgpaddr->n_pdns; i++) { - offset += sprintf(buffer+offset, "+CGPADDR: %u", cgpaddr->cid[i]); - - if (cgpaddr->PDP_addr_1[i] != NULL) { - /* IPv4 address */ - offset += sprintf(buffer+offset, ",%hhu.%hhu.%hhu.%hhu", - cgpaddr->PDP_addr_1[i][0], - cgpaddr->PDP_addr_1[i][1], - cgpaddr->PDP_addr_1[i][2], - cgpaddr->PDP_addr_1[i][3]); - } - - if (cgpaddr->PDP_addr_2[i] != NULL) { - /* IPv6 Link-local address prefixe */ - offset += sprintf(buffer+offset, - ",%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu", - 0xfe, 0x80, 0, 0, 0, 0, 0, 0); - /* IPv6 Link-local address */ - offset += sprintf(buffer+offset, - ".%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu", - cgpaddr->PDP_addr_2[i][0], - cgpaddr->PDP_addr_2[i][1], - cgpaddr->PDP_addr_2[i][2], - cgpaddr->PDP_addr_2[i][3], - cgpaddr->PDP_addr_2[i][4], - cgpaddr->PDP_addr_2[i][5], - cgpaddr->PDP_addr_2[i][6], - cgpaddr->PDP_addr_2[i][7]); - } - - offset += sprintf(buffer+offset, "\r\n"); - } - } else if (data->type == AT_COMMAND_TST) { - /* Display the list of defined PDN contexts */ - if (cgpaddr->n_pdns > 0) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CGPADDR: %u", cgpaddr->cid[0]); - - for (i = 1; i < cgpaddr->n_pdns; i++) { - offset += sprintf(buffer+offset, ",%u", cgpaddr->cid[i]); - } - - offset += sprintf(buffer+offset, "\r\n"); - } - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cmee() ** - ** ** - ** Description: Encodes AT CMEE command response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cmee(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_cmee_resp_t * cmee = &(data->response.cmee); - - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CMEE: %d\r\n", cmee->n); - } else if (data->type == AT_COMMAND_TST) { - if (at_response_format_v1) { - offset += sprintf(buffer, "\r\n"); - } - - offset += sprintf(buffer+offset, "+CMEE: (%d,%d)\r\n", - AT_CMEE_N_MIN, AT_CMEE_N_MAX); - } - - LOG_FUNC_RETURN (offset); -} - -/**************************************************************************** - ** ** - ** Name: _at_response_encode_cgev() ** - ** ** - ** Description: Encodes AT CGEV unsolicited result response message ** - ** ** - ** Inputs data: AT response data to encode ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of characters encoded in the ** - ** data buffer ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _at_response_encode_cgev(char* buffer, const at_response_t* data) -{ - LOG_FUNC_IN; - - int offset = 0; - - if (data->type == AT_COMMAND_GET) { - const at_cgev_resp_t * cgev = &(data->response.cgev); - offset += sprintf(buffer+offset, "+CGEV: %s %u\r\n", - _at_response_event_str[cgev->code], cgev->cid); - } - - LOG_FUNC_RETURN (offset); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.h b/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.h deleted file mode 100644 index 17c3ea0d81e058a234483b29a4c7a7b47ee8dc8e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/at_response.h +++ /dev/null @@ -1,789 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source at_response.h - -Version 0.1 - -Date 2012/03/09 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines structure of the AT command response returned after - completion of AT command processing. - -*****************************************************************************/ -#ifndef __AT_RESPONSE_H__ -#define __AT_RESPONSE_H__ - -#include "at_command.h" -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Total number of characters, including line terminators, in information text - */ -#define AT_RESPONSE_INFO_TEXT_SIZE 2048 - -/* - * Value of the mask parameter for AT command reponses without any optional - * parameters - */ -#define AT_RESPONSE_NO_PARAM AT_COMMAND_PARAM0 - -/* - * Maximum value of an AT command response identifier - */ -#define AT_RESPONSE_ID_MAX AT_COMMAND_ID_MAX - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * ================ - * General commands - * ================ - */ - -/* CGSN: Request Product Serial Number identification (IMEI) - * --------------------------------------------------------- - * Returns information text intended to permit the user to identify the - * individual Mobile Equipment to which it is connected to. - * Action command: - * +CGSN returns <sn> - * <sn> information text containing the IMEI - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGSN_MASK AT_RESPONSE_NO_PARAM - -/* CGSN AT command response type */ -typedef struct { - char sn[AT_RESPONSE_INFO_TEXT_SIZE+1]; -} at_cgsn_resp_t; - -/* CGMI: Request manufacturer identification - * ----------------------------------------- - * Returns information text intended to permit the user to identify the - * manufacturer of the Mobile Equipment to which it is connected to. - * Action command: - * +CGMI returns <manufacturer> - * <manufacturer> information text containing the manufacturer id - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGMI_MASK AT_RESPONSE_NO_PARAM - -/* CGMI AT command response type */ -typedef struct { - char manufacturer[AT_RESPONSE_INFO_TEXT_SIZE+1]; -} at_cgmi_resp_t; - -/* CGMM: Request model identification - * ---------------------------------- - * Returns information text intended to permit the user to identify the - * specific model of the Mobile Equipment to which it is connected to. - * +CGMM returns <model> - * <model> information text containing the model id - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGMM_MASK AT_RESPONSE_NO_PARAM - -/* CGMM AT command response type */ -typedef struct { - char model[AT_RESPONSE_INFO_TEXT_SIZE+1]; -} at_cgmm_resp_t; - -/* CGMR: Request revision identification - * ------------------------------------- - * Returns information text intended to permit the user to identify the - * version, revision level or date, or other pertinent information of the - * Mobile Equipment to which it is connected to. - * +CGMR returns <revision> - * <revision> information text containing the revision of the firmware - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGMR_MASK AT_RESPONSE_NO_PARAM - -/* CGMR AT command response type */ -typedef struct { - char revision[AT_RESPONSE_INFO_TEXT_SIZE+1]; -} at_cgmr_resp_t; - -/* CIMI: Request International Mobile Subscriber Identity - * ------------------------------------------------------ - * Returns <IMSI>, which is intended to permit the user to identify the - * individual SIM card or active application in the UICC (GSM or USIM) - * which is attached to the Mobile Equipment to which it is connected to. - * Action command: - * +CIMI returns <IMSI> - * <IMSI> International Mobile Subscriber Identity (string without - * double quotes) - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CIMI_MASK AT_RESPONSE_NO_PARAM - -/* CIMI AT command response type */ -typedef struct { - char IMSI[AT_RESPONSE_INFO_TEXT_SIZE+1]; -} at_cimi_resp_t; - -/* - * ============================================== - * Mobile Termination control and status commands - * ============================================== - */ -/* CFUN: Set phone functionality - * ----------------------------- - * Used to set the Mobile Equipment to different power consumption states - * Read parameter command: - * +CFUN? returns +CFUN: <fun> - * <fun> integer type - level of functionality - * Test parameter command: - * +CFUN=? returns +CFUN: (list of supported <fun>s),(list of supported <rst>s) - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CFUN_MASK AT_RESPONSE_NO_PARAM - -/* CFUN AT command response type */ -typedef struct { - int fun; -} at_cfun_resp_t; - -/* CPIN: Enter PIN - * --------------- - * Used to enter MT passwords which are needed before any other - * functionality of the MT can be used - * Read parameter command: - * +CPIN? returns +CPIN: <code> - * <code> string - value may be: "READY", "SIM PIN" - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CPIN_MASK AT_RESPONSE_NO_PARAM - -/* CPIN AT command response type */ -typedef struct { -#define AT_CPIN_RESP_SIZE 16 - char code[AT_CPIN_RESP_SIZE+1]; -} at_cpin_resp_t; - -/* CSQ: Signal quality - * ------------------- - * Returns received signal strength indication and channel bit error rate - * from the Mobile Equipment - * Action command: - * +CSQ returns +CSQ: <rssi>, <ber> - * <rssi> integer type - received signal strength indication (in dBm) - * <ber> integer type - channel bit error rate (in percent) - */ - -/* Received signal strength indicator */ -#define AT_CSQ_RSSI_0 0 /* -113 dBm or less */ -#define AT_CSQ_RSSI_31 31 /* -51 dBm or greater */ -#define AT_CSQ_RSSI_UNKNOWN 99 /* not known or not detectable */ - -/* Channel bit error rate */ -#define AT_CSQ_BER_0 0 /* BER < 0.2 % */ -#define AT_CSQ_BER_1 1 /* 0.2 % < BER < 0.4 % */ -#define AT_CSQ_BER_2 2 /* 0.4 % < BER < 0.8 % */ -#define AT_CSQ_BER_3 3 /* 0.8 % < BER < 1.6 % */ -#define AT_CSQ_BER_4 4 /* 1.6 % < BER < 3.2 % */ -#define AT_CSQ_BER_5 5 /* 3.2 % < BER < 6.4 % */ -#define AT_CSQ_BER_6 6 /* 6.4 % < BER < 12.8 % */ -#define AT_CSQ_BER_7 7 /* 12.8 % < BER */ -#define AT_CSQ_BER_UNKNOWN 99 /* not known or not detectable */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CSQ_MASK AT_RESPONSE_NO_PARAM - -/* CSQ AT command response type */ -typedef struct { - int rssi; - int ber; -} at_csq_resp_t; - -/* CESQ: Extended signal quality - * ----------------------------- - * Returns received signal quality parameters. - * Action command: - * +CESQ returns +CESQ: <rssi>,<ber>,<rscp>,<ecno>,<rsrq>,<rsrp> - * <rssi> integer type - received signal strength indication (in dBm) - * <ber> integer type - channel bit error rate (in percent) - * <rscp> integer type - received signal code power (in dBm) - * <ecno> integer type - ratio of the received energy per PN chip (in dBm) - * <rsrq> integer type - reference signal received quality (in dBm) - * <rsrp> integer type - reference signal received power (in dBm) - */ - -/* Received signal strength indicator */ -#define AT_CESQ_RSSI_0 0 /* -113 dBm or less */ -#define AT_CESQ_RSSI_31 31 /* -51 dBm or greater */ -#define AT_CESQ_RSSI_UNKNOWN 99 /* not known or not detectable */ - -/* Channel bit error rate */ -#define AT_CESQ_BER_0 0 /* BER < 0.2 % */ -#define AT_CESQ_BER_1 1 /* 0.2 % < BER < 0.4 % */ -#define AT_CESQ_BER_2 2 /* 0.4 % < BER < 0.8 % */ -#define AT_CESQ_BER_3 3 /* 0.8 % < BER < 1.6 % */ -#define AT_CESQ_BER_4 4 /* 1.6 % < BER < 3.2 % */ -#define AT_CESQ_BER_5 5 /* 3.2 % < BER < 6.4 % */ -#define AT_CESQ_BER_6 6 /* 6.4 % < BER < 12.8 % */ -#define AT_CESQ_BER_7 7 /* 12.8 % < BER */ -#define AT_CESQ_BER_UNKNOWN 99 /* not known or not detectable */ - -/* Received signal code power */ -#define AT_CESQ_RSCP_0 0 /* -120 dBm or less */ -#define AT_CESQ_RSCP_96 96 /* -24 dBm or greater */ -#define AT_CESQ_RSCP_UNKNOWN 255 /* not known or not detectable */ - -/* Ratio of the received energy per PN chip (Ec/No) */ -#define AT_CESQ_ECNO_0 0 /* -24 dBm or less */ -#define AT_CESQ_ECNO_49 49 /* 0,5 dBm or greater */ -#define AT_CESQ_ECNO_UNKNOWN 255 /* not known or not detectable */ - -/* Reference signal received quality */ -#define AT_CESQ_RSRQ_0 0 /* -19,5 dBm or less */ -#define AT_CESQ_RSRQ_34 34 /* -2,5 dBm or greater */ -#define AT_CESQ_RSRQ_UNKNOWN 255 /* not known or not detectable */ - -/* Reference signal received power */ -#define AT_CESQ_RSRP_0 0 /* -140 dBm or less */ -#define AT_CESQ_RSRP_97 97 /* -43 dBm or greater */ -#define AT_CESQ_RSRP_UNKNOWN 255 /* not known or not detectable */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CESQ_MASK AT_RESPONSE_NO_PARAM - -/* CSQ AT command response type */ -typedef struct { - int rssi; - int ber; - int rscp; - int ecno; - int rsrq; - int rsrp; -} at_cesq_resp_t; - -/* CLAC: List all available AT commands - * ------------------------------------ - * Returns one or more lines of AT Commands that are available for the user. - * Action command: - * +CLAC returns +CLAC: <AT Command1>[<CR><LF><AT Command2>[...]] - * <AT Command> string - defines the AT command including the prefix AT - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CLAC_MASK AT_RESPONSE_NO_PARAM - -/* CLAC AT command response type */ -typedef struct { - int n_acs; -#define AT_CLAC_RESP_SIZE 100 - const char* ac[AT_CLAC_RESP_SIZE]; -} at_clac_resp_t; - -/* - * ========================= - * Mobile Termination errors - * ========================= - */ -/* - * CMEE: Report mobile termination error - * ------------------------------------- - * Disables or enables the use of final result code +CME ERROR: <err> as an - * indication of an error relating to the functionality of the MT. - * Read parameter command: - * +CMEE? returns +CMEE: <n> - * <n> numeric parameter - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CMEE_MASK AT_RESPONSE_NO_PARAM - -/* CMEE AT command response type */ -typedef at_cmee_t at_cmee_resp_t; - -/* - * ================================ - * Network service related commands - * ================================ - */ -/* CNUM: Subscriber number - * ----------------------- - * Returns the MSISDNs related to the subscriber. - * Action command: - * +CNUM returns +CNUM: <number1>,<type1>[<CR><LF> - * +CNUM: <number2>,<type2>[...]] - * <numberx> string type phone number of format specified by <typex> - * <typex> type of address octet in integer format - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CNUM_MASK AT_RESPONSE_NO_PARAM - -/* CNUM AT command response type */ -typedef struct { -#define AT_CNUM_NUMBER_SIZE MSISDN_DIGIT_SIZE - char number[AT_CNUM_NUMBER_SIZE]; - int type; -} at_cnum_resp_t; - -/* CLCK: Facility lock - * ------------------- - * Used to lock, unlock or interrogate a MT or a network facility <fac>. - * When <mode>=2, returns +CLCK: <status> - * <status> state of the network service - */ - -/* Network service status */ -#define AT_CLCK_RESP_STATUS_NOT_ACTIVE 0 -#define AT_CLCK_RESP_STATUS_ACTIVE 1 - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CLCK_MASK AT_RESPONSE_NO_PARAM - -/* CLCK AT command response type */ -typedef struct { - int status; -} at_clck_resp_t; - -/* COPS: PLMN selection - * -------------------- - * Forces an attempt to select and register the GSM/UMTS/EPS network operator - * using the SIM/USIM card installed in the currently selected card slot. - * Read parameter command: - * +COPS? returns +COPS:<mode>[,<format>,<oper>[,<AcT>]] - * <mode> operation mode of the network selection - * <format> representation format of the network operator - * <oper> APN operator identifier - * <AcT> access technology - * Test command returns a set of parameters, each representing an operator - * present in the network: - * +COPS=? returns +COPS: [list of supported (<stat>,long alphanumeric <oper>, - * short alphanumeric <oper>,numeric <oper>[,<AcT>])s][,,(list of supported - * <mode>s),(list of supported <format>s)] - * <stat> network operator availability - */ - -/* Optional parameter bitmask */ -#define AT_COPS_RESP_FORMAT_MASK AT_COMMAND_PARAM2 -#define AT_COPS_RESP_OPER_MASK AT_COMMAND_PARAM3 -#define AT_COPS_RESP_ACT_MASK AT_COMMAND_PARAM4 - -/* Structure of COPS AT test parameter command */ -typedef struct { - const char* data; /* String representation of the list of operators */ - int size; /* Size in byte of the data to be dislayed */ -} at_cops_tst_t; - -/* Structure of COPS AT read parameter command */ -typedef at_cops_t at_cops_get_t; - -/* COPS AT command response type */ -typedef union { - at_cops_tst_t tst; - at_cops_get_t get; -} at_cops_resp_t; - -/* CREG: network registration - * -------------------------- - * When <n>=1, returns +CREG: <stat>, the Mobile Equipment's circuit mode - * network registration status in GERA/UTRA/E-UTRA Network. - * When <n>=2, returns +CREG: <stat>[,<lac>,<ci>[,<AcT>]], the Mobile - * Equipment's circuit mode network registration status and location information - * in GERA/UTRA/E-UTRA Network. - * Read parameter command: - * +CREG? returns +CREG:<n>,<stat>[,<lac>,<ci>[,<AcT>]] - * <n> numeric parameter - * <stat> numeric parameter that indicates the circuit mode registration - * status - * <lac> string type; two byte location area code in hexadecimal format - * <ci> string type; four byte GERAN/UTRAN/E-UTRAN cell ID in hexadeci- - * mal format - * <AcT> a numeric parameter that indicates the access technology of - * the serving cell - */ - -/* Network registration status */ -#define AT_CREG_RESP_REG_OFF NET_REG_STATE_OFF -#define AT_CREG_RESP_REG_HN NET_REG_STATE_HN -#define AT_CREG_RESP_REG_ON NET_REG_STATE_ON -#define AT_CREG_RESP_REG_DENIED NET_REG_STATE_DENIED -#define AT_CREG_RESP_REG_UNKNOWN NET_REG_STATE_UNKNOWN -#define AT_CREG_RESP_REG_SMS_HN NET_REG_STATE_SMS_HN -#define AT_CREG_RESP_REG_SMS_ROAMING NET_REG_STATE_SMS_ROAMING -#define AT_CREG_RESP_REG_ROAMING NET_REG_STATE_ROAMING - -/* Access technology indicators */ -#define AT_CREG_RESP_GSM NET_ACCESS_GSM /* GSM */ -#define AT_CREG_RESP_COMPACT NET_ACCESS_COMPACT /* GSM Compact */ -#define AT_CREG_RESP_UTRAN NET_ACCESS_UTRAN /* UTRAN */ -#define AT_CREG_RESP_EGPRS NET_ACCESS_EGPRS /* GSM w/EGPRS */ -#define AT_CREG_RESP_HSDPA NET_ACCESS_HSDPA /* UTRAN w/HSDPA */ -#define AT_CREG_RESP_HSUPA NET_ACCESS_HSUPA /* UTRAN w/HSUPA */ -#define AT_CREG_RESP_HSDUPA NET_ACCESS_HSDUPA /* w/HSDPA and HSUPA */ -#define AT_CREG_RESP_EUTRAN NET_ACCESS_EUTRAN /* E-UTRAN */ - -/* Optional parameter bitmask */ -//#define AT_CREG_RESP_N_MASK AT_COMMAND_PARAM1 -#define AT_CREG_RESP_LAC_MASK AT_COMMAND_PARAM3 -#define AT_CREG_RESP_CI_MASK AT_COMMAND_PARAM4 -#define AT_CREG_RESP_ACT_MASK AT_COMMAND_PARAM5 - -/* CREG AT command response type */ -typedef struct { - int n; - int stat; -#define AT_CREG_RESP_LAC_SIZE 4 - char lac[AT_CREG_RESP_LAC_SIZE+1]; -#define AT_CREG_RESP_CI_SIZE 8 - char ci[AT_CREG_RESP_CI_SIZE+1]; - int AcT; -} at_creg_resp_t; - -/* - * ========================== - * Commands for Packet Domain - * ========================== - */ -/* CGATT: GPRS service attach/detach - * --------------------------------- - * Used to attach the MT to, or detach the MT from, the GPRS service. - * Read parameter command: - * +CGATT? returns CGATT: <state> - * <state> numeric parameter that indicates the state of GPRS attachment - * Test parameter command: - * +CGATT=? returns CGATT: (list of supported <state>s) - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGATT_MASK AT_RESPONSE_NO_PARAM - -/* CGATT AT command response type */ -typedef struct { - int state; -} at_cgatt_resp_t; - -/* CGREG: GPRS network registration status - * --------------------------------------- - * When <n>=1, returns +CGREG: <stat>, the Mobile Equipment's GPRS network - * registration status in GERA/UTRA Network. - * When <n>=2, returns +CGREG: <stat>[,<lac>,<ci>[,<AcT>,<rac>]], the Mobile - * Equipment's GPRS network registration status and location information in - * GERA/UTRA Network. - * Read parameter command: - * +CGREG? returns +CGREG:<n>,<stat>[,<lac>,<ci>[,<AcT>,<rac>]] - * <n> numeric parameter - * <stat> numeric parameter that indicates the GPRS registration status - * <lac> string type; two byte location area code in hexadecimal format - * <ci> string type; four byte GERAN/UTRAN cell ID in hexadecimal format - * <AcT> a numeric parameter that indicates the access technology of - * the serving cell - * <rac> string type; one byte routing area code in hexadecimal format - */ - -/* Network registration status */ -#define AT_CGREG_RESP_REG_OFF NET_REG_STATE_OFF -#define AT_CGREG_RESP_REG_HN NET_REG_STATE_HN -#define AT_CGREG_RESP_REG_ON NET_REG_STATE_ON -#define AT_CGREG_RESP_REG_DENIED NET_REG_STATE_DENIED -#define AT_CGREG_RESP_REG_UNKNOWN NET_REG_STATE_UNKNOWN -#define AT_CGREG_RESP_REG_ROAMING NET_REG_STATE_ROAMING -#define AT_CGREG_RESP_REG_EMERGENCY NET_REG_STATE_EMERGENCY - -/* Access technology indicators */ -#define AT_CGREG_RESP_GSM NET_ACCESS_GSM /* GSM */ -#define AT_CGREG_RESP_COMPACT NET_ACCESS_COMPACT /* GSM Compact */ -#define AT_CGREG_RESP_UTRAN NET_ACCESS_UTRAN /* UTRAN */ -#define AT_CGREG_RESP_EGPRS NET_ACCESS_EGPRS /* GSM w/EGPRS */ -#define AT_CGREG_RESP_HSDPA NET_ACCESS_HSDPA /* UTRAN w/HSDPA */ -#define AT_CGREG_RESP_HSUPA NET_ACCESS_HSUPA /* UTRAN w/HSUPA */ -#define AT_CGREG_RESP_HSDUPA NET_ACCESS_HSDUPA /* w/HSDPA and HSUPA */ - -/* Optional parameter bitmask */ -//#define AT_CGREG_RESP_N_MASK AT_COMMAND_PARAM1 -#define AT_CGREG_RESP_LAC_MASK AT_COMMAND_PARAM3 -#define AT_CGREG_RESP_CI_MASK AT_COMMAND_PARAM4 -#define AT_CGREG_RESP_ACT_MASK AT_COMMAND_PARAM5 -#define AT_CGREG_RESP_RAC_MASK AT_COMMAND_PARAM6 - -/* CGREG AT command response type */ -typedef struct { - int n; - int stat; -#define AT_CGREG_RESP_LAC_SIZE 4 - char lac[AT_CGREG_RESP_LAC_SIZE+1]; -#define AT_CGREG_RESP_CI_SIZE 8 - char ci[AT_CGREG_RESP_CI_SIZE+1]; - int AcT; -#define AT_CGREG_RESP_RAC_SIZE 2 - char rac[AT_CGREG_RESP_RAC_SIZE+1]; -} at_cgreg_resp_t; - -/* CEREG: EPS network registration status - * -------------------------------------- - * When <n>=1, returns +CEREG: <stat>, the Mobile Equipment's EPS services - * registration status in EUTRA Network. - * When <n>=2, returns +CEREG: <stat>[,<tac>,<ci>[,<AcT>]], the Mobile - * Equipment's EPS services registration status and location information in - * EUTRA Network. - * Read parameter command: - * +CEREG? returns +CEREG:<n>,<stat>[,<tac>,<ci>[,<AcT>]] - * <n> numeric parameter - * <stat> numeric parameter that indicates the EPS registration status - * <tac> string type; two byte tracking area code in hexadecimal format - * <ci> string type; four byte E-UTRAN cell ID in hexadecimal format - * <AcT> a numeric parameter that indicates the access technology of - * the serving cell - */ - -/* Network registration status */ -#define AT_CEREG_RESP_REG_OFF NET_REG_STATE_OFF -#define AT_CEREG_RESP_REG_HN NET_REG_STATE_HN -#define AT_CEREG_RESP_REG_ON NET_REG_STATE_ON -#define AT_CEREG_RESP_REG_DENIED NET_REG_STATE_DENIED -#define AT_CEREG_RESP_REG_UNKNOWN NET_REG_STATE_UNKNOWN -#define AT_CEREG_RESP_REG_ROAMING NET_REG_STATE_ROAMING -#define AT_CEREG_RESP_REG_EMERGENCY NET_REG_STATE_EMERGENCY - -/* Access technology indicators */ -#define AT_CEREG_RESP_EUTRAN NET_ACCESS_EUTRAN /* E-UTRAN */ - -/* Optional parameter bitmask */ -//#define AT_CEREG_RESP_N_MASK AT_COMMAND_PARAM1 -#define AT_CEREG_RESP_TAC_MASK AT_COMMAND_PARAM3 -#define AT_CEREG_RESP_CI_MASK AT_COMMAND_PARAM4 -#define AT_CEREG_RESP_ACT_MASK AT_COMMAND_PARAM5 - -/* CEREG AT command response type */ -typedef struct { - int n; - int stat; -#define AT_CEREG_RESP_TAC_SIZE 4 - char tac[AT_CEREG_RESP_TAC_SIZE+1]; -#define AT_CEREG_RESP_CI_SIZE 8 - char ci[AT_CEREG_RESP_CI_SIZE+1]; - int AcT; -} at_cereg_resp_t; - -/* CGDCONT: Define PDP Context - * --------------------------- - * Specifies PDP context parameter values for a PDP context identified by - * the (local) context identification parameter, <cid>. - * Read parameter command: - * +CGDCONT? returns +CGDCONT: <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>, - * <h_comp>[,<IPv4AddrAlloc>[,<emergency indication>[,<P-CSCF_ - * discovery>[,<IM_CN_Signalling_Flag_Ind>]]]][<CR><LF> - * +CGDCONT: <cid>,<PDP_type>,<APN>,<PDP_addr>,<d_comp>, - * <h_comp>[,<IPv4AddrAlloc>[,<emergency indication>[,<P-CSCF_ - * discovery>[,<IM_CN_Signalling_Flag_Ind>]]]] - * [...]] - * <cid> a numeric parameter which specifies a particular PDP - * context definition - * <PDP_type> type of packet data protocol ("IP", "IPV6", "IPV4V6") - * <APN> Access Point logical Name - * <PDP_addr> Mobile Equipment PDP address (not applicable to EPS) - * <d_comp> PDP data compression parameter - * <h_comp> PDP header compression parameter - * <IPv4AddrAlloc> IPv4 address allocation parameter - * <emergency indication> emergency bearer services support indication - * <P-CSCF_discovery> P-CSCF address discovery parameter - * <IM_CN_Signalling_Flag_Ind> IM CN subsystem-related signalling - * support indication - */ - -/* Optional parameter bitmask */ -#define AT_CGDCONT_RESP_IPV4ADDRALLOC_MASK AT_COMMAND_PARAM7 -#define AT_CGDCONT_RESP_EMERGECY_INDICATION_MASK AT_COMMAND_PARAM8 -#define AT_CGDCONT_RESP_P_CSCF_DISCOVERY_MASK AT_COMMAND_PARAM9 -#define AT_CGDCONT_RESP_IM_CN_SIGNALLING_FLAG_IND_MASK AT_COMMAND_PARAM10 - -/* Structure of CGDCONT AT read parameter command */ -typedef struct { -#define AT_CGDCONT_RESP_SIZE 8 - int n_pdns; /* Number of defined PDN contexts in the lists */ - int cid[AT_CGDCONT_RESP_SIZE]; /* List of PDN context identifiers */ - int PDP_type[AT_CGDCONT_RESP_SIZE]; - const char* APN[AT_CGDCONT_RESP_SIZE]; - int d_comp[AT_CGDCONT_RESP_SIZE]; - int h_comp[AT_CGDCONT_RESP_SIZE]; -} at_cgdcont_get_t; - -/* Structure of CGDCONT AT read parameter command */ -typedef struct { - int n_cid; /* Range of supported PDN context identifiers */ -} at_cgdcont_tst_t; - -/* CGDCONT AT command response type */ -typedef union { - at_cgdcont_tst_t tst; - at_cgdcont_get_t get; -} at_cgdcont_resp_t; - -/* CGACT: PDP context activate or deactivate - * ----------------------------------------- - * Read command returns the current activation states for all the defined - * PDP contexts. - * Read parameter command: - * +CGACT? returns +CGACT: <cid>,<state>[<CR><LF>+CGACT: <cid>,<state>[...]] - * <cid> a numeric parameter which specifies a particular PDP context - * definition - * <state> numeric parameter that indicates the state of PDP context - * activation - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGACT_MASK AT_RESPONSE_NO_PARAM - -/* CGACT AT command response type */ -typedef struct { -#define AT_CGACT_RESP_SIZE AT_CGDCONT_RESP_SIZE - int n_pdns; /* Number of defined PDN contexts in the lists */ - int cid[AT_CGACT_RESP_SIZE]; /* List of PDN context identifiers */ - int state[AT_CGACT_RESP_SIZE]; /* List of PDN context states */ -} at_cgact_resp_t; - -/* CGPADDR: Show PDP address(es) - * ----------------------------- - * Returns a list of PDP addresses for the specified context identifiers. - * +CGPADDR= returns +CGPADDR: <cid>[,PDP_addr_1[,PDP_addr_2]][<CR><LF> - * +CGPADDR: <cid>[,PDP_addr_1[,PDP_addr_2]][...]] - * <cid> a numeric parameter which specifies a particular PDP - * context definition - * <PDP_addr_x> string that identifies the MT in the address space - * applicable to the PDP - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGPADDR_MASK AT_RESPONSE_NO_PARAM - -/* CGPADDR AT command response type */ -typedef struct { -#define AT_CGPADDR_RESP_SIZE AT_CGDCONT_RESP_SIZE - int n_pdns; /* Number of defined PDP addresses in the lists */ - int cid[AT_CGPADDR_RESP_SIZE]; /* List of PDN context identifiers */ - /* List of IPv4 addresses */ - const char* PDP_addr_1[AT_CGPADDR_RESP_SIZE]; - /* List of IPv6 addresses */ - const char* PDP_addr_2[AT_CGPADDR_RESP_SIZE]; -} at_cgpaddr_resp_t; - -/* CGEV: Unsolicited result - * ------------------------ - * Returns unsolicited result codes in case of certain events occurring - * in the Packet Domain MT or the network. - * +CGREV: <code> <cid> - * <code> unsolicited result code - * <cid> a numeric parameter which specifies a particular PDP - * context definition - */ - -/* Optional parameter bitmask */ -#define AT_RESPONSE_CGEV_MASK AT_RESPONSE_NO_PARAM - -/* Unsolicited result codes */ -#define AT_CGEV_RESP_NW_PDN_ACT (-1) /* Not applicable for LTE */ -#define AT_CGEV_RESP_ME_PDN_ACT NET_PDN_MT_DEFAULT_ACT -#define AT_CGEV_RESP_NW_PDN_DEACT NET_PDN_NW_DEFAULT_DEACT -#define AT_CGEV_RESP_ME_PDN_DEACT NET_PDN_MT_DEFAULT_DEACT -#define AT_CGEV_RESP_NW_ACT NET_PDN_NW_DEDICATED_ACT -#define AT_CGEV_RESP_ME_ACT NET_PDN_MT_DEDICATED_ACT -#define AT_CGEV_RESP_NW_DEACT NET_PDN_NW_DEDICATED_DEACT -#define AT_CGEV_RESP_ME_DEACT NET_PDN_MT_DEDICATED_DEACT - -/* CGEV unsolicited result type */ -typedef struct { - int code; - int cid; -} at_cgev_resp_t; - -/* - * ========================================== - * Global AT command response type definition - * ========================================== - */ - -/* AT command response type */ -typedef struct { - at_command_id_t id; /* AT command identifier */ - at_command_type_t type; /* AT command type */ - int mask; /* Optional parameter bitmask */ - int cause_code; /* AT command error cause code */ - union { - at_cgsn_resp_t cgsn; - at_cgmi_resp_t cgmi; - at_cgmm_resp_t cgmm; - at_cgmr_resp_t cgmr; - at_cimi_resp_t cimi; - at_cfun_resp_t cfun; - at_cpin_resp_t cpin; - at_csq_resp_t csq; - at_cesq_resp_t cesq; - at_clac_resp_t clac; - at_cmee_resp_t cmee; - at_cnum_resp_t cnum; - at_clck_resp_t clck; - at_cops_resp_t cops; - at_cgatt_resp_t cgatt; - at_creg_resp_t creg; - at_cgreg_resp_t cgreg; - at_cereg_resp_t cereg; - at_cgdcont_resp_t cgdcont; - at_cgact_resp_t cgact; - at_cgpaddr_resp_t cgpaddr; - at_cgev_resp_t cgev; - } response; -} at_response_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int at_response_encode(char* buffer, const at_response_t* at_response); - -#endif /* __AT_RESPONSE_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/Makefile b/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/Makefile deleted file mode 100644 index 867c3f697e8cdf33c8850d7d8eaaf5d296a96b86..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -LIBS = -lutil -lapi -lEMMmsg -lESMmsg -lies -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(USERAPIDIR) - -LIBSAPI = $(LIBDIR)/$(LIBAPI).a $(LIBDIR)/$(LIBAPI).so - -TST_OBJ = at_parser.o - -TST_TARGET = at_parser - -TARGETS = $(TST_TARGET) - -all: $(TARGETS) - -%.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -$(TST_TARGET): $(TST_OBJ) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -clean: - $(RM) $(OBJS) $(TARGETS) *.bak *~ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -at_parser.o: $(USERAPIDIR)/at_command.h -at_parser.o: $(INCDIR)/commonDef.h $(INCDIR)/userDef.h -at_parser.o: $(INCDIR)/networkDef.h $(UTILDIR)/log.h diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.c b/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.c deleted file mode 100644 index 7d0ca3f1e1377bf34bac2b4e8b9238a441bc6d48..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.c +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - Source main.c - Version 0.1 - Date 01/04/2012 - Product NAS stack - Subsystem Application Programming Interface - Author Baris Demiray - Description Interacts with AT parser for testing purposes - *****************************************************************************/ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include "at_command.h" - -#include "nas_log.h" - -int main() -{ - const char * sample_at_commands[] = { - "AT+CGSN\r", "AT+CGSN=?\r", "AT+CGMI\r", "AT+CGMI=?\r", "AT+CGMM\r", - "AT+CGMM=?\r", "AT+CIMI\r", "AT+CIMI=?\r", "AT+CFUN=1,1\r", - "AT+CFUN=2\r", "AT+CFUN?\r", "AT+CFUN=?\r", "AT+CPIN=1234\r", - "AT+CPIN=1234,4321\r", "AT+CPIN?\r", "AT+CPIN=?\r", "AT+CSQ\r", - "AT+CSQ=?\r", "AT+COPS=1,1,EURECOM\r", "AT+COPS=2,3\r", "AT+COPS=5\r", - "AT+COPS?\r", "AT+COPS=?\r", "AT+CGREG=1\r", "AT+CGREG?\r", - "AT+CGREG=?\r", "AT+CGDCONT=1\r", "AT+CGDCONT?\r", "AT+CGDCONT=?\r", - "AT+CGACT=1\r", "AT+CGACT?\r", "AT+CGACT=?\r", "AT+CGMR\r", - "AT+CGMR=?\r", "AT+CESQ\r", "AT+CESQ=?\r", "AT+CMEE=2\r", - "AT+CMEE?\r", "AT+CMEE=?\r", "AT+CLCK=SC,2\r", "AT+CLCK=?\r", - "AT+CREG=1\r", "AT+CREG?\r", "AT+CREG=?\r", - "AT+CEREG=1\r", "AT+CEREG?\r", "AT+CEREG=?\r", - "AT+CGATT=1\r", "AT+CGATT?\r", "AT+CGATT=?\r", - "AT\r", "null" - }; - - const char * sample_faulty_at_commands[] = { - "AT+CGSN=3,4\r", "AT+CGSN=??\r", "AT+CGMI=1,b\r", "AT+CGMI==\r", - "AT+CGMM?\r", "AT+CGMM==n\r", "AT+CIMI=4\r", "AT+CIMI=?t\r", - "AT+CFUN=n1,1\r", "AT+CFUN??\r", "AT+CFUN=a?\r", "AT+CPIN=1fd4\r", - "AT+CPIN=1sd+,432\r", "AT+CPIN?4\r", "AT+CPIN=?,?\r", "AT+CSQ=AT\r", - "AT+CSQ=q\r", - "AT+COPS=123121123123123123,EURECOMEURECOMEURECOMEURECOM\r", - "AT+COPS=2asd3,33ads1\r", "AT+COPS.=5\r", "AT+COPS?/r\\r", - "AT+COPS=?\n\r\r", "AT+CGREG=da1243\42r", "AT+CGREG.?\r", - "AT+CGREG1=?\r", "AT+CGDCONT=d31\r", "AT+CGDCONTxc?\\crca", - "AT+CGDCONcTc=c?\r", "AT+CGA12C3T=11\123r", "AT+CGACT';;.,?\r", - "AT+CGACT=?]\\;e23\r", "\r\r\r", "AT+COP\r", "null" - }; - - at_command_t at_command; - unsigned int at_command_index; - - //log_init(0x2f); - - /* Parse valid AT commands */ - at_command_index = 0; - - while (strncmp(sample_at_commands[at_command_index], "null", 4) != 0) { - if (at_command_decode(sample_at_commands[at_command_index], - strlen(sample_at_commands[at_command_index]), - &at_command) > 0) { - printf("INFO: Fine, parser interpreted valid command %s\n", - sample_at_commands[at_command_index]); - } else { - printf("ERROR: Parser rejected valid command %s\n", - sample_at_commands[at_command_index]); - } - - at_command_index++; - } - - /* Parse invalid AT commands */ - at_command_index = 0; - - while (strncmp(sample_faulty_at_commands[at_command_index], "null", 4) != 0) { - if (at_command_decode(sample_faulty_at_commands[at_command_index], - strlen(sample_faulty_at_commands[at_command_index]), - &at_command) > 0) { - printf("ERROR: Parser interpreted invalid command %s\n", - sample_faulty_at_commands[at_command_index]); - } else { - printf("INFO: Fine, parser rejected the command %s\n", - sample_faulty_at_commands[at_command_index]); - } - - at_command_index++; - } - - /* - * Provide a console to the user - */ - int bytes_read; - size_t input_size = 100; - char *input; - - printf("Note 1: Carriage return will be appended to every command by default\n"); - printf("Note 2: Enter 'quit' to exit\n"); - printf("AT Command> "); - - input = (char *)malloc(input_size + 1); - - bytes_read = getline(&input, &input_size, stdin); - - while (strncmp(input, "quit", 4) != 0) { - if (bytes_read == -1) { - puts("Cannot read user input!\n"); - } else { - input[bytes_read - 1] = '\r'; - - if (at_command_decode(input, bytes_read, &at_command) > 0) - printf("INFO: Parser interpreted command %s\n", input); - else - printf("ERROR: Parser rejected command %s\n", input); - } - - printf("\nAT Command> "); - memset(input, 0x00, input_size); - bytes_read = getline(&input, &input_size, stdin); - } - - free(input); - - printf("Exiting...\n"); - - return 0; -} diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in b/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in deleted file mode 100644 index 24ba718cad480f9ad0bca054a42befa6db29bfa9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in +++ /dev/null @@ -1,2 +0,0 @@ -AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? -quit diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in.bis b/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in.bis deleted file mode 100644 index ef9bde30f7d037b78e80bdc6ecfd75cd67625a4a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.in.bis +++ /dev/null @@ -1,59 +0,0 @@ -ATE0Q0V1 -ATE0Q0V1 -ATS0=0 -AT+CMEE=1 -AT+CREG=2 -AT+CGREG=1 -AT+CCWA=1 -AT+CMOD=0 -AT+CSSN=0,1 -AT+COLP=0 -AT+CSCS="HEX" -AT+CUSD=1 -AT+CGEREP=1,0 -AT+CMGF=0 -AT+CFUN? -AT+CPIN? -AT+CSMS=1 -AT+CNMI=1,2,2,1,0 -AT+CFUN=0 -AT+CFUN=1 -AT+CPIN? -AT+CSMS=1 -AT+CNMI=1,2,2,1,0 -AT+CGSN -AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? -AT+CGREG? -AT+CREG? -AT+COPS? -AT+CLCC -AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? -AT+CGREG? -AT+CREG? -AT+COPS? -AT+COPS=0 -AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? -AT+CGREG? -AT+CREG? -AT+COPS? -AT+CIMI -AT+CRSM=192,12258,0,0,15 -AT+CRSM=192,28480,0,0,15 -AT+CRSM=192,28617,0,0,15 -AT+CRSM=192,28589,0,0,15 -AT+CRSM=192,28618,0,0,15 -AT+CRSM=192,28433,0,0,15 -AT+CRSM=192,28619,0,0,15 -AT+CRSM=192,28435,0,0,15 -AT+CRSM=192,28486,0,0,15 -AT+CRSM=192,28621,0,0,15 -AT+CRSM=192,28613,0,0,15 -AT+CRSM=192,28472,0,0,15 -AT+CRSM=192,28438,0,0,15 -AT+CRSM=192,28437,0,0,15 -AT+CPIN? -AT+CRSM=192,28439,0,0,15 -AT+CRSM=192,28436,0,0,15 -AT+CRSM=192,28440,0,0,15 -AT+CSQ -quit diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out b/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out deleted file mode 100644 index 8c9db5d7d3e44da83de0e248174af6701ce10d8b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out +++ /dev/null @@ -1,90 +0,0 @@ -INFO: Fine, parser interpreted valid command AT+CGSN -INFO: Fine, parser interpreted valid command AT+CGSN=? -INFO: Fine, parser interpreted valid command AT+CGMI -INFO: Fine, parser interpreted valid command AT+CGMI=? -INFO: Fine, parser interpreted valid command AT+CGMM -INFO: Fine, parser interpreted valid command AT+CGMM=? -INFO: Fine, parser interpreted valid command AT+CIMI -INFO: Fine, parser interpreted valid command AT+CIMI=? -INFO: Fine, parser interpreted valid command AT+CFUN=1,1 -INFO: Fine, parser interpreted valid command AT+CFUN=2 -INFO: Fine, parser interpreted valid command AT+CFUN? -INFO: Fine, parser interpreted valid command AT+CFUN=? -INFO: Fine, parser interpreted valid command AT+CPIN=1234 -INFO: Fine, parser interpreted valid command AT+CPIN=1234,4321 -INFO: Fine, parser interpreted valid command AT+CPIN? -INFO: Fine, parser interpreted valid command AT+CPIN=? -INFO: Fine, parser interpreted valid command AT+CSQ -INFO: Fine, parser interpreted valid command AT+CSQ=? -INFO: Fine, parser interpreted valid command AT+COPS=1,1,EURECOM -INFO: Fine, parser interpreted valid command AT+COPS=2,3 -INFO: Fine, parser interpreted valid command AT+COPS=5 -INFO: Fine, parser interpreted valid command AT+COPS? -INFO: Fine, parser interpreted valid command AT+COPS=? -INFO: Fine, parser interpreted valid command AT+CGREG=1 -INFO: Fine, parser interpreted valid command AT+CGREG? -INFO: Fine, parser interpreted valid command AT+CGREG=? -INFO: Fine, parser interpreted valid command AT+CGDCONT=1 -INFO: Fine, parser interpreted valid command AT+CGDCONT? -INFO: Fine, parser interpreted valid command AT+CGDCONT=? -INFO: Fine, parser interpreted valid command AT+CGACT=1 -INFO: Fine, parser interpreted valid command AT+CGACT? -INFO: Fine, parser interpreted valid command AT+CGACT=? -INFO: Fine, parser interpreted valid command AT+CGMR -INFO: Fine, parser interpreted valid command AT+CGMR=? -INFO: Fine, parser interpreted valid command AT+CESQ -INFO: Fine, parser interpreted valid command AT+CESQ=? -INFO: Fine, parser interpreted valid command AT+CMEE=2 -INFO: Fine, parser interpreted valid command AT+CMEE? -INFO: Fine, parser interpreted valid command AT+CMEE=? -INFO: Fine, parser interpreted valid command AT+CLCK=SC,2 -INFO: Fine, parser interpreted valid command AT+CLCK=? -INFO: Fine, parser interpreted valid command AT+CREG=1 -INFO: Fine, parser interpreted valid command AT+CREG? -INFO: Fine, parser interpreted valid command AT+CREG=? -INFO: Fine, parser interpreted valid command AT+CEREG=1 -INFO: Fine, parser interpreted valid command AT+CEREG? -INFO: Fine, parser interpreted valid command AT+CEREG=? -INFO: Fine, parser interpreted valid command AT+CGATT=1 -INFO: Fine, parser interpreted valid command AT+CGATT? -INFO: Fine, parser interpreted valid command AT+CGATT=? -INFO: Fine, parser interpreted valid command AT -INFO: Fine, parser rejected the command AT+CGSN=3,4 -INFO: Fine, parser rejected the command AT+CGSN=?? -INFO: Fine, parser rejected the command AT+CGMI=1,b -INFO: Fine, parser rejected the command AT+CGMI== -INFO: Fine, parser rejected the command AT+CGMM? -INFO: Fine, parser rejected the command AT+CGMM==n -INFO: Fine, parser rejected the command AT+CIMI=4 -INFO: Fine, parser rejected the command AT+CIMI=?t -INFO: Fine, parser rejected the command AT+CFUN=n1,1 -INFO: Fine, parser rejected the command AT+CFUN?? -INFO: Fine, parser rejected the command AT+CFUN=a? -INFO: Fine, parser rejected the command AT+CPIN=1fd4 -INFO: Fine, parser rejected the command AT+CPIN=1sd+,432 -INFO: Fine, parser rejected the command AT+CPIN?4 -INFO: Fine, parser rejected the command AT+CPIN=?,? -INFO: Fine, parser rejected the command AT+CSQ=AT -INFO: Fine, parser rejected the command AT+CSQ=q -INFO: Fine, parser rejected the command AT+COPS=123121123123123123,EURECOMEURECOMEURECOMEURECOM -INFO: Fine, parser rejected the command AT+COPS=2asd3,33ads1 -INFO: Fine, parser rejected the command AT+COPS.=5 -INFO: Fine, parser rejected the command AT+COPS?/r\r -INFO: Fine, parser rejected the command AT+COPS=? - -INFO: Fine, parser rejected the command AT+CGREG=da1243"r -INFO: Fine, parser rejected the command AT+CGREG.? -INFO: Fine, parser rejected the command AT+CGREG1=? -INFO: Fine, parser rejected the command AT+CGDCONT=d31 -INFO: Fine, parser rejected the command AT+CGDCONTxc?\crca -INFO: Fine, parser rejected the command AT+CGDCONcTc=c? -INFO: Fine, parser rejected the command AT+CGA12C3T=11Sr -INFO: Fine, parser rejected the command AT+CGACT';;.,? -INFO: Fine, parser rejected the command AT+CGACT=?]\;e23 -INFO: Fine, parser rejected the command -INFO: Fine, parser rejected the command AT+COP -Note 1: Carriage return will be appended to every command by default -Note 2: Enter 'quit' to exit -AT Command> INFO: Parser interpreted command AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? - -AT Command> Exiting... diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out.bis b/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out.bis deleted file mode 100644 index 802433c742b82a63f08cf086ceec21ad9549533d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/at_parser.out.bis +++ /dev/null @@ -1,204 +0,0 @@ -INFO: Fine, parser interpreted valid command AT+CGSN -INFO: Fine, parser interpreted valid command AT+CGSN=? -INFO: Fine, parser interpreted valid command AT+CGMI -INFO: Fine, parser interpreted valid command AT+CGMI=? -INFO: Fine, parser interpreted valid command AT+CGMM -INFO: Fine, parser interpreted valid command AT+CGMM=? -INFO: Fine, parser interpreted valid command AT+CIMI -INFO: Fine, parser interpreted valid command AT+CIMI=? -INFO: Fine, parser interpreted valid command AT+CFUN=1,1 -INFO: Fine, parser interpreted valid command AT+CFUN=2 -INFO: Fine, parser interpreted valid command AT+CFUN? -INFO: Fine, parser interpreted valid command AT+CFUN=? -INFO: Fine, parser interpreted valid command AT+CPIN=1234 -INFO: Fine, parser interpreted valid command AT+CPIN=1234,4321 -INFO: Fine, parser interpreted valid command AT+CPIN? -INFO: Fine, parser interpreted valid command AT+CPIN=? -INFO: Fine, parser interpreted valid command AT+CSQ -INFO: Fine, parser interpreted valid command AT+CSQ=? -INFO: Fine, parser interpreted valid command AT+COPS=1,1,EURECOM -INFO: Fine, parser interpreted valid command AT+COPS=2,3 -INFO: Fine, parser interpreted valid command AT+COPS=5 -INFO: Fine, parser interpreted valid command AT+COPS? -INFO: Fine, parser interpreted valid command AT+COPS=? -INFO: Fine, parser interpreted valid command AT+CGREG=1 -INFO: Fine, parser interpreted valid command AT+CGREG? -INFO: Fine, parser interpreted valid command AT+CGREG=? -INFO: Fine, parser interpreted valid command AT+CGDCONT=1 -INFO: Fine, parser interpreted valid command AT+CGDCONT? -INFO: Fine, parser interpreted valid command AT+CGDCONT=? -INFO: Fine, parser interpreted valid command AT+CGACT=1 -INFO: Fine, parser interpreted valid command AT+CGACT? -INFO: Fine, parser interpreted valid command AT+CGACT=? -INFO: Fine, parser interpreted valid command AT+CGMR -INFO: Fine, parser interpreted valid command AT+CGMR=? -INFO: Fine, parser interpreted valid command AT+CESQ -INFO: Fine, parser interpreted valid command AT+CESQ=? -INFO: Fine, parser interpreted valid command AT+CMEE=2 -INFO: Fine, parser interpreted valid command AT+CMEE? -INFO: Fine, parser interpreted valid command AT+CMEE=? -INFO: Fine, parser interpreted valid command AT+CLCK=SC,2 -INFO: Fine, parser interpreted valid command AT+CLCK=? -INFO: Fine, parser interpreted valid command AT+CREG=1 -INFO: Fine, parser interpreted valid command AT+CREG? -INFO: Fine, parser interpreted valid command AT+CREG=? -INFO: Fine, parser interpreted valid command AT+CEREG=1 -INFO: Fine, parser interpreted valid command AT+CEREG? -INFO: Fine, parser interpreted valid command AT+CEREG=? -INFO: Fine, parser interpreted valid command AT+CGATT=1 -INFO: Fine, parser interpreted valid command AT+CGATT? -INFO: Fine, parser interpreted valid command AT+CGATT=? -INFO: Fine, parser interpreted valid command AT -INFO: Fine, parser rejected the command AT+CGSN=3,4 -INFO: Fine, parser rejected the command AT+CGSN=?? -INFO: Fine, parser rejected the command AT+CGMI=1,b -INFO: Fine, parser rejected the command AT+CGMI== -INFO: Fine, parser rejected the command AT+CGMM? -INFO: Fine, parser rejected the command AT+CGMM==n -INFO: Fine, parser rejected the command AT+CIMI=4 -INFO: Fine, parser rejected the command AT+CIMI=?t -INFO: Fine, parser rejected the command AT+CFUN=n1,1 -INFO: Fine, parser rejected the command AT+CFUN?? -INFO: Fine, parser rejected the command AT+CFUN=a? -INFO: Fine, parser rejected the command AT+CPIN=1fd4 -INFO: Fine, parser rejected the command AT+CPIN=1sd+,432 -INFO: Fine, parser rejected the command AT+CPIN?4 -INFO: Fine, parser rejected the command AT+CPIN=?,? -INFO: Fine, parser rejected the command AT+CSQ=AT -INFO: Fine, parser rejected the command AT+CSQ=q -INFO: Fine, parser rejected the command AT+COPS=123121123123123123,EURECOMEURECOMEURECOMEURECOM -INFO: Fine, parser rejected the command AT+COPS=2asd3,33ads1 -INFO: Fine, parser rejected the command AT+COPS.=5 -INFO: Fine, parser rejected the command AT+COPS?/r\r -INFO: Fine, parser rejected the command AT+COPS=? - -INFO: Fine, parser rejected the command AT+CGREG=da1243"r -INFO: Fine, parser rejected the command AT+CGREG.? -INFO: Fine, parser rejected the command AT+CGREG1=? -INFO: Fine, parser rejected the command AT+CGDCONT=d31 -INFO: Fine, parser rejected the command AT+CGDCONTxc?\crca -INFO: Fine, parser rejected the command AT+CGDCONcTc=c? -INFO: Fine, parser rejected the command AT+CGA12C3T=11Sr -INFO: Fine, parser rejected the command AT+CGACT';;.,? -INFO: Fine, parser rejected the command AT+CGACT=?]\;e23 -INFO: Fine, parser rejected the command -INFO: Fine, parser rejected the command AT+COP -Note 1: Carriage return will be appended to every command by default -Note 2: Enter 'quit' to exit -AT Command> INFO: Parser interpreted command ATE0Q0V1 - -AT Command> INFO: Parser interpreted command ATE0Q0V1 - -AT Command> ERROR: Parser rejected command ATS0=0 - -AT Command> INFO: Parser interpreted command AT+CMEE=1 - -AT Command> INFO: Parser interpreted command AT+CREG=2 - -AT Command> INFO: Parser interpreted command AT+CGREG=1 - -AT Command> ERROR: Parser rejected command AT+CCWA=1 - -AT Command> ERROR: Parser rejected command AT+CMOD=0 - -AT Command> ERROR: Parser rejected command AT+CSSN=0,1 - -AT Command> ERROR: Parser rejected command AT+COLP=0 - -AT Command> ERROR: Parser rejected command AT+CSCS="HEX" - -AT Command> ERROR: Parser rejected command AT+CUSD=1 - -AT Command> ERROR: Parser rejected command AT+CGEREP=1,0 - -AT Command> ERROR: Parser rejected command AT+CMGF=0 - -AT Command> INFO: Parser interpreted command AT+CFUN? - -AT Command> INFO: Parser interpreted command AT+CPIN? - -AT Command> ERROR: Parser rejected command AT+CSMS=1 - -AT Command> ERROR: Parser rejected command AT+CNMI=1,2,2,1,0 - -AT Command> INFO: Parser interpreted command AT+CFUN=0 - -AT Command> INFO: Parser interpreted command AT+CFUN=1 - -AT Command> INFO: Parser interpreted command AT+CPIN? - -AT Command> ERROR: Parser rejected command AT+CSMS=1 - -AT Command> ERROR: Parser rejected command AT+CNMI=1,2,2,1,0 - -AT Command> INFO: Parser interpreted command AT+CGSN - -AT Command> INFO: Parser interpreted command AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? - -AT Command> INFO: Parser interpreted command AT+CGREG? - -AT Command> INFO: Parser interpreted command AT+CREG? - -AT Command> INFO: Parser interpreted command AT+COPS? - -AT Command> ERROR: Parser rejected command AT+CLCC - -AT Command> INFO: Parser interpreted command AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? - -AT Command> INFO: Parser interpreted command AT+CGREG? - -AT Command> INFO: Parser interpreted command AT+CREG? - -AT Command> INFO: Parser interpreted command AT+COPS? - -AT Command> INFO: Parser interpreted command AT+COPS=0 - -AT Command> INFO: Parser interpreted command AT+COPS=3,0;+COPS?;+COPS=3,1;+COPS?;+COPS=3,2;+COPS? - -AT Command> INFO: Parser interpreted command AT+CGREG? - -AT Command> INFO: Parser interpreted command AT+CREG? - -AT Command> INFO: Parser interpreted command AT+COPS? - -AT Command> INFO: Parser interpreted command AT+CIMI - -AT Command> ERROR: Parser rejected command AT+CRSM=192,12258,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28480,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28617,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28589,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28618,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28433,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28619,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28435,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28486,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28621,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28613,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28472,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28438,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28437,0,0,15 - -AT Command> INFO: Parser interpreted command AT+CPIN? - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28439,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28436,0,0,15 - -AT Command> ERROR: Parser rejected command AT+CRSM=192,28440,0,0,15 - -AT Command> INFO: Parser interpreted command AT+CSQ - -AT Command> Exiting... diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/smartcom.txt b/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/smartcom.txt deleted file mode 100644 index 900f319254f6415adac613e3646e74e9683eeb80..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/tst/smartcom.txt +++ /dev/null @@ -1,23 +0,0 @@ -Fully implemented: -AT Command> INFO: Parser interpreted command AT+CGSN -AT Command> INFO: Parser interpreted command AT+CGMM -AT Command> INFO: Parser interpreted command AT+CGMI -AT Command> INFO: Parser interpreted command AT+CPIN? -AT Command> INFO: Parser interpreted command ATE0Q0V1+CMEE=1 -AT Command> INFO: Parser interpreted command AT+CFUN? -AT Command> INFO: Parser interpreted command AT+CFUN=1 -AT Command> INFO: Parser interpreted command AT+CIMI -AT Command> INFO: Parser interpreted command AT+COPS? -AT Command> ERROR: Parser rejected command AT+CREG -AT Command> INFO: Parser interpreted command AT+CGACT=1,1 -AT Command> INFO: Parser interpreted command AT+CGDCONT? - -Not implemented: -AT Command> ERROR: Parser rejected command AT+CNUM -AT Command> ERROR: Parser rejected command AT+CRSM -AT Command> ERROR: Parser rejected command AT+CGMR -AT Command> ERROR: Parser rejected command AT+CESQ -AT Command> ERROR: Parser rejected command AT+CNTI -AT Command> ERROR: Parser rejected command AT!BAND? -AT Command> ERROR: Parser rejected command AT+PACSP? - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.c b/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.c deleted file mode 100644 index f8a522de40bf25ee1746a8abcbf1bf4f950ad7b9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.c +++ /dev/null @@ -1,853 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source user_api.c - -Version 0.1 - -Date 2012/02/28 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer running in the UE - to send/receive message to/from the user application layer - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "user_api.h" -#include "nas_log.h" -#include "socket.h" -#include "device.h" -#include "nas_user.h" - -#include "at_command.h" -#include "at_response.h" -#include "at_error.h" - -#include "user_indication.h" - -#include <string.h> // strerror, memset -#include <netdb.h> // gai_strerror -#include <errno.h> // errno -#include <stdio.h> // sprintf -#include <unistd.h> // gethostname - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * Asynchronous notification procedure handlers - */ -static int _user_api_registration_handler(unsigned char id, const void* data, size_t size); -static int _user_api_location_handler(unsigned char id, const void* data, size_t size); -static int _user_api_network_handler(unsigned char id, const void* data, size_t size); -static int _user_api_pdn_connection_handler(unsigned char id, const void* data, size_t size); - -static int _user_api_send(at_response_t* data); - -/* ------------------- - * Connection endpoint - * ------------------- - * The connection endpoint is used to send/receive data to/from the - * user application layer. Its definition depends on the underlaying - * mechanism chosen to communicate (network socket, I/O terminal device). - * A connection endpoint is handled using an identifier, and functions - * used to retreive the file descriptor actually allocated by the system, - * to receive data, to send data, and to perform clean up when connection - * is shut down. - * Only one single end to end connection with the user is managed at a - * time. - */ -static struct { - /* Connection endpoint reference */ - void* endpoint; - /* Connection endpoint handlers */ - void* (*open) (int, const char*, const char*); - int (*getfd)(const void*); - ssize_t (*recv) (void*, char*, size_t); - ssize_t (*send) (const void*, const char*, size_t); - void (*close)(void*); -} _user_api_id; - -#define USER_API_OPEN(a, b, c) _user_api_id.open(a, b, c) -#define USER_API_GETFD() _user_api_id.getfd(_user_api_id.endpoint) -#define USER_API_RECV(a, b) _user_api_id.recv(_user_api_id.endpoint, a, b) -#define USER_API_SEND(a, b) _user_api_id.send(_user_api_id.endpoint, a, b) -#define USER_API_CLOSE() _user_api_id.close(_user_api_id.endpoint) - -/* - * The buffer used to receive data from the user application layer - */ -#define USER_API_RECV_BUFFER_SIZE 4096 -static char _user_api_recv_buffer[USER_API_RECV_BUFFER_SIZE]; - -/* - * The buffer used to send data to the user application layer - */ -#define USER_API_SEND_BUFFER_SIZE USER_API_RECV_BUFFER_SIZE -static char _user_api_send_buffer[USER_API_SEND_BUFFER_SIZE]; - -/* - * The decoded data received from the user application layer - */ -static struct { - int n_cmd; /* number of user data to be processed */ -#define USER_DATA_MAX 10 - at_command_t cmd[USER_DATA_MAX]; /* user data to be processed */ -} _user_data = {}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: user_api_initialize() ** - ** ** - ** Description: Initializes the user API from which the NAS layer ** - ** will send/receive messages to/from the user application ** - ** layer ** - ** ** - ** Inputs: host: The name of the host from which the user ** - ** application layer will connect ** - ** port: The local port number ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: _user_api_id ** - ** ** - ***************************************************************************/ -int user_api_initialize(const char* host, const char* port, - const char* devname, const char* devparams) -{ - LOG_FUNC_IN; - - gethostname(_user_api_send_buffer, USER_API_SEND_BUFFER_SIZE); - - if (devname != NULL) { - /* Initialize device handlers */ - _user_api_id.open = device_open; - _user_api_id.getfd = device_get_fd; - _user_api_id.recv = device_read; - _user_api_id.send = device_write; - _user_api_id.close = device_close; - - /* Initialize communication channel */ - _user_api_id.endpoint = USER_API_OPEN(DEVICE, devname, devparams); - - if (_user_api_id.endpoint == NULL) { - LOG_TRACE(ERROR, "USR-API - Failed to open connection endpoint, " - "%s", strerror(errno)); - LOG_FUNC_RETURN (RETURNerror); - } - - LOG_TRACE(INFO, "USR-API - User's communication device %d is OPENED " - "on %s/%s", user_api_get_fd(), _user_api_send_buffer, devname); - } else { - /* Initialize network socket handlers */ - _user_api_id.open = socket_udp_open; - _user_api_id.getfd = socket_get_fd; - _user_api_id.recv = socket_recv; - _user_api_id.send = socket_send; - _user_api_id.close = socket_close; - - /* Initialize communication channel */ - _user_api_id.endpoint = USER_API_OPEN(SOCKET_SERVER, host, port); - - if (_user_api_id.endpoint == NULL) { - const char* error = ( (errno < 0) ? - gai_strerror(errno) : strerror(errno) ); - LOG_TRACE(ERROR, "USR-API - Failed to open connection endpoint, " - "%s", error); - LOG_FUNC_RETURN (RETURNerror); - } - - LOG_TRACE(INFO, "USR-API - User's UDP socket %d is BOUND to %s/%s", - user_api_get_fd(), _user_api_send_buffer, port); - } - - /* Register the asynchronous notification handlers */ - if (user_ind_register(USER_IND_REG, 0, _user_api_registration_handler) != RETURNok) { - LOG_TRACE(WARNING, "USR-API - " - "Failed to register registration notification"); - } else if (user_ind_register(USER_IND_LOC, 0, _user_api_location_handler) != RETURNok) { - LOG_TRACE(WARNING, "USR-API - " - "Failed to register location notification"); - } else if (user_ind_register(USER_IND_PLMN, 0, _user_api_network_handler) != RETURNok) { - LOG_TRACE(WARNING, "USR-API - " - "Failed to register network notification"); - } else if (user_ind_register(USER_IND_PLMN, 0, NULL) != RETURNok) { - LOG_TRACE(WARNING, "USR-API - Failed to enable network notification"); - } else if (user_ind_register(USER_IND_PDN, 0, _user_api_pdn_connection_handler) != RETURNok) { - LOG_TRACE(WARNING, "USR-API - " - "Failed to register PDN connection notification"); - } else if (user_ind_register(USER_IND_PDN, AT_CGACT, NULL) != RETURNok) { - LOG_TRACE(WARNING, "USR-API - " - "Failed to enable PDN connection notification"); - } else { - LOG_TRACE(INFO, "USR-API - " - "Notification handlers successfully registered"); - } - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: user_api_get_fd() ** - ** ** - ** Description: Get the file descriptor of the connection endpoint used ** - ** to send/receive messages to/from the user application ** - ** layer ** - ** ** - ** Inputs: None ** - ** Others: _user_api_id ** - ** ** - ** Outputs: Return: The file descriptor of the connection end- ** - ** point used by the user application layer ** - ** Others: None ** - ** ** - ***************************************************************************/ -int user_api_get_fd(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (USER_API_GETFD()); -} - -/**************************************************************************** - ** ** - ** Name: user_api_get_data() ** - ** ** - ** Description: Get a generic pointer to the user data structure at the ** - ** given index. Casting to the proper type is necessary ** - ** before its usage. ** - ** ** - ** Inputs: index: Index of the user data structure to get ** - ** Others: _user_data ** - ** ** - ** Outputs: Return: A generic pointer to the user data ** - ** structure ** - ** Others: None ** - ** ** - ***************************************************************************/ -const void* user_api_get_data(int index) -{ - LOG_FUNC_IN; - - if (index < _user_data.n_cmd) { - LOG_FUNC_RETURN ((void*)(&_user_data.cmd[index])); - } - - LOG_FUNC_RETURN (NULL); -} - -/**************************************************************************** - ** ** - ** Name: user_api_read_data() ** - ** ** - ** Description: Read data received from the user application layer ** - ** ** - ** Inputs: fd: File descriptor of the connection endpoint ** - ** from which data have been received ** - ** Others: _user_api_id ** - ** ** - ** Outputs: Return: The number of bytes read when success; ** - ** RETURNerror Otherwise ** - ** Others: _user_api_recv_buffer, _user_api_id ** - ** ** - ***************************************************************************/ -int user_api_read_data(int fd) -{ - LOG_FUNC_IN; - - int rbytes; - - /* Sanity check */ - int sfd = user_api_get_fd(); - - if (fd != sfd) { - LOG_TRACE(ERROR, "USR-API - Endpoint %d is not the one created for communication with the user application layer (%d)", fd, sfd); - LOG_FUNC_RETURN (RETURNerror); - } - - memset(_user_api_recv_buffer, 0, USER_API_RECV_BUFFER_SIZE); - - /* Receive data from the user application layer */ - rbytes = USER_API_RECV(_user_api_recv_buffer, USER_API_RECV_BUFFER_SIZE); - - if (rbytes == RETURNerror) { - LOG_TRACE(ERROR, "USR-API - recv() failed, %s", strerror(errno)); - LOG_FUNC_RETURN (RETURNerror); - } else if (rbytes == 0) { - //LOG_TRACE(WARNING, "USR-API - A signal was caught"); - } else { - LOG_TRACE(INFO, "USR-API - %d bytes received " - "from the user application layer", rbytes); - LOG_DUMP(_user_api_recv_buffer, rbytes); - } - - LOG_FUNC_RETURN (rbytes); -} - -/**************************************************************************** - ** ** - ** Name: user_api_set_data() ** - ** ** - ** Description: Set content of data received buffer to allow loop back ** - ** ** - ** Inputs: message: Message to set into the received buffer ** - ** ** - ** Outputs: Return: The number of bytes write when success; ** - ** RETURNerror Otherwise ** - ** Others: _user_api_recv_buffer ** - ** ** - ***************************************************************************/ -int user_api_set_data(char *message) -{ - LOG_FUNC_IN; - - int rbytes; - - memset(_user_api_recv_buffer, 0, USER_API_RECV_BUFFER_SIZE); - - strncpy(_user_api_recv_buffer, message, USER_API_RECV_BUFFER_SIZE); - rbytes = strlen(_user_api_recv_buffer); - - LOG_TRACE(INFO, "USR-API - %d bytes write", rbytes); - LOG_DUMP(_user_api_recv_buffer, rbytes); - - LOG_FUNC_RETURN (rbytes); -} - -/**************************************************************************** - ** ** - ** Name: user_api_send_data() ** - ** ** - ** Description: Send data to the user application layer ** - ** ** - ** Inputs: fd: File descriptor of the connection endpoint ** - ** to which data have to be sent ** - ** length: Number of bytes to send ** - ** Others: _user_api_send_buffer, _user_api_id ** - ** ** - ** Outputs: Return: The number of bytes sent when success; ** - ** RETURNerror Otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _user_api_send_data(int length) -{ - int sbytes = USER_API_SEND(_user_api_send_buffer, length); - - if (sbytes == RETURNerror) { - LOG_TRACE(ERROR, "USR-API - send() failed, %s", strerror(errno)); - return RETURNerror; - } else if (sbytes == 0) { - LOG_TRACE(WARNING, "USR-API - A signal was caught"); - } else { - LOG_TRACE(INFO, "USR-API - %d bytes sent " - "to the user application layer", sbytes); - LOG_DUMP(_user_api_send_buffer, sbytes); - } - - return sbytes; -} -int user_api_send_data(int fd, int length) -{ - LOG_FUNC_IN; - - /* Sanity check */ - int sfd = user_api_get_fd(); - - if (fd != sfd) { - LOG_TRACE(ERROR, "USR-API - Endpoint %d is not the one created for communication with the user application layer (%d)", fd, sfd); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Send data to the user application layer */ - int sbytes = 0; - - if (length > 0) { - sbytes = _user_api_send_data(length); - } - - LOG_FUNC_RETURN (sbytes); -} - -/**************************************************************************** - ** ** - ** Name: user_api_close() ** - ** ** - ** Description: Close the user API from which the NAS layer sent/received ** - ** messages to/from the user application layer ** - ** ** - ** Inputs: fd: File descriptor of the connection endpoint ** - ** allocated by the system to communicate ** - ** with the user application layer ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: _user_api_id ** - ** ** - ***************************************************************************/ -void user_api_close(int fd) -{ - LOG_FUNC_IN; - - /* Sanity check */ - int sfd = user_api_get_fd(); - - if (fd != sfd) { - LOG_TRACE(ERROR, "USR-API - Endpoint %d is not the one created for communication with the user application layer (%d)", fd, sfd); - LOG_FUNC_OUT; - return; - } - - /* Cleanup the connection endpoint */ - USER_API_CLOSE(); - _user_api_id.endpoint = NULL; - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: user_api_decode_data() ** - ** ** - ** Description: Parses the message received from the user application ** - ** (mainly AT commands) and fills the user data structure. ** - ** Returns an AT syntax error code to the user application ** - ** layer when the AT command failed to be decoded. ** - ** ** - ** Inputs: length: Number of bytes to decode ** - ** Others: _user_api_recv_buffer ** - ** ** - ** Outputs: Return: The number of AT commands succeessfully ** - ** decoded ** - ** Others: _user_api_send_buffer, _user_data ** - ** ** - ***************************************************************************/ -int user_api_decode_data(int length) -{ - LOG_FUNC_IN; - - /* Parse the AT command line */ - LOG_TRACE(INFO, "USR-API - Decode user data: %s", _user_api_recv_buffer); - _user_data.n_cmd = at_command_decode(_user_api_recv_buffer, length, - _user_data.cmd); - - if (_user_data.n_cmd > 0) { - /* AT command data received from the user application layer - * has been successfully decoded */ - LOG_TRACE(INFO, "USR-API - %d AT command%s ha%s been successfully " - "decoded", _user_data.n_cmd, - (_user_data.n_cmd > 1) ? "s" : "", - (_user_data.n_cmd > 1) ? "ve" : "s"); - } else { - int bytes; - - /* Failed to decode AT command data received from the user - * application layer; Return syntax error code message */ - LOG_TRACE(ERROR, "USR-API - Syntax error: Failed to decode " - "AT command data %s", _user_api_recv_buffer); - - /* Encode the syntax error code message */ - bytes = at_error_encode(_user_api_send_buffer, AT_ERROR_SYNTAX, - AT_ERROR_OPERATION_NOT_SUPPORTED); - - /* Send the syntax error code message */ - (void) _user_api_send_data(bytes); - } - - LOG_FUNC_RETURN (_user_data.n_cmd); -} - -/**************************************************************************** - ** ** - ** Name: user_api_encode_data() ** - ** ** - ** Description: Encodes AT command response message ** - ** ** - ** Inputs data: Generic pointer to the data to encode ** - ** success_code: Indicates whether success code has to be ** - ** displayed or not (covers the case where ** - ** more than one AT command is executed in ** - ** the same user command line). ** - ** Others: None ** - ** ** - ** Outputs: Return: The number of characters that have been ** - ** successfully encoded; ** - ** RETURNerror otherwise. ** - ** Others: _user_api_send_buffer ** - ** ** - ***************************************************************************/ -int user_api_encode_data(const void* data, int success_code) -{ - LOG_FUNC_IN; - - const at_response_t* user_data = (at_response_t*)(data); - int bytes; - - /* Encode AT command error message */ - if (user_data->cause_code != AT_ERROR_SUCCESS) { - bytes = at_error_encode(_user_api_send_buffer, AT_ERROR_CME, - user_data->cause_code); - } - /* Encode AT command response message */ - else { - bytes = at_response_encode(_user_api_send_buffer, user_data); - - /* Add success result code */ - if ( (success_code) && (bytes != RETURNerror) ) { - bytes += at_error_encode(&_user_api_send_buffer[bytes], - AT_ERROR_OK, 0); - } - } - - if (bytes != RETURNerror) { - LOG_TRACE(INFO, "USR-API - %d bytes encoded", bytes); - } else { - LOG_TRACE(ERROR, "USR-API - Syntax error: Failed to encode AT " - "response data (%d)", user_data->id); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: user_api_callback() ** - ** ** - ** Description: Notifies the user application that asynchronous notifica- ** - ** tion has been received from the EPS Mobility Management ** - ** sublayer. ** - ** ** - ** Inputs: stat: Network registration status ** - ** tac: Location/Tracking Area Code ** - ** ci: Indentifier of the serving cell ** - ** AcT: Access Technology supported by the cell ** - ** data: Data string to display to the user ** - ** size: Size of the notification data (only used ** - ** to display string information to the user ** - ** application) ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int user_api_emm_callback(Stat_t stat, tac_t tac, ci_t ci, AcT_t AcT, - const char* data, size_t size) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - if (size > 1) { - /* - * The list of available operators present in the network has to be - * displayed to the user application - */ - rc = user_ind_notify(USER_IND_PLMN, (void*)data, size); - } else { - user_indication_t ind; - ind.notification.reg.status = stat; - - if (size > 0) { - /* The UE's network registration status has changed */ - rc = user_ind_notify(USER_IND_REG, (void*)&ind, 0); - } - - if (rc != RETURNerror) { - /* The UE's location area has changed or, - * the UE's network registration status has changed and - * only location information notification is enabled */ - ind.notification.loc.tac = tac; - ind.notification.loc.ci = ci; - ind.notification.loc.AcT = AcT; - rc = user_ind_notify(USER_IND_LOC, (void*)&ind, 0); - } - } - - if (rc != RETURNerror) { - LOG_FUNC_RETURN (RETURNok); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: user_api_esm_callback() ** - ** ** - ** Description: Notifies the user application that asynchronous notifica- ** - ** tion has been received from the EPS Session Management ** - ** sublayer. ** - ** ** - ** Inputs: cid: PDN connection identifier ** - ** state: PDN connection status ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int user_api_esm_callback(int cid, network_pdn_state_t state) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - user_indication_t ind; - ind.notification.pdn.cid = cid; - ind.notification.pdn.status = state; - /* The status of the specified PDN connection has changed */ - rc = user_ind_notify(USER_IND_PDN, (void*)&ind, 0); - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _user_api_send() ** - ** ** - ** Description: Encodes and sends data to the user application layer ** - ** ** - ** Inputs: data: The data to send ** - ** Others: _user_api_send_buffer, _user_api_id ** - ** ** - ** Outputs: Return: The number of bytes sent when success; ** - ** RETURNerror Otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _user_api_send(at_response_t* data) -{ - LOG_FUNC_IN; - - /* Encode AT command response message */ - int bytes = at_response_encode(_user_api_send_buffer, data); - - /* Send the AT command response message to the user application */ - if (bytes != RETURNerror) { - bytes = _user_api_send_data(bytes); - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _user_api_registration_handler() ** - ** ** - ** Description: Procedure executed upon receiving registration notifica- ** - ** tion whenever there is a change in the UE's network re- ** - ** gistration status in GERAN/UTRAN/E-UTRAN. ** - ** The network registration data are then displayed to the ** - ** user. ** - ** ** - ** Inputs: id: Network registration AT command identifier ** - ** data: Generic pointer to the registration data ** - ** size: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of bytes actually sent to the ** - ** user application ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _user_api_registration_handler(unsigned char id, const void* data, - size_t size) -{ - LOG_FUNC_IN; - - /* Get registration notification data */ - user_ind_reg_t* reg = (user_ind_reg_t*)data; - - /* Setup AT command response message for AT+CEREG? read command */ - at_response_t at_response; - at_response.id = id; // may be +CREG, +CGREG, +CEREG - at_response.type = AT_COMMAND_GET; - at_response.mask = AT_RESPONSE_NO_PARAM; - at_response.response.cereg.n = AT_CEREG_ON; - at_response.response.cereg.stat = reg->status; - - /* Encode and send the AT command response message to the user */ - int bytes = _user_api_send(&at_response); - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _user_api_location_handler() ** - ** ** - ** Description: Procedure executed upon receiving location notification ** - ** whenever there is a change in the network serving cell ** - ** in GERAN/UTRAN/E-UTRAN. ** - ** The location data are then displayed to the user. ** - ** ** - ** Inputs: id: Network registration AT command identifier ** - ** data: Generic pointer to the registration data ** - ** size: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of bytes actually sent to the ** - ** user application ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _user_api_location_handler(unsigned char id, const void* data, - size_t size) -{ - LOG_FUNC_IN; - - /* Get location notification data */ - user_ind_loc_t* loc = (user_ind_loc_t*)data; - - /* Setup AT command response message for AT+CEREG? read command */ - at_response_t at_response; - at_response.id = id; // may be +CREG, +CGREG, +CEREG - at_response.type = AT_COMMAND_GET; - at_response.mask = (AT_CEREG_RESP_TAC_MASK | AT_CEREG_RESP_CI_MASK); - at_response.response.cereg.n = AT_CEREG_BOTH; - at_response.response.cereg.stat = loc->status; - sprintf(at_response.response.cereg.tac, "%.4x", loc->tac); // two byte - sprintf(at_response.response.cereg.ci, "%.8x", loc->ci); // four byte - - if (at_response.response.cereg.AcT != NET_ACCESS_UNAVAILABLE) { - at_response.response.cereg.AcT = loc->AcT; - at_response.mask |= AT_CEREG_RESP_ACT_MASK; - } - - /* Encode and send the AT command response message to the user */ - int bytes = _user_api_send(&at_response); - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _user_api_network_handler() ** - ** ** - ** Description: Procedure executed whenever the list of operators present ** - ** in the network has to be displayed to the user. ** - ** ** - ** Inputs: id: Not used ** - ** data: Generic pointer to the list of operators ** - ** size: The size of the data to display ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of bytes actually sent to the ** - ** user application ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _user_api_network_handler(unsigned char id, const void* data, - size_t size) -{ - LOG_FUNC_IN; - - /* Setup AT command response message for AT+COPS=? test command */ - at_response_t at_response; - at_response.id = AT_COPS; - at_response.type = AT_COMMAND_TST; - at_response.response.cops.tst.data = (char*)data; - at_response.response.cops.tst.size = size; - - /* Encode and send the AT command response message to the user */ - int bytes = _user_api_send(&at_response); - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _user_api_pdn_connection_handler() ** - ** ** - ** Description: Procedure executed upon receiving PDN connection notifi- ** - ** cation whenever the user or the network has activated or ** - ** desactivated a PDN connection. ** - ** The PDN connection data are then displayed to the user. ** - ** ** - ** Inputs: id: Not used ** - ** data: Generic pointer to the PDN connection data ** - ** size: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of bytes actually sent to the ** - ** user application ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _user_api_pdn_connection_handler(unsigned char id, const void* data, - size_t size) -{ - LOG_FUNC_IN; - - /* Get PDN connection notification data */ - user_ind_pdn_t* pdn = (user_ind_pdn_t*)data; - - /* Setup AT command unsolicited result response message for +CGEV */ - at_response_t at_response; - at_response.id = AT_CGEV; - at_response.type = AT_COMMAND_GET; - at_response.mask = AT_RESPONSE_CGEV_MASK; - at_response.response.cgev.cid = pdn->cid; - at_response.response.cgev.code = pdn->status; - - /* Encode and send the AT command response message to the user */ - int bytes = _user_api_send(&at_response); - - LOG_FUNC_RETURN (bytes); -} - -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.h b/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.h deleted file mode 100644 index d58b59577df061d75a50fcdb58984c94ccc4e5f6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_api.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source user_api.h - -Version 0.1 - -Date 2012/02/28 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer running in the UE - to send/receive message to/from the user application layer - -*****************************************************************************/ -#ifndef __USER_API_H__ -#define __USER_API_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int user_api_initialize(const char* host, const char* port, const char* devname, const char* devparams); - -int user_api_emm_callback(Stat_t stat, tac_t tac, ci_t ci, AcT_t AcT, const char* data, size_t size); -int user_api_esm_callback(int cid, network_pdn_state_t state); - -int user_api_get_fd(void); -const void* user_api_get_data(int index); - -int user_api_read_data(int fd); -int user_api_set_data(char *message); -int user_api_send_data(int fd, int length); -void user_api_close(int fd); - -int user_api_decode_data(int length); -int user_api_encode_data(const void* data, int add_success_code); - -#endif /* __USER_API_H__ */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.c b/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.c deleted file mode 100644 index 79759a3253a573c35292680c4b9e2f50a359cbb1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.c +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source user_indication.c - -Version 0.1 - -Date 2012/10/25 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines functions which allow the user application to register - procedures to be executed upon receiving asynchronous notifi- - cation. - -*****************************************************************************/ - -#include "user_indication.h" -#include "nas_log.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* Notification handler */ -static struct { - unsigned char id; - unsigned char mask; - user_ind_callback_t callback[USER_IND_MAX]; -} _user_ind_handler = {}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: user_ind_register() ** - ** ** - ** Description: Register the specified procedure to be executed upon ** - ** receiving the given asynchronous notification ** - ** ** - ** Inputs: ind: The notification type ** - ** id: The notification identifier ** - ** cb: The procedure to register ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _user_ind_handler ** - ** ** - ***************************************************************************/ -int user_ind_register(user_ind_t ind, unsigned char id, user_ind_callback_t cb) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - if (ind < USER_IND_MAX) { - /* Register the notification callback */ - if (cb != NULL) { - _user_ind_handler.callback[ind] = cb; - } else { - _user_ind_handler.id = id; - _user_ind_handler.mask |= (1 << ind); - } - - rc = RETURNok; - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: user_ind_deregister() ** - ** ** - ** Description: Prevent a registered procedure from being executed upon ** - ** receiving the given asynchronous notification ** - ** ** - ** Inputs: ind: The notification identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _user_ind_handler ** - ** ** - ***************************************************************************/ -int user_ind_deregister(user_ind_t ind) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - if (ind < USER_IND_MAX) { - _user_ind_handler.mask &= ~(1 << ind); - rc = RETURNok; - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: user_ind_notify() ** - ** ** - ** Description: Execute the procedure if registered for the received ** - ** notification identifier ** - ** ** - ** Inputs: ind: The notification identifier ** - ** data: Generic pointer to the notification data ** - ** size: The size parameter of the registered call- ** - ** back procedure to execute ** - ** Others: _user_ind_handler ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int user_ind_notify(user_ind_t ind, const void* data, size_t size) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - if (ind < USER_IND_MAX) { - if (_user_ind_handler.mask & (1 << ind)) { - /* Execute the notification callback */ - user_ind_callback_t notify = _user_ind_handler.callback[ind]; - - if (notify != NULL) { - rc = (*notify)(_user_ind_handler.id, data, size); - } - } else { - /* Silently discard not registered notification */ - rc = RETURNok; - } - } - - LOG_FUNC_RETURN(rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.h b/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.h deleted file mode 100644 index 799b02114867e5268a5bd01ff71e9f4dab7314d2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/user/user_indication.h +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source user_indication.h - -Version 0.1 - -Date 2012/10/25 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Defines functions which allow the user application to register - procedures to be executed upon receiving asynchronous notifi- - cation. - -*****************************************************************************/ -#ifndef __USER_IND_H__ -#define __USER_IND_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Type of notification that may be asynchronously received by the user - */ -typedef enum { - USER_IND_REG = 0, /* Registration notification */ - USER_IND_LOC, /* Location notification */ - USER_IND_PLMN, /* Network notification */ - USER_IND_PDN, /* PDN connection notification */ - USER_IND_MAX -} user_ind_t; - -/* - * Registration notification are received whenever there is a change in the - * UE's network registration status in GERAN/UTRAN/E-UTRAN - */ -typedef struct { - Stat_t status; /* network registration status */ -} user_ind_reg_t; - -/* - * Location notification are received whenever there is a change in the - * network serving cell in GERAN/UTRAN/E-UTRAN - */ -typedef struct { - Stat_t status; /* network registration status */ - tac_t tac; /* Location/Tracking area code */ - ci_t ci; /* GERAN/UTRAN/E-UTRAN cell ID */ - AcT_t AcT; /* Supported Access Technology */ -} user_ind_loc_t; - -/* - * PDN connection notification are received whenever the user or the network - * has activated or desactivated a PDN connection - */ -typedef struct { - UInt8_t cid; /* PDN connection identifier */ - network_pdn_state_t status; /* PDN connection status */ -} user_ind_pdn_t; - -/* - * Structure of asynchronous notification received by the user - */ -typedef struct { - union { - user_ind_reg_t reg; /* Registration notification */ - user_ind_loc_t loc; /* Location notification */ - user_ind_pdn_t pdn; /* PDN connection notification */ - } notification; -} user_indication_t; - -/* - * Type of procedure executed upon receiving registered notification - */ -typedef int (*user_ind_callback_t) (unsigned char, const void*, size_t); - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int user_ind_register(user_ind_t ind, unsigned char id, user_ind_callback_t cb); -int user_ind_deregister(user_ind_t ind); -int user_ind_notify(user_ind_t ind, const void* data, size_t size); - -#endif /* __USER_IND_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/COPYING b/openair-cn/NAS/EURECOM-NAS/src/api/usim/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/Makefile b/openair-cn/NAS/EURECOM-NAS/src/api/usim/Makefile deleted file mode 100644 index 8e7c24a4c4b8098d06c90571ee82ef2b499f18d6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) -I$(EMMMSGDIR) -I$(ESMMSGDIR) -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -all: $(OBJS) - -%.o: %.c Makefile - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -clean: - $(RM) $(OBJS) *.bak *~ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.c b/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.c deleted file mode 100644 index 7670cbfc0b9e066f75b718380b8f7e86e13c1ea9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.c +++ /dev/null @@ -1,485 +0,0 @@ -/*------------------------------------------------------------------- - * Example algorithms f1, f1*, f2, f3, f4, f5, f5* - *------------------------------------------------------------------- - * - * A sample implementation of the example 3GPP authentication and - * key agreement functions f1, f1*, f2, f3, f4, f5 and f5*. This is - * a byte-oriented implementation of the functions, and of the block - * cipher kernel function Rijndael. - * - * This has been coded for clarity, not necessarily for efficiency. - * - * The functions f2, f3, f4 and f5 share the same inputs and have - * been coded together as a single function. f1, f1* and f5* are - * all coded separately. - * From 3GPP 35.206-900 - *-----------------------------------------------------------------*/ - -#include "aka_functions.h" -#include "nas_log.h" - -/*--------- Operator Variant Algorithm Configuration Field --------*/ -/*------- Insert your value of OP here -------*/ -/* PFT OP used currently in HSS (OPENAIRHSS/auc/kdf.c) */ -u8 OP[16] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, - 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 - }; -/*------- Insert your value of OP here -------*/ - -/*------------------------------------------------------------------- - * Algorithm f1 - *------------------------------------------------------------------- - * - * Computes network authentication code MAC-A from key K, random - * challenge RAND, sequence number SQN and authentication management - * field AMF. - * - *-----------------------------------------------------------------*/ -void f1 ( u8 k_pP[16], u8 rand_pP[16], u8 sqn_pP[6], u8 amf_pP[2], - u8 mac_a_pP[8] ) -{ - u8 op_c[16]; - u8 temp[16]; - u8 in1[16]; - u8 out1[16]; - u8 rijndaelInput[16]; - u8 i; - RijndaelKeySchedule( k_pP ); - ComputeOPc( op_c ); - - for (i=0; i<16; i++) - rijndaelInput[i] = rand_pP[i] ^ op_c[i]; - - RijndaelEncrypt( rijndaelInput, temp ); - - for (i=0; i<6; i++) { - in1[i] = sqn_pP[i]; - in1[i+8] = sqn_pP[i]; - } - - for (i=0; i<2; i++) { - in1[i+6] = amf_pP[i]; - in1[i+14] = amf_pP[i]; - } - - /* XOR op_c and in1, rotate by r1=64, and XOR * - * on the constant c1 (which is all zeroes) */ - for (i=0; i<16; i++) - rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i]; - - /* XOR on the value temp computed before */ - for (i=0; i<16; i++) - rijndaelInput[i] ^= temp[i]; - - RijndaelEncrypt( rijndaelInput, out1 ); - - for (i=0; i<16; i++) - out1[i] ^= op_c[i]; - - for (i=0; i<8; i++) - mac_a_pP[i] = out1[i]; - - return; -} /* end of function f1 */ - -/*------------------------------------------------------------------- - * Algorithms f2-f5 - *------------------------------------------------------------------- - * - * Takes key K and random challenge RAND, and returns response RES, - * confidentiality key CK, integrity key IK and anonymity key AK. - * - *-----------------------------------------------------------------*/ -void f2345 ( u8 k_pP[16], u8 rand_pP[16], - u8 res_pP[8], u8 ck_pP[16], u8 ik_pP[16], u8 ak_pP[6] ) -{ - u8 op_c[16]; - u8 temp[16]; - u8 out[16]; - u8 rijndaelInput[16]; - u8 i; - - LOG_TRACE(DEBUG, - "USIM-API - f2345 : in k[0..15]=%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", - k_pP[0],k_pP[1],k_pP[2], k_pP[3], k_pP[4], k_pP[5], k_pP[6], k_pP[7], - k_pP[8],k_pP[9],k_pP[10],k_pP[11],k_pP[12],k_pP[13],k_pP[14],k_pP[15]); - LOG_TRACE(DEBUG, - "USIM-API - f2345 : in rand[0..15]=%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", - rand_pP[0],rand_pP[1],rand_pP[2], rand_pP[3], rand_pP[4], rand_pP[5], rand_pP[6], rand_pP[7], - rand_pP[8],rand_pP[9],rand_pP[10],rand_pP[11],rand_pP[12],rand_pP[13],rand_pP[14],rand_pP[15]); - - RijndaelKeySchedule( k_pP ); - ComputeOPc( op_c ); - - for (i=0; i<16; i++) - rijndaelInput[i] = rand_pP[i] ^ op_c[i]; - - RijndaelEncrypt( rijndaelInput, temp ); - - /* To obtain output block OUT2: XOR OPc and TEMP, * - * rotate by r2=0, and XOR on the constant c2 (which * - * is all zeroes except that the last bit is 1). */ - for (i=0; i<16; i++) - rijndaelInput[i] = temp[i] ^ op_c[i]; - - rijndaelInput[15] ^= 1; - RijndaelEncrypt( rijndaelInput, out ); - - for (i=0; i<16; i++) - out[i] ^= op_c[i]; - - for (i=0; i<8; i++) - res_pP[i] = out[i+8]; - - for (i=0; i<6; i++) - ak_pP[i] = out[i]; - - LOG_TRACE(DEBUG, - "USIM-API - f2345 : out f2 res[0..7]=%02X%02X%02X%02X%02X%02X%02X%02X", - res_pP[0],res_pP[1],res_pP[2], res_pP[3], res_pP[4], res_pP[5], res_pP[6], res_pP[7]); - LOG_TRACE(DEBUG, - "USIM-API - f2345 : out f5 ak[0..5]=%02X%02X%02X%02X%02X%02X", - ak_pP[0],ak_pP[1],ak_pP[2], ak_pP[3], ak_pP[4], ak_pP[5]); - - /* To obtain output block OUT3: XOR OPc and TEMP, * - * rotate by r3=32, and XOR on the constant c3 (which * - * is all zeroes except that the next to last bit is 1). */ - for (i=0; i<16; i++) - rijndaelInput[(i+12) % 16] = temp[i] ^ op_c[i]; - - rijndaelInput[15] ^= 2; - RijndaelEncrypt( rijndaelInput, out ); - - for (i=0; i<16; i++) - out[i] ^= op_c[i]; - - for (i=0; i<16; i++) - ck_pP[i] = out[i]; - - LOG_TRACE(DEBUG, - "USIM-API - f2345 : out f3 ck_pP[0..7]=%02X%02X%02X%02X%02X%02X%02X%02X", - ck_pP[0],ck_pP[1],ck_pP[2], ck_pP[3], ck_pP[4], ck_pP[5], ck_pP[6], ck_pP[7]); - - /* To obtain output block OUT4: XOR OPc and TEMP, * - * rotate by r4=64, and XOR on the constant c4 (which * - * is all zeroes except that the 2nd from last bit is 1). */ - for (i=0; i<16; i++) - rijndaelInput[(i+8) % 16] = temp[i] ^ op_c[i]; - - rijndaelInput[15] ^= 4; - RijndaelEncrypt( rijndaelInput, out ); - - for (i=0; i<16; i++) - out[i] ^= op_c[i]; - - for (i=0; i<16; i++) - ik_pP[i] = out[i]; - - LOG_TRACE(DEBUG, - "USIM-API - f2345 : out f4 ik_pP[0..15]=%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", - ik_pP[0],ik_pP[1],ik_pP[2], ik_pP[3], ik_pP[4], ik_pP[5], ik_pP[6], ik_pP[7], - ik_pP[8],ik_pP[9],ik_pP[10],ik_pP[11],ik_pP[12],ik_pP[13],ik_pP[14],ik_pP[15]); - return; -} /* end of function f2345 */ - -/*------------------------------------------------------------------- - * Algorithm f1* - *------------------------------------------------------------------- - * - * Computes resynch authentication code MAC-S from key K, random - * challenge RAND, sequence number SQN and authentication management - * field AMF. - * - *-----------------------------------------------------------------*/ -void f1star( u8 k_pP[16], u8 rand_pP[16], u8 sqn_pP[6], u8 amf_pP[2], - u8 mac_s_pP[8] ) -{ - u8 op_c[16]; - u8 temp[16]; - u8 in1[16]; - u8 out1[16]; - u8 rijndaelInput[16]; - u8 i; - RijndaelKeySchedule( k_pP ); - ComputeOPc( op_c ); - - for (i=0; i<16; i++) - rijndaelInput[i] = rand_pP[i] ^ op_c[i]; - - RijndaelEncrypt( rijndaelInput, temp ); - - for (i=0; i<6; i++) { - in1[i] = sqn_pP[i]; - in1[i+8] = sqn_pP[i]; - } - - for (i=0; i<2; i++) { - in1[i+6] = amf_pP[i]; - in1[i+14] = amf_pP[i]; - } - - /* XOR op_c and in1, rotate by r1=64, and XOR * - * on the constant c1 (which is all zeroes) */ - for (i=0; i<16; i++) - rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i]; - - /* XOR on the value temp computed before */ - for (i=0; i<16; i++) - rijndaelInput[i] ^= temp[i]; - - RijndaelEncrypt( rijndaelInput, out1 ); - - for (i=0; i<16; i++) - out1[i] ^= op_c[i]; - - for (i=0; i<8; i++) - mac_s_pP[i] = out1[i+8]; - - return; -} /* end of function f1star */ - -/*------------------------------------------------------------------- - * Algorithm f5* - *------------------------------------------------------------------- - * - * Takes key K and random challenge RAND, and returns resynch - * anonymity key AK. - * - *-----------------------------------------------------------------*/ -void f5star( u8 k_pP[16], u8 rand_pP[16], - u8 ak_pP[6] ) -{ - u8 op_c[16]; - u8 temp[16]; - u8 out[16]; - u8 rijndaelInput[16]; - u8 i; - RijndaelKeySchedule( k_pP ); - ComputeOPc( op_c ); - - for (i=0; i<16; i++) - rijndaelInput[i] = rand_pP[i] ^ op_c[i]; - - RijndaelEncrypt( rijndaelInput, temp ); - - /* To obtain output block OUT5: XOR OPc and TEMP, * - * rotate by r5=96, and XOR on the constant c5 (which * - * is all zeroes except that the 3rd from last bit is 1). */ - for (i=0; i<16; i++) - rijndaelInput[(i+4) % 16] = temp[i] ^ op_c[i]; - - rijndaelInput[15] ^= 8; - RijndaelEncrypt( rijndaelInput, out ); - - for (i=0; i<16; i++) - out[i] ^= op_c[i]; - - for (i=0; i<6; i++) - ak_pP[i] = out[i]; - - return; -} /* end of function f5star */ -/*------------------------------------------------------------------- - * Function to compute OPc from OP and K. Assumes key schedule has - already been performed. - *-----------------------------------------------------------------*/ -void ComputeOPc( u8 op_c_pP[16] ) -{ - u8 i; - LOG_TRACE(DEBUG, - "USIM-API - ComputeOPc : OP[0..15]=%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", - OP[0],OP[1],OP[2], OP[3], OP[4], OP[5], OP[6], OP[7], - OP[8],OP[9],OP[10],OP[11],OP[12],OP[13],OP[14],OP[15]); - RijndaelEncrypt( OP, op_c_pP ); - - for (i=0; i<16; i++) - op_c_pP[i] ^= OP[i]; - - return; -} /* end of function ComputeOPc */ -/*-------------------- Rijndael round subkeys ---------------------*/ -u8 roundKeys[11][4][4]; -/*--------------------- Rijndael S box table ----------------------*/ -u8 S[256] = { - 99,124,119,123,242,107,111,197, 48, 1,103, 43,254,215,171,118, - 202,130,201,125,250, 89, 71,240,173,212,162,175,156,164,114,192, - 183,253,147, 38, 54, 63,247,204, 52,165,229,241,113,216, 49, 21, - 4,199, 35,195, 24,150, 5,154, 7, 18,128,226,235, 39,178,117, - 9,131, 44, 26, 27,110, 90,160, 82, 59,214,179, 41,227, 47,132, - 83,209, 0,237, 32,252,177, 91,106,203,190, 57, 74, 76, 88,207, - 208,239,170,251, 67, 77, 51,133, 69,249, 2,127, 80, 60,159,168, - 81,163, 64,143,146,157, 56,245,188,182,218, 33, 16,255,243,210, - 205, 12, 19,236, 95,151, 68, 23,196,167,126, 61,100, 93, 25,115, - 96,129, 79,220, 34, 42,144,136, 70,238,184, 20,222, 94, 11,219, - 224, 50, 58, 10, 73, 6, 36, 92,194,211,172, 98,145,149,228,121, - 231,200, 55,109,141,213, 78,169,108, 86,244,234,101,122,174, 8, - 186,120, 37, 46, 28,166,180,198,232,221,116, 31, 75,189,139,138, - 112, 62,181,102, 72, 3,246, 14, 97, 53, 87,185,134,193, 29,158, - 225,248,152, 17,105,217,142,148,155, 30,135,233,206, 85, 40,223, - 140,161,137, 13,191,230, 66,104, 65,153, 45, 15,176, 84,187, 22, -}; - -/*------- This array does the multiplication by x in GF(2^8) ------*/ -u8 Xtime[256] = { - 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, - 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, - 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, - 96, 98,100,102,104,106,108,110,112,114,116,118,120,122,124,126, - 128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158, - 160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190, - 192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222, - 224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254, - 27, 25, 31, 29, 19, 17, 23, 21, 11, 9, 15, 13, 3, 1, 7, 5, - 59, 57, 63, 61, 51, 49, 55, 53, 43, 41, 47, 45, 35, 33, 39, 37, - 91, 89, 95, 93, 83, 81, 87, 85, 75, 73, 79, 77, 67, 65, 71, 69, - 123,121,127,125,115,113,119,117,107,105,111,109, 99, 97,103,101, - 155,153,159,157,147,145,151,149,139,137,143,141,131,129,135,133, - 187,185,191,189,179,177,183,181,171,169,175,173,163,161,167,165, - 219,217,223,221,211,209,215,213,203,201,207,205,195,193,199,197, - 251,249,255,253,243,241,247,245,235,233,239,237,227,225,231,229 -}; -/*------------------------------------------------------------------- - * Rijndael key schedule function. Takes 16-byte key and creates - * all Rijndael's internal subkeys ready for encryption. - *-----------------------------------------------------------------*/ -void RijndaelKeySchedule( u8 key[16] ) -{ - u8 roundConst; - int i, j; - - /* first round key equals key */ - for (i=0; i<16; i++) - roundKeys[0][i & 0x03][i>>2] = key[i]; - - roundConst = 1; - - /* now calculate round keys */ - for (i=1; i<11; i++) { - roundKeys[i][0][0] = S[roundKeys[i-1][1][3]] - ^ roundKeys[i-1][0][0] ^ roundConst; - roundKeys[i][1][0] = S[roundKeys[i-1][2][3]] - ^ roundKeys[i-1][1][0]; - roundKeys[i][2][0] = S[roundKeys[i-1][3][3]] - ^ roundKeys[i-1][2][0]; - roundKeys[i][3][0] = S[roundKeys[i-1][0][3]] - ^ roundKeys[i-1][3][0]; - - for (j=0; j<4; j++) { - roundKeys[i][j][1] = roundKeys[i-1][j][1] ^ roundKeys[i][j][0]; - roundKeys[i][j][2] = roundKeys[i-1][j][2] ^ roundKeys[i][j][1]; - roundKeys[i][j][3] = roundKeys[i-1][j][3] ^ roundKeys[i][j][2]; - } - - /* update round constant */ - roundConst = Xtime[roundConst]; - } - - return; -} /* end of function RijndaelKeySchedule */ -/* Round key addition function */ -void KeyAdd(u8 state[4][4], u8 roundKeys[11][4][4], int round) -{ - int i, j; - - for (i=0; i<4; i++) - for (j=0; j<4; j++) - state[i][j] ^= roundKeys[round][i][j]; - - return; -} -/* Byte substitution transformation */ -int ByteSub(u8 state[4][4]) -{ - int i, j; - - for (i=0; i<4; i++) - for (j=0; j<4; j++) - state[i][j] = S[state[i][j]]; - - return 0; -} -/* Row shift transformation */ -void ShiftRow(u8 state[4][4]) -{ - u8 temp; - /* left rotate row 1 by 1 */ - temp = state[1][0]; - state[1][0] = state[1][1]; - state[1][1] = state[1][2]; - state[1][2] = state[1][3]; - state[1][3] = temp; - /* left rotate row 2 by 2 */ - temp = state[2][0]; - state[2][0] = state[2][2]; - state[2][2] = temp; - temp = state[2][1]; - state[2][1] = state[2][3]; - state[2][3] = temp; - /* left rotate row 3 by 3 */ - temp = state[3][0]; - state[3][0] = state[3][3]; - state[3][3] = state[3][2]; - state[3][2] = state[3][1]; - state[3][1] = temp; - return; -} -/* MixColumn transformation*/ -void MixColumn(u8 state[4][4]) -{ - u8 temp, tmp, tmp0; - int i; - - /* do one column at a time */ - for (i=0; i<4; i++) { - temp = state[0][i] ^ state[1][i] ^ state[2][i] ^ state[3][i]; - tmp0 = state[0][i]; - /* Xtime array does multiply by x in GF2^8 */ - tmp = Xtime[state[0][i] ^ state[1][i]]; - state[0][i] ^= temp ^ tmp; - tmp = Xtime[state[1][i] ^ state[2][i]]; - state[1][i] ^= temp ^ tmp; - tmp = Xtime[state[2][i] ^ state[3][i]]; - state[2][i] ^= temp ^ tmp; - tmp = Xtime[state[3][i] ^ tmp0]; - state[3][i] ^= temp ^ tmp; - } - - return; -} -/*------------------------------------------------------------------- - * Rijndael encryption function. Takes 16-byte input and creates - * 16-byte output (using round keys already derived from 16-byte - * key). - *-----------------------------------------------------------------*/ -void RijndaelEncrypt( u8 input[16], u8 output[16] ) -{ - u8 state[4][4]; - int i, r; - - /* initialise state array from input byte string */ - for (i=0; i<16; i++) - state[i & 0x3][i>>2] = input[i]; - - /* add first round_key */ - KeyAdd(state, roundKeys, 0); - - /* do lots of full rounds */ - for (r=1; r<=9; r++) { - ByteSub(state); - ShiftRow(state); - MixColumn(state); - KeyAdd(state, roundKeys, r); - } - - /* final round */ - ByteSub(state); - ShiftRow(state); - KeyAdd(state, roundKeys, r); - - /* produce output byte string from state array */ - for (i=0; i<16; i++) { - output[i] = state[i & 0x3][i>>2]; - } - - return; -} /* end of function RijndaelEncrypt */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.h b/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.h deleted file mode 100644 index 1bb4bbf021a6017c63144b9d18c3637dd3d97e77..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/aka_functions.h +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -typedef unsigned char u8; - -/*--------------------------- prototypes --------------------------*/ -void f1 ( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2], - u8 mac_a[8] ); -void f2345 ( u8 k[16], u8 rand[16], - u8 res[8], u8 ck[16], u8 ik[16], u8 ak[6] ); -void f1star( u8 k[16], u8 rand[16], u8 sqn[6], u8 amf[2], - u8 mac_s[8] ); -void f5star( u8 k[16], u8 rand[16], - u8 ak[6] ); -void ComputeOPc( u8 op_c[16] ); -void RijndaelKeySchedule( u8 key[16] ); -void RijndaelEncrypt( u8 input[16], u8 output[16] ); diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c b/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c deleted file mode 100644 index c9900ac68fdd3c139b5831c37fa47284a5ae5868..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.c +++ /dev/null @@ -1,406 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source usim_api.h - -Version 0.1 - -Date 2012/10/09 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer to read/write - data to/from the USIM application - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "usim_api.h" -#include "nas_log.h" -#include "memory.h" - -#include "aka_functions.h" -#include <string.h> // memcpy, memset -#include <stdlib.h> // malloc, free - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * The name of the file where are stored data of the USIM application - */ -#define USIM_API_NVRAM_FILENAME ".usim.nvram" - -/* - * The name of the environment variable which defines the directory - * where the USIM application file is located - */ -#define USIM_API_NVRAM_DIRNAME "USIM_DIR" - -/* - * Subscriber authentication security key - */ -#define USIM_API_K_SIZE 16 -#define USIM_API_K_VALUE "8BAF473F2F8FD09487CCCBD7097C6862" - -static UInt8_t _usim_api_k[USIM_API_K_SIZE]; - - -/* - * List of last used Sequence Numbers SQN - */ -static struct _usim_api_data_s { - /* Highest sequence number the USIM has ever accepted */ - UInt32_t sqn_ms; - /* List of the last used sequence numbers */ -#define USIM_API_SQN_LIST_SIZE 32 - UInt8_t n_sqns; - UInt32_t sqn[USIM_API_SQN_LIST_SIZE]; -} _usim_api_data; - -static UInt8_t _usim_api_hex_char_to_hex_value (char c); -static void _usim_api_hex_string_to_hex_value (UInt8_t *hex_value, const char *hex_string, int size); -static int _usim_api_check_sqn(UInt32_t seq, UInt8_t ind); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: usim_api_read() ** - ** ** - ** Description: Reads data from the USIM application ** - ** ** - ** Inputs: None ** - ** Others: File where are stored USIM data ** - ** ** - ** Outputs: data: Pointer to the USIM application data ** - ** Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -int usim_api_read(usim_data_t* data) -{ - LOG_FUNC_IN; - - /* Get USIM application pathname */ - char* path = memory_get_path(USIM_API_NVRAM_DIRNAME, - USIM_API_NVRAM_FILENAME); - - if (path == NULL) { - LOG_TRACE(ERROR, "USIM-API - Failed to get USIM pathname"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Read USIM application data */ - if (memory_read(path, data, sizeof(usim_data_t)) != RETURNok) { - LOG_TRACE(ERROR, "USIM-API - %s file is either not valid " - "or not present", path); - free(path); - LOG_FUNC_RETURN (RETURNerror); - } - - /* initialize the subscriber authentication security key */ - _usim_api_hex_string_to_hex_value(_usim_api_k, USIM_API_K_VALUE, USIM_API_K_SIZE); - - free(path); - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: usim_api_write() ** - ** ** - ** Description: Writes data to the USIM application ** - ** ** - ** Inputs: data: Pointer to the USIM application data ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -int usim_api_write(const usim_data_t* data) -{ - LOG_FUNC_IN; - - /* Get USIM application pathname */ - char* path = memory_get_path(USIM_API_NVRAM_DIRNAME, - USIM_API_NVRAM_FILENAME); - - if (path == NULL) { - LOG_TRACE(ERROR, "USIM-API - Failed to get USIM pathname"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Write USIM application data */ - if (memory_write(path, data, sizeof(usim_data_t)) != RETURNok) { - - LOG_TRACE(ERROR, "USIM-API - Unable to write USIM file %s", path); - free(path); - LOG_FUNC_RETURN (RETURNerror); - } - - free(path); - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: usim_api_authenticate() ** - ** ** - ** Description: Performs mutual authentication of the USIM to the network,** - ** checking whether authentication token AUTN can be accep- ** - ** ted. If so, returns an authentication response RES and ** - ** the ciphering and integrity keys. ** - ** In case of synch failure, returns a re-synchronization ** - ** token AUTS. ** - ** ** - ** 3GPP TS 31.102, section 7.1.1.1 ** - ** ** - ** Authentication and key generating function algorithms are ** - ** specified in 3GPP TS 35.206. ** - ** ** - ** Inputs: rand_pP: Random challenge number ** - ** autn_pP: Authentication token ** - ** AUTN = (SQN xor AK) || AMF || MAC ** - ** 48 16 64 bits ** - ** Others: Security key ** - ** ** - ** Outputs: auts_pP: Re-synchronization token ** - ** res_pP: Authentication response ** - ** ck_pP: Ciphering key ** - ** ik_pP Integrity key ** - ** ** - ** Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -int usim_api_authenticate(const OctetString* rand_pP, const OctetString* autn_pP, - OctetString* auts_pP, OctetString* res_pP, - OctetString* ck_pP, OctetString* ik_pP) -{ - LOG_FUNC_IN; - - int rc; - int i; - - LOG_TRACE(DEBUG, "USIM-API - rand :%s",dump_octet_string(rand_pP)); - LOG_TRACE(DEBUG, "USIM-API - autn :%s",dump_octet_string(autn_pP)); - - /* Compute the authentication response RES = f2K (RAND) */ - /* Compute the cipher key CK = f3K (RAND) */ - /* Compute the integrity key IK = f4K (RAND) */ - /* Compute the anonymity key AK = f5K (RAND) */ -#define USIM_API_AK_SIZE 6 - u8 ak[USIM_API_AK_SIZE]; - f2345(_usim_api_k, rand_pP->value, - res_pP->value, ck_pP->value, ik_pP->value, ak); - LOG_TRACE(DEBUG, "USIM-API - res(f2) :%s",dump_octet_string(res_pP)); - LOG_TRACE(DEBUG, "USIM-API - ck(f3) :%s",dump_octet_string(ck_pP)); - LOG_TRACE(DEBUG, "USIM-API - ik(f4) :%s",dump_octet_string(ik_pP)); - LOG_TRACE(DEBUG, "USIM-API - ak(f5) : %02X%02X%02X%02X%02X%02X", - ak[0],ak[1],ak[2],ak[3],ak[4],ak[5]); - - /* Retrieve the sequence number SQN = (SQN ⊕ AK) ⊕ AK */ -#define USIM_API_SQN_SIZE USIM_API_AK_SIZE - u8 sqn[USIM_API_SQN_SIZE]; - - for (i = 0; i < USIM_API_SQN_SIZE; i++) { - sqn[i] = autn_pP->value[i] ^ ak[i]; - } - - LOG_TRACE(DEBUG, "USIM-API - Retrieved SQN %02X%02X%02X%02X%02X%02X", - sqn[0],sqn[1],sqn[2],sqn[3],sqn[4],sqn[5]); - - /* Compute XMAC = f1K (SQN || RAND || AMF) */ -#define USIM_API_XMAC_SIZE 8 - u8 xmac[USIM_API_XMAC_SIZE]; - f1(_usim_api_k, rand_pP->value, sqn, &autn_pP->value[USIM_API_SQN_SIZE], xmac); - LOG_TRACE(DEBUG, - "USIM-API - Computed XMAC %02X%02X%02X%02X%02X%02X%02X%02X", - xmac[0],xmac[1],xmac[2],xmac[3], - xmac[4],xmac[5],xmac[6],xmac[7]); - - /* Compare the XMAC with the MAC included in AUTN */ -#define USIM_API_AMF_SIZE 2 - - if ( memcmp(xmac, &autn_pP->value[USIM_API_SQN_SIZE + USIM_API_AMF_SIZE], - USIM_API_XMAC_SIZE) != 0 ) { - LOG_TRACE(INFO, - "USIM-API - Comparing the XMAC with the MAC included in AUTN Failed"); - //LOG_FUNC_RETURN (RETURNerror); - } else { - LOG_TRACE(INFO, - "USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded"); - } - - /* Verify that the received sequence number SQN is in the correct range */ - rc = _usim_api_check_sqn(*(UInt32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]); - - if (rc != RETURNok) { - /* Synchronisation failure; compute the AUTS parameter */ - - /* Concealed value of the counter SQNms in the USIM: - * Conc(SQNMS) = SQNMS ⊕ f5*K(RAND) */ - f5star(_usim_api_k, rand_pP->value, ak); - -#define USIM_API_SQNMS_SIZE USIM_API_SQN_SIZE - u8 sqn_ms[USIM_API_SQNMS_SIZE]; - memset(sqn_ms, 0, USIM_API_SQNMS_SIZE); -#define USIM_API_SQN_MS_SIZE 3 - - for (i = 0; i < USIM_API_SQN_MS_SIZE; i++) { -#warning "LG:BUG HERE TODO" - sqn_ms[USIM_API_SQNMS_SIZE - i] = - ((UInt8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQN_MS_SIZE - i]; - } - - u8 sqnms[USIM_API_SQNMS_SIZE]; - - for (i = 0; i < USIM_API_SQNMS_SIZE; i++) { - sqnms[i] = sqn_ms[i] ^ ak[i]; - } - - LOG_TRACE(DEBUG, "USIM-API - SQNms %02X%02X%02X%02X%02X%02X", - sqnms[0],sqnms[1],sqnms[2],sqnms[3],sqnms[4],sqnms[5]); - - /* Synchronisation message authentication code: - * MACS = f1*K(SQNMS || RAND || AMF) */ -#define USIM_API_MACS_SIZE USIM_API_XMAC_SIZE - u8 macs[USIM_API_MACS_SIZE]; - f1star(_usim_api_k, rand_pP->value, sqn_ms, - &rand_pP->value[USIM_API_SQN_SIZE], macs); - LOG_TRACE(DEBUG, "USIM-API - MACS %02X%02X%02X%02X%02X%02X%02X%02X", - macs[0],macs[1],macs[2],macs[3], - macs[4],macs[5],macs[6],macs[7]); - - /* Synchronisation authentication token: - * AUTS = Conc(SQNMS) || MACS */ - memcpy(&auts_pP->value[0], sqnms, USIM_API_SQNMS_SIZE); - memcpy(&auts_pP->value[USIM_API_SQNMS_SIZE], macs, USIM_API_MACS_SIZE); - } - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _usim_api_hex_char_to_hex_value() ** - ** ** - ** Description: Converts an hexadecimal ASCII coded digit into its value. ** - ** ** - ** Inputs: c: A char holding the ASCII coded value ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: Converted value ** - ** Others: None ** - ** ** - ***************************************************************************/ -static UInt8_t _usim_api_hex_char_to_hex_value (char c) -{ - if (c >= 'A') { - /* Remove case bit */ - c &= ~('a' ^ 'A'); - - return (c - 'A' + 10); - } else { - return (c - '0'); - } -} - -/**************************************************************************** - ** ** - ** Name: _usim_api_hex_string_to_hex_value() ** - ** ** - ** Description: Converts an hexadecimal ASCII coded string into its value.** - ** ** - ** Inputs: hex_value: A pointer to the location to store the ** - ** conversion result ** - ** size: The size of hex_value in bytes ** - ** Others: None ** - ** ** - ** Outputs: hex_value: Converted value ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void _usim_api_hex_string_to_hex_value (UInt8_t *hex_value, const char *hex_string, int size) -{ - int i; - - for (i=0; i < size; i++) { - hex_value[i] = (_usim_api_hex_char_to_hex_value(hex_string[2 * i]) << 4) | _usim_api_hex_char_to_hex_value(hex_string[2 * i + 1]); - } -} - -/**************************************************************************** - ** ** - ** Name: _usim_api_check_sqn() ** - ** ** - ** Description: Verifies the freshness of sequence numbers to determine ** - ** whether the specified sequence number is in the correct ** - ** range and acceptabled by the USIM. ** - ** ** - ** 3GPP TS 33.102, Annex C.2 ** - ** ** - ** Inputs: seq: Sequence number value ** - ** ind: Index value ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _usim_api_check_sqn(UInt32_t seq, UInt8_t ind) -{ - /* TODO */ - return (RETURNok); -} - -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h b/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h deleted file mode 100644 index e2c09c41a6b16a4e0c4fdc11acf428f28f0bf70f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/api/usim/usim_api.h +++ /dev/null @@ -1,355 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source usim_api.h - -Version 0.1 - -Date 2012/10/09 - -Product NAS stack - -Subsystem Application Programming Interface - -Author Frederic Maurel - -Description Implements the API used by the NAS layer to read/write - data to/from the USIM application - -*****************************************************************************/ -#ifndef __USIM_API_H__ -#define __USIM_API_H__ - -#include "commonDef.h" -#include "networkDef.h" -#include "OctetString.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * USIM TLV parameter structure - * ---------------------------- - */ -#define USIM_TLV_T(SIZE) struct {UInt8_t type; UInt8_t length; Byte_t value[SIZE];} - -/* - * Non Access Stratum Configuration - * -------------------------------- - * TODO: To be encoded as BER-TLV - */ -typedef struct { - /* Determines the NAS signalling priority included in NAS - * messages */ -#define USIM_NAS_SIGNALLING_PRIORITY_TAG 0x80U - USIM_TLV_T(1) NAS_SignallingPriority; - /* Indicates whether the "NMO I, Network Mode of Operation I" - * indication is applied by the UE */ -#define USIM_NMO_I_BEHAVIOUR_TAG 0x81U - USIM_TLV_T(1) NMO_I_Behaviour; - /* Indicates whether attach with IMSI is performed when moving - * to a non-equivalent PLMN */ -#define USIM_ATTACH_WITH_IMSI_TAG 0x82U - USIM_TLV_T(1) AttachWithImsi; - /* Minimum value in minutes for the timer T controlling the - * periodic search for higher prioritized PLMNs */ -#define USIM_MINIMUM_PERIODIC_SEARCH_TIMER_TAG 0x83U - USIM_TLV_T(1) MinimumPeriodicSearchTimer; - /* Indicates whether the extended access barring is applicable - * for the UE */ -#define USIM_EXTENDED_ACCESS_BARRING_TAG 0x84U - USIM_TLV_T(1) ExtendedAccessBarring; - /* Indicates whether the timer T3245 and the related - * functionality is used by the UE */ -#define USIM_TIMER_T3245_BEHAVIOUR_TAG 0x85U - USIM_TLV_T(1) Timer_T3245_Behaviour; -} usim_nasconfig_t; - -/* - * Ciphering and Integrity Keys - * ---------------------------- - */ -typedef struct { - /* Key set identifier */ -#define USIM_KSI_MIN 0b000 -#define USIM_KSI_MAX 0b110 -#define USIM_KSI_NOT_AVAILABLE 0b111 - Byte_t ksi; - /* Cyphering key */ -#define USIM_CK_SIZE 16 - Byte_t ck[USIM_CK_SIZE]; - /* Integrity key */ -#define USIM_IK_SIZE 16 - Byte_t ik[USIM_IK_SIZE]; -} usim_keys_t; - -/* - * EPS NAS Security Context - * ------------------------ - * TODO: To be encoded as BER-TLV - */ -typedef struct { - /* Length of all subsequent data */ -#define USIM_EPS_NAS_SECURITY_CONTEXT_TAG 0xA0U - UInt8_t length; - /* Key set identifier KSI_ASME */ -#define USIM_KSI_ASME_TAG 0x80U - USIM_TLV_T(1) KSIasme; - /* ASME key (K_ASME) */ -#define USIM_K_ASME_TAG 0x81U -#define USIM_K_ASME_SIZE 32 - USIM_TLV_T(USIM_K_ASME_SIZE) Kasme; - /* Uplink NAS count */ -#define USIM_UL_NAS_COUNT_TAG 0x82U -#define USIM_UL_NAS_COUNT_SIZE 4 - USIM_TLV_T(USIM_UL_NAS_COUNT_SIZE) ulNAScount; - /* Downlink NAS count */ -#define USIM_DL_NAS_COUNT_TAG 0x83U -#define USIM_DL_NAS_COUNT_SIZE 4 - USIM_TLV_T(USIM_DL_NAS_COUNT_SIZE) dlNAScount; - /* Identifiers of selected NAS integrity and encryption - * algorithms */ -#define USIM_INT_ENC_ALGORITHMS_TAG 0x84U -#define USIM_INT_EIA0 0x00 -#define USIM_INT_EIA1 0x01 -#define USIM_INT_EIA2 0x02 -#define USIM_INT_EIA3 0x03 -#define USIM_INT_EIA4 0x04 -#define USIM_INT_EIA5 0x05 -#define USIM_INT_EIA6 0x06 -#define USIM_INT_EIA7 0x07 -#define USIM_ENC_EEA0 0x00 -#define USIM_ENC_EEA1 0x10 -#define USIM_ENC_EEA2 0x20 -#define USIM_ENC_EEA3 0x30 -#define USIM_ENC_EEA4 0x40 -#define USIM_ENC_EEA5 0x50 -#define USIM_ENC_EEA6 0x60 -#define USIM_ENC_EEA7 0x70 - USIM_TLV_T(1) algorithmID; -} usim_securityctx_t; - -/* - * Subcriber's Number structure - * ---------------------------- - */ -typedef struct { - Byte_t length; /* Length of BCD number/SSC contents */ - msisdn_t number; /* Mobile subscriber dialing number */ - Byte_t conf1_record_id; /* Configuration1 Record Identifier */ - Byte_t ext1_record_id; /* Extension1 Record Identifier */ -} usim_msisdn_t; - -/* - * PLMN Network Name structure - * --------------------------- - */ -typedef struct { - /* PLMN Full Name */ -#define USIM_PNN_FULLNAME_TAG 0x43U -#define USIM_PNN_FULLNAME_SIZE NET_FORMAT_LONG_SIZE - USIM_TLV_T(USIM_PNN_FULLNAME_SIZE) fullname; - /* PLMN Short Name */ -#define USIM_PNN_SHORTNAME_TAG 0x45U -#define USIM_PNN_SHORTNAME_SIZE NET_FORMAT_SHORT_SIZE - USIM_TLV_T(USIM_PNN_SHORTNAME_SIZE) shortname; -} usim_pnn_t; - -/* - * Operator PLMN List structure - * ---------------------------- - */ -typedef struct { - /* Tracking Area Identity range */ - plmn_t plmn; - tac_t start; - tac_t end; - /* PLMN Network Name Record Identifier */ - UInt8_t record_id; -} usim_opl_t; - -/* - * PLMN with Access Technology structure - * ------------------------------------- - */ -typedef struct { - plmn_t plmn; -#define USIM_ACT_GSM 0x8000 -#define USIM_ACT_COMPACT 0x4000 -#define USIM_ACT_CDMA_HRPD 0x2000 -#define USIM_ACT_CDMA_1xRTT 0x1000 -#define USIM_ACT_UTRAN 0x0080 -#define USIM_ACT_EUTRAN 0x0040 - UInt16_t AcT; -} usim_plmn_act_t; - -/* - * Location information structure - * ------------------------------ - */ -typedef struct { - UInt32_t tmsi; /* Temporary Mobile Subscriber Identity */ - lai_t lai; /* Location Area Identity */ - Byte_t reserved; /* Reserved for future use */ -#define USIM_LOCI_UPDATED 0x00 -#define USIM_LOCI_NOT_UPDATED 0x01 -#define USIM_LOCI_PLMN_NOT_ALLOWED 0x02 -#define USIM_LOCI_LA_NOT_ALLOWED 0x03 - Byte_t status; /* Location update status */ -} usim_loci_t; - -/* - * Packet Switched location information structure - * ---------------------------------------------- - */ -typedef struct { - UInt32_t p_tmsi; /* Packet Temporary Mobile Subscriber Identity */ - Byte_t signature[3]; /* P-TMSI signature value */ - RAI_t rai; /* Routing Area Identity */ -#define USIM_PSLOCI_UPDATED 0x00 -#define USIM_PSLOCI_NOT_UPDATED 0x01 -#define USIM_PSLOCI_PLMN_NOT_ALLOWED 0x02 -#define USIM_PSLOCI_LA_NOT_ALLOWED 0x03 - Byte_t status; /* Routing Area update status */ -} usim_psloci_t; - -/* - * EPS location information structure - * ---------------------------------- - */ -typedef struct { - GUTI_t guti; /* Globally Unique Temporary UE Identity */ - tai_t tai; /* Last visited registered Tracking Area Id */ -#define USIM_EPSLOCI_UPDATED 0x00 -#define USIM_EPSLOCI_NOT_UPDATED 0x01 -#define USIM_EPSLOCI_ROAMING_NOT_ALLOWED 0x02 - Byte_t status; /* EPS update status */ -} usim_epsloci_t; - -/* - * Administrative Data - * ------------------- - * Defines information concerning the mode of operation according to the - * type of USIM, such as normal (to be used by PLMN subscribers for 3G - * operations), type approval (to allow specific use of the ME during - * type approval procedures of e.g. the radio equipment), cell testing - * (to allow testing of a cell before commercial use of this cell), - * manufacturer specific (to allow the ME manufacturer to perform specific - * proprietary auto-test in its ME during e.g. maintenance phases). - * It also provides an indication about how some ME features shall work - * during normal operation as well as information about the length of the - * MNC, which is part of the International Mobile Subscriber Identity (IMSI). - */ -typedef struct { -#define USIM_NORMAL_MODE 0x00U -#define USIM_TYPE_APPROVAL_MODE 0x80U -#define USIM_NORMAL_SPECIFIC_MODE 0x01U -#define USIM_TYPE_APPROVAL_SPECIFIC_MODE 0x81U -#define USIM_MAINTENANCE_MODE 0x02U -#define USIM_CELL_TEST_MODE 0x04U - Byte_t UE_Operation_Mode; /* Mode of operation for the UE */ - UInt16_t Additional_Info; /* Additional information depending on - * the UE operation mode */ - Byte_t MNC_Length; /* Number of digits used for extracting - * the MNC from the IMSI */ -} usim_ad_t; - -/* - *--------------------------------------------------------------------------- - * Structure of the data handled by the USIM application - *--------------------------------------------------------------------------- - */ - -typedef struct { - /* - * Mandatory USIM configuration parameters - * --------------------------------------- - */ - imsi_t imsi; /* International Mobile Subscriber Identity */ - usim_keys_t keys; /* Ciphering and Integrity Keys */ - Byte_t hpplmn; /* Higher Priority PLMN search period */ -#define USIM_FPLMN_MAX 4 - plmn_t fplmn[USIM_FPLMN_MAX]; /* List of Forbidden PLMNs */ - usim_loci_t loci; /* Location Information */ - usim_psloci_t psloci; /* PS Location Information */ - usim_ad_t ad; /* Administrative Data */ - /* - * Optional USIM configuration parameters - * -------------------------------------- - */ - /* EPS NAS security context */ - usim_securityctx_t securityctx; - /* Subcriber's Number */ - usim_msisdn_t msisdn; - /* PLMN Network Name */ -#define USIM_PNN_MAX 8 - usim_pnn_t pnn[USIM_PNN_MAX]; - /* Operator PLMN List */ -#define USIM_OPL_MAX USIM_PNN_MAX - usim_opl_t opl[USIM_OPL_MAX]; - /* List of Equivalent HPLMNs */ -#define USIM_EHPLMN_MAX 2 - plmn_t ehplmn[USIM_EHPLMN_MAX]; - /* Home PLMN Selector with Access Technology */ - usim_plmn_act_t hplmn; - /* User controlled PLMN Selector with Access Technology */ -#define USIM_PLMN_MAX 8 - usim_plmn_act_t plmn[USIM_PLMN_MAX]; - /* Operator controlled PLMN Selector with Access Technology */ -#define USIM_OPLMN_MAX 8 - usim_plmn_act_t oplmn[USIM_OPLMN_MAX]; - /* EPS Location Information */ - usim_epsloci_t epsloci; - /* Non-Access Stratum configuration */ - usim_nasconfig_t nasconfig; -} usim_data_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int usim_api_read(usim_data_t* data); - -int usim_api_write(const usim_data_t* data); - -int usim_api_authenticate(const OctetString* rand, const OctetString* autn, - OctetString* auts, OctetString* res, - OctetString* ck, OctetString* ik); - -#endif /* __USIM_API_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Attach.c b/openair-cn/NAS/EURECOM-NAS/src/emm/Attach.c deleted file mode 100644 index a0b202142a9851fa95d95c97bc41b4131c259b9e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Attach.c +++ /dev/null @@ -1,2775 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source Attach.c - -Version 0.1 - -Date 2012/12/04 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the attach related EMM procedure executed by the - Non-Access Stratum. - - To get internet connectivity from the network, the network - have to know about the UE. When the UE is switched on, it - has to initiate the attach procedure to get initial access - to the network and register its presence to the Evolved - Packet Core (EPC) network in order to receive EPS services. - - As a result of a successful attach procedure, a context is - created for the UE in the MME, and a default bearer is esta- - blished between the UE and the PDN-GW. The UE gets the home - agent IPv4 and IPv6 addresses and full connectivity to the - IP network. - - The network may also initiate the activation of additional - dedicated bearers for the support of a specific service. - -*****************************************************************************/ - -#include "emm_proc.h" -#include "networkDef.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "emmData.h" - -#include "emm_sap.h" -#include "esm_sap.h" -#include "emm_cause.h" - -#include "NasSecurityAlgorithms.h" - -#ifdef NAS_MME -#include "mme_api.h" -#include "mme_config.h" -# if defined(NAS_BUILT_IN_EPC) -# include "nas_itti_messaging.h" -# endif -#endif - -#include <string.h> // memcmp, memcpy -#include <stdlib.h> // malloc, free - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* String representation of the EPS attach type */ -static const char *_emm_attach_type_str[] = { - "EPS", "IMSI", "EMERGENCY", "RESERVED" -}; - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the attach procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Timer handlers - */ -void *_emm_attach_t3410_handler(void *); -static void *_emm_attach_t3411_handler(void *); -static void *_emm_attach_t3402_handler(void *); - -/* - * Abnormal case attach procedure - */ -static void _emm_attach_abnormal_cases_bcd(emm_sap_t *); - -/* - * Internal data used for attach procedure - */ -static struct { -#define EMM_ATTACH_COUNTER_MAX 5 - unsigned int attempt_count; /* Counter used to limit the number of - * subsequently rejected attach attempts */ -} _emm_attach_data = {0}; -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the attach procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Timer handlers - */ -static void *_emm_attach_t3450_handler(void *); - -/* - * Functions that may initiate EMM common procedures - */ -static int _emm_attach_identify(void *); -static int _emm_attach_security(void *); -static int _emm_attach(void *); - -/* - * Abnormal case attach procedures - */ -static int _emm_attach_release(void *); -static int _emm_attach_reject(void *); -static int _emm_attach_abort(void *); - -static int _emm_attach_have_changed(const emm_data_context_t *ctx, - emm_proc_attach_type_t type, int ksi, - GUTI_t *guti, imsi_t *imsi, imei_t *imei, - int eea, int eia, int ucs2, int uea, int uia, int gea, - int umts_present, int gprs_present); -static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid, - emm_proc_attach_type_t type, int ksi, - GUTI_t *guti, imsi_t *imsi, imei_t *imei, - int eea, int eia, int ucs2, int uea, int uia, int gea, - int umts_present, int gprs_present, - const OctetString *esm_msg_pP); - -/* - * Internal data used for attach procedure - */ -typedef struct attach_data_s { - unsigned int ueid; /* UE identifier */ -#define ATTACH_COUNTER_MAX 5 - unsigned int retransmission_count; /* Retransmission counter */ - OctetString esm_msg; /* ESM message to be sent within - * the Attach Accept message */ -} attach_data_t; - -static int _emm_attach_accept(emm_data_context_t *emm_ctx, attach_data_t *data); - -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Attach procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_proc_attach() ** - ** ** - ** Description: Initiate EPS attach procedure to register a UE in PS mode ** - ** of operation for EPS services only, or register a UE for ** - ** emergency bearer services. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.2 ** - ** In state EMM-DEREGISTERED, the UE initiates the attach ** - ** procedure by sending an ATTACH REQUEST message to the MME,** - ** starting timer T3410 and entering state EMM-REGISTERED- ** - ** INITIATED. ** - ** ** - ** Inputs: type: Type of the requested attach ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3402, T3410, T3411 ** - ** ** - ***************************************************************************/ -int emm_proc_attach(emm_proc_attach_type_t type) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - emm_as_establish_t *emm_as = &emm_sap.u.emm_as.u.establish; - esm_sap_t esm_sap; - int rc; - - LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach type = %s (%d)", - _emm_attach_type_str[type], type); - - /* Update the emergency bearer service indicator */ - if (type == EMM_ATTACH_TYPE_EMERGENCY) { - _emm_data.is_emergency = TRUE; - } - - /* Setup initial NAS information message to transfer */ - emm_as->NASinfo = EMM_AS_NAS_INFO_ATTACH; - /* Set the attach type */ - emm_as->type = type; - - /* Set the RRC connection establishment cause */ - if (_emm_data.is_emergency) { - emm_as->RRCcause = NET_ESTABLISH_CAUSE_EMERGENCY; - emm_as->RRCtype = NET_ESTABLISH_TYPE_EMERGENCY_CALLS; - } else { - emm_as->RRCcause = NET_ESTABLISH_CAUSE_MO_SIGNAL; - emm_as->RRCtype = NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL; - } - - /* Set the PLMN identifier of the selected PLMN */ - emm_as->plmnID = &_emm_data.splmn; - /* - * Process the EPS mobile identity - */ - emm_as->UEid.guti = NULL; - emm_as->UEid.tai = NULL; - emm_as->UEid.imsi = NULL; - emm_as->UEid.imei = NULL; - - /* Check whether the UE is configured for "AttachWithIMSI" */ - if (_emm_data.AttachWithImsi) { - /* Check whether the selected PLMN is neither the registered PLMN - * nor in the list of equivalent PLMNs */ - if ( (!_emm_data.is_rplmn) && (!_emm_data.is_eplmn) ) { - LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI"); - /* Include the IMSI */ - emm_as->UEid.imsi = _emm_data.imsi; - } else { - LOG_TRACE(INFO, - "EMM-PROC - Initiate EPS attach with NO IMSI, is registered PLMN %d, is equivalent PLMN %d", - _emm_data.is_rplmn, - _emm_data.is_eplmn); - } - } else if (_emm_data.guti) { - LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with GUTI"); - /* Include a valid GUTI and the last visited registered TAI */ - emm_as->UEid.guti = _emm_data.guti; - emm_as->UEid.tai = _emm_data.tai; - } else if (!_emm_data.is_emergency) { - LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is no emergency and no GUTI"); - /* Include the IMSI if no valid GUTI is available */ - emm_as->UEid.imsi = _emm_data.imsi; - } else { - /* The UE is attaching for emergency bearer services and - * does not hold a valid GUTI */ - if (_emm_data.imsi) { - /* Include the IMSI if valid (USIM is present) */ - LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI"); - emm_as->UEid.imsi = _emm_data.imsi; - } else { - LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach with IMSI cause is emergency and no GUTI and no IMSI"); - /* Include the IMEI if the IMSI is not valid */ - emm_as->UEid.imei = _emm_data.imei; - } - } - - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_as->sctx, _emm_data.security, FALSE, FALSE); - emm_as->ksi = EMM_AS_NO_KEY_AVAILABLE; - - if (_emm_data.security) { - if (_emm_data.security->type != EMM_KSI_NOT_AVAILABLE) { - emm_as->ksi = _emm_data.security->eksi; - } - - LOG_TRACE(INFO, "EMM-PROC - eps_encryption 0x%X", _emm_data.security->capability.eps_encryption); - LOG_TRACE(INFO, "EMM-PROC - eps_integrity 0x%X", _emm_data.security->capability.eps_integrity); - emm_as->encryption = _emm_data.security->capability.eps_encryption; - emm_as->integrity = _emm_data.security->capability.eps_integrity; - } - - /* - * Notify ESM that initiation of a PDN connectivity procedure - * is requested to setup a default EPS bearer - */ - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ; - esm_sap.is_standalone = FALSE; - esm_sap.data.pdn_connect.is_defined = TRUE; - esm_sap.data.pdn_connect.cid = 1; - /* TODO: PDN type should be set according to the IP capability of the UE */ - esm_sap.data.pdn_connect.pdn_type = NET_PDN_TYPE_IPV4V6; - esm_sap.data.pdn_connect.apn = NULL; - esm_sap.data.pdn_connect.is_emergency = _emm_data.is_emergency; - rc = esm_sap_send(&esm_sap); - - if (rc != RETURNerror) { - /* Setup EMM procedure handler to be executed upon receiving - * lower layer notification */ - rc = emm_proc_lowerlayer_initialize(emm_proc_attach_request, - emm_proc_attach_failure, - emm_proc_attach_release, NULL); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Start T3410 timer */ - T3410.id = nas_timer_start(T3410.sec, _emm_attach_t3410_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3410 (%d) expires in %ld seconds", - T3410.id, T3410.sec); - /* Stop T3402 and T3411 timers if running */ - T3402.id = nas_timer_stop(T3402.id); - T3411.id = nas_timer_stop(T3411.id); - - /* - * Notify EMM-AS SAP that a RRC connection establishment procedure - * is requested from the Access-Stratum to send initial NAS message - * attach request to the network - */ - emm_sap.primitive = EMMAS_ESTABLISH_REQ; - /* Get the PDN connectivity request to transfer within the ESM - * container of the initial attach request message */ - emm_sap.u.emm_as.u.establish.NASmsg = esm_sap.send; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_request() ** - ** ** - ** Description: Performs the attach procedure upon receipt of indication ** - ** from lower layers that Attach Request message has been ** - ** successfully delivered to the network. ** - ** ** - ** Inputs: args: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_attach_request(void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify EMM that Attach Request has been sent to the network - */ - emm_sap.primitive = EMMREG_ATTACH_REQ; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_accept() ** - ** ** - ** Description: Performs the attach procedure accepted by the network. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.4 ** - ** Upon receiving the ATTACH ACCEPT message, the UE shall ** - ** stop timer T3410 and send an ATTACH COMPLETE message to ** - ** the MME. ** - ** ** - ** Inputs: t3412: Value of the T3412 timer in seconds ** - ** t3402: Value of the T3402 timer in seconds ** - ** t3423: Value of the T3423 timer in seconds ** - ** n_tais: Number of tracking area identities contai- ** - ** ned in the TAI list ** - ** tai: The TAI list that identifies the tracking ** - ** areas the UE is registered to ** - ** guti: New UE's temporary identity assigned by ** - ** the MME (GUTI reallocation) ** - ** n_eplmns: Number of equivalent PLMNs ** - ** eplmns: List of equivalent PLMNs ** - ** esm_msg_pP: Activate default EPS bearer context re- ** - ** quest ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, T3412, T3402, T3423 ** - ** ** - ***************************************************************************/ -int emm_proc_attach_accept(long t3412, long t3402, long t3423, - int n_tais, tai_t *tai, GUTI_t *guti, - int n_eplmns, plmn_t *eplmn, - const OctetString *esm_msg_pP) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - esm_sap_t esm_sap; - int rc; - int i; - int j; - - LOG_TRACE(INFO, "EMM-PROC - EPS attach accepted by the network"); - - /* Stop timer T3410 */ - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id); - T3410.id = nas_timer_stop(T3410.id); - - /* Delete old TAI list and store the received TAI list */ - _emm_data.ltai.n_tais = n_tais; - - for (i = 0; (i < n_tais) && (i < EMM_DATA_TAI_MAX); i++) { - _emm_data.ltai.tai[i] = tai[i]; - } - - /* Update periodic tracking area update timer value */ - T3412.sec = t3412; - - /* Update attach failure timer value */ - if ( !(t3402 < 0) ) { - T3402.sec = t3402; - } - - /* Update E-UTRAN deactivate ISR timer value */ - if ( !(t3423 < 0) ) { - T3423.sec = t3423; - } - - /* Delete old GUTI and store the new assigned GUTI if provided */ - if (guti) { - *_emm_data.guti = *guti; - } - - /* Update the stored list of equivalent PLMNs */ - _emm_data.nvdata.eplmn.n_plmns = 0; - - if (n_eplmns > 0) { - for (i = 0; (i < n_eplmns) && (i < EMM_DATA_EPLMN_MAX); i++) { - int is_forbidden = FALSE; - - if (!_emm_data.is_emergency) { - /* If the attach procedure is not for emergency bearer - * services, the UE shall remove from the list any PLMN - * code that is already in the list of forbidden PLMNs */ - for (j = 0; j < _emm_data.fplmn.n_plmns; j++) { - if (PLMNS_ARE_EQUAL(eplmn[i], _emm_data.fplmn.plmn[j])) { - is_forbidden = TRUE; - break; - } - } - } - - if ( !is_forbidden ) { - _emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] = - eplmn[i]; - } - } - - /* Add the PLMN code of the registered PLMN that sent the list */ - if (_emm_data.nvdata.eplmn.n_plmns < EMM_DATA_EPLMN_MAX) { - _emm_data.nvdata.eplmn.plmn[_emm_data.nvdata.eplmn.n_plmns++] = - _emm_data.splmn; - } - } - - /* - * Notify ESM that a default EPS bearer has to be activated - */ - esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ; - esm_sap.is_standalone = FALSE; - esm_sap.recv = esm_msg_pP; - rc = esm_sap_send(&esm_sap); - - if ( (rc != RETURNerror) && (esm_sap.err == ESM_SAP_SUCCESS) ) { - /* Setup EMM procedure handler to be executed upon receiving - * lower layer notification */ - rc = emm_proc_lowerlayer_initialize(emm_proc_attach_complete, - emm_proc_attach_failure, - NULL, NULL); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, - "EMM-PROC - Failed to initialize EMM procedure handler"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Notify EMM-AS SAP that Attach Complete message together with - * an Activate Default EPS Bearer Context Accept message has to - * be sent to the network - */ - emm_sap.primitive = EMMAS_DATA_REQ; - emm_sap.u.emm_as.u.data.guti = _emm_data.guti; - emm_sap.u.emm_as.u.data.ueid = 0; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx, - _emm_data.security, FALSE, TRUE); - /* Get the activate default EPS bearer context accept message - * to be transfered within the ESM container of the attach - * complete message */ - emm_sap.u.emm_as.u.data.NASinfo = EMM_AS_NAS_DATA_ATTACH; - emm_sap.u.emm_as.u.data.NASmsg = esm_sap.send; - rc = emm_sap_send(&emm_sap); - } else if (esm_sap.err != ESM_SAP_DISCARDED) { - /* 3GPP TS 24.301, section 5.5.1.2.6, case j - * If the ACTIVATE DEFAULT BEARER CONTEXT REQUEST message combined - * with the ATTACH ACCEPT is not accepted by the UE due to failure - * in the UE ESM sublayer, then the UE shall initiate the detach - * procedure by sending a DETACH REQUEST message to the network. - */ - emm_sap.primitive = EMMREG_DETACH_INIT; - rc = emm_sap_send(&emm_sap); - } else { - /* - * ESM procedure failed and, received message has been discarded or - * Status message has been returned; ignore ESM procedure failure - */ - rc = RETURNok; - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_reject() ** - ** ** - ** Description: Performs the attach procedure rejected by the network. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.5 ** - ** Upon receiving the ATTACH REJECT message, the UE shall ** - ** stop timer T3410 and take actions depending on the EMM ** - ** cause value received. ** - ** ** - ** Inputs: emm_cause: EMM cause indicating why the network re- ** - ** jected the attach request ** - ** esm_msg_pP: PDN connectivity reject ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, _emm_attach_data, T3410 ** - ** ** - ***************************************************************************/ -int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg_pP) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - EPS attach rejected by the network, " - "EMM cause = %d", emm_cause); - - /* Stop timer T3410 */ - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id); - T3410.id = nas_timer_stop(T3410.id); - - /* Update the EPS update status, the GUTI, the visited registered TAI and - * the eKSI */ - switch (emm_cause) { - case EMM_CAUSE_ILLEGAL_UE: - case EMM_CAUSE_ILLEGAL_ME: - case EMM_CAUSE_EPS_NOT_ALLOWED: - case EMM_CAUSE_BOTH_NOT_ALLOWED: - case EMM_CAUSE_PLMN_NOT_ALLOWED: - case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN: - case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN: - case EMM_CAUSE_TA_NOT_ALLOWED: - case EMM_CAUSE_ROAMING_NOT_ALLOWED: - case EMM_CAUSE_NO_SUITABLE_CELLS: - /* Set the EPS update status to EU3 ROAMING NOT ALLOWED */ - _emm_data.status = EU3_ROAMING_NOT_ALLOWED; - /* Delete the GUTI */ - _emm_data.guti = NULL; - /* Delete the last visited registered TAI */ - _emm_data.tai = NULL; - - /* Delete the eKSI */ - if (_emm_data.security) { - _emm_data.security->type = EMM_KSI_NOT_AVAILABLE; - } - - break; - - default : - break; - } - - /* Update list of equivalents PLMNs and attach attempt counter */ - switch (emm_cause) { - case EMM_CAUSE_ILLEGAL_UE: - case EMM_CAUSE_ILLEGAL_ME: - case EMM_CAUSE_EPS_NOT_ALLOWED: - case EMM_CAUSE_BOTH_NOT_ALLOWED: - /* Consider the USIM as invalid for EPS services */ - _emm_data.usim_is_valid = FALSE; - /* Delete the list of equivalent PLMNs */ - _emm_data.nvdata.eplmn.n_plmns = 0; - break; - - case EMM_CAUSE_PLMN_NOT_ALLOWED: - case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN: - case EMM_CAUSE_ROAMING_NOT_ALLOWED: - /* Delete the list of equivalent PLMNs */ - _emm_data.nvdata.eplmn.n_plmns = 0; - /* Reset the attach attempt counter */ - _emm_attach_data.attempt_count = 0; - break; - - case EMM_CAUSE_TA_NOT_ALLOWED: - case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN: - case EMM_CAUSE_NO_SUITABLE_CELLS: - /* Reset the attach attempt counter */ - _emm_attach_data.attempt_count = 0; - break; - - case EMM_CAUSE_ESM_FAILURE: - - /* 3GPP TS 24.301, section 5.5.1.2.6, case d */ - if (_emm_data.NAS_SignallingPriority != 1) { - /* The UE is not configured for NAS signalling low priority; - * set the attach attempt counter to 5 */ - _emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX; - } - - break; - - case EMM_CAUSE_SEMANTICALLY_INCORRECT: - case EMM_CAUSE_INVALID_MANDATORY_INFO: - case EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED: - case EMM_CAUSE_IE_NOT_IMPLEMENTED: - case EMM_CAUSE_PROTOCOL_ERROR: - /* 3GPP TS 24.301, section 5.5.1.2.6, case d - * Set the attach attempt counter to 5 */ - _emm_attach_data.attempt_count = EMM_ATTACH_COUNTER_MAX; - break; - - default : - break; - } - - /* Update "forbidden lists" */ - switch (emm_cause) { - case EMM_CAUSE_PLMN_NOT_ALLOWED: - case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN: - /* Store the PLMN identity in the "forbidden PLMN list" */ - _emm_data.fplmn.plmn[_emm_data.fplmn.n_plmns++] = _emm_data.splmn; - break; - - case EMM_CAUSE_TA_NOT_ALLOWED: - /* Store the current TAI in the list of "forbidden tracking - * areas for regional provision of service" */ - _emm_data.ftai.tai[_emm_data.ftai.n_tais++] = *_emm_data.tai; - break; - - case EMM_CAUSE_ROAMING_NOT_ALLOWED: - /* Store the current TAI in the list of "forbidden tracking - * areas for roaming" */ - _emm_data.ftai_roaming.tai[_emm_data.ftai_roaming.n_tais++] = *_emm_data.tai; - break; - - case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN: - /* Store the PLMN identity in the "forbidden PLMNs for GPRS - * service" list */ - _emm_data.fplmn_gprs.plmn[_emm_data.fplmn_gprs.n_plmns++] = _emm_data.splmn; - break; - - default : - break; - } - - /* Update state of EMM sublayer */ - switch (emm_cause) { - case EMM_CAUSE_ILLEGAL_UE: - case EMM_CAUSE_ILLEGAL_ME: - case EMM_CAUSE_EPS_NOT_ALLOWED: - case EMM_CAUSE_BOTH_NOT_ALLOWED: - /* - * Notify EMM that EPS attach is rejected - */ - emm_sap.primitive = EMMREG_ATTACH_REJ; - break; - - case EMM_CAUSE_PLMN_NOT_ALLOWED: - case EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN: - case EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN: - /* - * Notify EMM that the UE has to perform a PLMN selection because - * it is not allowed to operate in the currently selected PLMN - */ - emm_sap.primitive = EMMREG_REGISTER_REQ; - break; - - case EMM_CAUSE_TA_NOT_ALLOWED: - case EMM_CAUSE_ROAMING_NOT_ALLOWED: - case EMM_CAUSE_NO_SUITABLE_CELLS: - /* - * Notify EMM that the UE failed to register to the network for - * EPS services because it is not allowed to operate in the - * requested tracking area - */ - emm_sap.primitive = EMMREG_REGISTER_REJ; - break; - - case EMM_CAUSE_IMEI_NOT_ACCEPTED: - if (_emm_data.is_emergency) { - /* - * Notify EMM that the UE failed to register to the network - * for emergency bearer services because "IMEI not accepted" - */ - emm_sap.primitive = EMMREG_NO_IMSI; - break; - } - - /* break is volontary missing */ - - default : - /* Other values are considered as abnormal cases - * 3GPP TS 24.301, section 5.5.1.2.6, case d */ - _emm_attach_abnormal_cases_bcd(&emm_sap); - break; - } - - rc = emm_sap_send(&emm_sap); - - /* - * Notify ESM that the network rejected connectivity to the PDN - */ - if (esm_msg_pP != NULL) { - esm_sap_t esm_sap; - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ; - esm_sap.is_standalone = FALSE; - esm_sap.recv = esm_msg_pP; - rc = esm_sap_send(&esm_sap); - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_complete() ** - ** ** - ** Description: Terminates the attach procedure when Attach Complete mes- ** - ** sage has been successfully delivered to the MME. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.4 ** - ** Upon successfully sending the ATTACH COMPLETE message, ** - ** the UE shall reset the attach attempt counter and tra- ** - ** cking area updating attempt counter, enter state EMM- ** - ** REGISTERED and set the EPS update status to EU1-UPDATED. ** - ** ** - ** Inputs: args: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, _emm_attach_data ** - ** ** - ***************************************************************************/ -int emm_proc_attach_complete(void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - esm_sap_t esm_sap; - int rc; - - LOG_TRACE(INFO, "EMM-PROC - EPS attach complete"); - - /* Reset EMM procedure handler */ - (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - /* Reset the attach attempt counter */ - _emm_attach_data.attempt_count = 0; - /* TODO: Reset the tracking area updating attempt counter */ - - /* Set the EPS update status to EU1 UPDATED */ - _emm_data.status = EU1_UPDATED; - _emm_data.is_attached = TRUE; - - /* - * Notify EMM that network attach complete message has been delivered - * to the network - */ - emm_sap.primitive = EMMREG_ATTACH_CNF; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* - * Notify ESM that the Activate Default EPS Bearer Context Accept - * message has been delivered to the network within the Attach - * Complete message - */ - esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF; - esm_sap.is_standalone = FALSE; - rc = esm_sap_send(&esm_sap); - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_failure() ** - ** ** - ** Description: Performs the attach procedure abnormal case upon receipt ** - ** of transmission failure of Attach Request message or At- ** - ** tach Complete message. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.6, cases h and i ** - ** The UE shall restart the attach procedure when timer ** - ** T3411 expires. ** - ** ** - ** Inputs: is_initial: TRUE if the NAS message that failed to be ** - ** transfered is an initial NAS message (ESM ** - ** message embedded within an Attach Request ** - ** message) ** - ** args: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3410, T3411 ** - ** ** - ***************************************************************************/ -int emm_proc_attach_failure(int is_initial, void *args) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - esm_sap_t esm_sap; - - LOG_TRACE(WARNING, "EMM-PROC - EPS attach failure"); - - /* Reset EMM procedure handler */ - (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - /* Stop timer T3410 if still running */ - if (T3410.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id); - T3410.id = nas_timer_stop(T3410.id); - } - - if (is_initial) { - /* - * Notify ESM that the PDN CONNECTIVITY REQUEST message contained - * in the ESM message container IE of the ATTACH REQUEST has failed - * to be transmitted - */ - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ; - esm_sap.is_standalone = FALSE; - esm_sap.recv = NULL; - } else { - /* - * Notify ESM that ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message - * contained in the ESM message container IE of the ATTACH COMPLETE - * has failed to be transmitted - */ - esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ; - esm_sap.is_standalone = FALSE; - esm_sap.recv = NULL; - } - - rc = esm_sap_send(&esm_sap); - - if (rc != RETURNerror) { - /* Start T3411 timer */ - T3411.id = nas_timer_start(T3411.sec, _emm_attach_t3411_handler, NULL); - LOG_TRACE(INFO, "EMM-PROC - Timer T3411 (%d) expires in %ld seconds", - T3411.id, T3411.sec); - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_release() ** - ** ** - ** Description: Performs the attach procedure abnormal case upon receipt ** - ** of NAS signalling connection release indication. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.6, case b ** - ** The attach procedure shall be aborted and the UE shall ** - ** execute abnormal case attach procedure. ** - ** ** - ** Inputs: args: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_attach_release(void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released"); - - /* Execute abnormal case attach procedure */ - _emm_attach_abnormal_cases_bcd(&emm_sap); - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_restart() ** - ** ** - ** Description: Restarts the attach procedure ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_attach_restart(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - LOG_TRACE(INFO, "EMM-PROC - Restart EPS attach procedure"); - - /* - * Notify EMM that the attach procedure has to be restarted - */ - emm_sap.primitive = EMMREG_ATTACH_INIT; - emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_set_emergency() ** - ** ** - ** Description: Set the emergency bearer services indicator ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_attach_set_emergency(void) -{ - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "EMM-PROC - UE is now attached to the network for " - "emergency bearer services only"); - - _emm_data.is_emergency = TRUE; - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_set_detach() ** - ** ** - ** Description: Reset the network attachment indicator and enter state ** - ** EMM-DEREGISTERED - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_attach_set_detach(void) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, - "EMM-PROC - UE is now locally detached from the network"); - - /* Reset the network attachment indicator */ - _emm_data.is_attached = FALSE; - /* - * Notify that the UE is locally detached from the network - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_DETACH_CNF; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} - -#endif - -/* - * -------------------------------------------------------------------------- - * Attach procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_request() ** - ** ** - ** Description: Performs the UE requested attach procedure ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.3 ** - ** The network may initiate EMM common procedures, e.g. the ** - ** identification, authentication and security mode control ** - ** procedures during the attach procedure, depending on the ** - ** information received in the ATTACH REQUEST message (e.g. ** - ** IMSI, GUTI and KSI). ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** type: Type of the requested attach ** - ** native_ksi: TRUE if the security context is of type ** - ** native (for KSIASME) ** - ** ksi: The NAS ket sey identifier ** - ** native_guti: TRUE if the provided GUTI is native GUTI ** - ** guti: The GUTI if provided by the UE ** - ** imsi: The IMSI if provided by the UE ** - ** imei: The IMEI if provided by the UE ** - ** tai: Identifies the last visited tracking area ** - ** the UE is registered to ** - ** eea: Supported EPS encryption algorithms ** - ** eia: Supported EPS integrity algorithms ** - ** esm_msg_pP: PDN connectivity request ESM message ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_attach_request( - unsigned int ueid, - emm_proc_attach_type_t type, - int native_ksi, int ksi, - int native_guti, - GUTI_t *guti, - imsi_t *imsi, - imei_t *imei, - tai_t *tai, - int eea, int eia, int ucs2, int uea, int uia, int gea, - int umts_present, int gprs_present, - const OctetString *esm_msg_pP) -{ - LOG_FUNC_IN; - - int rc; - emm_data_context_t ue_ctx; - - LOG_TRACE(INFO, "EMM-PROC - EPS attach type = %s (%d) requested (ueid=0x%08x)", - _emm_attach_type_str[type], type, ueid); - LOG_TRACE(INFO, "EMM-PROC - umts_present = %u umts_present = %u", - umts_present, gprs_present); - - /* Initialize the temporary UE context */ - memset(&ue_ctx, 0 , sizeof(emm_data_context_t)); - ue_ctx.is_dynamic = FALSE; - ue_ctx.ueid = ueid; - -#if !defined(NAS_BUILT_IN_EPC) - - /* UE identifier sanity check */ - if (ueid >= EMM_DATA_NB_UE_MAX) { - ue_ctx.emm_cause = EMM_CAUSE_ILLEGAL_UE; - /* Do not accept UE with invalid identifier */ - rc = _emm_attach_reject(&ue_ctx); - LOG_FUNC_RETURN(rc); - } - -#endif - - /* 3GPP TS 24.301, section 5.5.1.1 - * MME not configured to support attach for emergency bearer services - * shall reject any request to attach with an attach type set to "EPS - * emergency attach". - */ - if ( !(_emm_data.conf.features & MME_API_EMERGENCY_ATTACH) && - (type == EMM_ATTACH_TYPE_EMERGENCY) ) { - ue_ctx.emm_cause = EMM_CAUSE_IMEI_NOT_ACCEPTED; - /* Do not accept the UE to attach for emergency services */ - rc = _emm_attach_reject(&ue_ctx); - LOG_FUNC_RETURN(rc); - } - - /* Get the UE's EMM context if it exists */ - emm_data_context_t **emm_ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - emm_data_context_t *temp = NULL; - - temp = emm_data_context_get(&_emm_data, ueid); - emm_ctx = &temp; -#else - emm_ctx = &_emm_data.ctx[ueid]; -#endif - - if (*emm_ctx != NULL) { - /* An EMM context already exists for the UE in the network */ - if (_emm_attach_have_changed(*emm_ctx, type, ksi, guti, imsi, imei, - eea, eia, ucs2, uea, uia, gea, umts_present, gprs_present)) { - /* - * 3GPP TS 24.301, section 5.5.1.2.7, abnormal case e - * The attach parameters have changed from the one received within - * the previous Attach Request message; - * the previously initiated attach procedure shall be aborted and - * the new attach procedure shall be executed; - */ - LOG_TRACE(WARNING, "EMM-PROC - Attach parameters have changed"); - /* - * Notify EMM that the attach procedure is aborted - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_PROC_ABORT; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = *emm_ctx; - - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Process new attach procedure */ - LOG_TRACE(WARNING, "EMM-PROC - Initiate new attach procedure"); - rc = emm_proc_attach_request(ueid, type, native_ksi, ksi, - native_guti, guti, imsi, imei, - tai, eea, eia, ucs2, uea, uia, gea, - umts_present, gprs_present, esm_msg_pP); - } - - LOG_FUNC_RETURN(rc); - } else { - /* Continue with the previous attach procedure */ - LOG_TRACE(WARNING, "EMM-PROC - Received duplicated Attach Request"); - LOG_FUNC_RETURN(RETURNok); - } - } else { - /* Create UE's EMM context */ - *emm_ctx = (emm_data_context_t *)calloc(1, sizeof(emm_data_context_t)); - - if (emm_ctx == NULL) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to create EMM context"); - ue_ctx.emm_cause = EMM_CAUSE_ILLEGAL_UE; - /* Do not accept the UE to attach to the network */ - rc = _emm_attach_reject(&ue_ctx); - LOG_FUNC_RETURN(rc); - } - - (*emm_ctx)->is_dynamic = TRUE; - (*emm_ctx)->guti = NULL; - (*emm_ctx)->old_guti = NULL; - (*emm_ctx)->imsi = NULL; - (*emm_ctx)->imei = NULL; - (*emm_ctx)->security = NULL; - (*emm_ctx)->esm_msg.length = 0; - (*emm_ctx)->esm_msg.value = NULL; - (*emm_ctx)->emm_cause = EMM_CAUSE_SUCCESS; - (*emm_ctx)->_emm_fsm_status = EMM_INVALID; - (*emm_ctx)->ueid = ueid; - - emm_fsm_set_status(ueid, *emm_ctx, EMM_DEREGISTERED); -#if defined(NAS_BUILT_IN_EPC) - emm_data_context_add(&_emm_data, *(emm_ctx)); -#endif - -#warning "TRICK TO SET TAC, BUT LOOK AT SPEC" - - if (tai) { - LOG_TRACE(WARNING, - "EMM-PROC - Set tac %u in context %u ", - tai->tac); - (*emm_ctx)->tac = tai->tac; - } else { - LOG_TRACE(WARNING, - "EMM-PROC - Could not set tac in context, cause tai is NULL "); - } - } - - /* Update the EMM context with the current attach procedure parameters */ - rc = _emm_attach_update(*emm_ctx, ueid, type, ksi, guti, imsi, imei, - eea, eia, ucs2, uea, uia, gea, umts_present, gprs_present, esm_msg_pP); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to update EMM context"); - /* Do not accept the UE to attach to the network */ - (*emm_ctx)->emm_cause = EMM_CAUSE_ILLEGAL_UE; - rc = _emm_attach_reject(*emm_ctx); - } else { - /* - * Performs UE identification - */ - rc = _emm_attach_identify(*emm_ctx); - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_reject() ** - ** ** - ** Description: Performs the protocol error abnormal case ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.7, case b ** - ** If the ATTACH REQUEST message is received with a protocol ** - ** error, the network shall return an ATTACH REJECT message. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** emm_cause: EMM cause code to be reported ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_attach_reject(unsigned int ueid, int emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - /* Create temporary UE context */ - emm_data_context_t ue_ctx; - memset(&ue_ctx, 0 , sizeof(emm_data_context_t)); - ue_ctx.is_dynamic = FALSE; - ue_ctx.ueid = ueid; - - /* Update the EMM cause code */ -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) -#else - if (ueid < EMM_DATA_NB_UE_MAX) -#endif - { - ue_ctx.emm_cause = emm_cause; - } else { - ue_ctx.emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - - /* Do not accept attach request with protocol error */ - rc = _emm_attach_reject(&ue_ctx); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_attach_complete() ** - ** ** - ** Description: Terminates the attach procedure upon receiving Attach ** - ** Complete message from the UE. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.4 ** - ** Upon receiving an ATTACH COMPLETE message, the MME shall ** - ** stop timer T3450, enter state EMM-REGISTERED and consider ** - ** the GUTI sent in the ATTACH ACCEPT message as valid. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** esm_msg_pP: Activate default EPS bearer context accept ** - ** ESM message ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, T3450 ** - ** ** - ***************************************************************************/ -int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg_pP) -{ - emm_data_context_t *emm_ctx = NULL; - int rc = RETURNerror; - emm_sap_t emm_sap; - esm_sap_t esm_sap; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - EPS attach complete (ueid=%u)", ueid); - - /* Stop timer T3450 */ - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", T3450.id); - T3450.id = nas_timer_stop(T3450.id); - - /* Release retransmission timer parameters */ - attach_data_t *data = (attach_data_t *)(emm_proc_common_get_args(ueid)); - - if (data) { - if (data->esm_msg.length > 0) { - free(data->esm_msg.value); - } - - free(data); - } - - /* Get the UE context */ - -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - } - -#endif - - if (emm_ctx) { - /* Delete the old GUTI and consider the GUTI sent in the Attach - * Accept message as valid */ - emm_ctx->guti_is_new = FALSE; - emm_ctx->old_guti = NULL; - /* - * Forward the Activate Default EPS Bearer Context Accept message - * to the EPS session management sublayer - */ - esm_sap.primitive = ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF; - esm_sap.is_standalone = FALSE; - esm_sap.ueid = ueid; - esm_sap.recv = esm_msg_pP; - esm_sap.ctx = emm_ctx; - rc = esm_sap_send(&esm_sap); - } else { - LOG_TRACE(ERROR, "EMM-PROC - No EMM context exists"); - } - - if ( (rc != RETURNerror) && (esm_sap.err == ESM_SAP_SUCCESS) ) { - /* Set the network attachment indicator */ - emm_ctx->is_attached = TRUE; - /* - * Notify EMM that attach procedure has successfully completed - */ - emm_sap.primitive = EMMREG_ATTACH_CNF; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - rc = emm_sap_send(&emm_sap); - } else if (esm_sap.err != ESM_SAP_DISCARDED) { - /* - * Notify EMM that attach procedure failed - */ - emm_sap.primitive = EMMREG_ATTACH_REJ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - rc = emm_sap_send(&emm_sap); - } else { - /* - * ESM procedure failed and, received message has been discarded or - * Status message has been returned; ignore ESM procedure failure - */ - rc = RETURNok; - } - - LOG_FUNC_RETURN(rc); -} - -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_attach_t3410_handler() ** - ** ** - ** Description: T3410 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.6, case c ** - ** Upon T3410 timer expiration, the attach procedure shall ** - ** be aborted and the UE shall execute abnormal case attach ** - ** procedure. ** - ** The NAS signalling connection shall be released locally. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: T3410 ** - ** ** - ***************************************************************************/ -void *_emm_attach_t3410_handler(void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - T3410 timer expired"); - - /* Stop T3410 timer */ - T3410.id = nas_timer_stop(T3410.id); - /* Execute abnormal case attach procedure */ - _emm_attach_abnormal_cases_bcd(&emm_sap); - - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Locally release the NAS signalling connection */ - _emm_data.ecm_status = ECM_IDLE; - } - - LOG_FUNC_RETURN(NULL); -} - -/**************************************************************************** - ** ** - ** Name: _emm_attach_t3411_handler() ** - ** ** - ** Description: T3411 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.6 ** - ** Upon T3411 timer expiration, the attach procedure shall ** - ** be restarted, if still required by ESM sublayer. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: T3411 ** - ** ** - ***************************************************************************/ -static void *_emm_attach_t3411_handler(void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - - LOG_TRACE(WARNING, "EMM-PROC - T3411 timer expired"); - - /* Stop T3411 timer */ - T3411.id = nas_timer_stop(T3411.id); - /* - * Notify EMM that timer T3411 expired and attach procedure has to be - * restarted - */ - emm_sap.primitive = EMMREG_ATTACH_INIT; - emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency; - - (void) emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(NULL); -} - -/**************************************************************************** - ** ** - ** Name: _emm_attach_t3402_handler() ** - ** ** - ** Description: T3402 timeout handler ** - ** ** - ** Upon T3402 timer expiration: ** - ** 3GPP TS 24.301, section 5.5.1.1 ** - ** the attach attempt counter shall be reset when the UE is ** - ** in substate DEREGISTERED.ATTEMPTING-TO-ATTACH; ** - ** 3GPP TS 24.301, section 5.2.2.3.3 ** - ** the UE shall initiate an attach or combined attach proce- ** - ** dure in substate DEREGISTERED.ATTEMPTING-TO-ATTACH; ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_attach_data, T3402 ** - ** ** - ***************************************************************************/ -static void *_emm_attach_t3402_handler(void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - - LOG_TRACE(WARNING, "EMM-PROC - T3402 timer expired"); - - /* Stop T3402 timer */ - T3402.id = nas_timer_stop(T3402.id); - /* Reset the attach attempt counter */ - _emm_attach_data.attempt_count = 0; - /* - * Notify EMM that timer T3402 expired and attach procedure has to be - * restarted - */ - emm_sap.primitive = EMMREG_ATTACH_INIT; - emm_sap.u.emm_reg.u.attach.is_emergency = _emm_data.is_emergency; - - (void) emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(NULL); -} - -/* - * -------------------------------------------------------------------------- - * Abnormal cases in the UE - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_attach_abnormal_cases_bcd() ** - ** ** - ** Description: Performs the abnormal case attach procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.6, cases b, c and d ** - ** The Timer T3410 shall be stopped if still running, the ** - ** attach attempt counter shall be incremented and the UE ** - ** shall proceed depending on whether the attach attempt ** - ** counter reached its maximum value or not. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: emm_sap: EMM service access point ** - ** Return: None ** - ** Others: _emm_data, _emm_attach_data, T3402, T3410, ** - ** T3411 ** - ** ** - ***************************************************************************/ -static void _emm_attach_abnormal_cases_bcd(emm_sap_t *emm_sap) -{ - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "EMM-PROC - Abnormal case, attach counter = %d", - _emm_attach_data.attempt_count); - - /* Stop timer T3410 */ - if (T3410.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id); - T3410.id = nas_timer_stop(T3410.id); - } - - if (_emm_attach_data.attempt_count < EMM_ATTACH_COUNTER_MAX) { - /* Increment the attach attempt counter */ - _emm_attach_data.attempt_count += 1; - /* Start T3411 timer */ - T3411.id = nas_timer_start(T3411.sec, _emm_attach_t3411_handler, NULL); - LOG_TRACE(INFO, "EMM-PROC - Timer T3411 (%d) expires in %ld seconds", - T3411.id, T3411.sec); - /* - * Notify EMM that the attempt to attach for EPS services failed and - * the attach attempt counter didn't reach its maximum value; network - * attach procedure shall be restarted when timer T3411 expires. - */ - emm_sap->primitive = EMMREG_ATTACH_FAILED; - } else { - /* Delete the GUTI */ - _emm_data.guti = NULL; - /* Delete the TAI list */ - _emm_data.ltai.n_tais = 0; - /* Delete the last visited registered TAI */ - _emm_data.tai = NULL; - /* Delete the list of equivalent PLMNs */ - _emm_data.nvdata.eplmn.n_plmns = 0; - - /* Delete the eKSI */ - if (_emm_data.security) { - _emm_data.security->type = EMM_KSI_NOT_AVAILABLE; - } - - /* Set the EPS update status to EU2 NOT UPDATED */ - _emm_data.status = EU2_NOT_UPDATED; - - /* Start T3402 timer */ - T3402.id = nas_timer_start(T3402.sec, _emm_attach_t3402_handler, NULL); - LOG_TRACE(INFO, "EMM-PROC - Timer T3402 (%d) expires in %ld seconds", - T3402.id, T3402.sec); - /* - * Notify EMM that the attempt to attach for EPS services failed and - * the attach attempt counter reached its maximum value. - */ - emm_sap->primitive = EMMREG_ATTACH_EXCEEDED; - } - - LOG_FUNC_OUT; -} -#endif // NAS_UE - -#ifdef NAS_MME -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_attach_t3450_handler() ** - ** ** - ** Description: T3450 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.7, case c ** - ** On the first expiry of the timer T3450, the network shall ** - ** retransmit the ATTACH ACCEPT message and shall reset and ** - ** restart timer T3450. This retransmission is repeated four ** - ** times, i.e. on the fifth expiry of timer T3450, the at- ** - ** tach procedure shall be aborted and the MME enters state ** - ** EMM-DEREGISTERED. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_emm_attach_t3450_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - attach_data_t *data = (attach_data_t *)(args); - - /* Increment the retransmission counter */ - data->retransmission_count += 1; - - LOG_TRACE(WARNING, "EMM-PROC - T3450 timer expired, retransmission " - "counter = %d", data->retransmission_count); - - /* Get the UE's EMM context */ - emm_data_context_t *emm_ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, data->ueid); -#else - emm_ctx = _emm_data.ctx[data->ueid]; -#endif - - if (data->retransmission_count < ATTACH_COUNTER_MAX) { - /* Send attach accept message to the UE */ - rc = _emm_attach_accept(emm_ctx, data); - } else { - /* Abort the attach procedure */ - rc = _emm_attach_abort(data); - } - - LOG_FUNC_RETURN(NULL); -} - -/* - * -------------------------------------------------------------------------- - * Abnormal cases in the MME - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_attach_release() ** - ** ** - ** Description: Releases the UE context data. ** - ** ** - ** Inputs: args: Data to be released ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_attach_release(void *args) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - emm_data_context_t *emm_ctx = (emm_data_context_t *)(args); - - if (emm_ctx) { - LOG_TRACE(WARNING, "EMM-PROC - Release UE context data (ueid=%u)", - emm_ctx->ueid); - - unsigned int ueid = emm_ctx->ueid; - - if (emm_ctx->guti) { - free(emm_ctx->guti); - emm_ctx->guti = NULL; - } - - if (emm_ctx->imsi) { - free(emm_ctx->imsi); - emm_ctx->imsi = NULL; - } - - if (emm_ctx->imei) { - free(emm_ctx->imei); - emm_ctx->imei = NULL; - } - - if (emm_ctx->esm_msg.length > 0) { - free(emm_ctx->esm_msg.value); - emm_ctx->esm_msg.value = NULL; - } - - /* Release NAS security context */ - if (emm_ctx->security) { - emm_security_context_t *security = emm_ctx->security; - - if (security->kasme.value) { - free(security->kasme.value); - security->kasme.value = NULL; - security->kasme.length = 0; - } - - if (security->knas_enc.value) { - free(security->knas_enc.value); - security->knas_enc.value = NULL; - security->knas_enc.length = 0; - } - - if (security->knas_int.value) { - free(security->knas_int.value); - security->knas_int.value = NULL; - security->knas_int.length = 0; - } - - free(emm_ctx->security); - emm_ctx->security = NULL; - } - - /* Release the EMM context */ -#if defined(NAS_BUILT_IN_EPC) - emm_data_context_remove(&_emm_data, emm_ctx); -#else - free(_emm_data.ctx[ueid]); - _emm_data.ctx[ueid] = NULL; -#endif - /* - * Notify EMM that the attach procedure is aborted - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_PROC_ABORT; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_attach_reject() ** - ** ** - ** Description: Performs the attach procedure not accepted by the network.** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.5 ** - ** If the attach request cannot be accepted by the network, ** - ** the MME shall send an ATTACH REJECT message to the UE in- ** - ** including an appropriate EMM cause value. ** - ** ** - ** Inputs: args: UE context data ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_attach_reject(void *args) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - emm_data_context_t *emm_ctx = (emm_data_context_t *)(args); - - if (emm_ctx) { - emm_sap_t emm_sap; - LOG_TRACE(WARNING, "EMM-PROC - EMM attach procedure not accepted " - "by the network (ueid=%08x, cause=%d)", - emm_ctx->ueid, emm_ctx->emm_cause); - /* - * Notify EMM-AS SAP that Attach Reject message has to be sent - * onto the network - */ - emm_sap.primitive = EMMAS_ESTABLISH_REJ; - emm_sap.u.emm_as.u.establish.ueid = emm_ctx->ueid; - emm_sap.u.emm_as.u.establish.UEid.guti = NULL; - - if (emm_ctx->emm_cause == EMM_CAUSE_SUCCESS) { - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - - emm_sap.u.emm_as.u.establish.emm_cause = emm_ctx->emm_cause; - emm_sap.u.emm_as.u.establish.NASinfo = EMM_AS_NAS_INFO_ATTACH; - - if (emm_ctx->emm_cause != EMM_CAUSE_ESM_FAILURE) { - emm_sap.u.emm_as.u.establish.NASmsg.length = 0; - emm_sap.u.emm_as.u.establish.NASmsg.value = NULL; - } else if (emm_ctx->esm_msg.length > 0) { - emm_sap.u.emm_as.u.establish.NASmsg = emm_ctx->esm_msg; - } else { - LOG_TRACE(ERROR, "EMM-PROC - ESM message is missing"); - LOG_FUNC_RETURN(RETURNerror); - } - - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.establish.sctx, - emm_ctx->security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - - /* Release the UE context, even if the network failed to send the - * ATTACH REJECT message */ - if (emm_ctx->is_dynamic) { - rc = _emm_attach_release(emm_ctx); - } - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_attach_abort() ** - ** ** - ** Description: Aborts the attach procedure ** - ** ** - ** Inputs: args: Attach procedure data to be released ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3450 ** - ** ** - ***************************************************************************/ -static int _emm_attach_abort(void *args) -{ - int rc = RETURNerror; - emm_data_context_t *ctx = NULL; - attach_data_t *data; - - LOG_FUNC_IN; - - data = (attach_data_t *)(args); - - if (data) { - unsigned int ueid = data->ueid; - esm_sap_t esm_sap; - - LOG_TRACE(WARNING, "EMM-PROC - Abort the attach procedure (ueid=%u)", - ueid); - - /* Stop timer T3450 */ - if (T3450.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3450 (%d)", T3450.id); - T3450.id = nas_timer_stop(T3450.id); - } - - /* Release retransmission timer parameters */ - if (data->esm_msg.length > 0) { - free(data->esm_msg.value); - } - - free(data); - -#if defined(NAS_BUILT_IN_EPC) - ctx = emm_data_context_get(&_emm_data, ueid); -#else - ctx = _emm_data.ctx[ueid]; -#endif - - /* - * Notify ESM that the network locally refused PDN connectivity - * to the UE - */ - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ; - esm_sap.ueid = ueid; - esm_sap.ctx = ctx; - esm_sap.recv = NULL; - rc = esm_sap_send(&esm_sap); - - if (rc != RETURNerror) { - /* - * Notify EMM that EPS attach procedure failed - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_ATTACH_REJ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = ctx; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Release the UE context */ - rc = _emm_attach_release(ctx); - } - } - } - - LOG_FUNC_RETURN (rc); -} - -/* - * -------------------------------------------------------------------------- - * Functions that may initiate EMM common procedures - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_attach_identify() ** - ** ** - ** Description: Performs UE's identification. May initiates identifica- ** - ** tion, authentication and security mode control EMM common ** - ** procedures. ** - ** ** - ** Inputs: args: Identification argument parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -static int _emm_attach_identify(void *args) -{ - int rc = RETURNerror; - emm_data_context_t *emm_ctx = (emm_data_context_t *)(args); - int guti_reallocation = FALSE; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - Identify incoming UE (ueid=0x%08x) using %s", - emm_ctx->ueid, (emm_ctx->imsi)? "IMSI" : (emm_ctx->guti)? "GUTI" : - (emm_ctx->imei)? "IMEI" : "none"); - - /* - * UE's identification - * ------------------- - */ - if (emm_ctx->imsi) { - /* The UE identifies itself using an IMSI */ -#if defined(NAS_BUILT_IN_EPC) - if (!emm_ctx->security) { - /* Ask upper layer to fetch new security context */ - nas_itti_auth_info_req(emm_ctx->ueid, emm_ctx->imsi, 1, NULL); - - rc = RETURNok; - } else -#endif - { - rc = mme_api_identify_imsi(emm_ctx->imsi, &emm_ctx->vector); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to identify the UE using provided IMSI"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - - guti_reallocation = TRUE; - } - } else if (emm_ctx->guti) { - /* The UE identifies itself using a GUTI */ - rc = mme_api_identify_guti(emm_ctx->guti, &emm_ctx->vector); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to identify the UE using " - "provided GUTI (tmsi=%u)", emm_ctx->guti->m_tmsi); - /* 3GPP TS 24.401, Figure 5.3.2.1-1, point 4 - * The UE was attempting to attach to the network using a GUTI - * that is not known by the network; the MME shall initiate an - * identification procedure to retrieve the IMSI from the UE. - */ - rc = emm_proc_identification(emm_ctx->ueid, - emm_ctx, - EMM_IDENT_TYPE_IMSI, - _emm_attach_identify, - _emm_attach_release, - _emm_attach_release); - - if (rc != RETURNok) { - /* Failed to initiate the identification procedure */ - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to initiate identification procedure"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - /* Do not accept the UE to attach to the network */ - rc = _emm_attach_reject(emm_ctx); - } - - /* Relevant callback will be executed when identification - * procedure completes */ - LOG_FUNC_RETURN(rc); - } - } else if ( (emm_ctx->imei) && (emm_ctx->is_emergency) ) { - /* The UE is attempting to attach to the network for emergency - * services using an IMEI */ - rc = mme_api_identify_imei(emm_ctx->imei, &emm_ctx->vector); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to identify the UE using provided IMEI"); - emm_ctx->emm_cause = EMM_CAUSE_IMEI_NOT_ACCEPTED; - } - } else { - LOG_TRACE(WARNING, "EMM-PROC - UE's identity is not available"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - - /* - * GUTI reallocation - * ----------------- - */ - if ( (rc != RETURNerror) && guti_reallocation ) { - /* Release the old GUTI */ - if (emm_ctx->old_guti) { - free(emm_ctx->old_guti); - } - - /* Save the GUTI previously used by the UE to identify itself */ - emm_ctx->old_guti = emm_ctx->guti; - /* Allocate a new GUTI */ - emm_ctx->guti = (GUTI_t *)malloc(sizeof(GUTI_t)); - /* Request the MME to assign a GUTI to the UE */ - rc = mme_api_new_guti(emm_ctx->imsi, emm_ctx->guti, - &emm_ctx->tac, &emm_ctx->n_tacs); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to assign new GUTI"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - } else { - LOG_TRACE(WARNING, "EMM-PROC - New GUTI assigned to the UE " - "(tmsi=%u)", emm_ctx->guti->m_tmsi); - /* Update the GUTI indicator as new */ - emm_ctx->guti_is_new = TRUE; - } - } - - /* - * UE's authentication - * ------------------- - */ - if (rc != RETURNerror) { - if (emm_ctx->security) { - /* A security context exists for the UE in the network; - * proceed with the attach procedure. - */ - rc = _emm_attach(emm_ctx); - } else if ( (emm_ctx->is_emergency) && - (_emm_data.conf.features & MME_API_UNAUTHENTICATED_IMSI) ) { - /* 3GPP TS 24.301, section 5.5.1.2.3 - * 3GPP TS 24.401, Figure 5.3.2.1-1, point 5a - * MME configured to support Emergency Attach for unauthenticated - * IMSIs may choose to skip the authentication procedure even if - * no EPS security context is available and proceed directly to the - * execution of the security mode control procedure. - */ - rc = _emm_attach_security(emm_ctx); - } - -#if !defined(NAS_BUILT_IN_EPC) - else { - /* 3GPP TS 24.401, Figure 5.3.2.1-1, point 5a - * No EMM context exists for the UE in the network; authentication - * and NAS security setup to activate integrity protection and NAS - * ciphering are mandatory. - */ - auth_vector_t *auth = &emm_ctx->vector; - const OctetString loc_rand = {AUTH_RAND_SIZE, (uint8_t *)auth->rand}; - const OctetString autn = {AUTH_AUTN_SIZE, (uint8_t *)auth->autn}; - rc = emm_proc_authentication(emm_ctx, emm_ctx->ueid, 0, // TODO: eksi != 0 - &loc_rand, &autn, - _emm_attach_security, - _emm_attach_release, - _emm_attach_release); - - if (rc != RETURNok) { - /* Failed to initiate the authentication procedure */ - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to initiate authentication procedure"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - } - -#endif - } - - if (rc != RETURNok) { - /* Do not accept the UE to attach to the network */ - rc = _emm_attach_reject(emm_ctx); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_attach_security() ** - ** ** - ** Description: Initiates security mode control EMM common procedure. ** - ** ** - ** Inputs: args: security argument parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -#if defined(NAS_BUILT_IN_EPC) -int emm_attach_security(void *args) -{ - return _emm_attach_security(args); -} -#endif - -static int _emm_attach_security(void *args) -{ - LOG_FUNC_IN; - - int rc; - emm_data_context_t *emm_ctx = (emm_data_context_t *)(args); - - LOG_TRACE(INFO, "EMM-PROC - Setup NAS security (ueid=%u)", emm_ctx->ueid); - - /* Create new NAS security context */ - if (emm_ctx->security == NULL) { - emm_ctx->security = - (emm_security_context_t *)malloc(sizeof(emm_security_context_t)); - } - - if (emm_ctx->security) { - memset(emm_ctx->security, 0, sizeof(emm_security_context_t)); - emm_ctx->security->type = EMM_KSI_NOT_AVAILABLE; - emm_ctx->security->selected_algorithms.encryption = NAS_SECURITY_ALGORITHMS_EEA0; - emm_ctx->security->selected_algorithms.integrity = NAS_SECURITY_ALGORITHMS_EIA0; - } else { - LOG_TRACE(WARNING, "EMM-PROC - Failed to create security context"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - /* Do not accept the UE to attach to the network */ - rc = _emm_attach_reject(emm_ctx); - LOG_FUNC_RETURN(rc); - } - - /* Initialize the security mode control procedure */ - rc = emm_proc_security_mode_control(emm_ctx->ueid, 0, // TODO: eksi != 0 - emm_ctx->eea, emm_ctx->eia,emm_ctx->ucs2, - emm_ctx->uea, emm_ctx->uia, emm_ctx->gea, - emm_ctx->umts_present, emm_ctx->gprs_present, - _emm_attach, _emm_attach_release, - _emm_attach_release); - - if (rc != RETURNok) { - /* Failed to initiate the security mode control procedure */ - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to initiate security mode control procedure"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - /* Do not accept the UE to attach to the network */ - rc = _emm_attach_reject(emm_ctx); - } - - LOG_FUNC_RETURN (rc); -} - -/* - * -------------------------------------------------------------------------- - * MME specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_attach() ** - ** ** - ** Description: Performs the attach signalling procedure while a context ** - ** exists for the incoming UE in the network. ** - ** ** - ** 3GPP TS 24.301, section 5.5.1.2.4 ** - ** Upon receiving the ATTACH REQUEST message, the MME shall ** - ** send an ATTACH ACCEPT message to the UE and start timer ** - ** T3450. ** - ** ** - ** Inputs: args: attach argument parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -static int _emm_attach(void *args) -{ - LOG_FUNC_IN; - - esm_sap_t esm_sap; - int rc; - - emm_data_context_t *emm_ctx = (emm_data_context_t *)(args); - - LOG_TRACE(INFO, "EMM-PROC - Attach UE (ueid=%u)", emm_ctx->ueid); - - /* 3GPP TS 24.401, Figure 5.3.2.1-1, point 5a - * At this point, all NAS messages shall be protected by the NAS security - * functions (integrity and ciphering) indicated by the MME unless the UE - * is emergency attached and not successfully authenticated. - */ - - /* - * Notify ESM that PDN connectivity is requested - */ - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ; - esm_sap.is_standalone = FALSE; - esm_sap.ueid = emm_ctx->ueid; - esm_sap.ctx = emm_ctx; - esm_sap.recv = &emm_ctx->esm_msg; - rc = esm_sap_send(&esm_sap); - - if ( (rc != RETURNerror) && (esm_sap.err == ESM_SAP_SUCCESS) ) { - /* - * The attach request is accepted by the network - */ - - /* Delete the stored UE radio capability information, if any */ - /* Store the UE network capability */ - /* Assign the TAI list the UE is registered to */ - - /* Allocate parameters of the retransmission timer callback */ - attach_data_t *data = (attach_data_t *)calloc(1,sizeof(attach_data_t)); - - if (data != NULL) { - /* Setup ongoing EMM procedure callback functions */ - rc = emm_proc_common_initialize(emm_ctx->ueid, NULL, NULL, NULL, - _emm_attach_abort, data); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, - "Failed to initialize EMM callback functions"); - free(data); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Set the UE identifier */ - data->ueid = emm_ctx->ueid; - /* Reset the retransmission counter */ - data->retransmission_count = 0; -#if defined(ORIGINAL_CODE) - /* Setup the ESM message container */ - data->esm_msg.value = (uint8_t *)malloc(esm_sap.send.length); - - if (data->esm_msg.value) { - data->esm_msg.length = esm_sap.send.length; - memcpy(data->esm_msg.value, esm_sap.send.value, - esm_sap.send.length); - } else { - data->esm_msg.length = 0; - } - - /* Send attach accept message to the UE */ - rc = _emm_attach_accept(emm_ctx, data); - - if (rc != RETURNerror) { - if (emm_ctx->guti_is_new && emm_ctx->old_guti) { - /* Implicit GUTI reallocation; - * Notify EMM that common procedure has been initiated - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REQ; - emm_sap.u.emm_reg.ueid = data->ueid; - rc = emm_sap_send(&emm_sap); - } - } - -#else - rc = RETURNok; -#endif - } - } else if (esm_sap.err != ESM_SAP_DISCARDED) { - /* - * The attach procedure failed due to an ESM procedure failure - */ - emm_ctx->emm_cause = EMM_CAUSE_ESM_FAILURE; - - /* Setup the ESM message container to include PDN Connectivity Reject - * message within the Attach Reject message */ - if (emm_ctx->esm_msg.length > 0) { - free(emm_ctx->esm_msg.value); - } - - emm_ctx->esm_msg.value = (uint8_t *)malloc(esm_sap.send.length); - - if (emm_ctx->esm_msg.value) { - emm_ctx->esm_msg.length = esm_sap.send.length; - memcpy(emm_ctx->esm_msg.value, esm_sap.send.value, - esm_sap.send.length); - /* Send Attach Reject message */ - rc = _emm_attach_reject(emm_ctx); - } else { - emm_ctx->esm_msg.length = 0; - } - } else { - /* - * ESM procedure failed and, received message has been discarded or - * Status message has been returned; ignore ESM procedure failure - */ - rc = RETURNok; - } - - if (rc != RETURNok) { - /* The attach procedure failed */ - LOG_TRACE(WARNING, "EMM-PROC - Failed to respond to Attach Request"); - emm_ctx->emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - /* Do not accept the UE to attach to the network */ - rc = _emm_attach_reject(emm_ctx); - } - - LOG_FUNC_RETURN (rc); -} - -int emm_cn_wrapper_attach_accept(emm_data_context_t *emm_ctx, void *data) -{ - return _emm_attach_accept(emm_ctx,(attach_data_t *)data); -} -/**************************************************************************** - ** ** - ** Name: _emm_attach_accept() ** - ** ** - ** Description: Sends ATTACH ACCEPT message and start timer T3450 ** - ** ** - ** Inputs: data: Attach accept retransmission data ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3450 ** - ** ** - ***************************************************************************/ -static int _emm_attach_accept(emm_data_context_t *emm_ctx, attach_data_t *data) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - // may be caused by timer not stopped when deleted context - if (emm_ctx) { - /* - * Notify EMM-AS SAP that Attach Accept message together with an Activate - * Default EPS Bearer Context Request message has to be sent to the UE - */ - - emm_sap.primitive = EMMAS_ESTABLISH_CNF; - emm_sap.u.emm_as.u.establish.ueid = emm_ctx->ueid; - - if (emm_ctx->guti_is_new && emm_ctx->old_guti) { - /* Implicit GUTI reallocation; - * include the new assigned GUTI in the Attach Accept message */ - LOG_TRACE(INFO,"EMM-PROC - Implicit GUTI reallocation, include the new assigned GUTI in the Attach Accept message"); - emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->old_guti; - emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti; - } else if (emm_ctx->guti_is_new && emm_ctx->guti) { - /* include the new assigned GUTI in the Attach Accept message */ - LOG_TRACE(INFO,"EMM-PROC - Include the new assigned GUTI in the Attach Accept message"); - emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->guti; - emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti; - } else { - emm_sap.u.emm_as.u.establish.UEid.guti = emm_ctx->guti; -#warning "TEST LG FORCE GUTI IE IN ATTACH ACCEPT" - emm_sap.u.emm_as.u.establish.new_guti = emm_ctx->guti; - //emm_sap.u.emm_as.u.establish.new_guti = NULL; - } - - emm_sap.u.emm_as.u.establish.n_tacs = emm_ctx->n_tacs; - emm_sap.u.emm_as.u.establish.tac = emm_ctx->tac; - emm_sap.u.emm_as.u.establish.NASinfo = EMM_AS_NAS_INFO_ATTACH; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.establish.sctx, - emm_ctx->security, FALSE, TRUE); - - LOG_TRACE(INFO,"EMM-PROC - encryption = 0x%X ", emm_sap.u.emm_as.u.establish.encryption); - LOG_TRACE(INFO,"EMM-PROC - integrity = 0x%X ", emm_sap.u.emm_as.u.establish.integrity); - emm_sap.u.emm_as.u.establish.encryption = emm_ctx->security->selected_algorithms.encryption; - emm_sap.u.emm_as.u.establish.integrity = emm_ctx->security->selected_algorithms.integrity; - LOG_TRACE(INFO,"EMM-PROC - encryption = 0x%X (0x%X)", - emm_sap.u.emm_as.u.establish.encryption, - emm_ctx->security->selected_algorithms.encryption); - LOG_TRACE(INFO,"EMM-PROC - integrity = 0x%X (0x%X)", - emm_sap.u.emm_as.u.establish.integrity, - emm_ctx->security->selected_algorithms.integrity); - - /* Get the activate default EPS bearer context request message to - * transfer within the ESM container of the attach accept message */ - emm_sap.u.emm_as.u.establish.NASmsg = data->esm_msg; - LOG_TRACE(INFO,"EMM-PROC - NASmsg src size = %d NASmsg dst size = %d ", - data->esm_msg.length, emm_sap.u.emm_as.u.establish.NASmsg.length); - - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - if (T3450.id != NAS_TIMER_INACTIVE_ID) { - /* Re-start T3450 timer */ - T3450.id = nas_timer_restart(T3450.id); - } else { - /* Start T3450 timer */ - T3450.id = nas_timer_start(T3450.sec, _emm_attach_t3450_handler, data); - } - - LOG_TRACE(INFO,"EMM-PROC - Timer T3450 (%d) expires in %ld seconds", - T3450.id, T3450.sec); - } - } else { - LOG_TRACE(WARNING,"EMM-PROC - emm_ctx NULL"); - } - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_attach_have_changed() ** - ** ** - ** Description: Check whether the given attach parameters differs from ** - ** those previously stored when the attach procedure has ** - ** been initiated. ** - ** ** - ** Inputs: ctx: EMM context of the UE in the network ** - ** type: Type of the requested attach ** - ** ksi: Security ket sey identifier ** - ** guti: The GUTI provided by the UE ** - ** imsi: The IMSI provided by the UE ** - ** imei: The IMEI provided by the UE ** - ** eea: Supported EPS encryption algorithms ** - ** eia: Supported EPS integrity algorithms ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: TRUE if at least one of the parameters ** - ** differs; FALSE otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_attach_have_changed(const emm_data_context_t *ctx, - emm_proc_attach_type_t type, int ksi, - GUTI_t *guti, imsi_t *imsi, imei_t *imei, - int eea, int eia, int ucs2, int uea, int uia, int gea, - int umts_present, int gprs_present) -{ - LOG_FUNC_IN; - - /* Emergency bearer services indicator */ - if ( (type == EMM_ATTACH_TYPE_EMERGENCY) != ctx->is_emergency) { - LOG_FUNC_RETURN (TRUE); - } - - /* Security key set identifier */ - if (ksi != ctx->ksi) { - LOG_FUNC_RETURN (TRUE); - } - - /* Supported EPS encryption algorithms */ - if (eea != ctx->eea) { - LOG_FUNC_RETURN (TRUE); - } - - /* Supported EPS integrity algorithms */ - if (eia != ctx->eia) { - LOG_FUNC_RETURN (TRUE); - } - - if (umts_present != ctx->umts_present) { - LOG_FUNC_RETURN (TRUE); - } - - if (ctx->umts_present) { - if (ucs2 != ctx->ucs2) { - LOG_FUNC_RETURN (TRUE); - } - - /* Supported UMTS encryption algorithms */ - if (uea != ctx->uea) { - LOG_FUNC_RETURN (TRUE); - } - - /* Supported UMTS integrity algorithms */ - if (uia != ctx->uia) { - LOG_FUNC_RETURN (TRUE); - } - } - - if (gprs_present != ctx->gprs_present) { - LOG_FUNC_RETURN (TRUE); - } - - if (ctx->gprs_present) { - if (gea != ctx->gea) { - LOG_FUNC_RETURN (TRUE); - } - } - - /* The GUTI if provided by the UE */ - if ( (guti) && (ctx->guti == NULL) ) { - LOG_FUNC_RETURN (TRUE); - } - - if ( (guti == NULL) && (ctx->guti) ) { - LOG_FUNC_RETURN (TRUE); - } - - if ( (guti) && (ctx->guti) ) { - if (guti->m_tmsi != ctx->guti->m_tmsi) { - LOG_FUNC_RETURN (TRUE); - } - - if ( memcmp(&guti->gummei, &ctx->guti->gummei, sizeof(gummei_t)) != 0 ) { - LOG_FUNC_RETURN (TRUE); - } - } - - /* The IMSI if provided by the UE */ - if ( (imsi) && (ctx->imsi == NULL) ) { - LOG_FUNC_RETURN (TRUE); - } - - if ( (imsi == NULL) && (ctx->imsi) ) { - LOG_FUNC_RETURN (TRUE); - } - - if ( (imsi) && (ctx->imsi) ) { - if ( memcmp(imsi, ctx->imsi, sizeof(imsi_t)) != 0 ) { - LOG_FUNC_RETURN (TRUE); - } - } - - /* The IMEI if provided by the UE */ - if ( (imei) && (ctx->imei == NULL) ) { - LOG_FUNC_RETURN (TRUE); - } - - if ( (imei == NULL) && (ctx->imei) ) { - LOG_FUNC_RETURN (TRUE); - } - - if ( (imei) && (ctx->imei) ) { - if ( memcmp(imei, ctx->imei, sizeof(imei_t)) != 0 ) { - LOG_FUNC_RETURN (TRUE); - } - } - - LOG_FUNC_RETURN (FALSE); -} - -/**************************************************************************** - ** ** - ** Name: _emm_attach_update() ** - ** ** - ** Description: Update the EMM context with the given attach procedure ** - ** parameters. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** type: Type of the requested attach ** - ** ksi: Security ket sey identifier ** - ** guti: The GUTI provided by the UE ** - ** imsi: The IMSI provided by the UE ** - ** imei: The IMEI provided by the UE ** - ** eea: Supported EPS encryption algorithms ** - ** eia: Supported EPS integrity algorithms ** - ** esm_msg_pP: ESM message contained with the attach re- ** - ** quest ** - ** Others: None ** - ** ** - ** Outputs: ctx: EMM context of the UE in the network ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_attach_update(emm_data_context_t *ctx, unsigned int ueid, - emm_proc_attach_type_t type, int ksi, - GUTI_t *guti, imsi_t *imsi, imei_t *imei, - int eea, int eia, int ucs2, int uea, int uia, int gea, - int umts_present, int gprs_present, - const OctetString *esm_msg_pP) -{ - int mnc_length; - LOG_FUNC_IN; - /* UE identifier */ - ctx->ueid = ueid; - /* Emergency bearer services indicator */ - ctx->is_emergency = (type == EMM_ATTACH_TYPE_EMERGENCY); - /* Security key set identifier */ - ctx->ksi = ksi; - /* Supported EPS encryption algorithms */ - ctx->eea = eea; - /* Supported EPS integrity algorithms */ - ctx->eia = eia; - ctx->ucs2 = ucs2; - ctx->uea = uea; - ctx->uia = uia; - ctx->gea = gea; - ctx->umts_present = umts_present; - ctx->gprs_present = gprs_present; - - /* The GUTI if provided by the UE */ - if (guti) { - LOG_TRACE(INFO, "EMM-PROC - GUTI NOT NULL"); - - if (ctx->guti == NULL) { - ctx->guti = (GUTI_t *)malloc(sizeof(GUTI_t)); - } - - if (ctx->guti != NULL) { - memcpy(ctx->guti, guti, sizeof(GUTI_t)); - } else { - LOG_FUNC_RETURN (RETURNerror); - } - } else { - if (ctx->guti == NULL) { - ctx->guti = (GUTI_t *)calloc(1, sizeof(GUTI_t)); - } - -#warning "LG: We should assign the GUTI accordingly to the visited plmn id" - - if ((ctx->guti != NULL) && (imsi)) { - ctx->tac = mme_config.gummei.plmn_tac[0]; - ctx->guti->gummei.MMEcode = mme_config.gummei.mmec[0]; - ctx->guti->gummei.MMEgid = mme_config.gummei.mme_gid[0]; - ctx->guti->m_tmsi = (uint32_t) ctx; - - mnc_length = mme_config_find_mnc_length( - imsi->u.num.digit1, - imsi->u.num.digit2, - imsi->u.num.digit3, - imsi->u.num.digit4, - imsi->u.num.digit5, - imsi->u.num.digit6); - - if ((mnc_length == 2) || (mnc_length == 3)) { - ctx->guti->gummei.plmn.MCCdigit1 = imsi->u.num.digit1; - ctx->guti->gummei.plmn.MCCdigit2 = imsi->u.num.digit2; - ctx->guti->gummei.plmn.MCCdigit3 = imsi->u.num.digit3; - - if (mnc_length == 2) { - ctx->guti->gummei.plmn.MNCdigit1 = imsi->u.num.digit4; - ctx->guti->gummei.plmn.MNCdigit2 = imsi->u.num.digit5; - ctx->guti->gummei.plmn.MNCdigit3 = 15; - LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI from IMSI %01X%01X%01X.%01X%01X.%04X.%02X.%08X to emm_data_context", - ctx->guti->gummei.plmn.MCCdigit1, - ctx->guti->gummei.plmn.MCCdigit2, - ctx->guti->gummei.plmn.MCCdigit3, - ctx->guti->gummei.plmn.MNCdigit1, - ctx->guti->gummei.plmn.MNCdigit2, - ctx->guti->gummei.MMEgid, - ctx->guti->gummei.MMEcode, - ctx->guti->m_tmsi - ); - } else { - ctx->guti->gummei.plmn.MNCdigit1 = imsi->u.num.digit5; - ctx->guti->gummei.plmn.MNCdigit2 = imsi->u.num.digit6; - ctx->guti->gummei.plmn.MNCdigit3 = imsi->u.num.digit4; - LOG_TRACE(WARNING, "EMM-PROC - Assign GUTI from IMSI %01X%01X%01X.%01X%01X%01X.%04X.%02X.%08X to emm_data_context", - ctx->guti->gummei.plmn.MCCdigit1, - ctx->guti->gummei.plmn.MCCdigit2, - ctx->guti->gummei.plmn.MCCdigit3, - ctx->guti->gummei.plmn.MNCdigit1, - ctx->guti->gummei.plmn.MNCdigit2, - ctx->guti->gummei.plmn.MNCdigit3, - ctx->guti->gummei.MMEgid, - ctx->guti->gummei.MMEcode, - ctx->guti->m_tmsi - ); - } - - LOG_TRACE(WARNING, "EMM-PROC - Set ctx->guti_is_new to emm_data_context"); - ctx->guti_is_new = TRUE; - } else { - LOG_FUNC_RETURN (RETURNerror); - } - } else { - LOG_FUNC_RETURN (RETURNerror); - } - } - - /* The IMSI if provided by the UE */ - if (imsi) { - if (ctx->imsi == NULL) { - ctx->imsi = (imsi_t *)malloc(sizeof(imsi_t)); - } - - if (ctx->imsi != NULL) { - memcpy(ctx->imsi, imsi, sizeof(imsi_t)); - } else { - LOG_FUNC_RETURN (RETURNerror); - } - } - - /* The IMEI if provided by the UE */ - if (imei) { - if (ctx->imei == NULL) { - ctx->imei = (imei_t *)malloc(sizeof(imei_t)); - } - - if (ctx->imei != NULL) { - memcpy(ctx->imei, imei, sizeof(imei_t)); - } else { - LOG_FUNC_RETURN (RETURNerror); - } - } - - /* The ESM message contained within the attach request */ - if (esm_msg_pP->length > 0) { - if (ctx->esm_msg.value != NULL) { - free(ctx->esm_msg.value); - ctx->esm_msg.value = NULL; - ctx->esm_msg.length = 0; - } - - ctx->esm_msg.value = (uint8_t *)malloc(esm_msg_pP->length); - - if (ctx->esm_msg.value != NULL) { - memcpy((char *)ctx->esm_msg.value, - (char *)esm_msg_pP->value, esm_msg_pP->length); - - } else { - LOG_FUNC_RETURN (RETURNerror); - } - } - - ctx->esm_msg.length = esm_msg_pP->length; - /* Attachment indicator */ - ctx->is_attached = FALSE; - - LOG_FUNC_RETURN (RETURNok); -} - -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c b/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c deleted file mode 100644 index 9fb9498089b19b779e37bb4d7a7ddf6aaec6e36e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Authentication.c +++ /dev/null @@ -1,1579 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source Authentication.c - -Version 0.1 - -Date 2013/03/04 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the authentication EMM procedure executed by the - Non-Access Stratum. - - The purpose of the EPS authentication and key agreement (AKA) - procedure is to provide mutual authentication between the user - and the network and to agree on a key KASME. The procedure is - always initiated and controlled by the network. However, the - UE can reject the EPS authentication challenge sent by the - network. - - A partial native EPS security context is established in the - UE and the network when an EPS authentication is successfully - performed. The computed key material KASME is used as the - root for the EPS integrity protection and ciphering key - hierarchy. - -*****************************************************************************/ - -#include <stdlib.h> // malloc, free -#include <string.h> // memcpy, memcmp, memset -#include <arpa/inet.h> // htons - -#include "emm_proc.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "emmData.h" - -#include "emm_sap.h" -#include "emm_cause.h" - -#ifdef NAS_UE -#include "usim_api.h" -#include "secu_defs.h" -#endif - -#ifdef NAS_MME -# if defined(NAS_BUILT_IN_EPC) -# include "nas_itti_messaging.h" -# endif -#include "msc.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * Retransmission timer handlers - */ -extern void *_emm_attach_t3410_handler(void *); -extern void *_emm_service_t3417_handler(void *); -extern void *_emm_detach_t3421_handler(void *); -extern void *_emm_tau_t3430_handler(void *); -#endif // NAS_UE - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the authentication procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Timer handlers - */ -static void *_authentication_t3416_handler(void *); -static void *_authentication_t3418_handler(void *); -static void *_authentication_t3420_handler(void *); - -/* - * Internal data used for authentication procedure - */ -static struct { - uint8_t rand[AUTH_RAND_SIZE]; /* Random challenge number */ - uint8_t res[AUTH_RES_SIZE]; /* Authentication response */ - uint8_t ck[AUTH_CK_SIZE]; /* Ciphering key */ - uint8_t ik[AUTH_IK_SIZE]; /* Integrity key */ -#define AUTHENTICATION_T3410 0x01 -#define AUTHENTICATION_T3417 0x02 -#define AUTHENTICATION_T3421 0x04 -#define AUTHENTICATION_T3430 0x08 - unsigned char timers; /* Timer restart bitmap */ -#define AUTHENTICATION_COUNTER_MAX 3 - unsigned char mac_count:2; /* MAC failure counter (#20) */ - unsigned char umts_count:2; /* UMTS challenge failure counter (#26) */ - unsigned char sync_count:2; /* Sync failure counter (#21) */ -} _authentication_data; - -/* - * Abnormal case authentication procedure - */ -static int _authentication_abnormal_cases_cde(int emm_cause, - const OctetString *auts); -static int _authentication_abnormal_case_f(void); - -static int _authentication_stop_timers(void); -static int _authentication_start_timers(void); -static int _authentication_kasme(const OctetString *autn, - const OctetString *ck, const OctetString *ik, const plmn_t *plmn, - OctetString *kasme); -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the authentication procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Timer handlers - */ -static void *_authentication_t3460_handler(void *); - -/* - * Function executed whenever the ongoing EMM procedure that initiated - * the authentication procedure is aborted or the maximum value of the - * retransmission timer counter is exceed - */ -static int _authentication_abort(void *); - -/* - * Internal data used for authentication procedure - */ -typedef struct { - unsigned int ueid; /* UE identifier */ -#define AUTHENTICATION_COUNTER_MAX 5 - unsigned int retransmission_count; /* Retransmission counter */ - int ksi; /* NAS key set identifier */ - OctetString rand; /* Random challenge number */ - OctetString autn; /* Authentication token */ - int notify_failure; /* Indicates whether the authentication - * procedure failure shall be notified - * to the ongoing EMM procedure */ -} authentication_data_t; - -static int _authentication_request(authentication_data_t *data); -static int _authentication_reject(unsigned int ueid); -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Authentication procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_proc_authentication_request() ** - ** ** - ** Description: Performs the MME requested authentication procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.3 ** - ** Upon receiving the AUTHENTICATION REQUEST message, the UE ** - ** shall store the received RAND together with the RES re- ** - ** turned from the USIM in the volatile memory of the ME, to ** - ** avoid a synchronisation failure. The UE shall process the ** - ** authentication challenge data and respond with an AUTHEN- ** - ** TICATION RESPONSE message to the network. ** - ** ** - ** Inputs: native_ksi: TRUE if the security context is of type ** - ** native (for KSIASME) ** - ** ksi: The NAS ket sey identifier ** - ** rand: Authentication parameter RAND ** - ** autn: Authentication parameter AUTN ** - ** Others: _emm_data, _authentication_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, _authentication_data, T3416, ** - ** T3418, T3420 ** - ** ** - ***************************************************************************/ -int emm_proc_authentication_request(int native_ksi, int ksi, - const OctetString *rand, - const OctetString *autn) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(INFO, "EMM-PROC - Authentication requested ksi type = %s, ksi = %d", native_ksi ? "native" : "mapped", ksi); - - /* 3GPP TS 24.301, section 5.4.2.1 - * The UE shall proceed with an EPS authentication challenge only if a - * USIM is present - */ - if (!_emm_data.usim_is_valid) { - LOG_TRACE(WARNING, "EMM-PROC - USIM is not present or not valid"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Stop timer T3418, if running */ - if (T3418.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3418 (%d)", T3418.id); - T3418.id = nas_timer_stop(T3418.id); - } - - /* Stop timer T3420, if running */ - if (T3420.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3420 (%d)", T3420.id); - T3420.id = nas_timer_stop(T3420.id); - } - - /* Setup security keys */ - OctetString ck = {AUTH_CK_SIZE, _authentication_data.ck}; - OctetString ik = {AUTH_IK_SIZE, _authentication_data.ik}; - OctetString res = {AUTH_RES_SIZE, _authentication_data.res}; - - if (memcmp(_authentication_data.rand, rand->value, AUTH_CK_SIZE) != 0) { - /* - * There is no valid stored RAND in the ME or the stored RAND is - * different from the new received value in the AUTHENTICATION - * REQUEST message - */ - OctetString auts; - auts.length = 0; - auts.value = (uint8_t *)malloc(AUTH_AUTS_SIZE); - - if (auts.value == NULL) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to allocate AUTS parameter"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* 3GPP TS 33.401, section 6.1.1 - * Get the "separation bit" of the AMF field of AUTN */ - int sbit = AUTH_AMF_SEPARATION_BIT(autn->value[AUTH_AMF_INDEX]); - - if (sbit != 0) { - /* LW: only 64 bits from the response field are used for the authentication response for this algorithms */ - res.length = 8; /* Bytes */ - - /* - * Perform EPS authentication challenge to check the authenticity - * of the core network by means of the received AUTN parameter and - * request the USIM to compute RES, CK and IK for given RAND - */ - rc = usim_api_authenticate(rand, autn, &auts, &res, &ck, &ik); - } - - if (rc != RETURNok) { - /* - * Network authentication not accepted by the UE - */ - LOG_TRACE(WARNING, "EMM-PROC - Network authentication failed (%s)", - (auts.length > 0) ? "SQN failure" : - (sbit == 0) ? "Non-EPS authentication unacceptable" : - "MAC code failure"); - /* Delete any previously stored RAND and RES and stop timer T3416 */ - (void) emm_proc_authentication_delete(); - - /* Proceed authentication abnormal cases procedure */ - if (auts.length > 0) { - /* 3GPP TS 24.301, section 5.4.2.6, case e - * SQN failure */ - rc = _authentication_abnormal_cases_cde( - EMM_CAUSE_SYNCH_FAILURE, &auts); - } else if (sbit == 0) { - /* 3GPP TS 24.301, section 5.4.2.6, case d - * Non-EPS authentication unacceptable */ - rc = _authentication_abnormal_cases_cde( - EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE, NULL); - } else { - /* 3GPP TS 24.301, section 5.4.2.6, case c - * MAC code failure */ - rc = _authentication_abnormal_cases_cde( - EMM_CAUSE_MAC_FAILURE, NULL); - } - - /* Free the AUTS parameter */ - free(auts.value); - LOG_FUNC_RETURN (rc); - } - - /* Free the AUTS parameter */ - free(auts.value); - - /* Store the new RAND in the volatile memory */ - if (rand->length <= AUTH_RAND_SIZE) { - memcpy(_authentication_data.rand, rand->value, rand->length); - } - - /* Start, or reset and restart timer T3416 */ - if (T3416.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3416 (%d)", T3416.id); - T3416.id = nas_timer_stop(T3416.id); - } - - T3416.id = nas_timer_start(T3416.sec, _authentication_t3416_handler, NULL); - LOG_TRACE(INFO, "EMM-PROC - Timer T3416 (%d) expires in %ld seconds", - T3416.id, T3416.sec); - } - - /* - * The stored RAND value is equal to the new received value in the - * AUTHENTICATION REQUEST message, or the UE has successfully checked - * the authenticity of the core network - */ - /* Start any retransmission timers */ - rc = _authentication_start_timers(); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to start retransmission timers"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Setup EMM procedure handler to be executed upon receiving - * lower layer notification */ - rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, - "EMM-PROC - Failed to initialize EMM procedure handler"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Notify EMM-AS SAP that Authentication Response message has to be sent - * to the network - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMAS_SECURITY_RES; - emm_sap.u.emm_as.u.security.guti = _emm_data.guti; - emm_sap.u.emm_as.u.security.ueid = 0; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH; - emm_sap.u.emm_as.u.security.emm_cause = EMM_CAUSE_SUCCESS; - emm_sap.u.emm_as.u.security.res = &res; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - _emm_data.security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Reset the authentication failure counters */ - _authentication_data.mac_count = 0; - _authentication_data.umts_count = 0; - _authentication_data.sync_count = 0; - - /* Create non-current EPS security context */ - if (_emm_data.non_current == NULL) { - _emm_data.non_current = - (emm_security_context_t *)malloc(sizeof(emm_security_context_t)); - } - - if (_emm_data.non_current) { - memset(_emm_data.non_current, 0, sizeof(emm_security_context_t)); - - /* Set the security context type */ - if (native_ksi) { - _emm_data.non_current->type = EMM_KSI_NATIVE; - } else { - _emm_data.non_current->type = EMM_KSI_MAPPED; - } - - /* Set the EPS key set identifier */ - _emm_data.non_current->eksi = ksi; - /* Derive the Kasme from the authentication challenge using - * the PLMN identity of the selected PLMN */ - _emm_data.non_current->kasme.length = AUTH_KASME_SIZE; - _emm_data.non_current->kasme.value = malloc(32); - _authentication_kasme(autn, &ck, &ik, &_emm_data.splmn, - &_emm_data.non_current->kasme); - /* NAS integrity and cyphering keys are not yet available */ - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_authentication_reject() ** - ** ** - ** Description: Performs the authentication procedure not accepted by the ** - ** network. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.5 ** - ** Upon receiving an AUTHENTICATION REJECT message, the UE ** - ** shall abort any EMM signalling procedure, stop any of the ** - ** timers T3410, T3417 or T3430 (if running) and enter state ** - ** EMM-DEREGISTERED. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, _authentication_data, T3410, ** - ** T3417, T3430 ** - ** ** - ***************************************************************************/ -int emm_proc_authentication_reject(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - Authentication not accepted by the network"); - - /* Delete any previously stored RAND and RES and stop timer T3416 */ - (void) emm_proc_authentication_delete(); - - /* Set the EPS update status to EU3 ROAMING NOT ALLOWED */ - _emm_data.status = EU3_ROAMING_NOT_ALLOWED; - /* Delete the stored GUTI */ - _emm_data.guti = NULL; - /* Delete the TAI list */ - _emm_data.ltai.n_tais = 0; - /* Delete the last visited registered TAI */ - _emm_data.tai = NULL; - - /* Delete the eKSI */ - if (_emm_data.security) { - _emm_data.security->type = EMM_KSI_NOT_AVAILABLE; - } - - /* Consider the USIM invalid */ - _emm_data.usim_is_valid = FALSE; - - /* Stop timer T3410 */ - if (T3410.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id); - T3410.id = nas_timer_stop(T3410.id); - } - - /* Stop timer T3417 */ - if (T3417.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3417 (%d)", T3417.id); - T3417.id = nas_timer_stop(T3417.id); - } - - /* Stop timer T3430 */ - if (T3430.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3430 (%d)", T3430.id); - T3430.id = nas_timer_stop(T3430.id); - } - - /* Abort any EMM signalling procedure (prevent the retransmission timers to - * be restarted) */ - _authentication_data.timers = 0x00; - - /* - * Notify EMM that authentication is not accepted by the network - */ - emm_sap.primitive = EMMREG_AUTH_REJ; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_authentication_delete() ** - ** ** - ** Description: Deletes the RAND and RES values stored into the volatile ** - ** memory of the Mobile Equipment and stop timer T3416, if ** - ** running, upon receipt of a SECURITY MODE COMMAND, SERVICE ** - ** REJECT, TRACKING AREA UPDATE REJECT, TRACKING AREA UPDATE ** - ** ACCEPT or AUTHENTICATION REJECT message; upon expiry of ** - ** timer T3416; or if the UE enters the EMM state EMM- ** - ** DEREGISTERED or EMM-NULL. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.3 ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _authentication_data, T3416 ** - ** ** - ***************************************************************************/ -int emm_proc_authentication_delete(void) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - Delete authentication data RAND and RES"); - - /* Stop timer T3416, if running */ - if (T3416.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3416 (%d)", T3416.id); - T3416.id = nas_timer_stop(T3416.id); - } - - /* Delete any previously stored RAND and RES */ - memset(_authentication_data.rand, 0, AUTH_RAND_SIZE); - memset(_authentication_data.res, 0, AUTH_RES_SIZE); - - LOG_FUNC_RETURN (RETURNok); -} -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Authentication procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: emm_proc_authentication() ** - ** ** - ** Description: Initiates authentication procedure to establish partial ** - ** native EPS security context in the UE and the MME. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.2 ** - ** The network initiates the authentication procedure by ** - ** sending an AUTHENTICATION REQUEST message to the UE and ** - ** starting the timer T3460. The AUTHENTICATION REQUEST mes- ** - ** sage contains the parameters necessary to calculate the ** - ** authentication response. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** ksi: NAS key set identifier ** - ** rand: Random challenge number ** - ** autn: Authentication token ** - ** success: Callback function executed when the authen-** - ** tication procedure successfully completes ** - ** reject: Callback function executed when the authen-** - ** tication procedure fails or is rejected ** - ** failure: Callback function executed whener a lower ** - ** layer failure occured before the authenti- ** - ** cation procedure comnpletes ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_authentication(void *ctx, unsigned int ueid, int ksi, - const OctetString *_rand, const OctetString *autn, - emm_common_success_callback_t success, - emm_common_reject_callback_t reject, - emm_common_failure_callback_t failure) - -{ - int rc = RETURNerror; - authentication_data_t *data; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - Initiate authentication KSI = %d, ctx = %p", ksi, ctx); - - /* Allocate parameters of the retransmission timer callback */ - data = (authentication_data_t *)malloc(sizeof(authentication_data_t)); - - if (data != NULL) { - /* Setup ongoing EMM procedure callback functions */ - rc = emm_proc_common_initialize(ueid, success, reject, failure, - _authentication_abort, data); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "Failed to initialize EMM callback functions"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Set the UE identifier */ - data->ueid = ueid; - /* Reset the retransmission counter */ - data->retransmission_count = 0; - /* Set the key set identifier */ - data->ksi = ksi; - - /* Set the authentication random challenge number */ - if (_rand->length > 0) { - data->rand.value = (uint8_t *)malloc(_rand->length); - data->rand.length = 0; - - if (data->rand.value) { - memcpy(data->rand.value, _rand->value, _rand->length); - data->rand.length = _rand->length; - } - } - - /* Set the authentication token */ - if (autn->length > 0) { - data->autn.value = (uint8_t *)malloc(autn->length); - data->autn.length = 0; - - if (data->autn.value) { - memcpy(data->autn.value, autn->value, autn->length); - data->autn.length = autn->length; - } - } - - /* Set the failure notification indicator */ - data->notify_failure = FALSE; - /* Send authentication request message to the UE */ - rc = _authentication_request(data); - - if (rc != RETURNerror) { - /* - * Notify EMM that common procedure has been initiated - */ - - - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REQ ue id %06x (authentication)", ueid); - - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REQ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = ctx; - rc = emm_sap_send(&emm_sap); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_authentication_complete() ** - ** ** - ** Description: Performs the authentication completion procedure executed ** - ** by the network. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.4 ** - ** Upon receiving the AUTHENTICATION RESPONSE message, the ** - ** MME shall stop timer T3460 and check the correctness of ** - ** the RES parameter. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** emm_cause: Authentication failure EMM cause code ** - ** res: Authentication response parameter. or auts ** - ** in case of sync failure ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, T3460 ** - ** ** - ***************************************************************************/ -int emm_proc_authentication_complete(unsigned int ueid, int emm_cause, - const OctetString *res) -{ - int rc; - emm_sap_t emm_sap; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - Authentication complete (ueid=%u, cause=%d)", - ueid, emm_cause); - - /* Stop timer T3460 */ - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id); - T3460.id = nas_timer_stop(T3460.id); - - /* Release retransmission timer paramaters */ - authentication_data_t *data = - (authentication_data_t *)(emm_proc_common_get_args(ueid)); - - if (data) { - if (data->rand.length > 0) { - free(data->rand.value); - } - - if (data->autn.length > 0) { - free(data->autn.value); - } - - free(data); - } - - /* Get the UE context */ - emm_data_context_t *emm_ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - } - -#endif - - if (emm_cause == EMM_CAUSE_SUCCESS) { - /* Check the received RES parameter */ - if ( (emm_ctx == NULL) || - (memcmp(res->value, &emm_ctx->vector.xres, res->length) != 0) ) { - /* RES does not match the XRES parameter */ - LOG_TRACE(WARNING, "EMM-PROC - Failed to authentify the UE"); - emm_cause = EMM_CAUSE_ILLEGAL_UE; - } else { - LOG_TRACE(DEBUG, "EMM-PROC - Success to authentify the UE RESP XRES == XRES UE CONTEXT"); - } - } - - if (emm_cause != EMM_CAUSE_SUCCESS) { - switch (emm_cause) { - -#if defined(NAS_BUILT_IN_EPC) - - case EMM_CAUSE_SYNCH_FAILURE: - /* USIM has detected a mismatch in SQN. - * Ask for a new vector. - */ - MSC_LOG_EVENT( - MSC_NAS_EMM_MME, - "SQN SYNCH_FAILURE ue id %06x", ueid); - - LOG_TRACE(DEBUG, "EMM-PROC - USIM has detected a mismatch in SQN Ask for a new vector"); - nas_itti_auth_info_req(ueid, emm_ctx->imsi, 0, res->value); - - rc = RETURNok; - LOG_FUNC_RETURN (rc); - break; -#endif - - default: - LOG_TRACE(DEBUG, "EMM-PROC - The MME received an authentication failure message or the RES does not match the XRES parameter computed by the network"); - /* The MME received an authentication failure message or the RES - * contained in the Authentication Response message received from - * the UE does not match the XRES parameter computed by the network */ - (void) _authentication_reject(ueid); - /* - * Notify EMM that the authentication procedure failed - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid); - - - emm_sap.primitive = EMMREG_COMMON_PROC_REJ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - break; - } - } else { - /* - * Notify EMM that the authentication procedure successfully completed - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_CNF ue id %06x", ueid); - - LOG_TRACE(DEBUG, "EMM-PROC - Notify EMM that the authentication procedure successfully completed"); - emm_sap.primitive = EMMREG_COMMON_PROC_CNF; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - emm_sap.u.emm_reg.u.common.is_attached = emm_ctx->is_attached; - } - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _authentication_t3416_handler() ** - ** ** - ** Description: T3416 timeout handler ** - ** Upon T3416 timer expiration, the RAND and RES values sto- ** - ** red in the ME shall be deleted. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.3 ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: T3416 ** - ** ** - ***************************************************************************/ -static void *_authentication_t3416_handler(void *args) -{ - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "EMM-PROC - T3416 timer expired"); - - /* Stop timer T3416 */ - T3416.id = nas_timer_stop(T3416.id); - /* Delete previouly stored RAND and RES authentication data */ - (void) emm_proc_authentication_delete(); - - LOG_FUNC_RETURN (NULL); -} - -/**************************************************************************** - ** ** - ** Name: _authentication_t3418_handler() ** - ** ** - ** Description: T3418 timeout handler ** - ** Upon T3418 timer expiration, the UE shall deem that the ** - ** source of the authentication challenge is not genuine ** - ** (authentication not accepted by the UE). ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.7, case c ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _authentication_data, T3418 ** - ** ** - ***************************************************************************/ -static void *_authentication_t3418_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - T3418 timer expired"); - - /* Stop timer T3418 */ - T3418.id = nas_timer_stop(T3418.id); - /* Reset the MAC failure and UMTS challenge failure counters */ - _authentication_data.mac_count = 0; - _authentication_data.umts_count = 0; - /* 3GPP TS 24.301, section 5.4.2.7, case f */ - rc = _authentication_abnormal_case_f(); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f"); - } - - LOG_FUNC_RETURN (NULL); -} - -/**************************************************************************** - ** ** - ** Name: _authentication_t3420_handler() ** - ** ** - ** Description: T3420 timeout handler ** - ** Upon T3420 timer expiration, the UE shall deem that the ** - ** network has failed the authentication check. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.7, case e ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _authentication_data, T3420 ** - ** ** - ***************************************************************************/ -static void *_authentication_t3420_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - T3420 timer expired"); - - /* Stop timer T3420 */ - T3420.id = nas_timer_stop(T3420.id); - /* Reset the sync failure counter */ - _authentication_data.sync_count = 0; - /* 3GPP TS 24.301, section 5.4.2.7, case f */ - rc = _authentication_abnormal_case_f(); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - Failed to proceed abnormal case f"); - } - - LOG_FUNC_RETURN (NULL); -} - -/* - * -------------------------------------------------------------------------- - * Abnormal cases in the UE - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _authentication_abnormal_cases_cde() ** - ** ** - ** Description: Performs the abnormal case authentication procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.7, cases c, d and e ** - ** ** - ** Inputs: emm_cause: EMM cause code ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _authentication_data, T3418, T3420 ** - ** ** - ***************************************************************************/ -static int _authentication_abnormal_cases_cde(int emm_cause, - const OctetString *auts) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - " - "Abnormal case, authentication counters c/d/e = %d/%d/%d", - _authentication_data.mac_count, _authentication_data.umts_count, - _authentication_data.sync_count); - - /* - * Notify EMM-AS SAP that Authentication Failure message has to be sent - * to the network - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMAS_SECURITY_RES; - emm_sap.u.emm_as.u.security.guti = _emm_data.guti; - emm_sap.u.emm_as.u.security.ueid = 0; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH; - emm_sap.u.emm_as.u.security.emm_cause = emm_cause; - emm_sap.u.emm_as.u.security.auts = auts; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - _emm_data.security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* - * Update the authentication failure counters - */ - switch (emm_cause) { - case EMM_CAUSE_MAC_FAILURE: - /* 3GPP TS 24.301, section 5.4.2.6, case c - * Update the MAC failure counter */ - _authentication_data.mac_count += 1; - /* Start timer T3418 */ - T3418.id = nas_timer_start(T3418.sec, - _authentication_t3418_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3418 (%d) expires in " - "%ld seconds", T3418.id, T3418.sec); - break; - - case EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE: - /* 3GPP TS 24.301, section 5.4.2.6, case d - * Update the UMTS challenge failure counter */ - _authentication_data.umts_count += 1; - /* Start timer T3418 */ - T3418.id = nas_timer_start(T3418.sec, - _authentication_t3418_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3418 (%d) expires in " - "%ld seconds", T3418.id, T3418.sec); - break; - - case EMM_CAUSE_SYNCH_FAILURE: - /* 3GPP TS 24.301, section 5.4.2.6, case e - * Update the synch failure counter */ - _authentication_data.sync_count += 1; - /* Start timer T3420 */ - T3420.id = nas_timer_start(T3420.sec, - _authentication_t3420_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3420 (%d) expires in " - "%ld seconds", T3420.id, T3420.sec); - break; - - default: - LOG_TRACE(WARNING, "EMM cause code is not valid (%d)", - emm_cause); - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Stop any retransmission timers that are running - */ - rc = _authentication_stop_timers(); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to stop retransmission timers"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Check whether the network has failed the authentication check - */ - int failure_counter = 0; - - if (emm_cause == EMM_CAUSE_MAC_FAILURE) { - failure_counter = _authentication_data.mac_count - + _authentication_data.sync_count; - } else if (emm_cause == EMM_CAUSE_SYNCH_FAILURE) { - failure_counter = _authentication_data.mac_count - + _authentication_data.umts_count - + _authentication_data.sync_count; - } - - if (failure_counter >= AUTHENTICATION_COUNTER_MAX) { - /* 3GPP TS 24.301, section 5.4.2.6, case f */ - rc = _authentication_abnormal_case_f(); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to proceed abnormal case f"); - } - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _authentication_abnormal_case_f() ** - ** ** - ** Description: Performs the abnormal case authentication procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.7, case f ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _authentication_abnormal_case_f(void) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - Authentication abnormal case f"); - - /* - * Request RRC to locally release the RRC connection and treat - * the active cell as barred - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMAS_RELEASE_REQ; - emm_sap.u.emm_as.u.release.guti = _emm_data.guti; - emm_sap.u.emm_as.u.release.cause = EMM_AS_CAUSE_AUTHENTICATION; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Start any retransmission timers (e.g. T3410, T3417, T3421 or - * T3430), if they were running and stopped when the UE received - * the first AUTHENTICATION REQUEST message containing an invalid - * MAC or SQN */ - rc = _authentication_start_timers(); - } - - LOG_FUNC_RETURN (rc); -} - -/* - * -------------------------------------------------------------------------- - * UE specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _authentication_stop_timers() ** - ** ** - ** Description: Stops any retransmission timers (e.g. T3410, T3417, T3421 ** - ** or T3430) that are running ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _authentication_data, T3410, T3417, T3421, ** - ** T3430 ** - ** ** - ***************************************************************************/ -static int _authentication_stop_timers(void) -{ - LOG_FUNC_IN; - - /* Stop attach timer */ - if (T3410.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3410 (%d)", T3410.id); - T3410.id = nas_timer_stop(T3410.id); - _authentication_data.timers |= AUTHENTICATION_T3410; - } - - /* Stop service request timer */ - if (T3417.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3417 (%d)", T3417.id); - T3417.id = nas_timer_stop(T3417.id); - _authentication_data.timers |= AUTHENTICATION_T3417; - } - - /* Stop detach timer */ - if (T3421.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3421 (%d)", T3421.id); - T3421.id = nas_timer_stop(T3421.id); - _authentication_data.timers |= AUTHENTICATION_T3421; - } - - /* Stop tracking area update timer */ - if (T3430.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3430 (%d)", T3430.id); - T3430.id = nas_timer_stop(T3430.id); - _authentication_data.timers |= AUTHENTICATION_T3430; - } - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _authentication_start_timers() ** - ** ** - ** Description: Starts any retransmission timers (e.g. T3410, T3417, ** - ** T3421 or T3430), if they were running and stopped when ** - ** the UE received the first AUTHENTICATION REQUEST message ** - ** containing an invalid MAC or SQN ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.7, case f ** - ** ** - ** Inputs: None ** - ** Others: _authentication_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3410, T3417, T3421, T3430 ** - ** ** - ***************************************************************************/ -static int _authentication_start_timers(void) -{ - LOG_FUNC_IN; - - if (_authentication_data.timers & AUTHENTICATION_T3410) { - /* Start attach timer */ - T3410.id = nas_timer_start(T3410.sec, _emm_attach_t3410_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3410 (%d) expires in " - "%ld seconds", T3410.id, T3410.sec); - } - - if (_authentication_data.timers & AUTHENTICATION_T3417) { - /* Start service request timer */ - T3417.id = nas_timer_start(T3417.sec, _emm_service_t3417_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3417 (%d) expires in " - "%ld seconds", T3417.id, T3417.sec); - } - - if (_authentication_data.timers & AUTHENTICATION_T3421) { - /* Start detach timer */ - T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3421 (%d) expires in " - "%ld seconds", T3421.id, T3421.sec); - } - - if (_authentication_data.timers & AUTHENTICATION_T3430) { - /* Start tracking area update timer */ - T3430.id = nas_timer_start(T3430.sec, _emm_tau_t3430_handler, NULL); - LOG_TRACE(INFO,"EMM-PROC - Timer T3430 (%d) expires in " - "%ld seconds", T3430.id, T3430.sec); - } - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _authentication_kasme() ** - ** ** - ** Description: Computes the Key Access Security Management Entity Kasme ** - ** from the provided authentication challenge data. ** - ** ** - ** 3GPP TS 33.401, Annex A.2 ** - ** ** - ** Inputs: autn: Authentication token ** - ** ck: Cipherig key ** - ** ik: Integrity key ** - ** plmn: Identifier of the currently selected PLMN ** - ** Others: None ** - ** ** - ** Outputs: kasme: Key Access Security Management Entity ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _authentication_kasme(const OctetString *autn, - const OctetString *ck, const OctetString *ik, - const plmn_t *plmn, OctetString *kasme) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO,"EMM-PROC _authentication_kasme INPUT CK %s", - dump_octet_string(ck)); - LOG_TRACE(INFO,"EMM-PROC _authentication_kasme INPUT IK %s", - dump_octet_string(ik)); - LOG_TRACE(INFO,"EMM-PROC _authentication_kasme INPUT AUTN %s", - dump_octet_string(autn)); - LOG_TRACE(INFO,"EMM-PROC _authentication_kasme INPUT KASME LENGTH %u", - kasme->length); - - /* Compute the derivation key KEY = CK || IK */ - UInt8_t key[ck->length + ik->length]; - memcpy(key, ck->value, ck->length); - memcpy(key + ck->length, ik->value, ik->length); - - /* Compute the KDF input_s parameter - * S = FC(0x10) || SNid(MCC, MNC) || 0x00 0x03 || SQN ⊕ AK || 0x00 0x06 - */ - UInt8_t input_s[16]; // less than 16 - UInt8_t sn_id[AUTH_SNID_SIZE]; // less than 16 - UInt16_t length; - int offset = 0; - int size_of_length = sizeof(length); - - // FC - input_s[offset] = 0x10; - offset += 1; - - // P0=SN id - length = AUTH_SNID_SIZE; - sn_id[0] = (plmn->MCCdigit2 << 4) | plmn->MCCdigit1; - sn_id[1] = (plmn->MNCdigit3 << 4) | plmn->MCCdigit3; - sn_id[2] = (plmn->MNCdigit2 << 4) | plmn->MNCdigit1; - - memcpy(input_s + offset, sn_id, length); - LOG_TRACE(INFO,"EMM-PROC _authentication_kasme P0 MCC,MNC %02X %02X %02X", - input_s[offset], - input_s[offset+1], - input_s[offset+2]); - offset += length; - // L0=SN id length - length = htons(length); - memcpy(input_s + offset, &length, size_of_length); - offset += size_of_length; - - // P1=Authentication token - length = AUTH_SQN_SIZE; - memcpy(input_s + offset, autn->value, length); - offset += length; - // L1 - length = htons(length); - memcpy(input_s + offset, &length, size_of_length); - offset += size_of_length; - - LOG_TRACE(INFO, - "EMM-PROC _authentication_kasme input S to KFD (length %u)%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", - offset, - input_s[0],input_s[1],input_s[2],input_s[3], - input_s[4],input_s[5],input_s[6],input_s[7], - input_s[8],input_s[9],input_s[10],input_s[11], - input_s[12],input_s[13]); - /* TODO !!! Compute the Kasme key */ - // todo_hmac_256(key, input_s, kasme->value); - kdf(key, - ck->length + ik->length , /*key_length*/ - input_s, - offset, - kasme->value, - kasme->length); - - LOG_TRACE(INFO,"EMM-PROC KASME (l=%d)%s", - kasme->length, - dump_octet_string(kasme)); - - LOG_FUNC_RETURN (RETURNok); -} -#endif // NAS_UE - -#ifdef NAS_MME -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _authentication_t3460_handler() ** - ** ** - ** Description: T3460 timeout handler ** - ** Upon T3460 timer expiration, the authentication request ** - ** message is retransmitted and the timer restarted. When ** - ** retransmission counter is exceed, the MME shall abort the ** - ** authentication procedure and any ongoing EMM specific ** - ** procedure and release the NAS signalling connection. ** - ** ** - ** 3GPP TS 24.301, section 5.4.2.7, case b ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_authentication_t3460_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - authentication_data_t *data = (authentication_data_t *)(args); - - /* Increment the retransmission counter */ - data->retransmission_count += 1; - - LOG_TRACE(WARNING, "EMM-PROC - T3460 timer expired, retransmission " - "counter = %d", data->retransmission_count); - - if (data->retransmission_count < AUTHENTICATION_COUNTER_MAX) { - /* Send authentication request message to the UE */ - rc = _authentication_request(data); - } else { - unsigned int ueid = data->ueid; - /* Set the failure notification indicator */ - data->notify_failure = TRUE; - /* Abort the authentication procedure */ - rc = _authentication_abort(data); - - /* Release the NAS signalling connection */ - if (rc != RETURNerror) { - emm_sap_t emm_sap; - emm_sap.primitive = EMMAS_RELEASE_REQ; - emm_sap.u.emm_as.u.release.guti = NULL; - emm_sap.u.emm_as.u.release.ueid = ueid; - emm_sap.u.emm_as.u.release.cause = EMM_AS_CAUSE_AUTHENTICATION; - rc = emm_sap_send(&emm_sap); - } - } - - LOG_FUNC_RETURN (NULL); -} - -/* - * -------------------------------------------------------------------------- - * MME specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _authentication_request() ** - ** ** - ** Description: Sends AUTHENTICATION REQUEST message and start timer T3460** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3460 ** - ** ** - ***************************************************************************/ -int _authentication_request(authentication_data_t *data) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - struct emm_data_context_s *emm_ctx; - - /* - * Notify EMM-AS SAP that Authentication Request message has to be sent - * to the UE - */ - emm_sap.primitive = EMMAS_SECURITY_REQ; - emm_sap.u.emm_as.u.security.guti = NULL; - emm_sap.u.emm_as.u.security.ueid = data->ueid; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH; - emm_sap.u.emm_as.u.security.ksi = data->ksi; - emm_sap.u.emm_as.u.security.rand = &data->rand; - emm_sap.u.emm_as.u.security.autn = &data->autn; - - /* TODO: check for pointer validity */ -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, data->ueid); -#else - emm_ctx = _emm_data.ctx[data->ueid]; -#endif - - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - emm_ctx->security, FALSE, TRUE); - - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMAS_SECURITY_REQ ue id %06x", data->ueid); - - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - if (T3460.id != NAS_TIMER_INACTIVE_ID) { - /* Re-start T3460 timer */ - T3460.id = nas_timer_restart(T3460.id); - } else { - /* Start T3460 timer */ - T3460.id = nas_timer_start(T3460.sec, _authentication_t3460_handler, - data); - } - - LOG_TRACE(INFO,"EMM-PROC - Timer T3460 (%d) expires in %ld seconds", - T3460.id, T3460.sec); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _authentication_reject() ** - ** ** - ** Description: Sends AUTHENTICATION REJECT message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _authentication_reject(unsigned int ueid) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - struct emm_data_context_s *emm_ctx; - - /* - * Notify EMM-AS SAP that Authentication Reject message has to be sent - * to the UE - */ - emm_sap.primitive = EMMAS_SECURITY_REJ; - emm_sap.u.emm_as.u.security.guti = NULL; - emm_sap.u.emm_as.u.security.ueid = ueid; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_AUTH; - -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, ueid); -#else - emm_ctx = _emm_data.ctx[ueid]; -#endif - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - emm_ctx->security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _authentication_abort() ** - ** ** - ** Description: Aborts the authentication procedure currently in progress ** - ** ** - ** Inputs: args: Authentication data to be released ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3460 ** - ** ** - ***************************************************************************/ -static int _authentication_abort(void *args) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - authentication_data_t *data = (authentication_data_t *)(args); - - if (data) { - unsigned int ueid = data->ueid; - int notify_failure = data->notify_failure; - - LOG_TRACE(WARNING, "EMM-PROC - Abort authentication procedure " - "(ueid=%u)", ueid); - - /* Stop timer T3460 */ - if (T3460.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id); - T3460.id = nas_timer_stop(T3460.id); - } - - /* Release retransmission timer paramaters */ - if (data->rand.length > 0) { - free(data->rand.value); - } - - if (data->autn.length > 0) { - free(data->autn.value); - } - - free(data); - - /* - * Notify EMM that the authentication procedure failed - */ - if (notify_failure) { - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REJ; - emm_sap.u.emm_reg.ueid = ueid; - rc = emm_sap_send(&emm_sap); - } else { - rc = RETURNok; - } - } - - LOG_FUNC_RETURN (rc); -} - -#endif // NAS_MME - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/COPYING b/openair-cn/NAS/EURECOM-NAS/src/emm/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c b/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c deleted file mode 100644 index 041abaa53df708674415f1e08630d6e1a0728bab..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Detach.c +++ /dev/null @@ -1,724 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source Detach.c - -Version 0.1 - -Date 2013/05/07 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the detach related EMM procedure executed by the - Non-Access Stratum. - - The detach procedure is used by the UE to detach for EPS servi- - ces, to disconnect from the last PDN it is connected to; by the - network to inform the UE that it is detached for EPS services - or non-EPS services or both, to disconnect the UE from the last - PDN to which it is connected and to inform the UE to re-attach - to the network and re-establish all PDN connections. - -*****************************************************************************/ - -#include "emm_proc.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "emmData.h" - -#include "emm_sap.h" -#include "esm_sap.h" -#include "msc.h" - -#include <stdlib.h> // free - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* String representation of the detach type */ -static const char *_emm_detach_type_str[] = { - "EPS", "IMSI", "EPS/IMSI", - "RE-ATTACH REQUIRED", "RE-ATTACH NOT REQUIRED", "RESERVED" -}; - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the detach procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Timer handlers - */ -void *_emm_detach_t3421_handler(void *); - -/* - * Abnormal case detach procedures - */ -static int _emm_detach_abort(emm_proc_detach_type_t type); - -/* - * Internal data used for detach procedure - */ -static struct { -#define EMM_DETACH_COUNTER_MAX 5 - unsigned int count; /* Counter used to limit the number of - * subsequently detach attempts */ - int switch_off; /* UE switch-off indicator */ - emm_proc_detach_type_t type; /* Type of the detach procedure - * currently in progress */ -} _emm_detach_data = {0, FALSE, EMM_DETACH_TYPE_RESERVED}; -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the detach procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Detach procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_proc_detach() ** - ** ** - ** Description: Initiates the detach procedure in order for the UE to de- ** - ** tach for EPS services. ** - ** ** - ** 3GPP TS 24.301, section 5.5.2.2.1 ** - ** In state EMM-REGISTERED or EMM-REGISTERED-INITIATED, the ** - ** UE initiates the detach procedure by sending a DETACH RE- ** - ** QUEST message to the network, starting timer T3421 and ** - ** entering state EMM-DEREGISTERED-INITIATED. ** - ** ** - ** Inputs: type: Type of the requested detach ** - ** switch_off: Indicates whether the detach is required ** - ** because the UE is switched off or not ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_detach_data ** - ** ** - ***************************************************************************/ -int emm_proc_detach(emm_proc_detach_type_t type, int switch_off) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data; - int rc; - - LOG_TRACE(INFO, "EMM-PROC - Initiate EPS detach type = %s (%d)", - _emm_detach_type_str[type], type); - - /* Initialize the detach procedure internal data */ - _emm_detach_data.count = 0; - _emm_detach_data.switch_off = switch_off; - _emm_detach_data.type = type; - - /* Setup EMM procedure handler to be executed upon receiving - * lower layer notification */ - rc = emm_proc_lowerlayer_initialize(emm_proc_detach_request, - emm_proc_detach_failure, - emm_proc_detach_release, NULL); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "Failed to initialize EMM procedure handler"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Setup NAS information message to transfer */ - emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH; - emm_as->NASmsg.length = 0; - emm_as->NASmsg.value = NULL; - /* Set the detach type */ - emm_as->type = type; - /* Set the switch-off indicator */ - emm_as->switch_off = switch_off; - /* Set the EPS mobile identity */ - emm_as->guti = _emm_data.guti; - emm_as->ueid = 0; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_as->sctx, _emm_data.security, FALSE, TRUE); - - /* - * Notify EMM-AS SAP that Detach Request message has to - * be sent to the network - */ - emm_sap.primitive = EMMAS_DATA_REQ; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_detach_request() ** - ** ** - ** Description: Performs the detach procedure upon receipt of indication ** - ** from lower layers that Detach Request message has been ** - ** successfully delivered to the network. ** - ** ** - ** Inputs: args: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3421 ** - ** ** - ***************************************************************************/ -int emm_proc_detach_request(void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - if ( !_emm_detach_data.switch_off ) { - /* Start T3421 timer */ - T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL); - LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld seconds", - T3421.id, T3421.sec); - } - - /* - * Notify EMM that Detach Request has been sent to the network - */ - emm_sap.primitive = EMMREG_DETACH_REQ; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_detach_accept() ** - ** ** - ** Description: Performs the UE initiated detach procedure for EPS servi- ** - ** ces only When the DETACH ACCEPT message is received from ** - ** the network. ** - ** ** - ** 3GPP TS 24.301, section 5.5.2.2.2 ** - ** Upon receiving the DETACH ACCEPT message, the UE shall ** - ** stop timer T3421, locally deactivate all EPS bearer con- ** - ** texts without peer-to-peer signalling and enter state EMM-** - ** DEREGISTERED. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3421 ** - ** ** - ***************************************************************************/ -int emm_proc_detach_accept(void) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMM-PROC - UE initiated detach procedure completion"); - - /* Reset EMM procedure handler */ - (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - /* Stop timer T3421 */ - T3421.id = nas_timer_stop(T3421.id); - - /* - * Notify ESM that all EPS bearer contexts have to be locally deactivated - */ - esm_sap_t esm_sap; - esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; - esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI; - rc = esm_sap_send(&esm_sap); - - /* - * XXX - Upon receiving notification from ESM that all EPS bearer - * contexts are locally deactivated, the UE is considered as - * detached from the network and is entered state EMM-DEREGISTERED - */ - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_detach_failure() ** - ** ** - ** Description: Performs the detach procedure abnormal case upon receipt ** - ** of transmission failure of Detach Request message. ** - ** ** - ** 3GPP TS 24.301, section 5.5.2.2.4, case h ** - ** The UE shall restart the detach procedure. ** - ** ** - ** Inputs: is_initial: Not used ** - ** args: Not used ** - ** Others: _emm_detach_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_detach_failure(int is_initial, void *args) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - LOG_TRACE(WARNING, "EMM-PROC - Network detach failure"); - - /* Reset EMM procedure handler */ - (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - /* Stop timer T3421 */ - T3421.id = nas_timer_stop(T3421.id); - - /* - * Notify EMM that detach procedure has to be restarted - */ - emm_sap.primitive = EMMREG_DETACH_INIT; - emm_sap.u.emm_reg.u.detach.switch_off = _emm_detach_data.switch_off; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_detach_release() ** - ** ** - ** Description: Performs the detach procedure abnormal case upon receipt ** - ** of NAS signalling connection release indication before ** - ** reception of Detach Accept message. ** - ** ** - ** 3GPP TS 24.301, section 5.5.2.2.4, case b ** - ** The detach procedure shall be aborted. ** - ** ** - ** Inputs: args: not used ** - ** Others: _emm_detach_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_detach_release(void *args) -{ - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "EMM-PROC - NAS signalling connection released"); - - /* Abort the detach procedure */ - int rc = _emm_detach_abort(_emm_detach_data.type); - - LOG_FUNC_RETURN(rc); -} -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Detach procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: emm_proc_detach() ** - ** ** - ** Description: Initiate the detach procedure to inform the UE that it is ** - ** detached for EPS services, or to re-attach to the network ** - ** and re-establish all PDN connections. ** - ** ** - ** 3GPP TS 24.301, section 5.5.2.3.1 ** - ** In state EMM-REGISTERED the network initiates the detach ** - ** procedure by sending a DETACH REQUEST message to the UE, ** - ** starting timer T3422 and entering state EMM-DEREGISTERED- ** - ** INITIATED. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** type: Type of the requested detach ** - ** Others: _emm_detach_type_str ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3422 ** - ** ** - ***************************************************************************/ -int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(INFO, "EMM-PROC - Initiate detach type = %s (%d)", - _emm_detach_type_str[type], type); - - /* TODO */ - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_detach_request() ** - ** ** - ** Description: Performs the UE initiated detach procedure for EPS servi- ** - ** ces only When the DETACH REQUEST message is received by ** - ** the network. ** - ** ** - ** 3GPP TS 24.301, section 5.5.2.2.2 ** - ** Upon receiving the DETACH REQUEST message the network ** - ** shall send a DETACH ACCEPT message to the UE and store ** - ** the current EPS security context, if the detach type IE ** - ** does not indicate "switch off". Otherwise, the procedure ** - ** is completed when the network receives the DETACH REQUEST ** - ** message. ** - ** The network shall deactivate the EPS bearer context(s) ** - ** for this UE locally without peer-to-peer signalling and ** - ** shall enter state EMM-DEREGISTERED. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** type: Type of the requested detach ** - ** switch_off: Indicates whether the detach is required ** - ** because the UE is switched off or not ** - ** native_ksi: TRUE if the security context is of type ** - ** native ** - ** ksi: The NAS ket sey identifier ** - ** guti: The GUTI if provided by the UE ** - ** imsi: The IMSI if provided by the UE ** - ** imei: The IMEI if provided by the UE ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type, - int switch_off, int native_ksi, int ksi, - GUTI_t *guti, imsi_t *imsi, imei_t *imei) -{ - LOG_FUNC_IN; - - int rc; - emm_data_context_t *emm_ctx = NULL; - - LOG_TRACE(INFO, "EMM-PROC - Detach type = %s (%d) requested (ueid=%u)", - _emm_detach_type_str[type], type, ueid); - - /* Get the UE context */ -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - } - -#endif - - if (emm_ctx == NULL) { - LOG_TRACE(WARNING, "No EMM context exists for the UE (ueid=%u)", ueid); - LOG_FUNC_RETURN(RETURNok); - } - - if (switch_off) { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, - "0 Removing UE context ue id %06x", ueid); - /* The UE is switched off */ - if (emm_ctx->guti) { - free(emm_ctx->guti); - } - - if (emm_ctx->imsi) { - free(emm_ctx->imsi); - } - - if (emm_ctx->imei) { - free(emm_ctx->imei); - } - - if (emm_ctx->esm_msg.length > 0) { - free(emm_ctx->esm_msg.value); - } - - /* Release NAS security context */ - if (emm_ctx->security) { - emm_security_context_t *security = emm_ctx->security; - - if (security->kasme.value) { - free(security->kasme.value); - } - - if (security->knas_enc.value) { - free(security->knas_enc.value); - } - - if (security->knas_int.value) { - free(security->knas_int.value); - } - - free(emm_ctx->security); - } - - /* Release the EMM context */ -#if defined(NAS_BUILT_IN_EPC) - emm_data_context_remove(&_emm_data, emm_ctx); - free(emm_ctx); -#else - free(_emm_data.ctx[ueid]); - _emm_data.ctx[ueid] = NULL; -#endif - rc = RETURNok; - } else { - /* Normal detach without UE switch-off */ - emm_sap_t emm_sap; - emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data; - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMM_AS_NAS_INFO_DETACH ue id %06x", ueid); - - - /* Setup NAS information message to transfer */ - emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH; - emm_as->NASmsg.length = 0; - emm_as->NASmsg.value = NULL; - /* Set the UE identifier */ - emm_as->guti = NULL; - emm_as->ueid = ueid; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_as->sctx, emm_ctx->security, FALSE, TRUE); - /* - * Notify EMM-AS SAP that Detach Accept message has to - * be sent to the network - */ - emm_sap.primitive = EMMAS_DATA_REQ; - rc = emm_sap_send(&emm_sap); - } - - if (rc != RETURNerror) { - /* - * Notify ESM that all EPS bearer contexts allocated for this UE have - * to be locally deactivated - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_ESM_MME, - NULL,0, - "0 ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ ue id %06x", ueid); - esm_sap_t esm_sap; - esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; - esm_sap.ueid = ueid; - esm_sap.ctx = emm_ctx; - esm_sap.data.eps_bearer_context_deactivate.ebi = ESM_SAP_ALL_EBI; - rc = esm_sap_send(&esm_sap); - - if (rc != RETURNerror) { - emm_sap_t emm_sap; - /* - * Notify EMM that the UE has been implicitly detached - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_DETACH_REQ ue id %06x", ueid); - emm_sap.primitive = EMMREG_DETACH_REQ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - rc = emm_sap_send(&emm_sap); - } - } - - LOG_FUNC_RETURN(rc); -} -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_detach_t3421_handler() ** - ** ** - ** Description: T3421 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 5.5.2.2.4 case c ** - ** On the first four expiries of the timer, the UE shall re- ** - ** transmit the DETACH REQUEST message and shall reset and ** - ** restart timer T3421. On the fifth expiry of timer T3421, ** - ** the detach procedure shall be aborted. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: _emm_detach_data ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void *_emm_detach_t3421_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - /* Increment the retransmission counter */ - _emm_detach_data.count += 1; - - LOG_TRACE(WARNING, "EMM-PROC - T3421 timer expired, " - "retransmission counter = %d", _emm_detach_data.count); - - if (_emm_detach_data.count < EMM_DETACH_COUNTER_MAX) { - /* Retransmit the Detach Request message */ - emm_sap_t emm_sap; - emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data; - - /* Stop timer T3421 */ - T3421.id = nas_timer_stop(T3421.id); - - /* Setup NAS information message to transfer */ - emm_as->NASinfo = EMM_AS_NAS_INFO_DETACH; - emm_as->NASmsg.length = 0; - emm_as->NASmsg.value = NULL; - /* Set the detach type */ - emm_as->type = _emm_detach_data.type; - /* Set the switch-off indicator */ - emm_as->switch_off = _emm_detach_data.switch_off; - /* Set the EPS mobile identity */ - emm_as->guti = _emm_data.guti; - emm_as->ueid = 0; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_as->sctx, _emm_data.security, - FALSE, TRUE); - - /* - * Notify EMM-AS SAP that Detach Request message has to - * be sent to the network - */ - emm_sap.primitive = EMMAS_DATA_REQ; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Start T3421 timer */ - T3421.id = nas_timer_start(T3421.sec, _emm_detach_t3421_handler, NULL); - LOG_TRACE(INFO, "EMM-PROC - Timer T3421 (%d) expires in %ld " - "seconds", T3421.id, T3421.sec); - } - } else { - /* Abort the detach procedure */ - rc = _emm_detach_abort(_emm_detach_data.type); - } - - LOG_FUNC_RETURN(NULL); -} - -/* - * -------------------------------------------------------------------------- - * Abnormal cases in the UE - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_detach_abort() ** - ** ** - ** Description: Aborts the detach procedure ** - ** ** - ** Inputs: type: not used ** - ** Others: _emm_detach_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3421 ** - ** ** - ***************************************************************************/ -static int _emm_detach_abort(emm_proc_detach_type_t type) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc ; - - LOG_TRACE(WARNING, "EMM-PROC - Abort the detach procedure"); - - /* Reset EMM procedure handler */ - (void) emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - /* Stop timer T3421 */ - T3421.id = nas_timer_stop(T3421.id); - - /* - * Notify EMM that detach procedure failed - */ - emm_sap.primitive = EMMREG_DETACH_FAILED; - emm_sap.u.emm_reg.u.detach.type = type; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.c b/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.c deleted file mode 100644 index d142ec405e977704b87d742559af53e0cdcd2ac8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.c +++ /dev/null @@ -1,516 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmCommon.h - -Version 0.1 - -Date 2013/04/19 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines callback functions executed within EMM common procedures - by the Non-Access Stratum running at the network side. - - Following EMM common procedures can always be initiated by the - network whilst a NAS signalling connection exists: - - GUTI reallocation - authentication - security mode control - identification - EMM information - -*****************************************************************************/ - -#ifdef NAS_MME - -#include "EmmCommon.h" - -#include "commonDef.h" -#include "nas_log.h" -#include "emmData.h" - -#include <stdlib.h> // malloc, free -#include <string.h> -#include <assert.h> - -#if defined(NAS_BUILT_IN_EPC) -# include "assertions.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* EMM procedure callback cleanup function */ -static void _emm_common_cleanup(unsigned int ueid); - -/* Ongoing EMM procedure callback functions */ -typedef struct emm_common_data_s { - unsigned int ueid; - int ref_count; - emm_common_success_callback_t success; - emm_common_reject_callback_t reject; - emm_common_failure_callback_t failure; - emm_common_abort_callback_t abort; - void *args; - -#if defined(NAS_BUILT_IN_EPC) - RB_ENTRY(emm_common_data_s) entries; -#endif -} emm_common_data_t; - -#if defined(NAS_BUILT_IN_EPC) -typedef struct emm_common_data_head_s { - RB_HEAD(emm_common_data_map, emm_common_data_s) emm_common_data_root; -} emm_common_data_head_t; - -emm_common_data_head_t emm_common_data_head = { RB_INITIALIZER() }; - -static inline -int emm_common_data_compare_ueid(struct emm_common_data_s *p1, - struct emm_common_data_s *p2); -struct emm_common_data_s *emm_common_data_context_get( - struct emm_common_data_head_s *root, unsigned int _ueid); - -RB_PROTOTYPE(emm_common_data_map, emm_common_data_s, entries, - emm_common_data_compare_ueid); - -/* Generate functions used for the MAP */ -RB_GENERATE(emm_common_data_map, emm_common_data_s, entries, - emm_common_data_compare_ueid); - -static inline -int emm_common_data_compare_ueid(struct emm_common_data_s *p1, - struct emm_common_data_s *p2) -{ - if (p1->ueid > p2->ueid) { - return 1; - } - - if (p1->ueid < p2->ueid) { - return -1; - } - - /* Matching reference -> return 0 */ - return 0; -} - -struct emm_common_data_s *emm_common_data_context_get( - struct emm_common_data_head_s *root, unsigned int _ueid) -{ - struct emm_common_data_s reference; - - DevAssert(root != NULL); - DevCheck(_ueid > 0, _ueid, 0, 0); - - memset(&reference, 0, sizeof(struct emm_common_data_s)); - reference.ueid = _ueid; - return RB_FIND(emm_common_data_map, &root->emm_common_data_root, &reference); -} -#else -static emm_common_data_t *_emm_common_data[EMM_DATA_NB_UE_MAX]; -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_proc_common_initialize() ** - ** ** - ** Description: Initialize EMM procedure callback functions executed for ** - ** the UE with the given identifier ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** success: EMM procedure executed upon successful EMM ** - ** common procedure completion ** - ** reject: EMM procedure executed if the EMM common ** - ** procedure failed or is rejected ** - ** failure: EMM procedure executed upon transmission ** - ** failure reported by lower layer ** - ** abort: EMM common procedure executed when the on- ** - ** going EMM procedure is aborted ** - ** args: EMM common procedure argument parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_common_data ** - ** ** - ***************************************************************************/ -int emm_proc_common_initialize(unsigned int ueid, - emm_common_success_callback_t _success, - emm_common_reject_callback_t _reject, - emm_common_failure_callback_t _failure, - emm_common_abort_callback_t _abort, - void *args) -{ - struct emm_common_data_s *emm_common_data_ctx = NULL; - LOG_FUNC_IN; - -#if defined(NAS_BUILT_IN_EPC) - assert(ueid > 0); - emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid); -#else - assert(ueid < EMM_DATA_NB_UE_MAX); -#endif - - if (emm_common_data_ctx == NULL) { - emm_common_data_ctx = (emm_common_data_t *)malloc(sizeof(emm_common_data_t)); - emm_common_data_ctx->ueid = ueid; -#if defined(NAS_BUILT_IN_EPC) - RB_INSERT(emm_common_data_map, &emm_common_data_head.emm_common_data_root, - emm_common_data_ctx); -#endif - - if (emm_common_data_ctx) { - emm_common_data_ctx->ref_count = 0; - } - } - - if (emm_common_data_ctx) { - emm_common_data_ctx->ref_count += 1; - emm_common_data_ctx->success = _success; - emm_common_data_ctx->reject = _reject; - emm_common_data_ctx->failure = _failure; - emm_common_data_ctx->abort = _abort; - emm_common_data_ctx->args = args; - LOG_FUNC_RETURN(RETURNok); - } - - LOG_FUNC_RETURN(RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_common_success() ** - ** ** - ** Description: The EMM common procedure initiated between the UE with ** - ** the specified identifier and the MME completed success- ** - ** fully. The network performs required actions related to ** - ** the ongoing EMM procedure. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: _emm_common_data, _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_common_success(unsigned int ueid) -{ - emm_common_data_t *emm_common_data_ctx = NULL; - emm_common_success_callback_t emm_callback; - - int rc = RETURNerror; - - LOG_FUNC_IN; - -#if defined(NAS_BUILT_IN_EPC) - DevCheck(ueid > 0, ueid, 0, 0); - emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid); -#else - assert(ueid < EMM_DATA_NB_UE_MAX); - emm_common_data_ctx = _emm_common_data[ueid]; -#endif - - assert(emm_common_data_ctx != NULL); - - emm_callback = emm_common_data_ctx->success; - - if (emm_callback) { - struct emm_data_context_s *ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - ctx = emm_data_context_get(&_emm_data, ueid); -#else - ctx = _emm_data.ctx[ueid]; -#endif - rc = (*emm_callback)(ctx); - } - - _emm_common_cleanup(ueid); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_common_reject() ** - ** ** - ** Description: The EMM common procedure initiated between the UE with ** - ** the specified identifier and the MME failed or has been ** - ** rejected. The network performs required actions related ** - ** to the ongoing EMM procedure. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: _emm_common_data, _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_common_reject(unsigned int ueid) -{ - emm_common_data_t *emm_common_data_ctx = NULL; - int rc = RETURNerror; - emm_common_reject_callback_t emm_callback; - - LOG_FUNC_IN; - -#if defined(NAS_BUILT_IN_EPC) - DevCheck(ueid > 0, ueid, 0, 0); - emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid); -#else - assert(ueid < EMM_DATA_NB_UE_MAX); - emm_common_data_ctx = _emm_common_data[ueid]; -#endif - - assert(emm_common_data_ctx != NULL); - - emm_callback = emm_common_data_ctx->reject; - - if (emm_callback) { - struct emm_data_context_s *ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - ctx = emm_data_context_get(&_emm_data, ueid); -#else - ctx = _emm_data.ctx[ueid]; -#endif - rc = (*emm_callback)(ctx); - } - - _emm_common_cleanup(ueid); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_common_failure() ** - ** ** - ** Description: The EMM common procedure has been initiated between the ** - ** UE with the specified identifier and the MME, and a lower ** - ** layer failure occurred before the EMM common procedure ** - ** being completed. The network performs required actions ** - ** related to the ongoing EMM procedure. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: _emm_common_data, _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_common_failure(unsigned int ueid) -{ - emm_common_data_t *emm_common_data_ctx = NULL; - emm_common_failure_callback_t emm_callback; - - int rc = RETURNerror; - - LOG_FUNC_IN; - -#if defined(NAS_BUILT_IN_EPC) - DevCheck(ueid > 0, ueid, 0, 0); - emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid); -#else - assert(ueid < EMM_DATA_NB_UE_MAX); - emm_common_data_ctx = _emm_common_data[ueid]; -#endif - assert(emm_common_data_ctx != NULL); - - emm_callback = emm_common_data_ctx->failure; - - if (emm_callback) { - struct emm_data_context_s *ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - ctx = emm_data_context_get(&_emm_data, ueid); -#else - ctx = _emm_data.ctx[ueid]; -#endif - rc = (*emm_callback)(ctx); - } - - _emm_common_cleanup(ueid); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_common_abort() ** - ** ** - ** Description: The ongoing EMM procedure has been aborted. The network ** - ** performs required actions related to the EMM common pro- ** - ** cedure previously initiated between the UE with the spe- ** - ** cified identifier and the MME. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: _emm_common_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_common_abort(unsigned int ueid) -{ - emm_common_data_t *emm_common_data_ctx = NULL; - emm_common_failure_callback_t emm_callback; - - int rc = RETURNerror; - - LOG_FUNC_IN; - -#if defined(NAS_BUILT_IN_EPC) - DevCheck(ueid > 0, ueid, 0, 0); - emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid); -#else - assert(ueid < EMM_DATA_NB_UE_MAX); - emm_common_data_ctx = _emm_common_data[ueid]; -#endif - assert(emm_common_data_ctx != NULL); - - emm_callback = emm_common_data_ctx->abort; - - if (emm_callback) { - struct emm_data_context_s *ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - ctx = emm_data_context_get(&_emm_data, ueid); -#else - ctx = _emm_data.ctx[ueid]; -#endif - rc = (*emm_callback)(ctx); - } - - _emm_common_cleanup(ueid); - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_common_get_args() ** - ** ** - ** Description: Returns pointer to the EMM common procedure argument pa- ** - ** rameters allocated for the UE with the given identifier. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: _emm_common_data ** - ** ** - ** Outputs: None ** - ** Return: pointer to the EMM common procedure argu- ** - ** ment parameters ** - ** Others: None ** - ** ** - ***************************************************************************/ -void *emm_proc_common_get_args(unsigned int ueid) -{ - emm_common_data_t *emm_common_data_ctx = NULL; - LOG_FUNC_IN; - -#if defined(NAS_BUILT_IN_EPC) - DevCheck(ueid > 0, ueid, 0, 0); - emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid); -#else - assert(ueid < EMM_DATA_NB_UE_MAX); - emm_common_data_ctx = _emm_common_data[ueid]; -#endif - assert(emm_common_data_ctx != NULL); - - LOG_FUNC_RETURN(emm_common_data_ctx->args); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_proc_common_cleanup() ** - ** ** - ** Description: Cleans EMM procedure callback functions upon completion ** - ** of an EMM common procedure previously initiated within an ** - ** EMM procedure currently in progress between the network ** - ** and the UE with the specified identifier. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_common_data ** - ** ** - ***************************************************************************/ -static void _emm_common_cleanup(unsigned int ueid) -{ - emm_common_data_t *emm_common_data_ctx = NULL; - -#if defined(NAS_BUILT_IN_EPC) - DevCheck(ueid > 0, ueid, 0, 0); - emm_common_data_ctx = emm_common_data_context_get(&emm_common_data_head, ueid); -#else - assert(ueid < EMM_DATA_NB_UE_MAX); - emm_common_data_ctx = _emm_common_data[ueid]; -#endif - - if (emm_common_data_ctx) { - emm_common_data_ctx->ref_count -= 1; - - if (emm_common_data_ctx->ref_count == 0) { - /* Release the callback functions */ -#if defined(NAS_BUILT_IN_EPC) - RB_REMOVE(emm_common_data_map, - &emm_common_data_head.emm_common_data_root, - emm_common_data_ctx); -#endif - free(emm_common_data_ctx); - emm_common_data_ctx = NULL; - } - } -} -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.h b/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.h deleted file mode 100644 index f09e4954ea524fdf3b8e7069f0a96ba80c1dbd9a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmCommon.h +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmCommon.h - -Version 0.1 - -Date 2013/04/19 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines callback functions executed within EMM common procedures - by the Non-Access Stratum running at the network side. - - Following EMM common procedures can always be initiated by the - network whilst a NAS signalling connection exists: - - GUTI reallocation - authentication - security mode control - identification - EMM information - -*****************************************************************************/ -#ifndef __EMM_COMMON_H__ -#define __EMM_COMMON_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Type of EMM procedure callback functions - * ---------------------------------------- - * EMM procedure to be executed under certain conditions, when an EMM common - * procedure has been initiated by the ongoing EMM procedure. - * - The EMM common procedure successfully completed - * - The EMM common procedure failed or is rejected - * - Lower layer failure occured before the EMM common procedure completion - */ -typedef int (*emm_common_success_callback_t)(void *); -typedef int (*emm_common_reject_callback_t) (void *); -typedef int (*emm_common_failure_callback_t)(void *); - -/* - * Type of EMM common procedure callback function - * ---------------------------------------------- - * EMM common procedure to be executed when the ongoing EMM procedure is - * aborted. - */ -typedef int (*emm_common_abort_callback_t)(void *); - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int emm_proc_common_initialize(unsigned int ueid, - emm_common_success_callback_t success, - emm_common_reject_callback_t reject, - emm_common_failure_callback_t failure, - emm_common_abort_callback_t abort, - void *args); - -int emm_proc_common_success(unsigned int ueid); -int emm_proc_common_reject(unsigned int ueid); -int emm_proc_common_failure(unsigned int ueid); -int emm_proc_common_abort(unsigned int ueid); - -void *emm_proc_common_get_args(unsigned int ueid); - -#endif /* __EMM_COMMON_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmStatusHdl.c b/openair-cn/NAS/EURECOM-NAS/src/emm/EmmStatusHdl.c deleted file mode 100644 index 67780db75543c8d37a9fed9e63d81a292ac0e434..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/EmmStatusHdl.c +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source Emmstatus.c - -Version 0.1 - -Date 2013/06/26 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMM status procedure executed by the Non-Access - Stratum. - - The purpose of the sending of the EMM STATUS message is to - report at any time certain error conditions detected upon - receipt of EMM protocol data. The EMM STATUS message can be - sent by both the MME and the UE. - -*****************************************************************************/ - -#include "emm_proc.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_cause.h" -#include "emmData.h" - -#include "emm_sap.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_proc_status_ind() ** - ** ** - ** Description: Processes received EMM status message. ** - ** ** - ** 3GPP TS 24.301, section 5.7 ** - ** On receipt of an EMM STATUS message no state transition ** - ** and no specific action shall be taken. Local actions are ** - ** possible and are implementation dependent. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** emm_cause: Received EMM cause code ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_status_ind(unsigned int ueid, int emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO,"EMM-PROC - EMM status procedure requested (cause=%d)", - emm_cause); - - LOG_TRACE(DEBUG, "EMM-PROC - To be implemented"); - - /* TODO */ - rc = RETURNok; - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_status() ** - ** ** - ** Description: Initiates EMM status procedure. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** emm_cause: EMM cause code to be reported ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_status(unsigned int ueid, int emm_cause) -{ - LOG_FUNC_IN; - - int rc; - emm_sap_t emm_sap; - - emm_security_context_t *sctx = NULL; - struct emm_data_context_s *ctx = NULL; - - LOG_TRACE(INFO,"EMM-PROC - EMM status procedure requested"); - - /* - * Notity EMM that EMM status indication has to be sent to lower layers - */ - emm_sap.primitive = EMMAS_STATUS_IND; - emm_sap.u.emm_as.u.status.emm_cause = emm_cause; - emm_sap.u.emm_as.u.status.ueid = ueid; - -#ifdef NAS_UE - emm_sap.u.emm_as.u.status.guti = _emm_data.guti; - sctx = _emm_data.security; -#endif -#ifdef NAS_MME - emm_sap.u.emm_as.u.status.guti = NULL; -# if defined(NAS_BUILT_IN_EPC) - ctx = emm_data_context_get(&_emm_data, ueid); -# else - ctx = _emm_data.ctx[ueid]; -# endif - - if (ctx) { - sctx = ctx->security; - } - -#endif - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.status.sctx, sctx, - FALSE, TRUE); - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c b/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c deleted file mode 100644 index 988834899d1c1520bbe911ccdf2757a6b45665fe..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Identification.c +++ /dev/null @@ -1,674 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source Identification.c - -Version 0.1 - -Date 2013/04/09 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the identification EMM procedure executed by the - Non-Access Stratum. - - The identification procedure is used by the network to request - a particular UE to provide specific identification parameters - (IMSI, IMEI). - -*****************************************************************************/ - -#include "emm_proc.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "emmData.h" - -#include "emm_sap.h" -#include "msc.h" - -#include <stdlib.h> // malloc, free -#include <string.h> // memcpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* String representation of the requested identity type */ -static const char *_emm_identity_type_str[] = { - "NOT AVAILABLE", "IMSI", "IMEI", "IMEISV", "TMSI" -}; - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the identification procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the identification procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Timer handlers - */ -static void *_identification_t3470_handler(void *); - -/* - * Function executed whenever the ongoing EMM procedure that initiated - * the identification procedure is aborted or the maximum value of the - * retransmission timer counter is exceed - */ -static int _identification_abort(void *); - -/* - * Internal data used for identification procedure - */ -typedef struct { - unsigned int ueid; /* UE identifier */ -#define IDENTIFICATION_COUNTER_MAX 5 - unsigned int retransmission_count; /* Retransmission counter */ - emm_proc_identity_type_t type; /* Type of UE identity */ - int notify_failure; /* Indicates whether the identification - * procedure failure shall be notified - * to the ongoing EMM procedure */ -} identification_data_t; - -static int _identification_request(identification_data_t *data); -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Identification procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_proc_identification_request() ** - ** ** - ** Description: Performs the MME requested identification procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.4.3 ** - ** Upon receiving the IDENTITY REQUEST message, the UE shall ** - ** send an IDENTITY RESPONSE message to the network. The ** - ** IDENTITY RESPONSE message shall contain the identifica- ** - ** tion parameters as requested by the network. ** - ** ** - ** Inputs: type: Type of the requested identity ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_identification_request(emm_proc_identity_type_t type) -{ - LOG_FUNC_IN; - - int rc; - emm_sap_t emm_sap; - - LOG_TRACE(INFO, "EMM-PROC - Identification requested type = %s (%d)", - _emm_identity_type_str[type], type); - - /* Setup EMM procedure handler to be executed upon receiving - * lower layer notification */ - rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, - "EMM-PROC - Failed to initialize EMM procedure handler"); - LOG_FUNC_RETURN (RETURNerror); - } - - emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_NOT_AVAILABLE; - - switch (type) { - case EMM_IDENT_TYPE_IMSI: { - imsi_t modified_imsi; - - /* International Mobile Subscriber Identity is requested */ - if (_emm_data.imsi) { - memcpy (&modified_imsi, _emm_data.imsi, sizeof (modified_imsi)); - - /* LW: Eventually replace the 0xF value set in MNC digit 3 by a 0 to avoid IMSI to be truncated before reaching HSS */ - if (modified_imsi.u.num.digit6 == 0xF) { - modified_imsi.u.num.digit6 = 0; - } - - emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMSI; - emm_sap.u.emm_as.u.security.imsi = &modified_imsi; - - LOG_TRACE(INFO, "EMM-PROC - IMSI = %u%u%u %u%u%u %u%u%u%u%x%x%x%x%x", - emm_sap.u.emm_as.u.security.imsi->u.num.digit1, - emm_sap.u.emm_as.u.security.imsi->u.num.digit2, - emm_sap.u.emm_as.u.security.imsi->u.num.digit3, - - emm_sap.u.emm_as.u.security.imsi->u.num.digit4, - emm_sap.u.emm_as.u.security.imsi->u.num.digit5, - emm_sap.u.emm_as.u.security.imsi->u.num.digit6, - - emm_sap.u.emm_as.u.security.imsi->u.num.digit7, - emm_sap.u.emm_as.u.security.imsi->u.num.digit8, - emm_sap.u.emm_as.u.security.imsi->u.num.digit9, - emm_sap.u.emm_as.u.security.imsi->u.num.digit10, - emm_sap.u.emm_as.u.security.imsi->u.num.digit11, - emm_sap.u.emm_as.u.security.imsi->u.num.digit12, - emm_sap.u.emm_as.u.security.imsi->u.num.digit13, - emm_sap.u.emm_as.u.security.imsi->u.num.digit14, - emm_sap.u.emm_as.u.security.imsi->u.num.digit15); - } - - break; - } - - case EMM_IDENT_TYPE_IMEI: - - /* International Mobile Equipment Identity is requested */ - if (_emm_data.imei) { - emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_IMEI; - emm_sap.u.emm_as.u.security.imei = _emm_data.imei; - } - - break; - - case EMM_IDENT_TYPE_TMSI: - - /* Temporary Mobile Subscriber Identity is requested */ - if (_emm_data.guti) { - emm_sap.u.emm_as.u.security.identType = EMM_IDENT_TYPE_TMSI; - emm_sap.u.emm_as.u.security.tmsi = _emm_data.guti->m_tmsi; - } - - break; - - default: - /* Other identities are not available */ - break; - } - - /* - * Notify EMM-AS SAP that Identity Response message has to be sent - * to the MME - */ - emm_sap.primitive = EMMAS_SECURITY_RES; - emm_sap.u.emm_as.u.security.guti = _emm_data.guti; - emm_sap.u.emm_as.u.security.ueid = 0; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - _emm_data.security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Identification procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/******************************************************************** - ** ** - ** Name: emm_proc_identification() ** - ** ** - ** Description: Initiates an identification procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.4.2 ** - ** The network initiates the identification procedure by ** - ** sending an IDENTITY REQUEST message to the UE and star- ** - ** ting the timer T3470. The IDENTITY REQUEST message speci- ** - ** fies the requested identification parameters in the Iden- ** - ** tity type information element. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** type: Type of the requested identity ** - ** success: Callback function executed when the identi- ** - ** fication procedure successfully completes ** - ** reject: Callback function executed when the identi- ** - ** fication procedure fails or is rejected ** - ** failure: Callback function executed whener a lower ** - ** layer failure occured before the identifi- ** - ** cation procedure completes ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ********************************************************************/ -int emm_proc_identification(unsigned int ueid, - emm_data_context_t *emm_ctx, - emm_proc_identity_type_t type, - emm_common_success_callback_t success, - emm_common_reject_callback_t reject, - emm_common_failure_callback_t failure) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(INFO, "EMM-PROC - Initiate identification type = %s (%d), ctx = %p", - _emm_identity_type_str[type], type, emm_ctx); - - /* Allocate parameters of the retransmission timer callback */ - identification_data_t *data = - (identification_data_t *)malloc(sizeof(identification_data_t)); - - if (data != NULL) { - /* Setup ongoing EMM procedure callback functions */ - rc = emm_proc_common_initialize(ueid, success, reject, failure, - _identification_abort, data); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "Failed to initialize EMM callback functions"); - free(data); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Set the UE identifier */ - data->ueid = ueid; - /* Reset the retransmission counter */ - data->retransmission_count = 0; - /* Set the type of the requested identity */ - data->type = type; - /* Set the failure notification indicator */ - data->notify_failure = FALSE; - /* Send identity request message to the UE */ - rc = _identification_request(data); - - if (rc != RETURNerror) { - /* - * Notify EMM that common procedure has been initiated - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REQ ue id %06x (identification)", ueid); - - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REQ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - rc = emm_sap_send(&emm_sap); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_identification_complete() ** - ** ** - ** Description: Performs the identification completion procedure executed ** - ** by the network. ** - ** ** - ** 3GPP TS 24.301, section 5.4.4.4 ** - ** Upon receiving the IDENTITY RESPONSE message, the MME ** - ** shall stop timer T3470. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** imsi: The IMSI received from the UE ** - ** imei: The IMEI received from the UE ** - ** tmsi: The TMSI received from the UE ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data, T3470 ** - ** ** - ***************************************************************************/ -int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi, - const imei_t *imei, UInt32_t *tmsi) -{ - int rc = RETURNerror; - emm_sap_t emm_sap; - - emm_data_context_t *emm_ctx = NULL; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - Identification complete (ueid=%u)", ueid); - - /* Stop timer T3470 */ - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", T3470.id); - T3470.id = nas_timer_stop(T3470.id); - - /* Release retransmission timer paramaters */ - identification_data_t *data = - (identification_data_t *)(emm_proc_common_get_args(ueid)); - - if (data) { - free(data); - } - - /* Get the UE context */ -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - } - -#endif - - if (emm_ctx) { - if (imsi) { - /* Update the IMSI */ - if (emm_ctx->imsi == NULL) { - emm_ctx->imsi = (imsi_t *)malloc(sizeof(imsi_t)); - } - - if (emm_ctx->imsi) { - memcpy(emm_ctx->imsi, imsi, sizeof(imsi_t)); - } - } else if (imei) { - /* Update the IMEI */ - if (emm_ctx->imei == NULL) { - emm_ctx->imei = (imei_t *)malloc(sizeof(imei_t)); - } - - if (emm_ctx->imei) { - memcpy(emm_ctx->imei, imei, sizeof(imei_t)); - } - } else if (tmsi) { - /* Update the GUTI */ - if (emm_ctx->guti == NULL) { - emm_ctx->guti = (GUTI_t *)malloc(sizeof(GUTI_t)); - } - - if (emm_ctx->guti) { - memcpy(&emm_ctx->guti->gummei, - &_emm_data.conf.gummei, sizeof(gummei_t)); - emm_ctx->guti->m_tmsi = *tmsi; - } - } - - /* - * Notify EMM that the identification procedure successfully completed - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_CNF ue id %06x", ueid); - - emm_sap.primitive = EMMREG_COMMON_PROC_CNF; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - emm_sap.u.emm_reg.u.common.is_attached = emm_ctx->is_attached; - } else { - LOG_TRACE(ERROR, "EMM-PROC - No EMM context exists"); - /* - * Notify EMM that the identification procedure failed - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid); - - emm_sap.primitive = EMMREG_COMMON_PROC_REJ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - } - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_MME -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _identification_t3470_handler() ** - ** ** - ** Description: T3470 timeout handler ** - ** Upon T3470 timer expiration, the identification request ** - ** message is retransmitted and the timer restarted. When ** - ** retransmission counter is exceed, the MME shall abort the ** - ** identification procedure and any ongoing EMM procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.4.6, case b ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_identification_t3470_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - identification_data_t *data = (identification_data_t *)(args); - - /* Increment the retransmission counter */ - data->retransmission_count += 1; - - LOG_TRACE(WARNING, "EMM-PROC - T3470 timer expired, retransmission " - "counter = %d", data->retransmission_count); - - if (data->retransmission_count < IDENTIFICATION_COUNTER_MAX) { - /* Send identity request message to the UE */ - rc = _identification_request(data); - } else { - /* Set the failure notification indicator */ - data->notify_failure = TRUE; - /* Abort the identification procedure */ - rc = _identification_abort(data); - } - - LOG_FUNC_RETURN (NULL); -} - -/* - * -------------------------------------------------------------------------- - * MME specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _identification_request() ** - ** ** - ** Description: Sends IDENTITY REQUEST message and start timer T3470. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: T3470 ** - ** ** - ***************************************************************************/ -int _identification_request(identification_data_t *data) -{ - emm_sap_t emm_sap; - int rc; - - struct emm_data_context_s *emm_ctx = NULL; - - LOG_FUNC_IN; - - /* - * Notify EMM-AS SAP that Identity Request message has to be sent - * to the UE - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMAS_SECURITY_REQ ue id %06x", data->ueid); - - emm_sap.primitive = EMMAS_SECURITY_REQ; - emm_sap.u.emm_as.u.security.guti = NULL; - emm_sap.u.emm_as.u.security.ueid = data->ueid; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_IDENT; - emm_sap.u.emm_as.u.security.identType = data->type; - -#if defined(NAS_BUILT_IN_EPC) - - if (data->ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, data->ueid); - } - -#else - - if (data->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[data->ueid]; - } - -#endif - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - emm_ctx->security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - if (T3470.id != NAS_TIMER_INACTIVE_ID) { - /* Re-start T3470 timer */ - T3470.id = nas_timer_restart(T3470.id); - } else { - /* Start T3470 timer */ - T3470.id = nas_timer_start(T3470.sec, _identification_t3470_handler, - data); - } - - LOG_TRACE(INFO,"EMM-PROC - Timer T3470 (%d) expires in %ld seconds", - T3470.id, T3470.sec); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _identification_abort() ** - ** ** - ** Description: Aborts the identification procedure currently in progress ** - ** ** - ** Inputs: args: Identification data to be released ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: T3470 ** - ** ** - ***************************************************************************/ -static int _identification_abort(void *args) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - identification_data_t *data = (identification_data_t *)(args); - - if (data) { - unsigned int ueid = data->ueid; - int notify_failure = data->notify_failure; - - LOG_TRACE(WARNING, "EMM-PROC - Abort identification procedure " - "(ueid=%u)", ueid); - - /* Stop timer T3470 */ - if (T3470.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3470 (%d)", T3470.id); - T3470.id = nas_timer_stop(T3470.id); - } - - /* Release retransmission timer paramaters */ - free(data); - - /* - * Notify EMM that the identification procedure failed - */ - if (notify_failure) { - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REJ ue id %06x", ueid); - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REJ; - emm_sap.u.emm_reg.ueid = ueid; - rc = emm_sap_send(&emm_sap); - } else { - rc = RETURNok; - } - } - - LOG_FUNC_RETURN(rc); -} - -#endif // NAS_MME - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.c b/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.c deleted file mode 100644 index 027ed0fc5d869ad7641e0b71c3b5567d85aecc87..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.c +++ /dev/null @@ -1,1227 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source IdleMode.c - -Version 0.1 - -Date 2012/10/18 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines EMM procedures executed by the Non-Access Stratum - when the UE is in idle mode. - - When a UE is switched on, a Public Land Mobile Network is - selected and the UE searches for a suitable cell of this PLMN - to camp on. The UE will, if necessary, register its presence - in the registration area of the chosen cell and as outcome of - a successful Location Registration the selected PLMN becomes - the registered PLMN. - - If the UE loses coverage of the registered PLMN, either a new - PLMN is selected automatically (automatic mode), or an indi- - cation of which PLMNs are available is given to the user, so - that a manual selection can be made (manual mode). - - If the UE is unable to find a suitable cell to camp on, or - the USIM is not inserted, or if the location registration - failed under certain conditions, it attempts to camp on a - cell irrespective of the PLMN identity, and enters a "limited - service" state in which it can only attempt to make emergency - calls. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_proc.h" -#include "nas_log.h" - -#include "emm_sap.h" - -#include "IdleMode.h" -#include "emmData.h" - -#include <assert.h> -#include <stdio.h> // sprintf -#include <string.h> // strlen, strncpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn); -static int _IldlMode_get_opnn_id(const plmn_t *plmn); -static int _IdleMode_get_suitable_cell(int index); - -/* - * A list of PLMN identities in priority order is maintained locally - * to perform the PLMN selection procedure. - * - * In automatic mode of operation, this list is used for PLMN selection when - * the UE is switched on, or upon recovery from lack of coverage, or when the - * user requests the UE to initiate PLMN reselection, and registration. - * In manual mode of operation, this list is displayed to the user that may - * select an available PLMN and initiate registration. - * - * The list may contain PLMN identifiers in the following order: - * - The last registered PLMN or each equivalent PLMN present in the list of - * "equivalent PLMNs" (EPLMN_MAX), when UE is switched on or following - * recovery from lack of coverage; - * - The highest priority PLMN in the list of "equivalent HPLMNs" or the - * HPLMN derived from the IMSI (1) - * - Each PLMN/access technology combination in the "User Controlled PLMN - * Selector with Access Technology" (PLMN_MAX) - * - Each PLMN/access technology combination in the "Operator Controlled PLMN - * Selector with Access Technology" (OPLMN_MAX) - * - Other PLMN/access technology combinations with received high quality - * signal in random order (TODO) - * - Other PLMN/access technology combinations in order of decreasing signal - * quality (TODO) - * - The last selected PLMN again (1) - */ -static struct { - int n_plmns; -#define EMM_PLMN_LIST_SIZE (EMM_DATA_EPLMN_MAX + EMM_DATA_PLMN_MAX + \ - EMM_DATA_OPLMN_MAX + 2) - plmn_t *plmn[EMM_PLMN_LIST_SIZE]; - int index; /* Index of the PLMN for which selection is ongoing */ - int hplmn; /* Index of the home PLMN or the highest priority - * equivalent home PLMN */ - int fplmn; /* Index of the first forbidden PLMN */ - int splmn; /* Index of the currently selected PLMN */ - int rplmn; /* Index of the currently registered PLMN */ - struct plmn_param_t { - char fullname[NET_FORMAT_LONG_SIZE+1]; /* PLMN full identifier */ - char shortname[NET_FORMAT_SHORT_SIZE+1]; /* PLMN short identifier */ - char num[NET_FORMAT_NUM_SIZE+1]; /* PLMN numeric identifier */ - int stat; /* Indication of the PLMN availability */ - int tac; /* Location/Tracking Area Code */ - int ci; /* Serving cell identifier */ - int rat; /* Radio Access Technology supported by the serving cell */ - } param[EMM_PLMN_LIST_SIZE]; -} _emm_plmn_list; - -/* Callback executed whenever a network indication is received */ -static IdleMode_callback_t _emm_indication_notify; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: IdleMode_initialize() ** - ** ** - ** Description: Initializes EMM internal data used when the UE operates ** - ** in idle mode ** - ** ** - ** Inputs: cb: The function to executed whenever a net- ** - ** work indication is received ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_plmn_list, _emm_indication_notify ** - ** ** - ***************************************************************************/ -void IdleMode_initialize(IdleMode_callback_t cb) -{ - /* Initialize the list of available PLMNs */ - _emm_plmn_list.n_plmns = 0; - _emm_plmn_list.index = 0; - _emm_plmn_list.hplmn = -1; - _emm_plmn_list.fplmn = -1; - _emm_plmn_list.splmn = -1; - _emm_plmn_list.rplmn = -1; - - /* Initialize the network notification handler */ - _emm_indication_notify = *cb; - - /* Initialize EMM Service Access Point */ - emm_sap_initialize(); -} - -/* - *--------------------------------------------------------------------------- - * Functions used to get information from the local list of available PLMNs - *--------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_nb_plmns() ** - ** ** - ** Description: Get the number of available PLMNs in the ordered list. ** - ** ** - ** Inputs: None ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The number of PLMNs in the ordered list of ** - ** available PLMNs ** - ** Others: None ** - ** ** - ***************************************************************************/ -int IdleMode_get_nb_plmns(void) -{ - return _emm_plmn_list.n_plmns; -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_hplmn_index() ** - ** ** - ** Description: Get the index of the Home PLMN or the highest priority ** - ** Equivalent HPLMN in the ordered list of available PLMNs. ** - ** ** - ** Inputs: None ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The index of the HPLMN or the first EHPLMN ** - ** in the list ** - ** Others: None ** - ** ** - ***************************************************************************/ -int IdleMode_get_hplmn_index(void) -{ - return _emm_plmn_list.hplmn; -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_rplmn_index() ** - ** ** - ** Description: Get the index of the registered PLMN in the ordered list ** - ** of available PLMNs. ** - ** ** - ** Inputs: None ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The index of the registered PLMN in the ** - ** list ** - ** Others: None ** - ** ** - ***************************************************************************/ -int IdleMode_get_rplmn_index(void) -{ - return _emm_plmn_list.rplmn; -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_splmn_index() ** - ** ** - ** Description: Get the index of the selected PLMN in the ordered list of ** - ** available PLMNs. ** - ** ** - ** Inputs: None ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The index of the selected PLMN in the list ** - ** Others: None ** - ** ** - ***************************************************************************/ -int IdleMode_get_splmn_index(void) -{ - return _emm_plmn_list.splmn; -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_update_plmn_list() ** - ** ** - ** Description: Updates the string representation of the list of opera- ** - ** tors present in the network ** - ** ** - ** Inputs: i: Index of the first operator to update ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The size of the list in bytes ** - ** Others: _emm_data.plist ** - ** ** - ***************************************************************************/ -int IdleMode_update_plmn_list(int i) -{ - int offset = 0; - int n = 1; - - while ( (i < _emm_plmn_list.n_plmns) && (offset < EMM_DATA_BUFFER_SIZE) ) { - struct plmn_param_t *plmn = &(_emm_plmn_list.param[i++]); - - if (n++ > 1) { - offset += snprintf(_emm_data.plist.buffer + offset, - EMM_DATA_BUFFER_SIZE - offset, ","); - } - - offset += snprintf(_emm_data.plist.buffer + offset, - EMM_DATA_BUFFER_SIZE - offset, "(%d,%s,%s,%s", - plmn->stat, plmn->fullname, - plmn->shortname, plmn->num); - - if (plmn->rat != NET_ACCESS_UNAVAILABLE) { - offset += snprintf(_emm_data.plist.buffer + offset, - EMM_DATA_BUFFER_SIZE - offset, ",%d", - plmn->rat); - } - - offset += snprintf(_emm_data.plist.buffer + offset, - EMM_DATA_BUFFER_SIZE - offset, ")"); - } - - return (offset); -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_plmn_fullname() ** - ** ** - ** Description: Get the full name of the PLMN at the given index in the ** - ** ordered list of available PLMNs. ** - ** ** - ** Inputs: plmn: The PLMN of which the name is queried ** - ** index: The index of the PLMN in the ordered list ** - ** of available PLMNs ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: size: The length of the PLMN's name ** - ** Return: A pointer to the full name of the PLMN ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *IdleMode_get_plmn_fullname(const plmn_t *plmn, int index, - size_t *len) -{ - if (index < _emm_plmn_list.n_plmns) { - assert( PLMNS_ARE_EQUAL(*plmn, *_emm_plmn_list.plmn[index]) ); - *len = strlen(_emm_plmn_list.param[index].fullname); - return _emm_plmn_list.param[index].fullname; - } - - return NULL; -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_plmn_shortname() ** - ** ** - ** Description: Get the short name of the PLMN at the given index in the ** - ** ordered list of available PLMNs. ** - ** ** - ** Inputs: plmn: The PLMN of which the name is queried ** - ** index: The index of the PLMN in the ordered list ** - ** of available PLMNs ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: size: The length of the PLMN's name ** - ** Return: A pointer to the short name of the PLMN ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *IdleMode_get_plmn_shortname(const plmn_t *plmn, int index, - size_t *len) -{ - if (index < _emm_plmn_list.n_plmns) { - assert( PLMNS_ARE_EQUAL(*plmn, *_emm_plmn_list.plmn[index]) ); - *len = strlen(_emm_plmn_list.param[index].shortname); - return _emm_plmn_list.param[index].shortname; - } - - return NULL; -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_plmn_id() ** - ** ** - ** Description: Get the numeric identifier of the PLMN at the given index ** - ** in the ordered list of available PLMNs. ** - ** ** - ** Inputs: plmn: The PLMN of which the name is queried ** - ** index: The index of the PLMN in the ordered list ** - ** of available PLMNs ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: size: The length of the PLMN's name ** - ** Return: A pointer to the numeric identifier of the ** - ** PLMN ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *IdleMode_get_plmn_id(const plmn_t *plmn, int index, size_t *len) -{ - if (index < _emm_plmn_list.n_plmns) { - assert( PLMNS_ARE_EQUAL(*plmn, *_emm_plmn_list.plmn[index]) ); - *len = strlen(_emm_plmn_list.param[index].num); - return _emm_plmn_list.param[index].num; - } - - return NULL; -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_plmn_fullname_index() ** - ** ** - ** Description: Search the list of available PLMNs for the index of the ** - ** PLMN identifier given by the specified fullname ** - ** ** - ** Inputs: plmn: The full name of the PLMN ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The index of the PLMN, if found in the ** - ** list of available PLMNs; -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int IdleMode_get_plmn_fullname_index(const char *plmn) -{ - int index; - - /* Get the index of the PLMN identifier with specified full name */ - for (index = 0; index < _emm_plmn_list.n_plmns; index++) { - if ( strncmp(plmn, _emm_plmn_list.param[index].fullname, - NET_FORMAT_LONG_SIZE) != 0 ) { - continue; - } - - return (index); - } - - return (-1); -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_plmn_shortname_index() ** - ** ** - ** Description: Search the list of available PLMNs for the index of the ** - ** PLMN identifier given by the specified shortname ** - ** ** - ** Inputs: plmn: The short name of the PLMN ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The index of the PLMN, if found in the ** - ** list of available PLMNs; -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int IdleMode_get_plmn_shortname_index(const char *plmn) -{ - int index; - - /* Get the index of the PLMN identifier with specified short name */ - for (index = 0; index < _emm_plmn_list.n_plmns; index++) { - if ( !strncmp(plmn, _emm_plmn_list.param[index].shortname, - NET_FORMAT_SHORT_SIZE) ) { - continue; - } - - return (index); - } - - return (-1); -} - -/**************************************************************************** - ** ** - ** Name: IdleMode_get_plmn_id_index() ** - ** ** - ** Description: Search the list of available PLMNs for the index of the ** - ** PLMN identifier given by the specified numeric identifier ** - ** ** - ** Inputs: plmn: The numeric identifier of the PLMN ** - ** Others: _emm_plmn_list ** - ** ** - ** Outputs: None ** - ** Return: The index of the PLMN, if found in the ** - ** list of available PLMNs; -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int IdleMode_get_plmn_id_index(const char *plmn) -{ - int index; - - /* Get the index of the PLMN identifier with specified numeric identifier */ - for (index = 0; index < _emm_plmn_list.n_plmns; index++) { - if ( !strncmp(plmn, _emm_plmn_list.param[index].num, - NET_FORMAT_LONG_SIZE) ) { - continue; - } - - return (index); - } - - return (-1); -} - -/* - *--------------------------------------------------------------------------- - * Idle mode EMM procedures - *--------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: emm_proc_initialize() ** - ** ** - ** Description: Initialize the ordered list of available PLMNs candidate ** - ** to PLMN selection procedure. ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_plmn_list ** - ** ** - ***************************************************************************/ -int emm_proc_initialize(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - int i; - - if (!_emm_data.usim_is_valid) { - /* The USIM application is not present or not valid */ - LOG_TRACE(WARNING, "EMM-IDLE - USIM is not valid"); - emm_sap.primitive = EMMREG_NO_IMSI; - } else { - /* The highest priority is given to either the "equivalent PLMNs" - * if available, or the last registered PLMN */ - if (_emm_data.nvdata.eplmn.n_plmns > 0) { - for (i=0; i < _emm_data.nvdata.eplmn.n_plmns; i++) { - _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = - &_emm_data.nvdata.eplmn.plmn[i]; - } - } else if ( PLMN_IS_VALID(_emm_data.nvdata.rplmn) ) { - _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = - &_emm_data.nvdata.rplmn; - } - - /* Update the index of the HPLMN or EHPLM of highest priority. - * When switched on, the UE will try to automatically register - * to each previous PLMN within the ordered list of available - * PLMNs regardless of the network selection mode of operation */ - _emm_plmn_list.hplmn = _emm_plmn_list.n_plmns - 1; - // LG_emm_plmn_list.hplmn = _emm_plmn_list.n_plmns; - - /* Add the highest priority PLMN in the list of "equivalent HPLMNs" - if present and not empty, or the HPLMN derived from the IMSI */ - if (_emm_data.ehplmn.n_plmns > 0) { - _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = - &_emm_data.ehplmn.plmn[0]; - } else { - _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = &_emm_data.hplmn; - } - - /* Each PLMN/access technology combination in the "User - * Controlled PLMN Selector with Access Technology" */ - for (i=0; i < _emm_data.plmn.n_plmns; i++) { - _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = - &_emm_data.plmn.plmn[i]; - } - - /* Each PLMN/access technology combination in the "Operator - * Controlled PLMN Selector with Access Technology" */ - for (i=0; i < _emm_data.oplmn.n_plmns; i++) { - _emm_plmn_list.plmn[_emm_plmn_list.n_plmns++] = - &_emm_data.oplmn.plmn[i]; - } - - /* Other PLMN/access technology combinations with received - * high quality signal in random order */ - - /* Other PLMN/access technology combinations in order of - * decreasing signal quality */ - - /* TODO: Schedule periodic network selection attemps (hpplmn timer) */ - - /* Initialize the PLMNs' parameters */ - for (i=0; i < _emm_plmn_list.n_plmns; i++) { - struct plmn_param_t *plmn = &(_emm_plmn_list.param[i]); - int id = _IldlMode_get_opnn_id(_emm_plmn_list.plmn[i]); - - if (id < 0) { - plmn->fullname[0] = '\0'; - plmn->shortname[0] = '\0'; - } else { - strncpy(plmn->fullname, _emm_data.opnn[id].fullname, - NET_FORMAT_LONG_SIZE); - strncpy(plmn->shortname, _emm_data.opnn[id].shortname, - NET_FORMAT_SHORT_SIZE); - } - - (void)_IdleMode_plmn_str(plmn->num, _emm_plmn_list.plmn[i]); - plmn->stat = NET_OPER_UNKNOWN; - plmn->tac = 0; - plmn->ci = 0; - plmn->rat = NET_ACCESS_UNAVAILABLE; - } - - LOG_TRACE(INFO, "EMM-IDLE - %d PLMNs available for network selection", - _emm_plmn_list.n_plmns); - - /* Notify EMM that PLMN selection procedure has to be executed */ - emm_sap.primitive = EMMREG_REGISTER_REQ; - emm_sap.u.emm_reg.u.regist.index = 0; - } - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); - - /* TODO: Update the list of PLMNs upon receiving AS system information */ -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_plmn_selection() ** - ** ** - ** Description: Performs the network selection procedure when the UE is ** - ** swicthed on. ** - ** ** - ** The MS shall select the registered PLMN or equivalent ** - ** PLMN (if it is available) using all access technologies ** - ** that the MS is capable. ** - ** If there is no registered PLMN, or if registration is ** - ** not possible due to the PLMN being unavailable or regis- ** - ** tration failure, the MS performs the automatic or the ma- ** - ** nual procedure depending on its PLMN selection operating ** - ** mode. ** - ** ** - ** Inputs: None ** - ** Others: _emm_plmn_list, _emm_data ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_plmn_list.index ** - ** ** - ***************************************************************************/ -int emm_proc_plmn_selection(int index) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - if (_emm_data.plmn_mode != EMM_DATA_PLMN_AUTO) { - /* - * Manual or manual/automatic mode of operation - * -------------------------------------------- - */ - if (index >= _emm_plmn_list.hplmn) { - /* - * Selection of the last registered or equivalent PLMNs failed - */ - if (_emm_data.plmn_index < 0) { - /* - * The user did not select any PLMN yet; display the ordered - * list of available PLMNs to the user - */ - index = -1; - rc = emm_proc_network_notify(_emm_plmn_list.hplmn); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-IDLE - Failed to notify " - "network list update"); - } - } else { - /* - * Try to register to the PLMN manually selected by the user - */ - index = _emm_data.plmn_index; - } - } - } - - if ( !(index < 0) ) { - /* - * Search for a suitable cell of the currently selected PLMN: - * It can be the last registered or one of the equivalent PLMNs - * if available, or the PLMN selected by the user in manual mode, - * or any other PLMN in the ordered list of available PLMNs in - * automatic mode. - */ - _emm_plmn_list.index = index; - rc = _IdleMode_get_suitable_cell(index); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_plmn_end() ** - ** ** - ** Description: Completes the network selection procedure or triggers a ** - ** new one until a suitable or acceptable cell of the chosen ** - ** PLMN is found. ** - ** ** - ** If a suitable cell of the selected PLMN has been found, ** - ** that cell is chosen to camp on and provide available ser- ** - ** vices, and tunes to its control channel. ** - ** The MS will then register its presence in the registra- ** - ** tion area of the chosen cell, if it is capable of servi- ** - ** ces which require registration. As outcome of a success- ** - ** ful Location Registration the selected PLMN becomes the ** - ** registered PLMN. ** - ** ** - ** When no suitable cell can be found, the MS is unable to ** - ** obtain normal service from a PLMN. Then the MS attempts ** - ** to camp on an acceptable cell, irrespective of its PLMN ** - ** identity, so that only emergency calls can be made. ** - ** ** - ** Inputs: found: TRUE if a suitable cell of the chosen ** - ** PLMN has been found; FALSE otherwise. ** - ** tac: The code of the location/tracking area the ** - ** chosen PLMN belongs to ** - ** ci: The identifier of the cell ** - ** rat: The radio access technology supported by ** - ** the cell ** - ** Others: _emm_plmn_list, _emm_data ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_plmn_list, _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc = RETURNerror; - int index = _emm_plmn_list.index; - int select_next_plmn = FALSE; - - LOG_TRACE(INFO, "EMM-IDLE - %s cell found for PLMN %d in %s mode", - (found)? "One" : "No", index, - (_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO)? "Automatic" : - (_emm_data.plmn_mode == EMM_DATA_PLMN_MANUAL)? "Manual" : - "Automatic/manual"); - - if (found) { - int is_forbidden = FALSE; - - /* Select the PLMN of which a suitable cell has been found */ - _emm_data.splmn = *_emm_plmn_list.plmn[index]; - - /* Update the selected PLMN's parameters */ - _emm_plmn_list.param[index].tac = tac; - _emm_plmn_list.param[index].ci = ci; - _emm_plmn_list.param[index].rat = rat; - - /* Update the location data and notify EMM that data have changed */ - rc = emm_proc_location_notify(tac, ci , rat); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-IDLE - Failed to notify location update"); - } - - if (_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO) { - /* - * Automatic mode of operation - * --------------------------- - */ - int i; - - /* Check if the selected PLMN is in the forbidden list */ - for (i = 0; i < _emm_data.fplmn.n_plmns; i++) { - if (PLMNS_ARE_EQUAL(_emm_data.splmn, _emm_data.fplmn.plmn[i])) { - is_forbidden = TRUE; - break; - } - } - - if (!is_forbidden) { - for (i = 0; i < _emm_data.fplmn_gprs.n_plmns; i++) { - if (PLMNS_ARE_EQUAL(_emm_data.splmn, - _emm_data.fplmn_gprs.plmn[i])) { - is_forbidden = TRUE; - break; - } - } - } - - /* Check if the selected PLMN belongs to a forbidden - * tracking area */ - tai_t tai; - tai.plmn = _emm_data.splmn; - tai.tac = tac; - - if (!is_forbidden) { - for (i = 0; i < _emm_data.ftai.n_tais; i++) { - if (TAIS_ARE_EQUAL(tai, _emm_data.ftai.tai[i])) { - is_forbidden = TRUE; - break; - } - } - } - - if (!is_forbidden) { - for (i = 0; i < _emm_data.ftai_roaming.n_tais; i++) { - if (TAIS_ARE_EQUAL(tai, _emm_data.ftai_roaming.tai[i])) { - is_forbidden = TRUE; - break; - } - } - } - } - - if (is_forbidden) { - /* The selected cell is known not to be able to provide normal - * service */ - LOG_TRACE(INFO, "EMM-IDLE - UE may camp on this acceptable cell ", - "for limited services"); - - /* Save the index of the first forbidden PLMN */ - if (_emm_plmn_list.fplmn < 0) { - _emm_plmn_list.fplmn = index; - } - - _emm_plmn_list.param[index].stat = NET_OPER_FORBIDDEN; - } else { - /* A suitable cell has been found and the PLMN or tracking area - * is not in the forbidden list */ - LOG_TRACE(INFO, "EMM-IDLE - UE may camp on this suitable cell ", - "for normal services"); - _emm_plmn_list.fplmn = -1; - _emm_plmn_list.param[index].stat = NET_OPER_CURRENT; - emm_sap.primitive = EMMREG_REGISTER_CNF; - } - - /* Duplicate the new selected PLMN at the end of the ordered list */ - _emm_plmn_list.plmn[_emm_plmn_list.n_plmns] = &_emm_data.splmn; - } - - else if (_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO) { - /* - * Automatic mode of operation - * --------------------------- - * No suitable cell of the chosen PLMN has been found; - * Try to select the next PLMN in the ordered list of available PLMNs - */ - index += 1; - select_next_plmn = TRUE; - - /* Bypass the previously selected PLMN */ - if (index == _emm_plmn_list.splmn) { - index += 1; - } - } - - else if (_emm_data.plmn_index < 0) { - /* - * Manual or manual/automatic mode of operation - * -------------------------------------------- - * Attempt to automatically find a suitable cell of the last - * registered or equivalent PLMNs is ongoing - */ - index += 1; - select_next_plmn = TRUE; - } - - else if (_emm_data.plmn_mode == EMM_DATA_PLMN_MANUAL) { - /* - * Manual mode of operation - * ------------------------ - * No suitable cell of the PLMN selected by the user has been found - */ - emm_sap.primitive = EMMREG_NO_CELL; - } - - else { - /* - * Manual/automatic mode of operation - * -------------------------------------------- - * Attempt to find a suitable cell of the PLMN selected by the user - * failed; Try to automatically select another PLMN - */ - _emm_data.plmn_mode = EMM_DATA_PLMN_AUTO; - index = _emm_plmn_list.hplmn; - select_next_plmn = TRUE; - } - - /* - * Force an attempt to register to the next PLMN - */ - if (select_next_plmn) { - int last_plmn_index = _emm_plmn_list.n_plmns; - - if (_emm_plmn_list.splmn != -1) { - /* The last attempt was to register the previously selected PLMN */ - last_plmn_index += 1; - } - - if (index < last_plmn_index) { - /* Try to select the next PLMN in the list of available PLMNs */ - _emm_plmn_list.index = index; - rc = emm_proc_plmn_selection(index); - } else { - /* No suitable cell of any PLMN within the ordered list - * of available PLMNs has been found */ - select_next_plmn = FALSE; - emm_sap.primitive = EMMREG_NO_CELL; - } - } - - /* - * Or terminate the PLMN selection procedure - */ - if (!select_next_plmn) { - if (!(_emm_plmn_list.fplmn) < 0) { // FIXME this comparison makes no sense (bool < 0) - /* There were one or more PLMNs which were available and allowable, - * but an LR failure made registration on those PLMNs unsuccessful - * or an entry in any of the forbidden area lists prevented a - * registration attempt; select the first such PLMN and enters a - * limited service state. */ - index = _emm_plmn_list.fplmn; - _emm_plmn_list.fplmn = -1; - emm_sap.primitive = EMMREG_REGISTER_REJ; - } - - /* Update the availability indicator of the previously selected PLMN */ - if (_emm_plmn_list.splmn != -1) { - _emm_plmn_list.param[_emm_plmn_list.splmn].stat = NET_OPER_UNKNOWN; - } - - /* Update the index of the new selected PLMN */ - if (emm_sap.primitive != EMMREG_NO_CELL) { - _emm_plmn_list.splmn = index; - } else { - _emm_plmn_list.splmn = -1; - } - - /* - * Notify EMM that PLMN selection procedure has completed - */ - rc = emm_sap_send(&emm_sap); - - if (_emm_plmn_list.splmn != -1) { - if (_emm_plmn_list.splmn == _emm_plmn_list.rplmn) { - /* The selected PLMN is the registered PLMN */ - LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is the registered PLMN"); - _emm_data.is_rplmn = TRUE; - } else if (_emm_plmn_list.splmn < _emm_plmn_list.hplmn) { - /* The selected PLMN is in the list of equivalent PLMNs */ - LOG_TRACE(INFO, "EMM-IDLE - The selected PLMN is in the list of equivalent PLMNs"); - _emm_data.is_eplmn = TRUE; - } - - /* - * Notify EMM that an attach procedure has to be initiated - * to register the presence of the UE to the selected PLMN - */ - emm_sap.primitive = EMMREG_ATTACH_INIT; - rc = emm_sap_send(&emm_sap); - } - } - - LOG_FUNC_RETURN (rc); -} - -/* - *--------------------------------------------------------------------------- - * Network indication handlers - *--------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: emm_proc_registration_notify() ** - ** ** - ** Description: Updates the current network registration status and noti- ** - ** fy the EMM main controller that network registration sta- ** - ** tus has changed. ** - ** ** - ** Inputs: status: The new network registraton status ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_registration_notify(Stat_t status) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - /* Update the network registration status */ - if (_emm_data.stat != status) { - _emm_data.stat = status; - /* Notify EMM that data has changed */ - rc = (*_emm_indication_notify)(1); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_location_notify() ** - ** ** - ** Description: Updates the current location information and notify the ** - ** EMM main controller that location area has changed. ** - ** ** - ** Inputs: tac: The code of the new location/tracking area ** - ** ci: The identifier of the new serving cell ** - ** rat: The Radio Access Technology supported by ** - ** the new serving cell ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - /* Update the location information */ - if ( (_emm_data.tac != tac) || - (_emm_data.ci != ci) || - (_emm_data.rat != rat) ) { - _emm_data.tac = tac; - _emm_data.ci = ci; - _emm_data.rat = rat; - /* Notify EMM that data has changed */ - rc = (*_emm_indication_notify)(0); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_network_notify() ** - ** ** - ** Description: Updates the string representation of the list of opera- ** - ** tors present in the network and notify the EMM main con- ** - ** troller that the list has to be displayed to the user ** - ** application. ** - ** ** - ** Inputs: index: Index of the first operator to update ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_network_notify(int index) -{ - LOG_FUNC_IN; - - /* Update the list of operators present in the network */ - int size = IdleMode_update_plmn_list(index); - /* Notify EMM that data has changed */ - int rc = (*_emm_indication_notify)(size); - - LOG_FUNC_RETURN (rc); -} - -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _IdleMain_plmn_str() ** - ** ** - ** Description: Converts a PLMN identifier to a string representation in ** - ** the numeric format ** - ** ** - ** Inputs: plmn: The PLMN identifier to convert ** - ** Others: None ** - ** ** - ** Outputs: plmn_str: The PLMN identifier in numeric format ** - ** Return: The size in bytes of the string represen- ** - ** tation of the PLMN identifier ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _IdleMode_plmn_str(char *plmn_str, const plmn_t *plmn) -{ - char *p = plmn_str; - - if (plmn == NULL) { - return 0; - } - - if (plmn->MCCdigit1 != 0x0F) { - sprintf(p++, "%u", plmn->MCCdigit1); - } - - if (plmn->MCCdigit2 != 0x0F) { - sprintf(p++, "%u", plmn->MCCdigit2); - } - - if (plmn->MCCdigit3 != 0x0F) { - sprintf(p++, "%u", plmn->MCCdigit3); - } - - if (plmn->MNCdigit1 != 0x0F) { - sprintf(p++, "%u", plmn->MNCdigit1); - } - - if (plmn->MNCdigit2 != 0x0F) { - sprintf(p++, "%u", plmn->MNCdigit2); - } - - if (plmn->MNCdigit3 != 0x0F) { - sprintf(p++, "%u", plmn->MNCdigit3); - } - - return (p - plmn_str); -} - -/**************************************************************************** - ** ** - ** Name: _IldlMode_get_opnn_id() ** - ** ** - ** Description: Get the index of the specified PLMN in the list of opera- ** - ** tor network name records ** - ** ** - ** Inputs: plmn: The PLMN identifier ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: The index of the PLMN if found in the list ** - ** of operator network name records; ** - ** -1 otherwise; ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _IldlMode_get_opnn_id(const plmn_t *plmn) -{ - int i; - - for (i = 0; i < _emm_data.n_opnns; i++) { - if (plmn->MCCdigit1 != _emm_data.opnn[i].plmn->MCCdigit1) { - continue; - } - - if (plmn->MCCdigit2 != _emm_data.opnn[i].plmn->MCCdigit2) { - continue; - } - - if (plmn->MCCdigit3 != _emm_data.opnn[i].plmn->MCCdigit3) { - continue; - } - - if (plmn->MNCdigit1 != _emm_data.opnn[i].plmn->MNCdigit1) { - continue; - } - - if (plmn->MNCdigit2 != _emm_data.opnn[i].plmn->MNCdigit2) { - continue; - } - - if (plmn->MNCdigit3 != _emm_data.opnn[i].plmn->MNCdigit3) { - continue; - } - - /* Found */ - return (i); - } - - /* Not found */ - return (-1); -} - -/**************************************************************************** - ** ** - ** Name: _IdleMode_get_suitable_cell() ** - ** ** - ** Description: Query the Access Stratum to search for a suitable cell ** - ** that belongs to the selected PLMN. ** - ** ** - ** Inputs: index: Index of the selected PLMN in the ordered ** - ** list of available PLMNs ** - ** Others: _emm_plmn_list.plmn ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _IdleMode_get_suitable_cell(int index) -{ - emm_sap_t emm_sap; - const plmn_t *plmn = _emm_plmn_list.plmn[index]; - - LOG_TRACE(INFO, "EMM-IDLE - Trying to search a suitable cell " - "of PLMN %d in %s mode", index, - (_emm_data.plmn_mode == EMM_DATA_PLMN_AUTO)? "Automatic" : - (_emm_data.plmn_mode == EMM_DATA_PLMN_MANUAL)? "Manual" : - "Automatic/manual"); - /* - * Notify EMM-AS SAP that cell information related to the given - * PLMN are requested from the Access-Stratum - */ - emm_sap.primitive = EMMAS_CELL_INFO_REQ; - emm_sap.u.emm_as.u.cell_info.plmnIDs.n_plmns = 1; - emm_sap.u.emm_as.u.cell_info.plmnIDs.plmn[0] = *plmn; - - if (_emm_data.plmn_rat != NET_ACCESS_UNAVAILABLE) { - emm_sap.u.emm_as.u.cell_info.rat = (1 << _emm_data.plmn_rat); - } else { - emm_sap.u.emm_as.u.cell_info.rat = NET_ACCESS_UNAVAILABLE; - } - - return emm_sap_send(&emm_sap); -} -#endif // NAS_UE - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.h b/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.h deleted file mode 100644 index 7f23bb1bf4b007a4dba8c4325ccdd1b0a91eafa0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/IdleMode.h +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source IdleMode.h - -Version 0.1 - -Date 2012/10/23 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the functions used to get information from the list - of available PLMNs locally maintained when the UE is in - idle mode. - -*****************************************************************************/ -#ifndef __IDLEMODE_H__ -#define __IDLEMODE_H__ - -#include "commonDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -typedef int (*IdleMode_callback_t) (int); - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void IdleMode_initialize(IdleMode_callback_t cb); - -int IdleMode_get_nb_plmns(void); -int IdleMode_get_hplmn_index(void); -int IdleMode_get_rplmn_index(void); -int IdleMode_get_splmn_index(void); - -int IdleMode_update_plmn_list(int index); - -const char *IdleMode_get_plmn_fullname(const plmn_t *plmn, int index, - size_t *len); -const char *IdleMode_get_plmn_shortname(const plmn_t *plmn, int index, - size_t *len); -const char *IdleMode_get_plmn_id(const plmn_t *plmn, int index, size_t *len); - -int IdleMode_get_plmn_fullname_index(const char *plmn); -int IdleMode_get_plmn_shortname_index(const char *plmn); -int IdleMode_get_plmn_id_index(const char *plmn); - -#endif /* __IDLEMODE_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.c b/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.c deleted file mode 100644 index 0a19feb0a567be764b5c4ee9b2b0e28c8c6a6b96..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.c +++ /dev/null @@ -1,547 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source LowerLayer.c - -Version 0.1 - -Date 2012/03/14 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines EMM procedures executed by the Non-Access Stratum - upon receiving notifications from lower layers so that data - transfer succeed or failed, or NAS signalling connection is - released, or ESM unit data has been received from under layer, - and to request ESM unit data transfer to under layer. - -*****************************************************************************/ - -#include "LowerLayer.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emmData.h" - -#include "emm_sap.h" -#include "esm_sap.h" -#include "nas_log.h" - -#include <string.h> // memset - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * Data structure used to handle EMM procedures executed by the UE upon - * receiving lower layer notifications - */ -static struct { - lowerlayer_success_callback_t success; /* Successful data delivery */ - lowerlayer_failure_callback_t failure; /* Lower layer failure */ - lowerlayer_release_callback_t release; /* NAS signalling release */ - void *args; /* EMM procedure argument parameters */ -} _lowerlayer_data; -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Lower layer notification handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: lowerlayer_success() ** - ** ** - ** Description: Notify the EPS Mobility Management entity that data have ** - ** been successfully delivered to the network ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int lowerlayer_success(unsigned int ueid) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - emm_sap.primitive = EMMREG_LOWERLAYER_SUCCESS; - emm_sap.u.emm_reg.ueid = ueid; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: lowerlayer_failure() ** - ** ** - ** Description: Notify the EPS Mobility Management entity that lower la- ** - ** yers failed to deliver data to the network ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int lowerlayer_failure(unsigned int ueid) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - emm_sap.primitive = EMMREG_LOWERLAYER_FAILURE; - emm_sap.u.emm_reg.ueid = ueid; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: lowerlayer_establish() ** - ** ** - ** Description: Update the EPS connection management status upon recei- ** - ** ving indication so that the NAS signalling connection is ** - ** established ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int lowerlayer_establish(void) -{ - LOG_FUNC_IN; - -#ifdef NAS_UE - /* Update the EPS Connection Management status */ - _emm_data.ecm_status = ECM_CONNECTED; -#endif - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: lowerlayer_release() ** - ** ** - ** Description: Notify the EPS Mobility Management entity that NAS signal-** - ** ling connection has been released ** - ** ** - ** Inputs: cause: Release cause ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int lowerlayer_release(int cause) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - -#ifdef NAS_UE - /* Update the EPS Connection Management status */ - _emm_data.ecm_status = ECM_IDLE; -#endif - - emm_sap.primitive = EMMREG_LOWERLAYER_RELEASE; - emm_sap.u.emm_reg.ueid = 0; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: lowerlayer_data_ind() ** - ** ** - ** Description: Notify the EPS Session Management entity that data have ** - ** been received from lower layers ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** data: Data transfered from lower layers ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int lowerlayer_data_ind(unsigned int ueid, const OctetString *data) -{ - esm_sap_t esm_sap; - int rc; -#if defined(NAS_MME) - emm_data_context_t *emm_ctx = NULL; -#endif - - LOG_FUNC_IN; - -#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - } - -#endif - - esm_sap.primitive = ESM_UNITDATA_IND; - esm_sap.is_standalone = TRUE; - esm_sap.ueid = ueid; -#if defined(NAS_MME) - esm_sap.ctx = emm_ctx; -#endif - esm_sap.recv = data; - rc = esm_sap_send(&esm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: lowerlayer_data_req() ** - ** ** - ** Description: Notify the EPS Mobility Management entity that data have ** - ** to be transfered to lower layers ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** data: Data to be transfered to lower layers ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int lowerlayer_data_req(unsigned int ueid, const OctetString *data) -{ - LOG_FUNC_IN; - - int rc; - emm_sap_t emm_sap; - emm_security_context_t *sctx = NULL; - struct emm_data_context_s *ctx = NULL; - - emm_sap.primitive = EMMAS_DATA_REQ; -#ifdef NAS_UE - emm_sap.u.emm_as.u.data.guti = _emm_data.guti; - emm_sap.u.emm_as.u.data.ueid = 0; - sctx = _emm_data.security; -#endif -#ifdef NAS_MME - emm_sap.u.emm_as.u.data.guti = NULL; - emm_sap.u.emm_as.u.data.ueid = ueid; -# if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - ctx = emm_data_context_get(&_emm_data, ueid); - } - -# else - - if (ueid < EMM_DATA_NB_UE_MAX) { - ctx = _emm_data.ctx[ueid]; - } - -# endif - - if (ctx) { - sctx = ctx->security; - } - -#endif - emm_sap.u.emm_as.u.data.NASinfo = 0; - emm_sap.u.emm_as.u.data.NASmsg.length = data->length; - emm_sap.u.emm_as.u.data.NASmsg.value = data->value; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.data.sctx, sctx, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/* - * -------------------------------------------------------------------------- - * EMM procedure handlers - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_proc_lowerlayer_initialize() ** - ** ** - ** Description: Initialize EMM procedure handler ** - ** ** - ** Inputs: success: EMM procedure executed when data have been ** - ** successfully delivered by lower layers ** - ** failure: EMM procedure executed upon transmission ** - ** failure reported by lower layers ** - ** release: EMM procedure executed when lower layers ** - ** report that NAS signalling connection has ** - ** been released ** - ** args: EMM procedure argument parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _lowerlayer_data ** - ** ** - ***************************************************************************/ -int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success, - lowerlayer_failure_callback_t failure, - lowerlayer_release_callback_t release, - void *args) -{ - LOG_FUNC_IN; - - _lowerlayer_data.success = success; - _lowerlayer_data.failure = failure; - _lowerlayer_data.release = release; - _lowerlayer_data.args = args; - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_lowerlayer_success() ** - ** ** - ** Description: Handles EMM procedure to be executed upon receiving noti- ** - ** fication that data have been successfully delivered to ** - ** the network. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_lowerlayer_success(void) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - lowerlayer_success_callback_t emm_callback = _lowerlayer_data.success; - - if (emm_callback) { - rc = (*emm_callback)(_lowerlayer_data.args); - _lowerlayer_data.success = NULL; - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_lowerlayer_failure() ** - ** ** - ** Description: Handles EMM procedure to be executed upon receiving noti- ** - ** fication that data failed to be delivered to the network. ** - ** ** - ** Inputs: is_initial: TRUE if the NAS message that failed to be ** - ** transfered is an initial NAS message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_lowerlayer_failure(int is_initial) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - lowerlayer_failure_callback_t emm_callback = _lowerlayer_data.failure; - - if (emm_callback) { - rc = (*emm_callback)(is_initial, _lowerlayer_data.args); - _lowerlayer_data.failure = NULL; - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_lowerlayer_release() ** - ** ** - ** Description: Handles EMM procedure to be executed upon receiving noti- ** - ** fication that NAS signalling connection has been released ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_lowerlayer_release(void) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - lowerlayer_release_callback_t emm_callback = _lowerlayer_data.release; - - if (emm_callback) { - rc = (*emm_callback)(_lowerlayer_data.args); - _lowerlayer_data.release = NULL; - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE - -/**************************************************************************** - ** ** - ** Name: emm_as_set_security_data() ** - ** ** - ** Description: Setup security data according to the given EPS security ** - ** context when data transfer to lower layers is requested ** - ** ** - ** Inputs: args: EPS security context currently in use ** - ** is_new: Indicates whether a new security context ** - ** has just been taken into use ** - ** is_ciphered: Indicates whether the NAS message has to ** - ** be sent ciphered ** - ** Others: None ** - ** ** - ** Outputs: data: EPS NAS security data to be setup ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void emm_as_set_security_data(emm_as_security_data_t *data, const void *args, - int is_new, int is_ciphered) -{ - LOG_FUNC_IN; - - const emm_security_context_t *context = (emm_security_context_t *)(args); - - memset(data, 0, sizeof(emm_as_security_data_t)); - - if ( context && (context->type != EMM_KSI_NOT_AVAILABLE) ) { - /* 3GPP TS 24.301, sections 5.4.3.3 and 5.4.3.4 - * Once a valid EPS security context exists and has been taken - * into use, UE and MME shall cipher and integrity protect all - * NAS signalling messages with the selected NAS ciphering and - * NAS integrity algorithms */ - LOG_TRACE(INFO, - "EPS security context exists is new %u KSI %u SQN %u count %u", - is_new, - context->eksi, - context->ul_count.seq_num, - *(UInt32_t *)(&context->ul_count)); - LOG_TRACE(INFO, - "knas_int %s",dump_octet_string(&context->knas_int)); - LOG_TRACE(INFO, - "knas_enc %s",dump_octet_string(&context->knas_enc)); - LOG_TRACE(INFO, - "kasme %s",dump_octet_string(&context->kasme)); - - data->is_new = is_new; - data->ksi = context->eksi; -#if defined (NAS_UE) - data->sqn = context->ul_count.seq_num; - // LG data->count = *(UInt32_t *)(&context->ul_count); - data->count = 0x00000000 | (context->ul_count.overflow << 8 ) | context->ul_count.seq_num; -#else - data->sqn = context->dl_count.seq_num; - // LG data->count = *(UInt32_t *)(&context->ul_count); - data->count = 0x00000000 | (context->dl_count.overflow << 8 ) | context->dl_count.seq_num; -#endif - /* NAS integrity and cyphering keys may not be available if the - * current security context is a partial EPS security context - * and not a full native EPS security context */ - data->k_int = &context->knas_int; - - if (is_ciphered) { - /* 3GPP TS 24.301, sections 4.4.5 - * When the UE establishes a new NAS signalling connection, - * it shall send initial NAS messages integrity protected - * and unciphered */ - /* 3GPP TS 24.301, section 5.4.3.2 - * The MME shall send the SECURITY MODE COMMAND message integrity - * protected and unciphered */ - LOG_TRACE(WARNING, - "EPS security context exists knas_enc"); - data->k_enc = &context->knas_enc; - } - } else { - LOG_TRACE(WARNING, "EMM_AS_NO_KEY_AVAILABLE"); - /* No valid EPS security context exists */ - data->ksi = EMM_AS_NO_KEY_AVAILABLE; - } - - LOG_FUNC_OUT; -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.h b/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.h deleted file mode 100644 index eead2a909c599d97dc27e805a56fd6325e1fd0d9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/LowerLayer.h +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source lowerlayer.h - -Version 0.1 - -Date 2013/06/19 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines EMM procedures executed by the Non-Access Stratum - upon receiving notifications from lower layers so that data - transfer succeed or failed, or NAS signalling connection is - released, or ESM unit data has been received from under layer, - and to request ESM unit data transfer to under layer. - -*****************************************************************************/ -#ifndef __LOWERLAYER_H__ -#define __LOWERLAYER_H__ - -#include "OctetString.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * Type of EMM procedure callback function executed whenever data are - * successfully delivered to the network - */ -typedef int (*lowerlayer_success_callback_t)(void *); - -/* - * Type of EMM procedure callback function executed when data are not - * delivered to the network because a lower layer failure occurred - */ -typedef int (*lowerlayer_failure_callback_t)(int, void *); - -/* - * Type of EMM procedure callback function executed when NAS signalling - * connection is released - */ -typedef int (*lowerlayer_release_callback_t)(void *); -#endif - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int lowerlayer_success(unsigned int ueid); -int lowerlayer_failure(unsigned int ueid); -int lowerlayer_establish(void); -int lowerlayer_release(int cause); - -int lowerlayer_data_ind(unsigned int ueid, const OctetString *data); -int lowerlayer_data_req(unsigned int ueid, const OctetString *data); - -#endif /* __LOWERLAYER_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/Makefile b/openair-cn/NAS/EURECOM-NAS/src/emm/Makefile deleted file mode 100644 index ef85807e8fc76fb26ece82e1c7ef835c89203da5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. \ - -I$(INCDIR) \ - -I$(UTILDIR) \ - -I$(USIMAPIDIR) \ - -I$(MMEAPIDIR) \ - -I$(ESMDIR) \ - -I$(EMMSAPDIR) \ - -I$(ESMDIR) \ - -I$(ESMSAPDIR) \ - -I$(EMMMSGDIR) \ - -I$(IESDIR) \ - -I$(OPENAIRCN_DIR)/COMMON \ - -I$(OPENAIRCN_DIR)/SECU - - -all: $(OBJS) - @$(CD) $(EMMMSGDIR) && $(MAKE) - @$(CD) $(EMMSAPDIR) && $(MAKE) - -clean: - $(RM) $(OBJS) *.bak *~ - @$(CD) $(EMMSAPDIR) && $(MAKE) $@ - -veryclean: clean - @$(CD) $(EMMSAPDIR) && $(MAKE) $@ - @$(CD) $(EMMMSGDIR) && $(MAKE) $@ - $(RM) $(TARGET) - -%.o: %.c Makefile $(PROJDIR)/Makerules $(PROJDIR)/Makefile.inc - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c b/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c deleted file mode 100644 index eaceb2fd1766bcce7a9c7a39c839308ae49ef56d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/SecurityModeControl.c +++ /dev/null @@ -1,1256 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source SecurityModeControl.c - -Version 0.1 - -Date 2013/04/22 - -Product NAS stack - -Subsystem Template body file - -Author Frederic Maurel - -Description Defines the security mode control EMM procedure executed by the - Non-Access Stratum. - - The purpose of the NAS security mode control procedure is to - take an EPS security context into use, and initialise and start - NAS signalling security between the UE and the MME with the - corresponding EPS NAS keys and EPS security algorithms. - - Furthermore, the network may also initiate a SECURITY MODE COM- - MAND in order to change the NAS security algorithms for a cur- - rent EPS security context already in use. - -*****************************************************************************/ - -#include <stdlib.h> // malloc, free -#include <string.h> // memcpy -#include <inttypes.h> - -#include "emm_proc.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "emmData.h" - -#include "emm_sap.h" -#include "emm_cause.h" - -#include "UeSecurityCapability.h" - -#if defined(ENABLE_ITTI) -# include "assertions.h" -#endif -#include "secu_defs.h" -#include "msc.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the security mode control procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -static int _security_kdf(const OctetString *kasme, OctetString *key, - UInt8_t algo_dist, UInt8_t algo_id); - -static int _security_knas_enc(const OctetString *kasme, OctetString *knas_enc, - UInt8_t eia); -static int _security_knas_int(const OctetString *kasme, OctetString *knas_int, - UInt8_t eea); -static int _security_kenb(const OctetString *kasme, OctetString *kenb, - UInt32_t count); - -/* - * Internal data used for security mode control procedure - */ -static struct { - OctetString kenb; /* eNodeB security key */ -} _security_data; - -static void _security_release(emm_security_context_t *ctx); -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the security mode control procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Timer handlers - */ -static void *_security_t3460_handler(void *); - -/* - * Function executed whenever the ongoing EMM procedure that initiated - * the security mode control procedure is aborted or the maximum value of the - * retransmission timer counter is exceed - */ -static int _security_abort(void *); -static int _security_select_algorithms( - const int ue_eiaP, - const int ue_eeaP, - int * const mme_eiaP, - int * const mme_eeaP); -/* - * Internal data used for security mode control procedure - */ -typedef struct { - unsigned int ueid; /* UE identifier */ -#define SECURITY_COUNTER_MAX 5 - unsigned int retransmission_count; /* Retransmission counter */ - int ksi; /* NAS key set identifier */ - int eea; /* Replayed EPS encryption algorithms */ - int eia; /* Replayed EPS integrity algorithms */ - int ucs2; /* Replayed Alphabet */ - int uea; /* Replayed UMTS encryption algorithms */ - int uia; /* Replayed UMTS integrity algorithms */ - int gea; /* Replayed G encryption algorithms */ - int umts_present:1; - int gprs_present:1; - int selected_eea; /* Selected EPS encryption algorithms */ - int selected_eia; /* Selected EPS integrity algorithms */ - int notify_failure; /* Indicates whether the security mode control - * procedure failure shall be notified to the - * ongoing EMM procedure */ -} security_data_t; - -static int _security_request(security_data_t *data, int is_new); -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Security mode control procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_proc_security_mode_command() ** - ** ** - ** Description: Performs the MME requested security mode control proce- ** - ** dure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.3.3 ** - ** Upon receiving the SECURITY MODE COMMAND message, the UE ** - ** shall check whether the message can be accepted or not. ** - ** If accepted the UE shall send a SECURITY MODE COMPLETE ** - ** message integrity protected with the selected NAS inte- ** - ** grity algorithm and ciphered with the selected NAS ciphe- ** - ** ring algorithm. ** - ** ** - ** Inputs: native_ksi: TRUE if the security context is of type ** - ** native (for KSIASME) ** - ** ksi: The NAS ket sey identifier ** - ** seea: Selected EPS cyphering algorithm ** - ** seia: Selected EPS integrity algorithm ** - ** reea: Replayed EPS cyphering algorithm ** - ** reia: Replayed EPS integrity algorithm ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_security_mode_command(int native_ksi, int ksi, - int seea, int seia, int reea, int reia) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - int emm_cause = EMM_CAUSE_SUCCESS; - int security_context_is_new = FALSE; - - LOG_TRACE(INFO, "EMM-PROC - Security mode control requested (ksi=%d)", - ksi); - - /* Delete any previously stored RAND and RES and stop timer T3416 */ - (void) emm_proc_authentication_delete(); - - /* - * Check the replayed UE security capabilities - */ - UInt8_t eea = (0x80 >> _emm_data.security->capability.eps_encryption); - UInt8_t eia = (0x80 >> _emm_data.security->capability.eps_integrity); - - if ( (reea != eea) || (reia != eia) ) { - LOG_TRACE(WARNING, "EMM-PROC - Replayed UE security capabilities " - "rejected"); - emm_cause = EMM_CAUSE_UE_SECURITY_MISMATCH; - - /* XXX - For testing purpose UE always accepts EIA0 - * The UE shall accept "null integrity protection algorithm" EIA0 only - * if a PDN connection for emergency bearer services is established or - * the UE is establishing a PDN connection for emergency bearer services - */ - } - /* - * Check the non-current EPS security context - */ - else if (_emm_data.non_current == NULL) { - LOG_TRACE(WARNING, "EMM-PROC - Non-current EPS security context " - "is not valid"); - emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED; - } - /* - * Update the non-current EPS security context - */ - else { - LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context seea=%u seia=%u", seea, seia); - /* Update selected cyphering and integrity algorithms */ - //LG COMENTED _emm_data.non_current->capability.encryption = seea; - //LG COMENTED _emm_data.non_current->capability.integrity = seia; - - _emm_data.non_current->selected_algorithms.encryption = seea; - _emm_data.non_current->selected_algorithms.integrity = seia; - - /* Derive the NAS cyphering key */ - if (_emm_data.non_current->knas_enc.value == NULL) { - _emm_data.non_current->knas_enc.value = - (uint8_t *)calloc(1,AUTH_KNAS_ENC_SIZE); - _emm_data.non_current->knas_enc.length = AUTH_KNAS_ENC_SIZE; - } - - if (_emm_data.non_current->knas_enc.value != NULL) { - LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_enc"); - rc = _security_knas_enc(&_emm_data.non_current->kasme, - &_emm_data.non_current->knas_enc, seea); - } - - /* Derive the NAS integrity key */ - if (_emm_data.non_current->knas_int.value == NULL) { - _emm_data.non_current->knas_int.value = - (uint8_t *)calloc(1,AUTH_KNAS_INT_SIZE); - _emm_data.non_current->knas_int.length = AUTH_KNAS_INT_SIZE; - } - - if (_emm_data.non_current->knas_int.value != NULL) { - if (rc != RETURNerror) { - LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context knas_int"); - rc = _security_knas_int(&_emm_data.non_current->kasme, - &_emm_data.non_current->knas_int, seia); - } - } - - /* Derive the eNodeB key */ - if (_security_data.kenb.value == NULL) { - _security_data.kenb.value = (uint8_t *)calloc(1,AUTH_KENB_SIZE); - _security_data.kenb.length = AUTH_KENB_SIZE; - } - - if (_security_data.kenb.value != NULL) { - if (rc != RETURNerror) { - LOG_TRACE(INFO, "EMM-PROC - Update the non-current EPS security context kenb"); - // LG COMMENT rc = _security_kenb(&_emm_data.security->kasme, - rc = _security_kenb(&_emm_data.non_current->kasme, - &_security_data.kenb, - *(UInt32_t *)(&_emm_data.non_current->ul_count)); - } - } - - /* - * NAS security mode command accepted by the UE - */ - if (rc != RETURNerror) { - LOG_TRACE(INFO, "EMM-PROC - NAS security mode command accepted by the UE"); - - /* Update the current EPS security context */ - if ( native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) { - /* The type of security context flag included in the SECURITY - * MODE COMMAND message is set to "native security context" and - * the UE has a mapped EPS security context as the current EPS - * security context */ - if ( (_emm_data.non_current->type == EMM_KSI_NATIVE) && - (_emm_data.non_current->eksi == ksi) ) { - /* The KSI matches the non-current native EPS security - * context; the UE shall take the non-current native EPS - * security context into use which then becomes the - * current native EPS security context and delete the - * mapped EPS security context */ - LOG_TRACE(INFO, - "EMM-PROC - Update Current security context"); - /* Release non-current security context */ - _security_release(_emm_data.security); - _emm_data.security = _emm_data.non_current; - /* Reset the uplink NAS COUNT counter */ - _emm_data.security->ul_count.overflow = 0; - _emm_data.security->ul_count.seq_num = 0; - /* Set new security context indicator */ - security_context_is_new = TRUE; - } - } - - if ( !native_ksi && (_emm_data.security->type != EMM_KSI_NATIVE) ) { - /* The type of security context flag included in the SECURITY - * MODE COMMAND message is set to "mapped security context" and - * the UE has a mapped EPS security context as the current EPS - * security context */ - if (ksi != _emm_data.security->eksi) { - /* The KSI does not match the current EPS security context; - * the UE shall reset the uplink NAS COUNT counter */ - LOG_TRACE(INFO, - "EMM-PROC - Reset uplink NAS COUNT counter"); - _emm_data.security->ul_count.overflow = 0; - _emm_data.security->ul_count.seq_num = 0; - } - } - - _emm_data.security->selected_algorithms.encryption = seea; - _emm_data.security->selected_algorithms.integrity = seia; - - } - /* - * NAS security mode command not accepted by the UE - */ - else { - /* Setup EMM cause code */ - emm_cause = EMM_CAUSE_SECURITY_MODE_REJECTED; - - /* Release security mode control internal data */ - if (_security_data.kenb.value) { - free(_security_data.kenb.value); - _security_data.kenb.value = NULL; - _security_data.kenb.length = 0; - } - } - } - - /* Setup EMM procedure handler to be executed upon receiving - * lower layer notification */ - rc = emm_proc_lowerlayer_initialize(NULL, NULL, NULL, NULL); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, - "EMM-PROC - Failed to initialize EMM procedure handler"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Notify EMM-AS SAP that Security Mode response message has to be sent - * to the network - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMAS_SECURITY_RES; - emm_sap.u.emm_as.u.security.guti = _emm_data.guti; - emm_sap.u.emm_as.u.security.ueid = 0; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC; - emm_sap.u.emm_as.u.security.emm_cause = emm_cause; - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - _emm_data.security, security_context_is_new, TRUE); - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Security mode control procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME - - -/**************************************************************************** - ** ** - ** Name: emm_proc_security_mode_control() ** - ** ** - ** Description: Initiates the security mode control procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.3.2 ** - ** The MME initiates the NAS security mode control procedure ** - ** by sending a SECURITY MODE COMMAND message to the UE and ** - ** starting timer T3460. The message shall be sent unciphe- ** - ** red but shall be integrity protected using the NAS inte- ** - ** grity key based on KASME. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** ksi: NAS key set identifier ** - ** eea: Replayed EPS encryption algorithms ** - ** eia: Replayed EPS integrity algorithms ** - ** success: Callback function executed when the secu- ** - ** rity mode control procedure successfully ** - ** completes ** - ** reject: Callback function executed when the secu- ** - ** rity mode control procedure fails or is ** - ** rejected ** - ** failure: Callback function executed whener a lower ** - ** layer failure occured before the security ** - ** mode control procedure comnpletes ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_security_mode_control(unsigned int ueid, int ksi, - int eea, int eia,int ucs2, int uea, int uia, int gea, int umts_present, int gprs_present, - emm_common_success_callback_t success, - emm_common_reject_callback_t reject, - emm_common_failure_callback_t failure) -{ - int rc = RETURNerror; - int security_context_is_new = FALSE; - int mme_eea = NAS_SECURITY_ALGORITHMS_EEA0; - int mme_eia = NAS_SECURITY_ALGORITHMS_EIA0; - /* Get the UE context */ - emm_data_context_t *emm_ctx = NULL; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - Initiate security mode control procedure " - "KSI = %d EEA = %d EIA = %d", - ksi, eea, eia); - -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - } - -#endif - - if (emm_ctx && emm_ctx->security) { - if (emm_ctx->security->type == EMM_KSI_NOT_AVAILABLE) { - /* The security mode control procedure is initiated to take into use - * the EPS security context created after a successful execution of - * the EPS authentication procedure */ - emm_ctx->security->type = EMM_KSI_NATIVE; - emm_ctx->security->eksi = ksi; - emm_ctx->security->dl_count.overflow = 0; - emm_ctx->security->dl_count.seq_num = 0; - - /* TODO !!! Compute Kasme, and NAS cyphering and integrity keys */ - // LG: Kasme should have been received from authentication - // information request (S6A) - // Kasme is located in emm_ctx->vector.kasme - FREE_OCTET_STRING(emm_ctx->security->kasme); - - emm_ctx->security->kasme.value = malloc(32); - memcpy(emm_ctx->security->kasme.value, - emm_ctx->vector.kasme, - 32); - emm_ctx->security->kasme.length = 32; - - rc = _security_select_algorithms( - eia, - eea, - &mme_eia, - &mme_eea); - - emm_ctx->security->selected_algorithms.encryption = mme_eea; - emm_ctx->security->selected_algorithms.integrity = mme_eia; - - if (rc == RETURNerror) { - LOG_TRACE(WARNING, - "EMM-PROC - Failed to select security algorithms"); - LOG_FUNC_RETURN (RETURNerror); - } - - if ( ! emm_ctx->security->knas_int.value) { - emm_ctx->security->knas_int.value = malloc(AUTH_KNAS_INT_SIZE); - } else { - LOG_TRACE(ERROR, - " TODO realloc emm_ctx->security->knas_int OctetString"); - LOG_FUNC_RETURN (RETURNerror); - } - - emm_ctx->security->knas_int.length = AUTH_KNAS_INT_SIZE; - derive_key_nas( - NAS_INT_ALG, - emm_ctx->security->selected_algorithms.integrity, - emm_ctx->vector.kasme, - emm_ctx->security->knas_int.value); - - if ( ! emm_ctx->security->knas_enc.value) { - emm_ctx->security->knas_enc.value = malloc(AUTH_KNAS_ENC_SIZE); - } else { - LOG_TRACE(ERROR, - " TODO realloc emm_ctx->security->knas_enc OctetString"); - LOG_FUNC_RETURN (RETURNerror); - } - - emm_ctx->security->knas_enc.length = AUTH_KNAS_ENC_SIZE; - derive_key_nas( - NAS_ENC_ALG, - emm_ctx->security->selected_algorithms.encryption, - emm_ctx->vector.kasme, - emm_ctx->security->knas_enc.value); - - /* Set new security context indicator */ - security_context_is_new = TRUE; - } - } else { - LOG_TRACE(WARNING, "EMM-PROC - No EPS security context exists"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Allocate parameters of the retransmission timer callback */ - security_data_t *data = - (security_data_t *)malloc(sizeof(security_data_t)); - - if (data != NULL) { - /* Setup ongoing EMM procedure callback functions */ - rc = emm_proc_common_initialize(ueid, success, reject, failure, - _security_abort, data); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "Failed to initialize EMM callback functions"); - free(data); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Set the UE identifier */ - data->ueid = ueid; - /* Reset the retransmission counter */ - data->retransmission_count = 0; - /* Set the key set identifier */ - data->ksi = ksi; - /* Set the EPS encryption algorithms to be replayed to the UE */ - data->eea = eea; - /* Set the EPS integrity algorithms to be replayed to the UE */ - data->eia = eia; - data->ucs2 = ucs2; - /* Set the UMTS encryption algorithms to be replayed to the UE */ - data->uea = uea; - /* Set the UMTS integrity algorithms to be replayed to the UE */ - data->uia = uia; - /* Set the GPRS integrity algorithms to be replayed to the UE */ - data->gea = gea; - data->umts_present = umts_present; - data->gprs_present = gprs_present; - /* Set the EPS encryption algorithms selected to the UE */ - data->selected_eea = emm_ctx->security->selected_algorithms.encryption; - /* Set the EPS integrity algorithms selected to the UE */ - data->selected_eia = emm_ctx->security->selected_algorithms.integrity; - /* Set the failure notification indicator */ - data->notify_failure = FALSE; - /* Send security mode command message to the UE */ - rc = _security_request(data, security_context_is_new); - - if (rc != RETURNerror) { - /* - * Notify EMM that common procedure has been initiated - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REQ ue id %06x (security mode control)", ueid); - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REQ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - rc = emm_sap_send(&emm_sap); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_security_mode_complete() ** - ** ** - ** Description: Performs the security mode control completion procedure ** - ** executed by the network. ** - ** ** - ** 3GPP TS 24.301, section 5.4.3.4 ** - ** Upon receiving the SECURITY MODE COMPLETE message, the ** - ** MME shall stop timer T3460. ** - ** From this time onward the MME shall integrity protect and ** - ** encipher all signalling messages with the selected NAS ** - ** integrity and ciphering algorithms. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_security_mode_complete(unsigned int ueid) -{ - emm_data_context_t *emm_ctx = NULL; - - int rc = RETURNerror; - emm_sap_t emm_sap; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMM-PROC - Security mode complete (ueid=%u)", ueid); - - /* Stop timer T3460 */ - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id); - T3460.id = nas_timer_stop(T3460.id); - - /* Release retransmission timer paramaters */ - security_data_t *data = (security_data_t *)(emm_proc_common_get_args(ueid)); - - if (data) { - free(data); - } - - /* Get the UE context */ -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - } - -#endif - - if (emm_ctx && emm_ctx->security) { - /* - * Notify EMM that the authentication procedure successfully completed - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_CNF ue id %06x (security mode complete)", ueid); - emm_sap.primitive = EMMREG_COMMON_PROC_CNF; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - emm_sap.u.emm_reg.u.common.is_attached = emm_ctx->is_attached; - } else { - LOG_TRACE(ERROR, "EMM-PROC - No EPS security context exists"); - /* - * Notify EMM that the authentication procedure failed - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REJ ue id %06x (security mode complete)", ueid); - emm_sap.primitive = EMMREG_COMMON_PROC_REJ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - } - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_proc_security_mode_reject() ** - ** ** - ** Description: Performs the security mode control not accepted by the UE ** - ** ** - ** 3GPP TS 24.301, section 5.4.3.5 ** - ** Upon receiving the SECURITY MODE REJECT message, the MME ** - ** shall stop timer T3460 and abort the ongoing procedure ** - ** that triggered the initiation of the NAS security mode ** - ** control procedure. ** - ** The MME shall apply the EPS security context in use befo- ** - ** re the initiation of the security mode control procedure, ** - ** if any, to protect any subsequent messages. ** - ** ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_proc_security_mode_reject(unsigned int ueid) -{ - emm_data_context_t *emm_ctx = NULL; - int rc = RETURNerror; - - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "EMM-PROC - Security mode command not accepted by the UE" - "(ueid=0x%08x)", ueid); - - /* Stop timer T3460 */ - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id); - T3460.id = nas_timer_stop(T3460.id); - - /* Release retransmission timer paramaters */ - security_data_t *data = (security_data_t *)(emm_proc_common_get_args(ueid)); - - if (data) { - free(data); - } - - /* Get the UE context */ -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, ueid); - DevAssert(emm_ctx != NULL); - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - } - -#endif - - /* Set the key set identifier to its previous value */ - if (emm_ctx && emm_ctx->security) { - /* XXX - Usually, the MME should be able to maintain a current and - * a non-current EPS security context simultaneously as the UE do. - * This implementation choose to have only one security context by UE - * in the MME, thus security mode control procedure is only performed - * to take into use the first EPS security context created after a - * successful execution of the EPS authentication procedure */ - emm_ctx->security->type = EMM_KSI_NOT_AVAILABLE; - } - - /* - * Notify EMM that the authentication procedure failed - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REJ ue id %06x (security mode reject)", ueid); - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REJ; - emm_sap.u.emm_reg.ueid = ueid; - emm_sap.u.emm_reg.ctx = emm_ctx; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * -------------------------------------------------------------------------- - * UE specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _security_release() ** - ** ** - ** Description: Releases the given EPS NAS security context ** - ** ** - ** Inputs: ctx: The EPS NAS security context to release ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void _security_release(emm_security_context_t *ctx) -{ - LOG_FUNC_IN; - - if (ctx) { - /* Release Kasme security key */ - if (ctx->kasme.value) { - free(ctx->kasme.value); - ctx->kasme.value = NULL; - ctx->kasme.length = 0; - } - - /* Release NAS cyphering key */ - if (ctx->knas_enc.value) { - free(ctx->knas_enc.value); - ctx->knas_enc.value = NULL; - ctx->knas_enc.length = 0; - } - - /* Release NAS integrity key */ - if (ctx->knas_int.value) { - free(ctx->knas_int.value); - ctx->knas_int.value = NULL; - ctx->knas_int.length = 0; - } - - /* Release the NAS security context */ - free(ctx); - } - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: _security_knas_enc() ** - ** ** - ** Description: Algorithm Key generation function used for the derivation ** - ** of NAS encryption key Knas-enc from the Kasme. ** - ** ** - ** 3GPP TS 33.401, Annex A.7 ** - ** ** - ** Inputs: kasme: Key Access Security Management Entity ** - ** eea: Cyphering algorithm identity ** - ** Others: None ** - ** ** - ** Outputs: knas_enc: Derived key for NAS cyphering algorithm ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _security_knas_enc(const OctetString *kasme, OctetString *knas_enc, - UInt8_t eea) -{ - LOG_FUNC_IN; - LOG_TRACE(INFO, "%s with algo dist %d algo id %d", __FUNCTION__,0x01, eea); - LOG_FUNC_RETURN (_security_kdf(kasme, knas_enc, 0x01, eea)); -} - -/**************************************************************************** - ** ** - ** Name: _security_knas_int() ** - ** ** - ** Description: Algorithm Key generation function used for the derivation ** - ** of NAS integrity key Knas-int from the Kasme. ** - ** ** - ** 3GPP TS 33.401, Annex A.7 ** - ** ** - ** Inputs: kasme: Key Access Security Management Entity ** - ** eia: Integrity algorithm identity ** - ** Others: None ** - ** ** - ** Outputs: knas_int: Derived key for NAS integrity algorithm ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _security_knas_int(const OctetString *kasme, OctetString *knas_int, - UInt8_t eia) -{ - LOG_FUNC_IN; - LOG_TRACE(INFO, "%s with algo dist %d algo id %d", __FUNCTION__,0x02, eia); - LOG_FUNC_RETURN (_security_kdf(kasme, knas_int, 0x02, eia)); -} - -/**************************************************************************** - ** ** - ** Name: _security_kenb() ** - ** ** - ** Description: Computes the eNodeB key from Kasme and the given value of ** - ** uplink NAS counter. ** - ** ** - ** 3GPP TS 33.401, Annex A.3 ** - ** ** - ** Inputs: kasme: Key Access Security Management Entity ** - ** count: Uplink NAS counter value ** - ** Others: None ** - ** ** - ** Outputs: kenb: eNodeB security key ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _security_kenb(const OctetString *kasme, OctetString *kenb, - UInt32_t count) -{ - /* Compute the KDF input parameter - * S = FC(0x11) || UL NAS Count || 0x00 0x04 - */ - UInt8_t input[32]; - // UInt16_t length = 4; - // int offset = 0; - - LOG_TRACE(INFO, "%s with count= %d", __FUNCTION__, count); - memset(input, 0, 32); - input[0] = 0x11; - // P0 - input[1] = count >> 24; - input[2] = (UInt8_t)(count >> 16); - input[3] = (UInt8_t)(count >> 8); - input[4] = (UInt8_t)count; - // L0 - input[5] = 0; - input[6] = 4; - - kdf(kasme->value, 32, input, 7, kenb->value, 32); - kenb->length = 32; - return (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _security_kdf() ** - ** ** - ** Description: Algorithm Key generation function used for the derivation ** - ** of keys for NAS integrity and NAS encryption algorithms ** - ** from Kasme, algorithm types and algorithm identities. ** - ** ** - ** 3GPP TS 33.401, Annex A.7 ** - ** ** - ** Inputs: kasme: Key Access Security Management Entity ** - ** algo_dist: Algorithm type distinguisher ** - ** algo_id: Algorithm identity ** - ** Others: None ** - ** ** - ** Outputs: key: Derived key for NAS security protection ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _security_kdf(const OctetString *kasme, OctetString *key, - UInt8_t algo_dist, UInt8_t algo_id) -{ - /* Compute the KDF input parameter - * S = FC(0x15) || Algorithm distinguisher || 0x00 0x01 - || Algorithm identity || 0x00 0x01 - */ - UInt8_t input[32]; - UInt8_t output[32]; - LOG_TRACE(DEBUG, "%s:%u output key mem %p lenth %u", - __FUNCTION__, __LINE__, - key->value, - key->length); - memset(input, 0, 32); - // FC - input[0] = 0x15; - // P0 = Algorithm distinguisher - input[1] = algo_dist; - // L0 = 0x00 01 - input[2] = 0x00; - input[3] = 0x01; - // P1 = Algorithm identity - input[4] = algo_id; - // L1 = length of Algorithm identity 0x00 0x01 - input[5] = 0x00; - input[6] = 0x01; - - /* Compute the derived key */ - kdf(kasme->value, kasme->length, input, 7, output, 32); - memcpy(key->value, &output[31 - key->length + 1], key->length); - return (RETURNok); -} -#endif // NAS_UE - -#ifdef NAS_MME -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _security_t3460_handler() ** - ** ** - ** Description: T3460 timeout handler ** - ** Upon T3460 timer expiration, the security mode command ** - ** message is retransmitted and the timer restarted. When ** - ** retransmission counter is exceed, the MME shall abort the ** - ** security mode control procedure. ** - ** ** - ** 3GPP TS 24.301, section 5.4.3.7, case b ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_security_t3460_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - security_data_t *data = (security_data_t *)(args); - - /* Increment the retransmission counter */ - data->retransmission_count += 1; - - LOG_TRACE(WARNING, "EMM-PROC - T3460 timer expired, retransmission " - "counter = %d", data->retransmission_count); - - if (data->retransmission_count < SECURITY_COUNTER_MAX) { - /* Send security mode command message to the UE */ - rc = _security_request(data, FALSE); - } else { - /* Set the failure notification indicator */ - data->notify_failure = TRUE; - /* Abort the security mode control procedure */ - rc = _security_abort(data); - } - - LOG_FUNC_RETURN (NULL); -} - -/* - * -------------------------------------------------------------------------- - * MME specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _security_request() ** - ** ** - ** Description: Sends SECURITY MODE COMMAND message and start timer T3460 ** - ** ** - ** Inputs: data: Security mode control internal data ** - ** is_new: Indicates whether a new security context ** - ** has just been taken into use ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3460 ** - ** ** - ***************************************************************************/ -int _security_request(security_data_t *data, int is_new) -{ - struct emm_data_context_s *emm_ctx = NULL; - - emm_sap_t emm_sap; - int rc; - - LOG_FUNC_IN; - - /* - * Notify EMM-AS SAP that Security Mode Command message has to be sent - * to the UE - */ - emm_sap.primitive = EMMAS_SECURITY_REQ; - emm_sap.u.emm_as.u.security.guti = NULL; - emm_sap.u.emm_as.u.security.ueid = data->ueid; - emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC; - emm_sap.u.emm_as.u.security.ksi = data->ksi; - emm_sap.u.emm_as.u.security.eea = data->eea; - emm_sap.u.emm_as.u.security.eia = data->eia; - emm_sap.u.emm_as.u.security.ucs2 = data->ucs2; - emm_sap.u.emm_as.u.security.uea = data->uea; - emm_sap.u.emm_as.u.security.uia = data->uia; - emm_sap.u.emm_as.u.security.gea = data->gea; - emm_sap.u.emm_as.u.security.umts_present = data->umts_present; - emm_sap.u.emm_as.u.security.gprs_present = data->gprs_present; - emm_sap.u.emm_as.u.security.selected_eea = data->selected_eea; - emm_sap.u.emm_as.u.security.selected_eia = data->selected_eia; - -#if defined(NAS_BUILT_IN_EPC) - - if (data->ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, data->ueid); - } - -#else - - if (data->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[data->ueid]; - } - -#endif - - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, - emm_ctx->security, is_new, FALSE); - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMAS_SECURITY_REQ ue id %06x", data->ueid); - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - if (T3460.id != NAS_TIMER_INACTIVE_ID) { - /* Re-start T3460 timer */ - T3460.id = nas_timer_restart(T3460.id); - } else { - /* Start T3460 timer */ - T3460.id = nas_timer_start(T3460.sec, _security_t3460_handler, data); - } - - LOG_TRACE(INFO,"EMM-PROC - Timer T3460 (%d) expires in %ld seconds", - T3460.id, T3460.sec); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _security_abort() ** - ** ** - ** Description: Aborts the security mode control procedure currently in ** - ** progress ** - ** ** - ** Inputs: args: Security mode control data to be released ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3460 ** - ** ** - ***************************************************************************/ -static int _security_abort(void *args) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - security_data_t *data = (security_data_t *)(args); - - if (data) { - unsigned int ueid = data->ueid; - int notify_failure = data->notify_failure; - - LOG_TRACE(WARNING, "EMM-PROC - Abort security mode control procedure " - "(ueid=%u)", ueid); - - /* Stop timer T3460 */ - if (T3460.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "EMM-PROC - Stop timer T3460 (%d)", T3460.id); - T3460.id = nas_timer_stop(T3460.id); - } - - /* Release retransmission timer paramaters */ - free(data); - - /* - * Notify EMM that the security mode control procedure failed - */ - if (notify_failure) { - MSC_LOG_TX_MESSAGE( - MSC_NAS_EMM_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMREG_COMMON_PROC_REJ ue id %06x (security abort)", data->ueid); - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REJ; - emm_sap.u.emm_reg.ueid = ueid; - rc = emm_sap_send(&emm_sap); - } else { - rc = RETURNok; - } - } - - LOG_FUNC_RETURN (rc); -} - - -/**************************************************************************** - ** ** - ** Name: _security_select_algorithms() ** - ** ** - ** Description: Select int and enc algorithms based on UE capabilities and** - ** MME capabilities and MME preferences ** - ** ** - ** Inputs: ue_eia: integrity algorithms supported by UE ** - ** ue_eea: ciphering algorithms supported by UE ** - ** ** - ** Outputs: mme_eia: integrity algorithms supported by MME ** - ** mme_eea: ciphering algorithms supported by MME ** - ** ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _security_select_algorithms( - const int ue_eiaP, - const int ue_eeaP, - int * const mme_eiaP, - int * const mme_eeaP) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - int preference_index; - - *mme_eiaP = NAS_SECURITY_ALGORITHMS_EIA0; - *mme_eeaP = NAS_SECURITY_ALGORITHMS_EEA0; - - for (preference_index = 0; preference_index < 8; preference_index++) { - if (ue_eiaP & (0x80 >> _emm_data.conf.prefered_integrity_algorithm[preference_index])) { - LOG_TRACE(DEBUG, - "Selected NAS_SECURITY_ALGORITHMS_EIA%d (choice num %d)", - _emm_data.conf.prefered_integrity_algorithm[preference_index], - preference_index); - *mme_eiaP = _emm_data.conf.prefered_integrity_algorithm[preference_index]; - break; - } - } - - for (preference_index = 0; preference_index < 8; preference_index++) { - if (ue_eeaP & (0x80 >> _emm_data.conf.prefered_ciphering_algorithm[preference_index])) { - LOG_TRACE(DEBUG, - "Selected NAS_SECURITY_ALGORITHMS_EEA%d (choice num %d)", - _emm_data.conf.prefered_ciphering_algorithm[preference_index], - preference_index); - *mme_eeaP = _emm_data.conf.prefered_ciphering_algorithm[preference_index]; - break; - } - } - - LOG_FUNC_RETURN (RETURNok); -} - -#endif // NAS_MME - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/ServiceRequestHdl.c b/openair-cn/NAS/EURECOM-NAS/src/emm/ServiceRequestHdl.c deleted file mode 100644 index c00653823c67824bbb640ad123ddba2635d044de..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/ServiceRequestHdl.c +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source ServiceRequest.c - -Version 0.1 - -Date 2013/05/07 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the service request EMM procedure executed by the - Non-Access Stratum. - - The purpose of the service request procedure is to transfer - the EMM mode from EMM-IDLE to EMM-CONNECTED mode and establish - the radio and S1 bearers when uplink user data or signalling - is to be sent. - - This procedure is used when the network has downlink signalling - pending, the UE has uplink signalling pending, the UE or the - network has user data pending and the UE is in EMM-IDLE mode. - -*****************************************************************************/ - -#include "emm_proc.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "emmData.h" - -#include "emm_sap.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the service request procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Timer handlers - */ -void *_emm_service_t3417_handler(void *); -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the service request procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_service_t3417_handler() ** - ** ** - ** Description: T3417 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 5.6.1.6 case c ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void *_emm_service_t3417_handler(void *args) -{ - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "EMM-PROC - T3417 timer expired"); - - /* Stop timer T3417 */ - T3417.id = nas_timer_stop(T3417.id); - - LOG_FUNC_RETURN(NULL); -} - -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/TrackingAreaUpdate.c b/openair-cn/NAS/EURECOM-NAS/src/emm/TrackingAreaUpdate.c deleted file mode 100644 index 2e95dd303cc87a8eb81019ff5342ecb36454a6d0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/TrackingAreaUpdate.c +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source TrackingAreaUpdate.c - -Version 0.1 - -Date 2013/05/07 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the tracking area update EMM procedure executed by the - Non-Access Stratum. - - The tracking area updating procedure is always initiated by the - UE and is used to update the registration of the actual tracking - area of a UE in the network, to periodically notify the availa- - bility of the UE to the network, for MME load balancing, to up- - date certain UE specific parameters in the network. - -*****************************************************************************/ - -#include "emm_proc.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "emmData.h" - -#include "emm_sap.h" -#include "emm_cause.h" - -#include <string.h> // memcmp, memcpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the tracking area update procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Timer handlers - */ -void *_emm_tau_t3430_handler(void *); -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the tracking area update procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -static int _emm_tracking_area_update_reject(void *args); -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: emm_proc_tracking_area_update_reject() ** - ** ** - ** Description: ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** emm_cause: EMM cause code to be reported ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - /* Create temporary UE context */ - emm_data_context_t ue_ctx; - memset(&ue_ctx, 0 , sizeof(emm_data_context_t)); - ue_ctx.is_dynamic = FALSE; - ue_ctx.ueid = ueid; - - /* Update the EMM cause code */ -#if defined(NAS_BUILT_IN_EPC) - - if (ueid > 0) -#else - if (ueid < EMM_DATA_NB_UE_MAX) -#endif - { - ue_ctx.emm_cause = emm_cause; - } else { - ue_ctx.emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - - /* Do not accept attach request with protocol error */ - rc = _emm_tracking_area_update_reject(&ue_ctx); - - LOG_FUNC_RETURN(rc); -} -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_tau_t3430_handler() ** - ** ** - ** Description: T3430 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 5.5.3.2.6 case c ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void *_emm_tau_t3430_handler(void *args) -{ - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "EMM-PROC - T3430 timer expired"); - - /* Stop timer T3430 */ - T3430.id = nas_timer_stop(T3430.id); - - LOG_FUNC_RETURN(NULL); -} - -#endif // NAS_UE - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _emm_tracking_area_update_reject() ** - ** ** - ** Description: Performs the tracking area update procedure not accepted ** - ** by the network. ** - ** ** - ** Inputs: args: UE context data ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_tracking_area_update_reject(void *args) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - emm_data_context_t *emm_ctx = (emm_data_context_t *)(args); - - if (emm_ctx) { - emm_sap_t emm_sap; - LOG_TRACE(WARNING, "EMM-PROC - EMM tracking area update procedure not accepted " - "by the network (ueid=%08x, cause=%d)", - emm_ctx->ueid, emm_ctx->emm_cause); - /* - * Notify EMM-AS SAP that Tracking Area Update Reject message has to be sent - * onto the network - */ - emm_sap.primitive = EMMAS_ESTABLISH_REJ; - emm_sap.u.emm_as.u.establish.ueid = emm_ctx->ueid; - emm_sap.u.emm_as.u.establish.UEid.guti = NULL; - - if (emm_ctx->emm_cause == EMM_CAUSE_SUCCESS) { - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - - emm_sap.u.emm_as.u.establish.emm_cause = emm_ctx->emm_cause; - emm_sap.u.emm_as.u.establish.NASinfo = EMM_AS_NAS_INFO_TAU; - emm_sap.u.emm_as.u.establish.NASmsg.length = 0; - emm_sap.u.emm_as.u.establish.NASmsg.value = NULL; - - /* Setup EPS NAS security data */ - emm_as_set_security_data(&emm_sap.u.emm_as.u.establish.sctx, - emm_ctx->security, FALSE, TRUE); - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN(rc); -} - -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h b/openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h deleted file mode 100644 index 844aaaa9c7858e4113bef5521763553e95212bcb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/emmData.h +++ /dev/null @@ -1,532 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emmData.h - -Version 0.1 - -Date 2012/10/18 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines internal private data handled by EPS Mobility - Management sublayer. - -*****************************************************************************/ -#ifndef __EMMDATA_H__ -#define __EMMDATA_H__ - -#include "commonDef.h" -#include "networkDef.h" -#include "securityDef.h" - -#include "OctetString.h" -#include "nas_timer.h" - -#include "esmData.h" - -#ifdef NAS_MME -#include "emm_fsm.h" -#include "mme_api.h" -# if defined(NAS_BUILT_IN_EPC) -# include "tree.h" -# endif -#endif - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * The name of the file used as non-volatile memory device to store - * persistent EMM data when the UE is switched off - */ -#define EMM_NVRAM_FILENAME ".ue_emm.nvram" - -/* - * The name of the environment variable which defines the directory - * where the EMM data file is located - */ -#define EMM_NVRAM_DIRNAME "NVRAM_DIR" - -/* Network selection modes of operation */ -#define EMM_DATA_PLMN_AUTO NET_PLMN_AUTO -#define EMM_DATA_PLMN_MANUAL NET_PLMN_MANUAL - -#endif // NAS_UE - -/* Checks Mobile Country Code equality */ -#define MCCS_ARE_EQUAL(n1, n2) (((n1).MCCdigit1 == (n2).MCCdigit1) && \ - ((n1).MCCdigit2 == (n2).MCCdigit2) && \ - ((n1).MCCdigit3 == (n2).MCCdigit3)) - -/* Checks Mobile Network Code equality */ -#define MNCS_ARE_EQUAL(n1, n2) (((n1).MNCdigit1 == (n2).MNCdigit1) && \ - ((n1).MNCdigit2 == (n2).MNCdigit2) && \ - ((n1).MNCdigit3 == (n2).MNCdigit3)) - -/* Checks PLMNs equality */ -#define PLMNS_ARE_EQUAL(p1, p2) ((MCCS_ARE_EQUAL((p1),(p2))) && \ - (MNCS_ARE_EQUAL((p1),(p2)))) - -/* Checks TAIs equality */ -#define TAIS_ARE_EQUAL(t1, t2) ((PLMNS_ARE_EQUAL((t1).plmn,(t2).plmn)) && \ - ((t1).tac == (t2).tac)) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * EPS NAS security context handled by EPS Mobility Management sublayer in - * the UE and in the MME - * -------------------------------------------------------------------------- - */ -/* Type of security context */ -typedef enum { - EMM_KSI_NOT_AVAILABLE = 0, - EMM_KSI_NATIVE, - EMM_KSI_MAPPED -} emm_ksi_t; - -/* EPS NAS security context structure */ -typedef struct emm_security_context_s { - emm_ksi_t type; /* Type of security context */ - int eksi; /* NAS key set identifier for E-UTRAN */ - OctetString kasme; /* ASME security key (native context) */ - //OctetString ksgsn; /* SGSN security key (mapped context) */ - OctetString knas_enc; /* NAS cyphering key */ - OctetString knas_int; /* NAS integrity key */ - struct count_s{ - UInt32_t spare:8; - UInt32_t overflow:16; - UInt32_t seq_num:8; - } dl_count, ul_count; /* Downlink and uplink count parameters */ - struct { - UInt8_t eps_encryption; /* algorithm used for ciphering */ - UInt8_t eps_integrity; /* algorithm used for integrity protection */ - UInt8_t umts_encryption; /* algorithm used for ciphering */ - UInt8_t umts_integrity; /* algorithm used for integrity protection */ - UInt8_t gprs_encryption; /* algorithm used for ciphering */ - UInt8_t umts_present:1; - UInt8_t gprs_present:1; - } capability; /* UE network capability */ - struct { - UInt8_t encryption:4; /* algorithm used for ciphering */ - UInt8_t integrity:4; /* algorithm used for integrity protection */ - } selected_algorithms; /* MME selected algorithms */ -} emm_security_context_t; - -/* - * -------------------------------------------------------------------------- - * EMM internal data handled by EPS Mobility Management sublayer in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * EPS update status - * ----------------- - * The EPS update status value is changed only after the execution of an attach - * or combined attach, network initiated detach, authentication, tracking area - * update or combined tracking area update, service request or paging for EPS - * services using IMSI procedure. - * - * EU1: The last attach or tracking area updating attempt was successful. - * EU2: The last attach, service request or tracking area updating attempt - * failed procedurally, i.e. no response or reject message was received - * from the MME. - * EU3: The last attach, service request or tracking area updating attempt - * was correctly performed, but the answer from the MME was negative - * (because of roaming or subscription restrictions). - */ -typedef enum { - EU1_UPDATED, - EU2_NOT_UPDATED, - EU3_ROAMING_NOT_ALLOWED -} emm_eps_update_t; - -/* - * EPS Connection Management states - * -------------------------------- - * ECM-IDLE: No NAS signalling connection between UE and network exists. - * No UE context exists in the network. - * ECM-CONNECTED: The signalling connection is established between the UE - * and the MME (RRC connection and S1_MME connection). - */ -typedef enum { - ECM_IDLE, - ECM_CONNECTED -} emm_ecm_state_t; - -/* - * Structure of the EMM parameters stored in the UE's non-volatile memory - * ---------------------------------------------------------------------- - * These EMM parameters can only be used if the IMSI from the USIM matches - * the IMSI stored in the non-volatile memory; else the UE shall delete the - * EMM parameters. - * - * - EPLMN: List of equivalent PLMNs - Updated at the end of each attach or - * combined attach or tracking area updating or combined tracking area - * updating procedure. Deleted if the USIM is removed or when the UE attached - * for emergency bearer services enters the state EMM-DEREGISTERED. - * These PLMNs shall be regarded by the UE as equivalent to each other - * for PLMN selection, cell selection/re-selection and handover. - * The maximum number of possible entries in the stored list is 16. - */ -typedef struct emm_nvdata_s { - imsi_t imsi; - plmn_t rplmn; /* The registered PLMN */ - /* List of equivalent PLMNs */ -#define EMM_DATA_EPLMN_MAX 16 - PLMN_LIST_T(EMM_DATA_EPLMN_MAX) eplmn; -} emm_nvdata_t; - -/* - * Structure of the EMM data - * ------------------------- - */ -typedef struct emm_data_s { - int usim_is_valid; /* Indication of USIM data validity */ - - imei_t *imei; /* IMEI read from the UE's non-volatile memory*/ - const imsi_t *imsi; /* The valid IMSI read from the USIM */ - GUTI_t *guti; /* The valid GUTI read from the USIM */ - tai_t *tai; /* Last visited registered Tracking Area Id */ - - emm_eps_update_t status; /* The current EPS update status */ - emm_ecm_state_t ecm_status; /* The EPS Connection Management status */ - int is_attached; /* Network attachment indicator */ - int is_emergency; /* Emergency bearer services indicator*/ - - /* Tracking Areas list the UE is registered to - * Contains the list of TAIs that identify the tracking areas that - * the UE can enter without performing a tracking area updating - * procedure. The TAIs in a TAI list assigned by an MME to a UE - * pertain to the same MME area. - */ -#define EMM_DATA_TAI_MAX 16 - TAI_LIST_T(EMM_DATA_TAI_MAX) ltai; - - int plmn_mode; /* Network selection operating mode */ - int plmn_index; /* Manually selected PLMN */ - int plmn_rat; /* Manually selected Radio Access Technology*/ - - plmn_t splmn; /* The currently selected PLMN */ - int is_rplmn; /* splmn is the registered PLMN */ - int is_eplmn; /* splmn is in the list of equivalent PLMNs */ - Stat_t stat; /* Current network registration status */ - tac_t tac; /* Tracking area code */ - ci_t ci; /* GERAN/UTRAN/E-UTRAN serving cell identifier */ - AcT_t rat; /* Radio Access Technology of the serving cell */ - - /* An octet string representation of operators present in the network */ - struct { -#define EMM_DATA_BUFFER_SIZE 2048 - char buffer[EMM_DATA_BUFFER_SIZE+1]; - } plist; - - /* - * Data used for PLMN selection procedure - * -------------------------------------- - */ - plmn_t hplmn; /* The Home PLMN derived from the IMSI */ - /* List of Forbidden PLMNs - * Contains the list of PLMN identities for which a Location - * Registration has been rejected with EMM cause code #11 (PLMN - * not allowed). A PLMN is removed from this list if, after a - * subsequent manual selection of that PLMN, there is a successful - * Location Request. */ -#define EMM_DATA_FPLMN_MAX 4 - PLMN_LIST_T(EMM_DATA_FPLMN_MAX) fplmn; - /* List of Forbidden PLMNs for GPRS service - * Contains the list of PLMN identities for which an Attach Request - * has been rejected with EMM cause code #14 (GPRS/EPS services not - * allowed in this PLMN). A PLMN is removed from this list if, after - * a subsequent manual selection of that PLMN, there is a successful - * GPRS attach or EPS attach. */ -#define EMM_DATA_FPLMN_GPRS_MAX 4 - PLMN_LIST_T(EMM_DATA_FPLMN_GPRS_MAX) fplmn_gprs; - /* List of Equivalent HPLMNs */ -#define EMM_DATA_EHPLMN_MAX 4 - PLMN_LIST_T(EMM_DATA_EHPLMN_MAX) ehplmn; - /* List of user controlled PLMNs */ -#define EMM_DATA_PLMN_MAX 4 - PLMN_LIST_T(EMM_DATA_PLMN_MAX) plmn; - UInt16_t userAcT[EMM_DATA_PLMN_MAX]; - /* List of operator controlled PLMNs */ -#define EMM_DATA_OPLMN_MAX 4 - PLMN_LIST_T(EMM_DATA_OPLMN_MAX) oplmn; - UInt16_t operAcT[EMM_DATA_OPLMN_MAX]; - /* List of operator network name records */ -#define EMM_DATA_OPNN_MAX 16 - UInt8_t n_opnns; - struct { - const plmn_t *plmn; - const char *fullname; - const char *shortname; - } opnn[EMM_DATA_OPNN_MAX]; - - /* - * Data used for roaming service - * ----------------------------- - */ - /* List of Forbidden Tracking Areas - * Contains the list of TAIs for which an attach request has been - * rejected with EMM cause code #12 (tracking area not allowed). - */ -#define EMM_DATA_FTAI_MAX 40 - TAI_LIST_T(EMM_DATA_FTAI_MAX) ftai; - /* List of Forbidden Tracking Areas for roaming - * Contains the list of TAIs for which an attach request has been - * rejected with EMM cause code #13 (roaming not allowed in this - * tracking area). - */ -#define EMM_DATA_FTAI_ROAMING_MAX 40 - TAI_LIST_T(EMM_DATA_FTAI_ROAMING_MAX) ftai_roaming; - - /* - * NAS configuration parameters - * ---------------------------- - * see "Non Access Stratum Configuration" in USIM API header file - */ - Byte_t NAS_SignallingPriority; - Byte_t NMO_I_Behaviour; - Byte_t AttachWithImsi; - Byte_t MinimumPeriodicSearchTimer; - Byte_t ExtendedAccessBarring; - Byte_t Timer_T3245_Behaviour; - - /* - * EMM data stored in the UE's memory - * ---------------------------------- - */ - emm_nvdata_t nvdata; - - /* - * EPS NAS security context - * ------------------------ - */ - emm_security_context_t *security; /* current security context */ - emm_security_context_t *non_current; /* non-current security context */ - -} emm_data_t; - -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * EMM internal data handled by EPS Mobility Management sublayer in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Structure of the EMM context established by the network for a particular UE - * --------------------------------------------------------------------------- - */ -typedef struct emm_data_context_s { -#if defined(NAS_BUILT_IN_EPC) - RB_ENTRY(emm_data_context_s) entries; -#endif - - unsigned int ueid; /* UE identifier */ - int is_dynamic; /* Dynamically allocated context indicator */ - int is_attached; /* Attachment indicator */ - int is_emergency;/* Emergency bearer services indicator */ - - imsi_t *imsi; /* The IMSI provided by the UE or the MME */ - imei_t *imei; /* The IMEI provided by the UE */ - int guti_is_new; /* New GUTI indicator */ - GUTI_t *guti; /* The GUTI assigned to the UE */ - GUTI_t *old_guti; /* The old GUTI */ - int n_tacs; /* Number of consecutive tracking areas the UE is - * registered to */ - tac_t tac; /* Code of the first tracking area the UE is - * registered to */ - - int ksi; /* Security key set identifier provided by the UE */ - int eea; /* EPS encryption algorithms supported by the UE */ - int eia; /* EPS integrity algorithms supported by the UE */ - int ucs2; /* UCS2 Alphabet*/ - int uea; /* UMTS encryption algorithms supported by the UE */ - int uia; /* UMTS integrity algorithms supported by the UE */ - int gea; /* GPRS encryption algorithms supported by the UE */ - int umts_present; /* For encoding ue network capabilities (variable size)*/ - int gprs_present; /* For encoding ue network capabilities (variable size)*/ - - auth_vector_t vector;/* EPS authentication vector */ - emm_security_context_t *security; /* Current EPS NAS security context */ - OctetString esm_msg; /* ESM message contained within the initial request*/ - int emm_cause; /* EMM failure cause code */ - - emm_fsm_state_t _emm_fsm_status; - - esm_data_context_t esm_data_ctx; -} emm_data_context_t; - -/* - * Structure of the EMM data - * ------------------------- - */ -typedef struct emm_data_s { - /* - * MME configuration - * ----------------- - */ - mme_api_emm_config_t conf; - /* - * EMM contexts - * ------------ - */ -# if defined(NAS_BUILT_IN_EPC) - /* Use a tree for ue data context within MME */ - RB_HEAD(emm_data_context_map, emm_data_context_s) ctx_map; -# else -# define EMM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1) - emm_data_context_t *ctx [EMM_DATA_NB_UE_MAX]; -# endif -} emm_data_t; - -struct emm_data_context_s *emm_data_context_get( - emm_data_t *_emm_data, unsigned int _ueid); - -struct emm_data_context_s *emm_data_context_remove( - emm_data_t *_emm_data, struct emm_data_context_s *elm); - -void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm); -void emm_data_context_dump(struct emm_data_context_s *elm_pP); - -void emm_data_context_dump_all(void); - -#endif // NAS_MME - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * EPS mobility management data (used within EMM only) - * -------------------------------------------------------------------------- - */ -emm_data_t _emm_data; - -/* - * -------------------------------------------------------------------------- - * EPS mobility management timers – UE side - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -#define T3402_DEFAULT_VALUE 720 /* 12 minutes */ -#define T3410_DEFAULT_VALUE 15 /* 15 seconds */ -#define T3411_DEFAULT_VALUE 10 /* 10 seconds */ -#define T3412_DEFAULT_VALUE 3240 /* 54 minutes */ -#define T3416_DEFAULT_VALUE 30 /* 30 seconds */ -#define T3417_DEFAULT_VALUE 5 /* 5 seconds */ -#define T3417ext_DEFAULT_VALUE 10 /* 10 seconds */ -#define T3418_DEFAULT_VALUE 20 /* 20 seconds */ -#define T3420_DEFAULT_VALUE 15 /* 15 seconds */ -#define T3421_DEFAULT_VALUE 15 /* 15 seconds */ -#define T3423_DEFAULT_VALUE T3412_DEFAULT_VALUE -#define T3430_DEFAULT_VALUE 15 /* 15 seconds */ -#define T3440_DEFAULT_VALUE 10 /* 10 seconds */ - -struct nas_timer_t T3402; /* attach failure timer */ -struct nas_timer_t T3410; /* attach timer */ -struct nas_timer_t T3411; /* attach restart timer */ -struct nas_timer_t T3412; /* periodic tracking area update timer */ -struct nas_timer_t T3416; /* EPS authentication challenge timer */ -struct nas_timer_t T3417; /* Service request timer */ -struct nas_timer_t T3418; /* MAC authentication failure timer */ -struct nas_timer_t T3420; /* Synch authentication failure timer */ -struct nas_timer_t T3421; /* Detach timer */ -struct nas_timer_t T3430; /* tracking area update timer */ - -struct nas_timer_t T3423; /* E-UTRAN deactivate ISR timer */ -#endif - -/* - * -------------------------------------------------------------------------- - * EPS mobility management timers – Network side - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -#define T3450_DEFAULT_VALUE 6 /* 6 seconds */ -#define T3460_DEFAULT_VALUE 6 /* 6 seconds */ -#define T3470_DEFAULT_VALUE 6 /* 6 seconds */ - -struct nas_timer_t T3450; /* EMM message retransmission timer */ -struct nas_timer_t T3460; /* Authentication timer */ -struct nas_timer_t T3470; /* Identification timer */ - -/* - * mobile reachable timer - * ---------------------- - * The network supervises the periodic tracking area updating procedure - * of the UE by means of the mobile reachable timer. - * If the UE is not attached for emergency bearer services, the mobile - * reachable timer is 4 minutes greater than T3412. - * If the UE is attached for emergency bearer services, the MME shall - * set the mobile reachable timer with a value equal to T3412. When - * the mobile reachable timer expires, the MME shall locally detach the UE. - * - * The mobile reachable timer shall be reset and started, when the MME - * releases the NAS signalling connection for the UE. The mobile reachable - * timer shall be stopped when a NAS signalling connection is established - * for the UE. - */ - -/* - * implicit detach timer - * --------------------- - * If ISR is activated, the default value of the implicit detach timer is - * 4 minutes greater than T3423. - * If the implicit detach timer expires before the UE contacts the network, - * the network shall implicitly detach the UE. - * If the MME includes timer T3346 in the TRACKING AREA UPDATE REJECT message - * or the SERVICE REJECT message and T3346 is greater than T3412, the MME - * sets the mobile reachable timer and the implicit detach timer such that - * the sum of the timer values is greater than T3346. - * - * Upon expiry of the mobile reachable timer the network shall start the - * implicit detach timer. The implicit detach timer shall be stopped when - * a NAS signalling connection is established for the UE. - */ -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __EMMDATA_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_data_ctx.c b/openair-cn/NAS/EURECOM-NAS/src/emm/emm_data_ctx.c deleted file mode 100644 index 9fead509fadbed021ca5289d971cdccc8fbbe399..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_data_ctx.c +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ - -#include <stdlib.h> -#include <string.h> - -#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME) -#include "assertions.h" -#include "tree.h" -#include "emmData.h" -#include "nas_log.h" -#include "security_types.h" - -static inline -int emm_data_ctxt_compare_ueid(struct emm_data_context_s *p1, - struct emm_data_context_s *p2); - -RB_PROTOTYPE(emm_data_context_map, emm_data_context_s, entries, - emm_data_ctxt_compare_ueid); - -/* Generate functions used for the MAP */ -RB_GENERATE(emm_data_context_map, emm_data_context_s, entries, - emm_data_ctxt_compare_ueid); - -static inline -int emm_data_ctxt_compare_ueid(struct emm_data_context_s *p1, - struct emm_data_context_s *p2) -{ - if (p1->ueid > p2->ueid) { - return 1; - } - - if (p1->ueid < p2->ueid) { - return -1; - } - - /* Matching reference -> return 0 */ - return 0; -} - -struct emm_data_context_s *emm_data_context_get( - emm_data_t *emm_data, unsigned int _ueid) -{ - struct emm_data_context_s reference; - - DevAssert(emm_data != NULL); - DevCheck(_ueid > 0, _ueid, 0, 0); - - memset(&reference, 0, sizeof(struct emm_data_context_s)); - reference.ueid = _ueid; - return RB_FIND(emm_data_context_map, &emm_data->ctx_map, &reference); -} - -struct emm_data_context_s *emm_data_context_remove( - emm_data_t *emm_data, struct emm_data_context_s *elm) -{ - LOG_TRACE(INFO, "EMM-CTX - Remove in context %p UE id %u", elm, elm->ueid); - return RB_REMOVE(emm_data_context_map, &emm_data->ctx_map, elm); -} - -void emm_data_context_add(emm_data_t *emm_data, struct emm_data_context_s *elm) -{ - LOG_TRACE(INFO, "EMM-CTX - Add in context %p UE id %u", elm, elm->ueid); - RB_INSERT(emm_data_context_map, &emm_data->ctx_map, elm); -} - -void emm_data_context_dump(struct emm_data_context_s *elm_pP) -{ - if (elm_pP != NULL) { - char imsi_str[16]; - char guti_str[22]; - int k, size, remaining_size; - char key_string[KASME_LENGTH_OCTETS*2]; - LOG_TRACE(INFO, "EMM-CTX: ue id: 0x%06"PRIX32" (UE identifier)", elm_pP->ueid); - LOG_TRACE(INFO, " is_dynamic: %u (Dynamically allocated context indicator)", elm_pP->is_dynamic); - LOG_TRACE(INFO, " is_attached: %u (Attachment indicator)", elm_pP->is_attached); - LOG_TRACE(INFO, " is_emergency: %u (Emergency bearer services indicator)", elm_pP->is_emergency); - NAS_IMSI2STR(elm_pP->imsi, imsi_str, 16); - LOG_TRACE(INFO, " imsi: %s (The IMSI provided by the UE or the MME)", imsi_str); - LOG_TRACE(INFO, " imei: TODO (The IMEI provided by the UE)"); - LOG_TRACE(INFO, " guti_is_new: %u (New GUTI indicator)", elm_pP->guti_is_new); - GUTI2STR(elm_pP->guti, guti_str, 22); - LOG_TRACE(INFO, " guti: %s (The GUTI assigned to the UE)", guti_str); - GUTI2STR(elm_pP->old_guti, guti_str, 22); - LOG_TRACE(INFO, " old_guti: %s (The old GUTI)", guti_str); - LOG_TRACE(INFO, " n_tacs: %u (Number of consecutive tracking areas the UE is registered to)", elm_pP->n_tacs); - LOG_TRACE(INFO, " tac: 0x%04x (Code of the first tracking area the UE is registered to)", elm_pP->n_tacs); - LOG_TRACE(INFO, " ksi: %u (Security key set identifier provided by the UE)", elm_pP->ksi); - - LOG_TRACE(INFO, " auth_vector: (EPS authentication vector)"); - LOG_TRACE(INFO, " kasme: "KASME_FORMAT""KASME_FORMAT, KASME_DISPLAY_1(elm_pP->vector.kasme), KASME_DISPLAY_2(elm_pP->vector.kasme)); - LOG_TRACE(INFO, " rand: "RAND_FORMAT, RAND_DISPLAY(elm_pP->vector.rand)); - LOG_TRACE(INFO, " autn: "AUTN_FORMAT, AUTN_DISPLAY(elm_pP->vector.autn)); - for (k = 0; k < XRES_LENGTH_MAX; k++) {sprintf(&key_string[k * 3], "%02x,", elm_pP->vector.xres[k]);} - key_string[k * 3 - 1] = '\0'; - LOG_TRACE(INFO, " xres: %s\n", key_string); - - if (elm_pP->security != NULL) { - LOG_TRACE(INFO, " security context: (Current EPS NAS security context)"); - LOG_TRACE(INFO, " type: %s (Type of security context)", - (elm_pP->security->type == EMM_KSI_NOT_AVAILABLE)?"KSI_NOT_AVAILABLE":(elm_pP->security->type == EMM_KSI_NATIVE)?"KSI_NATIVE":"KSI_MAPPED"); - LOG_TRACE(INFO, " eksi: %u (NAS key set identifier for E-UTRAN)", elm_pP->security->eksi); - - if (elm_pP->security->kasme.length > 0) { - size = 0; - size = 0;remaining_size=KASME_LENGTH_OCTETS*2; - for (k = 0; k < elm_pP->security->kasme.length; k++) { - size +=snprintf(&key_string[size], remaining_size, "0x%x ", elm_pP->security->kasme.value[k]); - remaining_size -= size; - } - } else { - size +=snprintf(&key_string[0], remaining_size, "None"); - } - LOG_TRACE(INFO, " kasme: %s (ASME security key (native context))", key_string); - if (elm_pP->security->knas_enc.length > 0) { - size = 0; - size = 0;remaining_size=KASME_LENGTH_OCTETS*2; - for (k = 0; k < elm_pP->security->knas_enc.length; k++) { - size +=snprintf(&key_string[size], remaining_size, "0x%x ", elm_pP->security->knas_enc.value[k]); - remaining_size -= size; - } - } else { - size +=snprintf(&key_string[0], remaining_size, "None"); - } - LOG_TRACE(INFO, " knas_enc: %s (NAS cyphering key)", key_string); - if (elm_pP->security->knas_int.length > 0) { - size = 0;remaining_size=KASME_LENGTH_OCTETS*2; - for (k = 0; k < elm_pP->security->knas_int.length; k++) { - size +=snprintf(&key_string[size], remaining_size, "0x%x ", elm_pP->security->knas_int.value[k]); - remaining_size -= size; - } - } else { - size +=snprintf(&key_string[0], remaining_size, "None"); - } - LOG_TRACE(INFO, " knas_int: %s (NAS integrity key)", key_string); - LOG_TRACE(INFO, " dl_count.overflow: %u ", elm_pP->security->dl_count.overflow); - LOG_TRACE(INFO, " dl_count.seq_num: %u ", elm_pP->security->dl_count.seq_num); - LOG_TRACE(INFO, " ul_count.overflow: %u ", elm_pP->security->ul_count.overflow); - LOG_TRACE(INFO, " ul_count.seq_num: %u ", elm_pP->security->ul_count.seq_num); - LOG_TRACE(INFO, " TODO capability"); - LOG_TRACE(INFO, " selected_algorithms.encryption: %x ", elm_pP->security->selected_algorithms.encryption); - LOG_TRACE(INFO, " selected_algorithms.integrity: %x ", elm_pP->security->selected_algorithms.integrity); - } else { - LOG_TRACE(INFO, " No security context"); - } - LOG_TRACE(INFO, " _emm_fsm_status %u ", elm_pP->_emm_fsm_status); - LOG_TRACE(INFO, " TODO esm_data_ctx"); - } -} - -void emm_data_context_dump_all(void) -{ - struct emm_data_context_s *elm_p = NULL; - LOG_TRACE(INFO, "EMM-CTX - Dump all contexts:"); - RB_FOREACH(elm_p, emm_data_context_map,&_emm_data.ctx_map) { - emm_data_context_dump(elm_p); - } -} -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.c b/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.c deleted file mode 100644 index 8d91573c893f3118529a12d3bbe07bad9eff827b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.c +++ /dev/null @@ -1,1148 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_main.c - -Version 0.1 - -Date 2012/10/10 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EPS Mobility Management procedure call manager, - the main entry point for elementary EMM processing. - -*****************************************************************************/ - -#include "emm_main.h" -#include "nas_log.h" -#include "emmData.h" - -#ifdef NAS_UE -#include "memory.h" -#include "usim_api.h" -#include "IdleMode.h" - -#include <string.h> // memset, memcpy, strlen -#include <stdio.h> // sprintf -#include <stdlib.h> // malloc, free -#endif - -#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME) -# include "mme_config.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -static int _emm_main_get_imei(imei_t *imei, const char *imei_str); - -static int _emm_main_imsi_cmp(imsi_t *imsi1, imsi_t *imsi2); - -static const char *_emm_main_get_plmn(const plmn_t *plmn, int index, - int format, size_t *size); - -static int _emm_main_get_plmn_index(const char *plmn, int format); - -/* - * USIM application data - */ -static usim_data_t _usim_data; - -/* - * Callback executed whenever a change in the network has to be notified - * to the user application - */ -static emm_indication_callback_t _emm_main_user_callback; -static int _emm_main_callback(int); -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_main_initialize() ** - ** ** - ** Description: Initializes EMM internal data ** - ** ** - ** Inputs: cb: The user notification callback ** - ** imei: The IMEI read from the UE's non-volatile ** - ** memory ** - ** Others: _usim_data ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -void emm_main_initialize(emm_indication_callback_t cb, const char *imei) -{ - LOG_FUNC_IN; - - /* USIM validity indicator */ - _emm_data.usim_is_valid = FALSE; - /* The IMEI read from the UE's non-volatile memory */ - _emm_data.imei = (imei_t *)malloc(sizeof(imei_t)); - _emm_data.imei->length = _emm_main_get_imei(_emm_data.imei, imei); - /* The IMSI, valid only if USIM is present */ - _emm_data.imsi = NULL; - /* EPS location information */ - _emm_data.guti = NULL; - _emm_data.tai = NULL; - _emm_data.ltai.n_tais = 0; - /* EPS Connection Management status */ - _emm_data.ecm_status = ECM_IDLE; - /* Network selection mode of operation */ - _emm_data.plmn_mode = EMM_DATA_PLMN_AUTO; - /* Index of the PLMN manually selected by the user */ - _emm_data.plmn_index = -1; - /* Selected Radio Access Technology */ - _emm_data.plmn_rat = NET_ACCESS_UNAVAILABLE; - /* Selected PLMN */ - memset(&_emm_data.splmn, 0xFF, sizeof(plmn_t)); - _emm_data.is_rplmn = FALSE; - _emm_data.is_eplmn = FALSE; - /* Radio Access Technology of the serving cell */ - _emm_data.rat = NET_ACCESS_UNAVAILABLE; - /* Network registration status */ - _emm_data.stat = NET_REG_STATE_OFF; - _emm_data.is_attached = FALSE; - _emm_data.is_emergency = FALSE; - /* Location/Tracking area code */ - _emm_data.tac = 0; // two byte in hexadecimal format - /* Identifier of the serving cell */ - _emm_data.ci = 0; // four byte in hexadecimal format - /* List of operators present in the network */ - memset(_emm_data.plist.buffer, 0, EMM_DATA_BUFFER_SIZE + 1); - /* Home PLMN */ - memset(&_emm_data.hplmn, 0xFF, sizeof(plmn_t)); - /* List of Forbidden PLMNs */ - _emm_data.fplmn.n_plmns = 0; - /* List of Forbidden PLMNs for GPRS service */ - _emm_data.fplmn_gprs.n_plmns = 0; - /* List of Equivalent HPLMNs */ - _emm_data.ehplmn.n_plmns = 0; - /* List of user controlled PLMNs */ - _emm_data.plmn.n_plmns = 0; - /* List of operator controlled PLMNs */ - _emm_data.oplmn.n_plmns = 0; - /* List of operator network name records */ - _emm_data.n_opnns = 0; - /* List of Forbidden Tracking Areas */ - _emm_data.ftai.n_tais = 0; - /* List of Forbidden Tracking Areas for roaming */ - _emm_data.ftai_roaming.n_tais = 0; - - /* - * Get USIM application data - */ - if ( usim_api_read(&_usim_data) != RETURNok ) { - /* The USIM application may not be present or not valid */ - LOG_TRACE(WARNING, "EMM-MAIN - Failed to read USIM application data"); - } else { - int i; - - /* The USIM application is present and valid */ - LOG_TRACE(INFO, "EMM-MAIN - USIM application data successfully read"); - _emm_data.usim_is_valid = TRUE; - - /* Get the Home PLMN derived from the IMSI */ - _emm_data.hplmn.MCCdigit1 = _usim_data.imsi.u.num.digit1; - _emm_data.hplmn.MCCdigit2 = _usim_data.imsi.u.num.digit2; - _emm_data.hplmn.MCCdigit3 = _usim_data.imsi.u.num.digit3; - _emm_data.hplmn.MNCdigit1 = _usim_data.imsi.u.num.digit4; - _emm_data.hplmn.MNCdigit2 = _usim_data.imsi.u.num.digit5; - _emm_data.hplmn.MNCdigit3 = _usim_data.imsi.u.num.digit6; - - /* Get the list of forbidden PLMNs */ - for (i=0; (i < EMM_DATA_FPLMN_MAX) && (i < USIM_FPLMN_MAX); i++) { - if ( PLMN_IS_VALID(_usim_data.fplmn[i]) ) { - _emm_data.fplmn.plmn[i] = _usim_data.fplmn[i]; - _emm_data.fplmn.n_plmns += 1; - } - } - - /* Get the list of Equivalent HPLMNs */ - for (i=0; (i < EMM_DATA_EHPLMN_MAX) && (i < USIM_EHPLMN_MAX); i++) { - if ( PLMN_IS_VALID(_usim_data.ehplmn[i]) ) { - _emm_data.ehplmn.plmn[i] = _usim_data.ehplmn[i]; - _emm_data.ehplmn.n_plmns += 1; - } - } - - /* Get the list of User controlled PLMN Selector */ - for (i=0; (i < EMM_DATA_PLMN_MAX) && (i < USIM_PLMN_MAX); i++) { - if ( PLMN_IS_VALID(_usim_data.plmn[i].plmn) ) { - _emm_data.plmn.plmn[i] = _usim_data.plmn[i].plmn; - _emm_data.userAcT[i] = _usim_data.plmn[i].AcT; - _emm_data.plmn.n_plmns += 1; - } - } - - /* Get the list of Operator controlled PLMN Selector */ - for (i=0; (i < EMM_DATA_OPLMN_MAX) && (i < USIM_OPLMN_MAX); i++) { - if ( PLMN_IS_VALID(_usim_data.oplmn[i].plmn) ) { - _emm_data.oplmn.plmn[i] = _usim_data.oplmn[i].plmn; - _emm_data.operAcT[i] = _usim_data.oplmn[i].AcT; - _emm_data.oplmn.n_plmns += 1; - } - } - - /* Get the list of Operator network name records */ - for (i=0; (i < EMM_DATA_OPNN_MAX) && (i < USIM_OPL_MAX); i++) { - if ( PLMN_IS_VALID(_usim_data.opl[i].plmn) ) { - int pnn_id = _usim_data.opl[i].record_id; - _emm_data.opnn[i].plmn = &_usim_data.opl[i].plmn; - _emm_data.opnn[i].fullname = (char *)_usim_data.pnn[pnn_id].fullname.value; - _emm_data.opnn[i].shortname = (char *)_usim_data.pnn[pnn_id].shortname.value; - _emm_data.n_opnns += 1; - } - } - - /* TODO: Get the Higher Priority PLMN search period parameter */ - - /* Get the EPS location information */ - if (PLMN_IS_VALID(_usim_data.epsloci.guti.gummei.plmn)) { - _emm_data.guti = &_usim_data.epsloci.guti; - } - - if (TAI_IS_VALID(_usim_data.epsloci.tai)) { - _emm_data.tai = &_usim_data.epsloci.tai; - } - - _emm_data.status = _usim_data.epsloci.status; - - /* Get NAS configuration parameters */ - _emm_data.NAS_SignallingPriority = - _usim_data.nasconfig.NAS_SignallingPriority.value[0]; - _emm_data.NMO_I_Behaviour = _usim_data.nasconfig.NMO_I_Behaviour.value[0]; - _emm_data.AttachWithImsi = _usim_data.nasconfig.AttachWithImsi.value[0]; - _emm_data.MinimumPeriodicSearchTimer = - _usim_data.nasconfig.MinimumPeriodicSearchTimer.value[0]; - _emm_data.ExtendedAccessBarring = - _usim_data.nasconfig.ExtendedAccessBarring.value[0]; - _emm_data.Timer_T3245_Behaviour = - _usim_data.nasconfig.Timer_T3245_Behaviour.value[0]; - - /* - * Get EPS NAS security context - */ - /* Create NAS security context */ - _emm_data.security = - (emm_security_context_t *)malloc(sizeof(emm_security_context_t)); - - if (_emm_data.security != NULL) { - memset(_emm_data.security, 0, sizeof(emm_security_context_t)); - - /* Type of security context */ - if (_usim_data.securityctx.KSIasme.value[0] != - USIM_KSI_NOT_AVAILABLE) { - _emm_data.security->type = EMM_KSI_NATIVE; - } else { - _emm_data.security->type = EMM_KSI_NOT_AVAILABLE; - } - - /* EPS key set identifier */ - _emm_data.security->eksi = _usim_data.securityctx.KSIasme.value[0]; - /* ASME security key */ - _emm_data.security->kasme.length = - _usim_data.securityctx.Kasme.length; - _emm_data.security->kasme.value = - (uint8_t *)malloc(_emm_data.security->kasme.length); - - if (_emm_data.security->kasme.value) { - memcpy(_emm_data.security->kasme.value, - _usim_data.securityctx.Kasme.value, - _emm_data.security->kasme.length); - } - - /* Downlink count parameter */ - if (_usim_data.securityctx.dlNAScount.length <= sizeof(UInt32_t)) { - memcpy(&_emm_data.security->dl_count, - _usim_data.securityctx.dlNAScount.value, - _usim_data.securityctx.dlNAScount.length); - } - - /* Uplink count parameter */ - if (_usim_data.securityctx.ulNAScount.length <= sizeof(UInt32_t)) { - memcpy(&_emm_data.security->ul_count, - _usim_data.securityctx.ulNAScount.value, - _usim_data.securityctx.ulNAScount.length); - } - - /* Ciphering algorithm */ - _emm_data.security->capability.eps_encryption = - ((_usim_data.securityctx.algorithmID.value[0] >> 4) & 0xf); - /* Identity protection algorithm */ - _emm_data.security->capability.eps_integrity = - (_usim_data.securityctx.algorithmID.value[0] & 0xf); - /* NAS integrity and cyphering keys are not available */ - } else { - LOG_TRACE(WARNING, - "EMM-PROC - Failed to create security context"); - } - - /* - * Get EMM data from the UE's non-volatile memory - */ - memset(&_emm_data.nvdata.rplmn, 0xFF, sizeof(plmn_t)); - _emm_data.nvdata.eplmn.n_plmns = 0; - /* Get EMM data pathname */ - char *path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME); - - if (path == NULL) { - LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname"); - } else { - /* Get EMM data stored in the non-volatile memory device */ - int rc = memory_read(path, &_emm_data.nvdata, sizeof(emm_nvdata_t)); - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "EMM-MAIN - Failed to read %s", path); - } else { - /* Check the IMSI */ - LOG_TRACE(INFO, "EMM-MAIN - EMM data successfully read"); - _emm_data.imsi = &_usim_data.imsi; - int imsi_ok = _emm_main_imsi_cmp(&_emm_data.nvdata.imsi, - &_usim_data.imsi); - - if (!imsi_ok) { - LOG_TRACE(WARNING, "EMM-MAIN - IMSI checking failed nvram: " - "%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x, " - "usim: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x", - _emm_data.nvdata.imsi.u.value[0], - _emm_data.nvdata.imsi.u.value[1], - _emm_data.nvdata.imsi.u.value[2], - _emm_data.nvdata.imsi.u.value[3], - _emm_data.nvdata.imsi.u.value[4], - _emm_data.nvdata.imsi.u.value[5], - _emm_data.nvdata.imsi.u.value[6], - _emm_data.nvdata.imsi.u.value[7], - _usim_data.imsi.u.value[0], - _usim_data.imsi.u.value[1], - _usim_data.imsi.u.value[2], - _usim_data.imsi.u.value[3], - _usim_data.imsi.u.value[4], - _usim_data.imsi.u.value[5], - _usim_data.imsi.u.value[6], - _usim_data.imsi.u.value[7]); - memset(&_emm_data.nvdata.rplmn, 0xFF, sizeof(plmn_t)); - _emm_data.nvdata.eplmn.n_plmns = 0; - } - } - - free(path); - } - } - - /* - * Initialize EMM timers - */ - T3410.id = NAS_TIMER_INACTIVE_ID; - T3410.sec = T3410_DEFAULT_VALUE; - T3411.id = NAS_TIMER_INACTIVE_ID; - T3411.sec = T3411_DEFAULT_VALUE; - T3402.id = NAS_TIMER_INACTIVE_ID; - T3402.sec = T3402_DEFAULT_VALUE; - T3416.id = NAS_TIMER_INACTIVE_ID; - T3416.sec = T3416_DEFAULT_VALUE; - T3417.id = NAS_TIMER_INACTIVE_ID; - T3417.sec = T3417_DEFAULT_VALUE; - T3418.id = NAS_TIMER_INACTIVE_ID; - T3418.sec = T3418_DEFAULT_VALUE; - T3420.id = NAS_TIMER_INACTIVE_ID; - T3420.sec = T3420_DEFAULT_VALUE; - T3421.id = NAS_TIMER_INACTIVE_ID; - T3421.sec = T3421_DEFAULT_VALUE; - T3423.id = NAS_TIMER_INACTIVE_ID; - T3423.sec = T3423_DEFAULT_VALUE; - T3430.id = NAS_TIMER_INACTIVE_ID; - T3430.sec = T3430_DEFAULT_VALUE; - - /* - * Initialize the user notification callback - */ - _emm_main_user_callback = *cb; - - /* - * Initialize EMM internal data used for UE in idle mode - */ - IdleMode_initialize(&_emm_main_callback); - - LOG_FUNC_OUT; -} -#endif -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: emm_main_initialize() ** - ** ** - ** Description: Initializes EMM internal data ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -#if defined(NAS_BUILT_IN_EPC) -void emm_main_initialize(mme_config_t *mme_config_p) -#else -void emm_main_initialize(void) -#endif -{ - LOG_FUNC_IN; - - /* Retreive MME supported configuration data */ -#if defined(NAS_BUILT_IN_EPC) - - if (mme_api_get_emm_config(&_emm_data.conf, mme_config_p) != RETURNok) -#else - if (mme_api_get_emm_config(&_emm_data.conf) != RETURNok) -#endif - { - LOG_TRACE(ERROR, "EMM-MAIN - Failed to get MME configuration data"); - } - -#if defined(NAS_BUILT_IN_EPC) - RB_INIT(&_emm_data.ctx_map); -#endif - - /* - * Initialize EMM timers - */ - T3450.id = NAS_TIMER_INACTIVE_ID; - T3450.sec = T3450_DEFAULT_VALUE; - T3460.id = NAS_TIMER_INACTIVE_ID; - T3460.sec = T3460_DEFAULT_VALUE; - T3470.id = NAS_TIMER_INACTIVE_ID; - T3470.sec = T3470_DEFAULT_VALUE; - - LOG_FUNC_OUT; -} -#endif - -/**************************************************************************** - ** ** - ** Name: emm_main_cleanup() ** - ** ** - ** Description: Performs the EPS Mobility Management clean up procedure ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void emm_main_cleanup(void) -{ - LOG_FUNC_IN; - -#ifdef NAS_UE - - if (_emm_data.usim_is_valid) { - /* - * TODO: Update USIM application data - */ -#if 0 - int i; - - /* Update the list of Forbidden PLMNs */ - for (i=0; (i < _emm_data.fplmn.n_plmns) && (i < USIM_FPLMN_MAX); i++) { - _usim_data.fplmn[i] = _emm_data.fplmn.plmn[i]; - } - - /* Update the list of Equivalent HPLMNs */ - for (i=0; (i < _emm_data.ehplmn.n_plmns) && (i < USIM_EHPLMN_MAX); i++) { - _usim_data.ehplmn[i] = _emm_data.ehplmn.plmn[i]; - } - - /* Update the GUTI */ - if (_emm_data.guti) { - _usim_data.epsloci.guti = *(_emm_data.guti); - } - - /* Update the last visited registered TAI */ - if (_emm_data.tai) { - _usim_data.epsloci.tai = *(_emm_data.tai); - } - - /* Update the EPS location information */ - _usim_data.epsloci.status = _emm_data.status; - - if (_emm_data.security && (_emm_data.security->type == EMM_KSI_NATIVE)) { - /* TODO: Update the EPS security context parameters from the full - * native EPS security context */ - } - - /* - * Store USIM application data - * - List of forbidden PLMNs - */ - if ( usim_api_write(&_usim_data) != RETURNok ) { - /* The USIM application may not be present or not valid */ - LOG_TRACE(WARNING, "EMM-MAIN - " - "Failed to write USIM application data"); - } - -#endif - } - - /* - * Store EMM data into the UE's non-volatile memory - * - Registered PLMN - * - List of equivalent PLMNs - */ - char *path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME); - - if (path == NULL) { - LOG_TRACE(ERROR, "EMM-MAIN - Failed to get EMM data pathname"); - } else { - int rc = memory_write(path, &_emm_data.nvdata, sizeof(emm_nvdata_t)); - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "EMM-MAIN - Failed to write %s", path); - } - } - - /* Release dynamically allocated memory */ - if (_emm_data.imei) { - free(_emm_data.imei); - _emm_data.imei = NULL; - } - - if (_emm_data.security) { - emm_security_context_t *security = _emm_data.security; - - if (security->kasme.value) { - free(security->kasme.value); - security->kasme.value = NULL; - security->kasme.length = 0; - } - - if (security->knas_enc.value) { - free(security->knas_enc.value); - security->knas_enc.value = NULL; - security->knas_enc.length = 0; - } - - if (security->knas_int.value) { - free(security->knas_int.value); - security->knas_int.value = NULL; - security->knas_int.length = 0; - } - - free(_emm_data.security); - _emm_data.security = NULL; - } - -#endif // NAS_UE - - LOG_FUNC_OUT; -} - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_main_get_imsi() ** - ** ** - ** Description: Get the International Mobile Subscriber Identity number ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: Pointer to the IMSI ** - ** Others: None ** - ** ** - ***************************************************************************/ -const imsi_t *emm_main_get_imsi(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (&_emm_data.nvdata.imsi); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_msisdn() ** - ** ** - ** Description: Get the Mobile Subscriber Dialing Number from the USIM ** - ** ** - ** Inputs: None ** - ** Others: _usim_data ** - ** ** - ** Outputs: None ** - ** Return: Pointer to the subscriber dialing number ** - ** Others: None ** - ** ** - ***************************************************************************/ -const msisdn_t *emm_main_get_msisdn(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (&_usim_data.msisdn.number); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_set_plmn_selection_mode() ** - ** ** - ** Description: Set the network selection mode of operation to the given ** - ** mode and update the manually selected network selection ** - ** data ** - ** ** - ** Inputs: mode: The specified network selection mode of ** - ** operation ** - ** format: The representation format of the PLMN ** - ** identifier ** - ** plmn: Identifier of the selected PLMN ** - ** rat: The selected Radio Access Techonology ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_data ** - ** ** - ***************************************************************************/ -int emm_main_set_plmn_selection_mode(int mode, int format, - const network_plmn_t *plmn, int rat) -{ - LOG_FUNC_IN; - - int index; - - LOG_TRACE(INFO, "EMM-MAIN - PLMN selection: mode=%d, format=%d, plmn=%s, " - "rat=%d", mode, format, (const char *)&plmn->id, rat); - - _emm_data.plmn_mode = mode; - - if (mode != EMM_DATA_PLMN_AUTO) { - /* Get the index of the PLMN in the list of available PLMNs */ - index = _emm_main_get_plmn_index((const char *)&plmn->id, format); - - if (index < 0) { - LOG_TRACE(WARNING, "EMM-MAIN - PLMN %s not available", - (const char *)&plmn->id); - } else { - /* Update the manually selected network selection data */ - _emm_data.plmn_index = index; - _emm_data.plmn_rat = rat; - } - } else { - /* - * Get the index of the last PLMN the UE already tried to automatically - * register to when switched on; the equivalent PLMNs list shall not be - * applied to the user reselection in Automatic Network Selection Mode. - */ - index = IdleMode_get_hplmn_index(); - } - - LOG_FUNC_RETURN (index); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_plmn_selection_mode() ** - ** ** - ** Description: Get the current value of the network selection mode of ** - ** operation ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: The value of the network selection mode ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_main_get_plmn_selection_mode(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (_emm_data.plmn_mode); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_plmn_list() ** - ** ** - ** Description: Get the list of available PLMNs ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: plist: Pointer to the list of available PLMNs ** - ** Return: The size of the list in bytes ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_main_get_plmn_list(const char **plist) -{ - LOG_FUNC_IN; - - int size = IdleMode_update_plmn_list(0); - *plist = _emm_data.plist.buffer; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_selected_plmn() ** - ** ** - ** Description: Get the identifier of the currently selected PLMN ** - ** ** - ** Inputs: format: The requested format of the string repre- ** - ** sentation of the PLMN identifier ** - ** Others: _emm_data ** - ** ** - ** Outputs: plmn: The selected PLMN identifier coded in the ** - ** requested format ** - ** Return: A pointer to the string representation of ** - ** the selected PLMN ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format) -{ - LOG_FUNC_IN; - - size_t size = 0; - /* - * Get the identifier of the selected PLMN in the list of available PLMNs - */ - int index = IdleMode_get_splmn_index(); - - if ( !(index < 0) ) { - const char *name = _emm_main_get_plmn(&_emm_data.splmn, index, - format, &size); - - if (size > 0) { - LOG_FUNC_RETURN ((char *) memcpy(&plmn->id, name, size)); - } - } - - LOG_FUNC_RETURN (NULL); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_registered_plmn() ** - ** ** - ** Description: Get the identifier of the currently registered PLMN ** - ** ** - ** Inputs: format: The requested format of the string repre- ** - ** sentation of the PLMN identifier ** - ** Others: _emm_data ** - ** ** - ** Outputs: plmn: The registered PLMN identifier coded in ** - ** the requested format ** - ** Return: A pointer to the string representation of ** - ** the registered PLMN ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format) -{ - LOG_FUNC_IN; - - size_t size = 0; - - /* - * Get the identifier of the registered PLMN in the list of available PLMNs - */ - int index = IdleMode_get_rplmn_index(); - - if ( !(index < 0) ) { - const char *name = _emm_main_get_plmn(&_emm_data.nvdata.rplmn, - index, format, &size); - - if (size > 0) { - LOG_FUNC_RETURN ((char *) memcpy(&plmn->id, name, size)); - } - } - - LOG_FUNC_RETURN (NULL); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_plmn_status() ** - ** ** - ** Description: Get the value of the network registration status which ** - ** shows whether the network has currently indicated the ** - ** registration of the UE ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: The current network registration status ** - ** Others: None ** - ** ** - ***************************************************************************/ -Stat_t emm_main_get_plmn_status(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (_emm_data.stat); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_plmn_tac() ** - ** ** - ** Description: Get the code of the Tracking area the registered PLMN ** - ** belongs to ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: The Location/Tracking area code ** - ** Others: None ** - ** ** - ***************************************************************************/ -tac_t emm_main_get_plmn_tac(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (_emm_data.tac); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_plmn_ci() ** - ** ** - ** Description: Get the identifier of the serving cell ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: The serving cell identifier ** - ** Others: None ** - ** ** - ***************************************************************************/ -ci_t emm_main_get_plmn_ci(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (_emm_data.ci); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_plmn_rat() ** - ** ** - ** Description: Get the value of the Radio Access Technology of the ser- ** - ** ving cell ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: The value of the Radio Access Technology ** - ** of the serving cell ** - ** Others: None ** - ** ** - ***************************************************************************/ -AcT_t emm_main_get_plmn_rat(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (_emm_data.rat); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_is_attached() ** - ** ** - ** Description: Indicates whether the UE is currently attached to the ** - ** network for EPS services or emergency service only ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: TRUE if the UE is currently attached to ** - ** the network; FALSE otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_main_is_attached(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (_emm_data.is_attached); -} - -/**************************************************************************** - ** ** - ** Name: emm_main_get_plmn_rat() ** - ** ** - ** Description: Indicates whether the UE is currently attached to the ** - ** network for emergency bearer services ** - ** ** - ** Inputs: None ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: TRUE if the UE is currently attached or is ** - ** attempting to attach to the network for ** - ** emergency bearer services; FALSE otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_main_is_emergency(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN (_emm_data.is_attached && _emm_data.is_emergency); -} -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _emm_main_callback() ** - ** ** - ** Description: Forwards the network indication to the upper control la- ** - ** yer (user API) to notify that network registration and/or ** - ** location information has changed. ** - ** ** - ** Inputs: size: Size in byte of the list of operators ** - ** present in the network. The list has to be ** - ** displayed to the user application when ** - ** size > 0. ** - ** Others: _emm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_main_callback(int size) -{ - LOG_FUNC_IN; - - /* Forward the notification to the user API */ - int rc = (*_emm_main_user_callback)(_emm_data.stat, _emm_data.tac, - _emm_data.ci, _emm_data.rat, - _emm_data.plist.buffer, size); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_main_get_imei() ** - ** ** - ** Description: Returns the International Mobile Equipment Identity con- ** - ** tained in the given string representation ** - ** ** - ** Inputs: imei: The string representation of the IMEI ** - ** Others: None ** - ** ** - ** Outputs: imei: The IMEI of the UE ** - ** Return: The number of digits in the IMEI ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_main_get_imei(imei_t *imei, const char *imei_str) -{ - int len = strlen(imei_str); - - if (len % 2) { - imei->u.num.parity = ODD_PARITY; - } else { - imei->u.num.parity = EVEN_PARITY; - } - - imei->u.num.digit1 = imei_str[0] - '0'; - imei->u.num.digit2 = imei_str[1] - '0'; - imei->u.num.digit3 = imei_str[2] - '0'; - imei->u.num.digit4 = imei_str[3] - '0'; - imei->u.num.digit5 = imei_str[4] - '0'; - imei->u.num.digit6 = imei_str[5] - '0'; - imei->u.num.digit7 = imei_str[6] - '0'; - imei->u.num.digit8 = imei_str[7] - '0'; - imei->u.num.digit9 = imei_str[8] - '0'; - imei->u.num.digit10 = imei_str[9] - '0'; - imei->u.num.digit11 = imei_str[10] - '0'; - imei->u.num.digit12 = imei_str[11] - '0'; - imei->u.num.digit13 = imei_str[12] - '0'; - imei->u.num.digit14 = imei_str[13] - '0'; - imei->u.num.digit15 = imei_str[14] - '0'; - return (len); -} - -/**************************************************************************** - ** ** - ** Name: _emm_main_imsi_cmp() ** - ** ** - ** Description: Compares two International Mobile Subscriber Identifiers ** - ** ** - ** Inputs: imsi1: The first IMSI ** - ** imsi2: The second IMSI to compare to ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: TRUE if the first IMSI is found to match ** - ** the second; FALSE otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_main_imsi_cmp(imsi_t *imsi1, imsi_t *imsi2) -{ - int i; - - if (imsi1->length != imsi2->length) { - return FALSE; - } - - for (i = 0; i < imsi1->length; i++) { - if (imsi1->u.value[i] != imsi2->u.value[i]) { - return FALSE; - } - } - - return TRUE; -} - -/**************************************************************************** - ** ** - ** Name: _emm_main_get_plmn() ** - ** ** - ** Description: Get the identifier of the PLMN at the given index in the ** - ** list of available PLMNs. ** - ** ** - ** Inputs: plmn: The PLMN to search for ** - ** index: The index of the PLMN in the list of PLMNs ** - ** format: The requested representation format of the ** - ** PLMN identifier ** - ** Others: None ** - ** ** - ** Outputs: size: The size in bytes of the PLMN identifier ** - ** coded in the requested format ** - ** Return: A pointer to the identifier of the PLMN ** - ** Others: None ** - ** ** - ***************************************************************************/ -static const char *_emm_main_get_plmn(const plmn_t *plmn, int index, - int format, size_t *size) -{ - if ( PLMN_IS_VALID(*plmn) ) { - switch (format) { - case NET_FORMAT_LONG: - /* Get the long alpha-numeric representation of the PLMN */ - return IdleMode_get_plmn_fullname(plmn, index, size); - break; - - case NET_FORMAT_SHORT: - /* Get the short alpha-numeric representation of the PLMN */ - return IdleMode_get_plmn_shortname(plmn, index, size); - break; - - case NET_FORMAT_NUM: - /* Get the numeric representation of the PLMN */ - return IdleMode_get_plmn_id(plmn, index, size); - break; - - default: - LOG_TRACE(WARNING, "EMM-MAIN - Format is not valid (%d)", - format); - *size = 0; - break; - } - } - - return (NULL); -} - -/**************************************************************************** - ** ** - ** Name: _emm_main_get_plmn_index() ** - ** ** - ** Description: Get the index of the given PLMN in the ordered list of ** - ** available PLMNs ** - ** ** - ** Inputs: plmn: Identifier of the PLMN ** - ** format: The representation format of the PLMN ** - ** identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The index of the selected PLMN in the list ** - ** of available PLMNs; -1 if the PLMN is not ** - ** found ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_main_get_plmn_index(const char *plmn, int format) -{ - int index = -1; - - switch (format) { - case NET_FORMAT_LONG: - /* Get the index of the long alpha-numeric PLMN identifier */ - index = IdleMode_get_plmn_fullname_index(plmn); - break; - - case NET_FORMAT_SHORT: - /* Get the index of the short alpha-numeric PLMN identifier */ - index = IdleMode_get_plmn_shortname_index(plmn); - break; - - case NET_FORMAT_NUM: - /* Get the index of the numeric PLMN identifier */ - index = IdleMode_get_plmn_id_index(plmn); - break; - - default: - LOG_TRACE(WARNING, "EMM-MAIN - Format is not valid (%d)", format); - break; - } - - return (index); -} -#endif // NAS_UE - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.h b/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.h deleted file mode 100644 index 09eff876353462765be4a329330c2f78f249e03b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_main.h +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_main.h - -Version 0.1 - -Date 2012/10/10 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EPS Mobility Management procedure call manager, - the main entry point for elementary EMM processing. - -*****************************************************************************/ -#ifndef __EMM_MAIN_H__ -#define __EMM_MAIN_H__ - -#if defined(NAS_BUILT_IN_EPC) -# include "mme_config.h" -#endif - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_UE -void emm_main_initialize(emm_indication_callback_t cb, const char *imei); -#endif -#ifdef NAS_MME -# if defined(NAS_BUILT_IN_EPC) -void emm_main_initialize(mme_config_t *mme_config_p); -# else -void emm_main_initialize(void); -# endif -#endif -void emm_main_cleanup(void); - -#ifdef NAS_UE - -/* User's getter of UE's identity */ -const imsi_t *emm_main_get_imsi(void); - -/* User's getter of the subscriber dialing number */ -const msisdn_t *emm_main_get_msisdn(void); - -/* User's getter/setter for network selection */ -int emm_main_set_plmn_selection_mode(int mode, int format, - const network_plmn_t *plmn, int rat); -int emm_main_get_plmn_selection_mode(void); -int emm_main_get_plmn_list(const char **plist); -const char *emm_main_get_selected_plmn(network_plmn_t *plmn, int format); - -/* User's getter for network registration */ -Stat_t emm_main_get_plmn_status(void); -tac_t emm_main_get_plmn_tac(void); -ci_t emm_main_get_plmn_ci(void); -AcT_t emm_main_get_plmn_rat(void); -const char *emm_main_get_registered_plmn(network_plmn_t *plmn, int format); - -/* User's getter for network attachment */ -int emm_main_is_attached(void); -int emm_main_is_emergency(void); - -#endif // NAS_UE - -#endif /* __EMM_MAIN_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_proc.h b/openair-cn/NAS/EURECOM-NAS/src/emm/emm_proc.h deleted file mode 100644 index 32d0b064933b3d075f20d07630ae240c753d0f35..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/emm_proc.h +++ /dev/null @@ -1,265 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_proc.h - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EPS Mobility Management procedures executed at - the EMM Service Access Points. - -*****************************************************************************/ -#ifndef __EMM_PROC_H__ -#define __EMM_PROC_H__ - -#include "commonDef.h" -#include "OctetString.h" - -#ifdef NAS_MME -#include "EmmCommon.h" -#include "emmData.h" -#endif - -#ifdef NAS_UE -#include "LowerLayer.h" -#endif - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Type of network attachment */ -typedef enum { - EMM_ATTACH_TYPE_EPS = 0, - EMM_ATTACH_TYPE_IMSI, - EMM_ATTACH_TYPE_EMERGENCY, - EMM_ATTACH_TYPE_RESERVED, -} emm_proc_attach_type_t; - -/* Type of network detach */ -typedef enum { - EMM_DETACH_TYPE_EPS = 0, - EMM_DETACH_TYPE_IMSI, - EMM_DETACH_TYPE_EPS_IMSI, - EMM_DETACH_TYPE_REATTACH, - EMM_DETACH_TYPE_NOT_REATTACH, - EMM_DETACH_TYPE_RESERVED, -} emm_proc_detach_type_t; - -/* Type of requested identity */ -typedef enum { - EMM_IDENT_TYPE_NOT_AVAILABLE = 0, - EMM_IDENT_TYPE_IMSI, - EMM_IDENT_TYPE_IMEI, - EMM_IDENT_TYPE_IMEISV, - EMM_IDENT_TYPE_TMSI -} emm_proc_identity_type_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - *--------------------------------------------------------------------------- - * EMM status procedure - *--------------------------------------------------------------------------- - */ -int emm_proc_status_ind(unsigned int ueid, int emm_cause); -int emm_proc_status(unsigned int ueid, int emm_cause); - -/* - *--------------------------------------------------------------------------- - * Lower layer procedure - *--------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_lowerlayer_initialize(lowerlayer_success_callback_t success, - lowerlayer_failure_callback_t failure, - lowerlayer_release_callback_t release, - void *args); -int emm_proc_lowerlayer_success(void); -int emm_proc_lowerlayer_failure(int is_initial); -int emm_proc_lowerlayer_release(void); -#endif - -/* - *--------------------------------------------------------------------------- - * UE's Idle mode procedure - *--------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_initialize(void); -int emm_proc_plmn_selection(int index); -int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat); -#endif - -/* - * -------------------------------------------------------------------------- - * Attach procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_attach(emm_proc_attach_type_t type); -int emm_proc_attach_request(void *args); -int emm_proc_attach_accept(long T3412, long T3402, long T3423, int n_tais, - tai_t *tai, GUTI_t *guti, int n_eplmns, plmn_t *eplmn, - const OctetString *esm_msg); -int emm_proc_attach_reject(int emm_cause, const OctetString *esm_msg); -int emm_proc_attach_complete(void *args); -int emm_proc_attach_failure(int is_initial, void *args); -int emm_proc_attach_release(void *args); -int emm_proc_attach_restart(void); - -int emm_proc_attach_set_emergency(void); -int emm_proc_attach_set_detach(void); -#endif - -#ifdef NAS_MME -int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type, - int native_ksi, int ksi, int native_guti, GUTI_t *guti, imsi_t *imsi, - imei_t *imei, tai_t *tai, int eea, int eia, int ucs2, int uea, int uia, int gea, - int umts_present, int gprs_present, const OctetString *esm_msg); -int emm_proc_attach_reject(unsigned int ueid, int emm_cause); -int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg); -int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause); -#endif - -/* - * -------------------------------------------------------------------------- - * Detach procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_detach(emm_proc_detach_type_t type, int switch_off); -int emm_proc_detach_request(void *args); -int emm_proc_detach_accept(void); -int emm_proc_detach_failure(int is_initial, void *args); -int emm_proc_detach_release(void *args); -#endif - -#ifdef NAS_MME -int emm_proc_detach(unsigned int ueid, emm_proc_detach_type_t type); -int emm_proc_detach_request(unsigned int ueid, emm_proc_detach_type_t type, - int switch_off, int native_ksi, int ksi, GUTI_t *guti, imsi_t *imsi, - imei_t *imei); -#endif - -/* - * -------------------------------------------------------------------------- - * Identification procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_identification_request(emm_proc_identity_type_t type); -#endif - -#ifdef NAS_MME -int emm_proc_identification(unsigned int ueid, - emm_data_context_t *emm_ctx, - emm_proc_identity_type_t type, - emm_common_success_callback_t success, - emm_common_reject_callback_t reject, - emm_common_failure_callback_t failure); -int emm_proc_identification_complete(unsigned int ueid, const imsi_t *imsi, - const imei_t *imei, UInt32_t *tmsi); -#endif - -/* - * -------------------------------------------------------------------------- - * Authentication procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_authentication_request(int native_ksi, int ksi, - const OctetString *rand, const OctetString *autn); -int emm_proc_authentication_reject(void); -int emm_proc_authentication_delete(void); -#endif - -#ifdef NAS_MME -int emm_proc_authentication(void *ctx, unsigned int ueid, int ksi, - const OctetString *_rand, const OctetString *autn, - emm_common_success_callback_t success, - emm_common_reject_callback_t reject, - emm_common_failure_callback_t failure); -int emm_proc_authentication_complete(unsigned int ueid, int emm_cause, - const OctetString *res); - -int emm_attach_security(void *args); -#endif - -/* - * -------------------------------------------------------------------------- - * Security mode control procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia, - int reea, int reia); -#endif - -#ifdef NAS_MME -int emm_proc_security_mode_control(unsigned int ueid, int ksi, - int eea, int eia,int ucs2, int uea, int uia, int gea, - int umts_present, int gprs_present, - emm_common_success_callback_t success, - emm_common_reject_callback_t reject, - emm_common_failure_callback_t failure); -int emm_proc_security_mode_complete(unsigned int ueid); -int emm_proc_security_mode_reject(unsigned int ueid); -#endif - -/* - *--------------------------------------------------------------------------- - * Network indication handlers - *--------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_proc_registration_notify(Stat_t status); -int emm_proc_location_notify(tac_t tac, ci_t ci, AcT_t rat); -int emm_proc_network_notify(int index); -#endif - -#endif /* __EMM_PROC_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.c deleted file mode 100644 index 62eab5acb95c2e07a30bfae677a8adb4767ce5a8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.c +++ /dev/null @@ -1,373 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AttachAccept.h" - -int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_ACCEPT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_eps_attach_result(&attach_accept->epsattachresult, 0, *(buffer + decoded), len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_gprs_timer(&attach_accept->t3412value, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_tracking_area_identity_list(&attach_accept->tailist, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_esm_message_container(&attach_accept->esmmessagecontainer, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ATTACH_ACCEPT_GUTI_IEI: - if ((decoded_result = - decode_eps_mobile_identity(&attach_accept->guti, - ATTACH_ACCEPT_GUTI_IEI, buffer + decoded, len - decoded)) - <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_GUTI_PRESENT; - break; - - case ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI: - if ((decoded_result = - decode_location_area_identification(&attach_accept->locationareaidentification, - ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT; - break; - - case ATTACH_ACCEPT_MS_IDENTITY_IEI: - if ((decoded_result = - decode_mobile_identity(&attach_accept->msidentity, - ATTACH_ACCEPT_MS_IDENTITY_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_MS_IDENTITY_PRESENT; - break; - - case ATTACH_ACCEPT_EMM_CAUSE_IEI: - if ((decoded_result = decode_emm_cause(&attach_accept->emmcause, - ATTACH_ACCEPT_EMM_CAUSE_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_EMM_CAUSE_PRESENT; - break; - - case ATTACH_ACCEPT_T3402_VALUE_IEI: - if ((decoded_result = - decode_gprs_timer(&attach_accept->t3402value, - ATTACH_ACCEPT_T3402_VALUE_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_T3402_VALUE_PRESENT; - break; - - case ATTACH_ACCEPT_T3423_VALUE_IEI: - if ((decoded_result = - decode_gprs_timer(&attach_accept->t3423value, - ATTACH_ACCEPT_T3423_VALUE_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_T3423_VALUE_PRESENT; - break; - - case ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI: - if ((decoded_result = - decode_plmn_list(&attach_accept->equivalentplmns, - ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT; - break; - - case ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI: - if ((decoded_result = - decode_emergency_number_list(&attach_accept->emergencynumberlist, - ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, buffer + decoded, - len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT; - break; - - case ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI: - if ((decoded_result = - decode_eps_network_feature_support(&attach_accept->epsnetworkfeaturesupport, - ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; - break; - - case ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI: - if ((decoded_result = - decode_additional_update_result(&attach_accept->additionalupdateresult, - ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_accept->presencemask |= ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - LOG_FUNC_IN; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_ACCEPT_MINIMUM_LENGTH, len); - - *(buffer + encoded) = (encode_u8_eps_attach_result(&attach_accept->epsattachresult) & 0x0f); - encoded++; -#warning "LG TEST override t3412value" - attach_accept->t3412value.unit = GPRS_TIMER_UNIT_360S; - attach_accept->t3412value.timervalue = 10; - - if ((encode_result = encode_gprs_timer(&attach_accept->t3412value, 0, buffer - + encoded, len - encoded)) < 0) { //Return in case of error - LOG_TRACE(WARNING, "Failed encode_gprs_timer"); - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - - if ((encode_result = - encode_tracking_area_identity_list(&attach_accept->tailist, 0, buffer - + encoded, len - encoded)) < 0) { //Return in case of error - LOG_TRACE(WARNING, "Failed encode_tracking_area_identity_list"); - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - - if ((encode_result = - encode_esm_message_container(&attach_accept->esmmessagecontainer, 0, - buffer + encoded, len - encoded)) < 0) { //Return in case of error - LOG_TRACE(WARNING, "Failed encode_esm_message_container"); - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - - if ((attach_accept->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) - == ATTACH_ACCEPT_GUTI_PRESENT) { - if ((encode_result = encode_eps_mobile_identity(&attach_accept->guti, - ATTACH_ACCEPT_GUTI_IEI, buffer + encoded, len - encoded)) < 0) { - // Return in case of error - LOG_TRACE(WARNING, "Failed encode_eps_mobile_identity"); - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) - == ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) { - if ((encode_result = - encode_location_area_identification(&attach_accept->locationareaidentification, - ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI, buffer + encoded, - len - encoded)) < 0) { - LOG_TRACE(WARNING, "Failed encode_location_area_identification"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_MS_IDENTITY_PRESENT) - == ATTACH_ACCEPT_MS_IDENTITY_PRESENT) { - if ((encode_result = encode_mobile_identity(&attach_accept->msidentity, - ATTACH_ACCEPT_MS_IDENTITY_IEI, buffer + encoded, len - encoded)) < - 0) { - LOG_TRACE(WARNING, "Failed encode_mobile_identity"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_EMM_CAUSE_PRESENT) - == ATTACH_ACCEPT_EMM_CAUSE_PRESENT) { - if ((encode_result = encode_emm_cause(&attach_accept->emmcause, - ATTACH_ACCEPT_EMM_CAUSE_IEI, buffer + encoded, len - encoded)) < - 0) { - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - -#warning "LG TEST override t3402value" - attach_accept->presencemask |= ATTACH_ACCEPT_T3402_VALUE_PRESENT; - attach_accept->t3402value.unit = GPRS_TIMER_UNIT_60S; - attach_accept->t3402value.timervalue = 12; - - if ((attach_accept->presencemask & ATTACH_ACCEPT_T3402_VALUE_PRESENT) - == ATTACH_ACCEPT_T3402_VALUE_PRESENT) { - if ((encode_result = encode_gprs_timer(&attach_accept->t3402value, - ATTACH_ACCEPT_T3402_VALUE_IEI, buffer + encoded, len - encoded)) < - 0) { - LOG_TRACE(WARNING, "Failed encode_gprs_timer"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_T3423_VALUE_PRESENT) - == ATTACH_ACCEPT_T3423_VALUE_PRESENT) { - if ((encode_result = encode_gprs_timer(&attach_accept->t3423value, - ATTACH_ACCEPT_T3423_VALUE_IEI, buffer + encoded, len - encoded)) < - 0) { - LOG_TRACE(WARNING, "Failed encode_gprs_timer"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT) - == ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT) { - if ((encode_result = encode_plmn_list(&attach_accept->equivalentplmns, - ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer + encoded, len - - encoded)) < 0) { - LOG_TRACE(WARNING, "Failed encode_plmn_list"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) - == ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) { - if ((encode_result = - encode_emergency_number_list(&attach_accept->emergencynumberlist, - ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, buffer + encoded, len - - encoded)) < 0) { - LOG_TRACE(WARNING, "Failed encode_emergency_number_list"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) - == ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) { - if ((encode_result = - encode_eps_network_feature_support(&attach_accept->epsnetworkfeaturesupport, - ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI, buffer + encoded, - len - encoded)) < 0) { - LOG_TRACE(WARNING, "Failed encode_eps_network_feature_support"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - if ((attach_accept->presencemask & ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT) - == ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT) { - if ((encode_result = - encode_additional_update_result(&attach_accept->additionalupdateresult, - ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, buffer + encoded, len - - encoded)) < 0) { - LOG_TRACE(WARNING, "Failed encode_additional_update_result"); - // Return in case of error - LOG_FUNC_RETURN(encode_result); - } else - encoded += encode_result; - } - - LOG_FUNC_RETURN(encoded); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.h deleted file mode 100644 index 2c1fc64bae610a8d8e3582845b4c3eb3fd4b9e5b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachAccept.h +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EpsAttachResult.h" -#include "GprsTimer.h" -#include "TrackingAreaIdentityList.h" -#include "EsmMessageContainer.h" -#include "EpsMobileIdentity.h" -#include "LocationAreaIdentification.h" -#include "MobileIdentity.h" -#include "EmmCause.h" -#include "PlmnList.h" -#include "EmergencyNumberList.h" -#include "EpsNetworkFeatureSupport.h" -#include "AdditionalUpdateResult.h" - -#ifndef ATTACH_ACCEPT_H_ -#define ATTACH_ACCEPT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ATTACH_ACCEPT_MINIMUM_LENGTH ( \ - EPS_ATTACH_RESULT_MINIMUM_LENGTH + \ - GPRS_TIMER_MINIMUM_LENGTH + \ - TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH + \ - ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ATTACH_ACCEPT_MAXIMUM_LENGTH ( \ - EPS_ATTACH_RESULT_MAXIMUM_LENGTH + \ - GPRS_TIMER_MAXIMUM_LENGTH + \ - TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH + \ - ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \ - MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - EMM_CAUSE_MAXIMUM_LENGTH + \ - GPRS_TIMER_MAXIMUM_LENGTH + \ - GPRS_TIMER_MAXIMUM_LENGTH + \ - PLMN_LIST_MAXIMUM_LENGTH + \ - EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH + \ - EPS_NETWORK_FEATURE_SUPPORT_MAXIMUM_LENGTH + \ - ADDITIONAL_UPDATE_RESULT_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ATTACH_ACCEPT_GUTI_PRESENT (1<<0) -# define ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<1) -# define ATTACH_ACCEPT_MS_IDENTITY_PRESENT (1<<2) -# define ATTACH_ACCEPT_EMM_CAUSE_PRESENT (1<<3) -# define ATTACH_ACCEPT_T3402_VALUE_PRESENT (1<<4) -# define ATTACH_ACCEPT_T3423_VALUE_PRESENT (1<<5) -# define ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT (1<<6) -# define ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT (1<<7) -# define ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT (1<<8) -# define ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT (1<<9) - -typedef enum attach_accept_iei_tag { - ATTACH_ACCEPT_GUTI_IEI = 0x50, /* 0x50 = 80 */ - ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */ - ATTACH_ACCEPT_MS_IDENTITY_IEI = 0x23, /* 0x23 = 35 */ - ATTACH_ACCEPT_EMM_CAUSE_IEI = 0x53, /* 0x53 = 83 */ - ATTACH_ACCEPT_T3402_VALUE_IEI = 0x17, /* 0x17 = 23 */ - ATTACH_ACCEPT_T3423_VALUE_IEI = 0x59, /* 0x59 = 89 */ - ATTACH_ACCEPT_EQUIVALENT_PLMNS_IEI = 0x4A, /* 0x4A = 74 */ - ATTACH_ACCEPT_EMERGENCY_NUMBER_LIST_IEI = 0x34, /* 0x34 = 52 */ - ATTACH_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI = 0x64, /* 0x64 = 100 */ - ATTACH_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI = 0xF0, /* 0xF0 = 240 */ -} attach_accept_iei; - -/* - * Message name: Attach accept - * Description: This message is sent by the network to the UE to indicate that the corresponding attach request has been accepted. See table 8.2.1.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct attach_accept_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EpsAttachResult epsattachresult; - GprsTimer t3412value; - TrackingAreaIdentityList tailist; - EsmMessageContainer esmmessagecontainer; - /* Optional fields */ - uint32_t presencemask; - EpsMobileIdentity guti; - LocationAreaIdentification locationareaidentification; - MobileIdentity msidentity; - EmmCause emmcause; - GprsTimer t3402value; - GprsTimer t3423value; - PlmnList equivalentplmns; - EmergencyNumberList emergencynumberlist; - EpsNetworkFeatureSupport epsnetworkfeaturesupport; - AdditionalUpdateResult additionalupdateresult; -} attach_accept_msg; - -int decode_attach_accept(attach_accept_msg *attachaccept, uint8_t *buffer, uint32_t len); - -int encode_attach_accept(attach_accept_msg *attachaccept, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ATTACH_ACCEPT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.c deleted file mode 100644 index 386694eadf0fcdd38c043a33b7138712e9586b99..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.c +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AttachComplete.h" - -int decode_attach_complete(attach_complete_msg *attach_complete, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_COMPLETE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_message_container(&attach_complete->esmmessagecontainer, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_attach_complete(attach_complete_msg *attach_complete, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_COMPLETE_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_esm_message_container(&attach_complete->esmmessagecontainer, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.h deleted file mode 100644 index 6856d9fd32a61d4894eb785cab14b2f4a5cb7126..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachComplete.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EsmMessageContainer.h" - -#ifndef ATTACH_COMPLETE_H_ -#define ATTACH_COMPLETE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ATTACH_COMPLETE_MINIMUM_LENGTH ( \ - ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ATTACH_COMPLETE_MAXIMUM_LENGTH ( \ - ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH ) - - -/* - * Message name: Attach complete - * Description: This message is sent by the UE to the network in response to an ATTACH ACCEPT message. See table 8.2.2.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct attach_complete_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EsmMessageContainer esmmessagecontainer; -} attach_complete_msg; - -int decode_attach_complete(attach_complete_msg *attachcomplete, uint8_t *buffer, uint32_t len); - -int encode_attach_complete(attach_complete_msg *attachcomplete, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ATTACH_COMPLETE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.c deleted file mode 100644 index 16621cf25ede450588ff435a4c8828a85ccf64c7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.c +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AttachReject.h" - -int decode_attach_reject(attach_reject_msg *attach_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_emm_cause(&attach_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI: - if ((decoded_result = - decode_esm_message_container(&attach_reject->esmmessagecontainer, - ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI, buffer + decoded, - len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_reject->presencemask |= ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_attach_reject(attach_reject_msg *attach_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = encode_emm_cause(&attach_reject->emmcause, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((attach_reject->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) - == ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) { - if ((encode_result = - encode_esm_message_container(&attach_reject->esmmessagecontainer, - ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.h deleted file mode 100644 index 3d12b7fdadfb6d1087acf2850d5685ff0a89bad3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachReject.h +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EmmCause.h" -#include "EsmMessageContainer.h" - -#ifndef ATTACH_REJECT_H_ -#define ATTACH_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ATTACH_REJECT_MINIMUM_LENGTH ( \ - EMM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ATTACH_REJECT_MAXIMUM_LENGTH ( \ - EMM_CAUSE_MAXIMUM_LENGTH + \ - ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT (1<<0) - -typedef enum attach_reject_iei_tag { - ATTACH_REJECT_ESM_MESSAGE_CONTAINER_IEI = 0x78, /* 0x78 = 120 */ -} attach_reject_iei; - -/* - * Message name: Attach reject - * Description: This message is sent by the network to the UE to indicate that the corresponding attach request has been rejected. See table 8.2.3.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct attach_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EmmCause emmcause; - /* Optional fields */ - uint32_t presencemask; - EsmMessageContainer esmmessagecontainer; -} attach_reject_msg; - -int decode_attach_reject(attach_reject_msg *attachreject, uint8_t *buffer, uint32_t len); - -int encode_attach_reject(attach_reject_msg *attachreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ATTACH_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.c deleted file mode 100644 index 15a29b1f29f92ccf9b2d3d275a20d3ced52b5bdd..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.c +++ /dev/null @@ -1,474 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - -#include "nas_log.h" - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AttachRequest.h" - -int decode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - LOG_FUNC_IN; - LOG_TRACE(INFO, "EMM - attach_request len = %d", - len); - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ATTACH_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_eps_attach_type(&attach_request->epsattachtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - if ((decoded_result = decode_u8_nas_key_set_identifier(&attach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded++; - - if ((decoded_result = decode_eps_mobile_identity(&attach_request->oldgutiorimsi, 0, buffer + decoded, len - decoded)) < 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } else - decoded += decoded_result; - - if ((decoded_result = decode_ue_network_capability(&attach_request->uenetworkcapability, 0, buffer + decoded, len - decoded)) < 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } else - decoded += decoded_result; - - if ((decoded_result = decode_esm_message_container(&attach_request->esmmessagecontainer, 0, buffer + decoded, len - decoded)) < 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_IEI: - if ((decoded_result = - decode_p_tmsi_signature(&attach_request->oldptmsisignature, - ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_IEI, buffer + decoded, - len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT; - break; - - case ATTACH_REQUEST_ADDITIONAL_GUTI_IEI: - if ((decoded_result = - decode_eps_mobile_identity(&attach_request->additionalguti, - ATTACH_REQUEST_ADDITIONAL_GUTI_IEI, buffer + decoded, len - - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT; - break; - - case ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI: - if ((decoded_result = - decode_tracking_area_identity(&attach_request->lastvisitedregisteredtai, - ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI, buffer + - decoded, len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT; - break; - - case ATTACH_REQUEST_DRX_PARAMETER_IEI: - if ((decoded_result = - decode_drx_parameter(&attach_request->drxparameter, - ATTACH_REQUEST_DRX_PARAMETER_IEI, buffer + decoded, len - - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_DRX_PARAMETER_PRESENT; - break; - - case ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI: - if ((decoded_result = - decode_ms_network_capability(&attach_request->msnetworkcapability, - ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI, buffer + decoded, - len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT; - break; - - case ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI: - if ((decoded_result = - decode_location_area_identification(&attach_request->oldlocationareaidentification, - ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI, buffer - + decoded, len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT; - break; - - case ATTACH_REQUEST_TMSI_STATUS_IEI: - if ((decoded_result = - decode_tmsi_status(&attach_request->tmsistatus, - ATTACH_REQUEST_TMSI_STATUS_IEI, buffer + decoded, len - - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_TMSI_STATUS_PRESENT; - break; - - case ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI: - if ((decoded_result = - decode_mobile_station_classmark_2(&attach_request->mobilestationclassmark2, - ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI, buffer + - decoded, len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT; - break; - - case ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI: - if ((decoded_result = - decode_mobile_station_classmark_3(&attach_request->mobilestationclassmark3, - ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI, buffer + - decoded, len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT; - break; - - case ATTACH_REQUEST_SUPPORTED_CODECS_IEI: - if ((decoded_result = - decode_supported_codec_list(&attach_request->supportedcodecs, - ATTACH_REQUEST_SUPPORTED_CODECS_IEI, buffer + decoded, len - - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT; - break; - - case ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI: - if ((decoded_result = - decode_additional_update_type(&attach_request->additionalupdatetype, - ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI, buffer + - decoded, len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT; - break; - - case ATTACH_REQUEST_OLD_GUTI_TYPE_IEI: - if ((decoded_result = - decode_guti_type(&attach_request->oldgutitype, - ATTACH_REQUEST_OLD_GUTI_TYPE_IEI, - buffer + decoded, len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT; - break; - - case ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI: - if ((decoded_result = - decode_voice_domain_preference_and_ue_usage_setting(&attach_request->voicedomainpreferenceandueusagesetting, - ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI, - buffer + decoded, len - decoded)) <= 0) { - // return decoded_result; - LOG_FUNC_RETURN(decoded_result); - } - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - attach_request->presencemask |= ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT; - break; - - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - { - // return TLV_DECODE_UNEXPECTED_IEI; - LOG_FUNC_RETURN(TLV_DECODE_UNEXPECTED_IEI); - } - } - } - - LOG_FUNC_RETURN(decoded); -} - -int encode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&attach_request->naskeysetidentifier) & 0x0f) << 4) | (encode_u8_eps_attach_type(&attach_request->epsattachtype) & 0x0f); - encoded++; - - if ((encode_result = - encode_eps_mobile_identity(&attach_request->oldgutiorimsi, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((encode_result = - encode_ue_network_capability(&attach_request->uenetworkcapability, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((encode_result = - encode_esm_message_container(&attach_request->esmmessagecontainer, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((attach_request->presencemask & ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT) - == ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT) { - if ((encode_result = - encode_p_tmsi_signature(&attach_request->oldptmsisignature, - ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT) - == ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT) { - if ((encode_result = - encode_eps_mobile_identity(&attach_request->additionalguti, - ATTACH_REQUEST_ADDITIONAL_GUTI_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) - == ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) { - if ((encode_result = - encode_tracking_area_identity(&attach_request->lastvisitedregisteredtai, - ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_DRX_PARAMETER_PRESENT) - == ATTACH_REQUEST_DRX_PARAMETER_PRESENT) { - if ((encode_result = encode_drx_parameter(&attach_request->drxparameter, - ATTACH_REQUEST_DRX_PARAMETER_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) - == ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) { - if ((encode_result = - encode_ms_network_capability(&attach_request->msnetworkcapability, - ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) - == ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) { - if ((encode_result = - encode_location_area_identification(&attach_request->oldlocationareaidentification, - ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_TMSI_STATUS_PRESENT) - == ATTACH_REQUEST_TMSI_STATUS_PRESENT) { - if ((encode_result = encode_tmsi_status(&attach_request->tmsistatus, - ATTACH_REQUEST_TMSI_STATUS_IEI, buffer + encoded, len - encoded)) - < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) - == ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) { - if ((encode_result = - encode_mobile_station_classmark_2(&attach_request->mobilestationclassmark2, - ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) - == ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) { - if ((encode_result = - encode_mobile_station_classmark_3(&attach_request->mobilestationclassmark3, - ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT) - == ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT) { - if ((encode_result = - encode_supported_codec_list(&attach_request->supportedcodecs, - ATTACH_REQUEST_SUPPORTED_CODECS_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT) - == ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT) { - if ((encode_result = - encode_additional_update_type(&attach_request->additionalupdatetype, - ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT) - == ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT) { - if ((encode_result = - encode_guti_type(&attach_request->oldgutitype, - ATTACH_REQUEST_OLD_GUTI_TYPE_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((attach_request->presencemask & ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT) - == ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT) { - if ((encode_result = - encode_voice_domain_preference_and_ue_usage_setting(&attach_request->voicedomainpreferenceandueusagesetting, - ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.h deleted file mode 100644 index 5368df7fc77d22b138623416994299be3557c3fa..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AttachRequest.h +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EpsAttachType.h" -#include "NasKeySetIdentifier.h" -#include "EpsMobileIdentity.h" -#include "UeNetworkCapability.h" -#include "EsmMessageContainer.h" -#include "PTmsiSignature.h" -#include "TrackingAreaIdentity.h" -#include "DrxParameter.h" -#include "MsNetworkCapability.h" -#include "LocationAreaIdentification.h" -#include "TmsiStatus.h" -#include "MobileStationClassmark2.h" -#include "MobileStationClassmark3.h" -#include "SupportedCodecList.h" -#include "AdditionalUpdateType.h" -#include "GutiType.h" -#include "VoiceDomainPreferenceAndUeUsageSetting.h" - -#ifndef ATTACH_REQUEST_H_ -#define ATTACH_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ATTACH_REQUEST_MINIMUM_LENGTH ( \ - EPS_ATTACH_TYPE_MINIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MINIMUM_LENGTH + \ - UE_NETWORK_CAPABILITY_MINIMUM_LENGTH + \ - ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ATTACH_REQUEST_MAXIMUM_LENGTH ( \ - EPS_ATTACH_TYPE_MAXIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - UE_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \ - ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH + \ - P_TMSI_SIGNATURE_MAXIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH + \ - DRX_PARAMETER_MAXIMUM_LENGTH + \ - MS_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \ - LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \ - TMSI_STATUS_MAXIMUM_LENGTH + \ - MOBILE_STATION_CLASSMARK_2_MAXIMUM_LENGTH + \ - MOBILE_STATION_CLASSMARK_3_MAXIMUM_LENGTH + \ - SUPPORTED_CODEC_LIST_MAXIMUM_LENGTH + \ - ADDITIONAL_UPDATE_TYPE_MAXIMUM_LENGTH + \ - GUTI_TYPE_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT (1<<0) -# define ATTACH_REQUEST_ADDITIONAL_GUTI_PRESENT (1<<1) -# define ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT (1<<2) -# define ATTACH_REQUEST_DRX_PARAMETER_PRESENT (1<<3) -# define ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT (1<<4) -# define ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<5) -# define ATTACH_REQUEST_TMSI_STATUS_PRESENT (1<<6) -# define ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT (1<<7) -# define ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT (1<<8) -# define ATTACH_REQUEST_SUPPORTED_CODECS_PRESENT (1<<9) -# define ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT (1<<10) -# define ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT (1<<11) -# define ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_PRESENT (1<<12) - -typedef enum attach_request_iei_tag { - ATTACH_REQUEST_OLD_PTMSI_SIGNATURE_IEI = 0x19, /* 0x19 = 25 */ - ATTACH_REQUEST_ADDITIONAL_GUTI_IEI = 0x50, /* 0x50 = 80 */ - ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI = 0x52, /* 0x52 = 82 */ - ATTACH_REQUEST_DRX_PARAMETER_IEI = 0x5C, /* 0x5C = 92 */ - ATTACH_REQUEST_MS_NETWORK_CAPABILITY_IEI = 0x31, /* 0x31 = 49 */ - ATTACH_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */ - ATTACH_REQUEST_TMSI_STATUS_IEI = 0x90, /* 0x90 = 144 */ - ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI = 0x11, /* 0x11 = 17 */ - ATTACH_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI = 0x20, /* 0x20 = 32 */ - ATTACH_REQUEST_SUPPORTED_CODECS_IEI = 0x40, /* 0x40 = 64 */ - ATTACH_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI = 0xF0, /* 0xF0 = 240 */ - ATTACH_REQUEST_OLD_GUTI_TYPE_IEI = 0xE0, /* 0xE0 = 224 */ - ATTACH_REQUEST_VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_IEI = 0x5D, /* 0x5D = 93 */ -} attach_request_iei; - -/* - * Message name: Attach request - * Description: This message is sent by the UE to the network in order to perform an attach procedure. See table 8.2.4.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct attach_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EpsAttachType epsattachtype; - NasKeySetIdentifier naskeysetidentifier; - EpsMobileIdentity oldgutiorimsi; - UeNetworkCapability uenetworkcapability; - EsmMessageContainer esmmessagecontainer; - /* Optional fields */ - uint32_t presencemask; - PTmsiSignature oldptmsisignature; - EpsMobileIdentity additionalguti; - TrackingAreaIdentity lastvisitedregisteredtai; - DrxParameter drxparameter; - MsNetworkCapability msnetworkcapability; - LocationAreaIdentification oldlocationareaidentification; - TmsiStatus tmsistatus; - MobileStationClassmark2 mobilestationclassmark2; - MobileStationClassmark3 mobilestationclassmark3; - SupportedCodecList supportedcodecs; - AdditionalUpdateType additionalupdatetype; - GutiType oldgutitype; - VoiceDomainPreferenceAndUeUsageSetting voicedomainpreferenceandueusagesetting; -} attach_request_msg; - -int decode_attach_request(attach_request_msg *attachrequest, uint8_t *buffer, uint32_t len); - -int encode_attach_request(attach_request_msg *attachrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ATTACH_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.c deleted file mode 100644 index 979ade2f24fc9c0a53ad9659f032b8fbfb824627..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.c +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationFailure.h" - -int decode_authentication_failure(authentication_failure_msg *authentication_failure, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_FAILURE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_emm_cause(&authentication_failure->emmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI: - if ((decoded_result = - decode_authentication_failure_parameter(&authentication_failure->authenticationfailureparameter, - AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - authentication_failure->presencemask |= AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_authentication_failure(authentication_failure_msg *authentication_failure, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_FAILURE_MINIMUM_LENGTH, len); - - if ((encode_result = encode_emm_cause(&authentication_failure->emmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((authentication_failure->presencemask & AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) - == AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) { - if ((encode_result = - encode_authentication_failure_parameter(&authentication_failure->authenticationfailureparameter, - AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.h deleted file mode 100644 index 8c9b66dd3263805a32af1ae65071b03994e0de7a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationFailure.h +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EmmCause.h" -#include "AuthenticationFailureParameter.h" - -#ifndef AUTHENTICATION_FAILURE_H_ -#define AUTHENTICATION_FAILURE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define AUTHENTICATION_FAILURE_MINIMUM_LENGTH ( \ - EMM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define AUTHENTICATION_FAILURE_MAXIMUM_LENGTH ( \ - EMM_CAUSE_MAXIMUM_LENGTH + \ - AUTHENTICATION_FAILURE_PARAMETER_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT (1<<0) - -typedef enum authentication_failure_iei_tag { - AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI = 0x30, /* 0x30 = 48 */ -} authentication_failure_iei; - -/* - * Message name: Authentication failure - * Description: This message is sent by the UE to the network to indicate that authentication of the network has failed. See table 8.2.5.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct authentication_failure_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EmmCause emmcause; - /* Optional fields */ - uint32_t presencemask; - AuthenticationFailureParameter authenticationfailureparameter; -} authentication_failure_msg; - -int decode_authentication_failure(authentication_failure_msg *authenticationfailure, uint8_t *buffer, uint32_t len); - -int encode_authentication_failure(authentication_failure_msg *authenticationfailure, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(AUTHENTICATION_FAILURE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.c deleted file mode 100644 index 1d486e070bc21be20869bf1408e6f1eaeb3f2a7d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.c +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationReject.h" - -int decode_authentication_reject(authentication_reject_msg *authentication_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - return decoded; -} - -int encode_authentication_reject(authentication_reject_msg *authentication_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_REJECT_MINIMUM_LENGTH, len); - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.h deleted file mode 100644 index 85111297ee04892ae17d6575a9b75c371b4f103e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationReject.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" - -#ifndef AUTHENTICATION_REJECT_H_ -#define AUTHENTICATION_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define AUTHENTICATION_REJECT_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define AUTHENTICATION_REJECT_MAXIMUM_LENGTH (0) - -/* - * Message name: Authentication reject - * Description: This message is sent by the network to the UE to indicate that the authentication procedure has failed and that the UE shall abort all activities. See table 8.2.6.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct authentication_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; -} authentication_reject_msg; - -int decode_authentication_reject(authentication_reject_msg *authenticationreject, uint8_t *buffer, uint32_t len); - -int encode_authentication_reject(authentication_reject_msg *authenticationreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(AUTHENTICATION_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.c deleted file mode 100644 index e6f10c9ef6cd8497968749e56cb0e284f4ee72c1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.c +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationRequest.h" - -int decode_authentication_request(authentication_request_msg *authentication_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_authentication_parameter_rand(&authentication_request->authenticationparameterrand, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_authentication_parameter_autn(&authentication_request->authenticationparameterautn, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_authentication_request(authentication_request_msg *authentication_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme) & 0x0f) << 4) | 0x00; - encoded++; - - if ((encode_result = - encode_authentication_parameter_rand(&authentication_request->authenticationparameterrand, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((encode_result = - encode_authentication_parameter_autn(&authentication_request->authenticationparameterautn, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.h deleted file mode 100644 index 1bfe9f1719f401a9f0694efa0e7822b8dbadac19..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationRequest.h +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "NasKeySetIdentifier.h" -#include "AuthenticationParameterRand.h" -#include "AuthenticationParameterAutn.h" - -#ifndef AUTHENTICATION_REQUEST_H_ -#define AUTHENTICATION_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define AUTHENTICATION_REQUEST_MINIMUM_LENGTH ( \ - NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \ - AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH + \ - AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define AUTHENTICATION_REQUEST_MAXIMUM_LENGTH ( \ - NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \ - AUTHENTICATION_PARAMETER_RAND_MAXIMUM_LENGTH + \ - AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH ) - - -/* - * Message name: Authentication request - * Description: This message is sent by the network to the UE to initiate authentication of the UE identity. See table 8.2.7.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct authentication_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - NasKeySetIdentifier naskeysetidentifierasme; - AuthenticationParameterRand authenticationparameterrand; - AuthenticationParameterAutn authenticationparameterautn; -} authentication_request_msg; - -int decode_authentication_request(authentication_request_msg *authenticationrequest, uint8_t *buffer, uint32_t len); - -int encode_authentication_request(authentication_request_msg *authenticationrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(AUTHENTICATION_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.c deleted file mode 100644 index 775932e18f818efc17b239a973de71b9e72c3841..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.c +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationResponse.h" - -int decode_authentication_response(authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_authentication_response_parameter(&authentication_response->authenticationresponseparameter, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_authentication_response(authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_authentication_response_parameter(&authentication_response->authenticationresponseparameter, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.h deleted file mode 100644 index 2e93301ee7b7fde134f0035e7a5c9cffacacc92a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/AuthenticationResponse.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "AuthenticationResponseParameter.h" - -#ifndef AUTHENTICATION_RESPONSE_H_ -#define AUTHENTICATION_RESPONSE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define AUTHENTICATION_RESPONSE_MINIMUM_LENGTH ( \ - AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define AUTHENTICATION_RESPONSE_MAXIMUM_LENGTH ( \ - AUTHENTICATION_RESPONSE_PARAMETER_MAXIMUM_LENGTH ) - - -/* - * Message name: Authentication response - * Description: This message is sent by the UE to the network to deliver a calculated authentication response to the network. See table 8.2.8.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct authentication_response_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - AuthenticationResponseParameter authenticationresponseparameter; -} authentication_response_msg; - -int decode_authentication_response(authentication_response_msg *authenticationresponse, uint8_t *buffer, uint32_t len); - -int encode_authentication_response(authentication_response_msg *authenticationresponse, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(AUTHENTICATION_RESPONSE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/COPYING b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.c deleted file mode 100644 index d299fd8d13081738d3302e2e7569ba98e2d533e9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.c +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "CsServiceNotification.h" - -int decode_cs_service_notification(cs_service_notification_msg *cs_service_notification, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, CS_SERVICE_NOTIFICATION_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_paging_identity(&cs_service_notification->pagingidentity, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case CS_SERVICE_NOTIFICATION_CLI_IEI: - if ((decoded_result = decode_cli(&cs_service_notification->cli, - CS_SERVICE_NOTIFICATION_CLI_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_CLI_PRESENT; - break; - - case CS_SERVICE_NOTIFICATION_SS_CODE_IEI: - if ((decoded_result = - decode_ss_code(&cs_service_notification->sscode, - CS_SERVICE_NOTIFICATION_SS_CODE_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT; - break; - - case CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI: - if ((decoded_result = - decode_lcs_indicator(&cs_service_notification->lcsindicator, - CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT; - break; - - case CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI: - if ((decoded_result = - decode_lcs_client_identity(&cs_service_notification->lcsclientidentity, - CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - cs_service_notification->presencemask |= CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_cs_service_notification(cs_service_notification_msg *cs_service_notification, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, CS_SERVICE_NOTIFICATION_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_paging_identity(&cs_service_notification->pagingidentity, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_CLI_PRESENT) - == CS_SERVICE_NOTIFICATION_CLI_PRESENT) { - if ((encode_result = encode_cli(&cs_service_notification->cli, - CS_SERVICE_NOTIFICATION_CLI_IEI, buffer + encoded, len - encoded)) - < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT) - == CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT) { - if ((encode_result = encode_ss_code(&cs_service_notification->sscode, - CS_SERVICE_NOTIFICATION_SS_CODE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT) - == CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT) { - if ((encode_result = - encode_lcs_indicator(&cs_service_notification->lcsindicator, - CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((cs_service_notification->presencemask & CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT) - == CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT) { - if ((encode_result = - encode_lcs_client_identity(&cs_service_notification->lcsclientidentity, - CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.h deleted file mode 100644 index 6fcb5e0bab7d491a2f63d66b5f97c3caa5e824b5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/CsServiceNotification.h +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "PagingIdentity.h" -#include "Cli.h" -#include "SsCode.h" -#include "LcsIndicator.h" -#include "LcsClientIdentity.h" - -#ifndef CS_SERVICE_NOTIFICATION_H_ -#define CS_SERVICE_NOTIFICATION_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define CS_SERVICE_NOTIFICATION_MINIMUM_LENGTH ( \ - PAGING_IDENTITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define CS_SERVICE_NOTIFICATION_MAXIMUM_LENGTH ( \ - PAGING_IDENTITY_MAXIMUM_LENGTH + \ - CLI_MAXIMUM_LENGTH + \ - SS_CODE_MAXIMUM_LENGTH + \ - LCS_INDICATOR_MAXIMUM_LENGTH + \ - LCS_CLIENT_IDENTITY_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define CS_SERVICE_NOTIFICATION_CLI_PRESENT (1<<0) -# define CS_SERVICE_NOTIFICATION_SS_CODE_PRESENT (1<<1) -# define CS_SERVICE_NOTIFICATION_LCS_INDICATOR_PRESENT (1<<2) -# define CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_PRESENT (1<<3) - -typedef enum cs_service_notification_iei_tag { - CS_SERVICE_NOTIFICATION_CLI_IEI = 0x60, /* 0x60 = 96 */ - CS_SERVICE_NOTIFICATION_SS_CODE_IEI = 0x61, /* 0x61 = 97 */ - CS_SERVICE_NOTIFICATION_LCS_INDICATOR_IEI = 0x62, /* 0x62 = 98 */ - CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_IEI = 0x63, /* 0x63 = 99 */ -} cs_service_notification_iei; - -/* - * Message name: CS service notification - * Description: This message is sent by the network when a paging request with CS call indicator was received via SGs for a UE, and a NAS signalling connection is already established for the UE. See table 8.2.9.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct cs_service_notification_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - PagingIdentity pagingidentity; - /* Optional fields */ - uint32_t presencemask; - Cli cli; - SsCode sscode; - LcsIndicator lcsindicator; - LcsClientIdentity lcsclientidentity; -} cs_service_notification_msg; - -int decode_cs_service_notification(cs_service_notification_msg *csservicenotification, uint8_t *buffer, uint32_t len); - -int encode_cs_service_notification(cs_service_notification_msg *csservicenotification, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(CS_SERVICE_NOTIFICATION_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.c deleted file mode 100644 index 242020c4bf29be632128808ee87d13d77890d3f0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.c +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DetachAccept.h" - -int decode_detach_accept(detach_accept_msg *detach_accept, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DETACH_ACCEPT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - return decoded; -} - -int encode_detach_accept(detach_accept_msg *detach_accept, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DETACH_ACCEPT_MINIMUM_LENGTH, len); - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.h deleted file mode 100644 index 2966bbad7972365c495ea1e0fb3352fedb41637a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachAccept.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" - -#ifndef DETACH_ACCEPT_H_ -#define DETACH_ACCEPT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define DETACH_ACCEPT_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define DETACH_ACCEPT_MAXIMUM_LENGTH (0) - -/* - * Message name: Detach accept - * Description: This message is sent by the network to indicate that the detach procedure has been completed. See table 8.2.10.1.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct detach_accept_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; -} detach_accept_msg; - -int decode_detach_accept(detach_accept_msg *detachaccept, uint8_t *buffer, uint32_t len); - -int encode_detach_accept(detach_accept_msg *detachaccept, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(DETACH_ACCEPT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.c deleted file mode 100644 index 32b9a8f37f759e1d8b1a5c7523a532b74d26484e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.c +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DetachRequest.h" - -int decode_detach_request(detach_request_msg *detach_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DETACH_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_detach_type(&detach_request->detachtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) - return decoded_result; - - if ((decoded_result = decode_u8_nas_key_set_identifier(&detach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_eps_mobile_identity(&detach_request->gutiorimsi, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_detach_request(detach_request_msg *detach_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DETACH_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&detach_request->naskeysetidentifier) << 4) | (encode_u8_detach_type(&detach_request->detachtype) & 0x0f)); - encoded++; - - if ((encode_result = encode_eps_mobile_identity(&detach_request->gutiorimsi, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.h deleted file mode 100644 index 9577b9a9cd4caa96e3b1842b62903928eee7b6af..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DetachRequest.h +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "DetachType.h" -#include "NasKeySetIdentifier.h" -#include "EpsMobileIdentity.h" - -#ifndef DETACH_REQUEST_H_ -#define DETACH_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define DETACH_REQUEST_MINIMUM_LENGTH ( \ - DETACH_TYPE_MINIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define DETACH_REQUEST_MAXIMUM_LENGTH ( \ - DETACH_TYPE_MAXIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH ) - - -/* - * Message name: Detach request - * Description: This message is sent by the UE to request the release of an EMM context. See table 8.2.11.1.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct detach_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - DetachType detachtype; - NasKeySetIdentifier naskeysetidentifier; - EpsMobileIdentity gutiorimsi; -} detach_request_msg; - -int decode_detach_request(detach_request_msg *detachrequest, uint8_t *buffer, uint32_t len); - -int encode_detach_request(detach_request_msg *detachrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(DETACH_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.c deleted file mode 100644 index b4a1658c57a40ffd4ab4a2cc9db29ce9b29ccea0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.c +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DownlinkNasTransport.h" - -int decode_downlink_nas_transport(downlink_nas_transport_msg *downlink_nas_transport, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DOWNLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_nas_message_container(&downlink_nas_transport->nasmessagecontainer, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_downlink_nas_transport(downlink_nas_transport_msg *downlink_nas_transport, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DOWNLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_nas_message_container(&downlink_nas_transport->nasmessagecontainer, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.h deleted file mode 100644 index 4aaf43449b2e1b1dd5b623a0815165e9471e20b3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/DownlinkNasTransport.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "NasMessageContainer.h" - -#ifndef DOWNLINK_NAS_TRANSPORT_H_ -#define DOWNLINK_NAS_TRANSPORT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define DOWNLINK_NAS_TRANSPORT_MINIMUM_LENGTH ( \ - NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define DOWNLINK_NAS_TRANSPORT_MAXIMUM_LENGTH ( \ - NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH ) - - -/* - * Message name: Downlink NAS Transport - * Description: This message is sent by the network to the UE in order to carry an SMS message in encapsulated format. See table 8.2.12.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct downlink_nas_transport_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - NasMessageContainer nasmessagecontainer; -} downlink_nas_transport_msg; - -int decode_downlink_nas_transport(downlink_nas_transport_msg *downlinknastransport, uint8_t *buffer, uint32_t len); - -int encode_downlink_nas_transport(downlink_nas_transport_msg *downlinknastransport, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(DOWNLINK_NAS_TRANSPORT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.c deleted file mode 100644 index c7a041ed7d0473c01a43a0ffb3993d30f14700ac..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.c +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EmmInformation.h" - -int decode_emm_information(emm_information_msg *emm_information, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EMM_INFORMATION_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI: - if ((decoded_result = - decode_network_name(&emm_information->fullnamefornetwork, - EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - emm_information->presencemask |= EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT; - break; - - case EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI: - if ((decoded_result = - decode_network_name(&emm_information->shortnamefornetwork, - EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - emm_information->presencemask |= EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT; - break; - - case EMM_INFORMATION_LOCAL_TIME_ZONE_IEI: - if ((decoded_result = - decode_time_zone(&emm_information->localtimezone, - EMM_INFORMATION_LOCAL_TIME_ZONE_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - emm_information->presencemask |= EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT; - break; - - case EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI: - if ((decoded_result = - decode_time_zone_and_time(&emm_information->universaltimeandlocaltimezone, - EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - emm_information->presencemask |= EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT; - break; - - case EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI: - if ((decoded_result = - decode_daylight_saving_time(&emm_information->networkdaylightsavingtime, - EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - emm_information->presencemask |= EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_emm_information(emm_information_msg *emm_information, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EMM_INFORMATION_MINIMUM_LENGTH, len); - - if ((emm_information->presencemask & EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT) - == EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT) { - if ((encode_result = - encode_network_name(&emm_information->fullnamefornetwork, - EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((emm_information->presencemask & EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT) - == EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT) { - if ((encode_result = - encode_network_name(&emm_information->shortnamefornetwork, - EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((emm_information->presencemask & EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT) - == EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT) { - if ((encode_result = encode_time_zone(&emm_information->localtimezone, - EMM_INFORMATION_LOCAL_TIME_ZONE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((emm_information->presencemask & EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT) - == EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT) { - if ((encode_result = - encode_time_zone_and_time(&emm_information->universaltimeandlocaltimezone, - EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((emm_information->presencemask & EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT) - == EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT) { - if ((encode_result = - encode_daylight_saving_time(&emm_information->networkdaylightsavingtime, - EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.h deleted file mode 100644 index ce87feb4e7367ffbc670658449d0f8dc15fa97ef..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmInformation.h +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "NetworkName.h" -#include "TimeZone.h" -#include "TimeZoneAndTime.h" -#include "DaylightSavingTime.h" - -#ifndef EMM_INFORMATION_H_ -#define EMM_INFORMATION_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define EMM_INFORMATION_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define EMM_INFORMATION_MAXIMUM_LENGTH ( \ - NETWORK_NAME_MAXIMUM_LENGTH + \ - NETWORK_NAME_MAXIMUM_LENGTH + \ - TIME_ZONE_MAXIMUM_LENGTH + \ - TIME_ZONE_AND_TIME_MAXIMUM_LENGTH + \ - DAYLIGHT_SAVING_TIME_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT (1<<0) -# define EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT (1<<1) -# define EMM_INFORMATION_LOCAL_TIME_ZONE_PRESENT (1<<2) -# define EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_PRESENT (1<<3) -# define EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT (1<<4) - -typedef enum emm_information_iei_tag { - EMM_INFORMATION_FULL_NAME_FOR_NETWORK_IEI = 0x43, /* 0x43 = 67 */ - EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_IEI = 0x45, /* 0x45 = 69 */ - EMM_INFORMATION_LOCAL_TIME_ZONE_IEI = 0x46, /* 0x46 = 70 */ - EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_IEI = 0x47, /* 0x47 = 71 */ - EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_IEI = 0x49, /* 0x49 = 73 */ -} emm_information_iei; - -/* - * Message name: EMM information - * Description: This message is sent by the network at any time during EMM context is established to send certain information to the UE. See table 8.2.13.1. - * Significance: local - * Direction: network to UE - */ - -typedef struct emm_information_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - NetworkName fullnamefornetwork; - NetworkName shortnamefornetwork; - TimeZone localtimezone; - TimeZoneAndTime universaltimeandlocaltimezone; - DaylightSavingTime networkdaylightsavingtime; -} emm_information_msg; - -int decode_emm_information(emm_information_msg *emminformation, uint8_t *buffer, uint32_t len); - -int encode_emm_information(emm_information_msg *emminformation, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(EMM_INFORMATION_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.c deleted file mode 100644 index ec3154728bb49b5e3dd6673d7fd2807758ef5719..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.c +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EmmStatus.h" - -int decode_emm_status(emm_status_msg *emm_status, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EMM_STATUS_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_emm_cause(&emm_status->emmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_emm_status(emm_status_msg *emm_status, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EMM_STATUS_MINIMUM_LENGTH, len); - - if ((encode_result = encode_emm_cause(&emm_status->emmcause, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.h deleted file mode 100644 index 6fe769dac66579839a2489fffba13c9198cc8cd8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/EmmStatus.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EmmCause.h" - -#ifndef EMM_STATUS_H_ -#define EMM_STATUS_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define EMM_STATUS_MINIMUM_LENGTH ( \ - EMM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define EMM_STATUS_MAXIMUM_LENGTH ( \ - EMM_CAUSE_MAXIMUM_LENGTH ) - - -/* - * Message name: EMM status - * Description: This message is sent by the UE or by the network at any time to report certain error conditions listed in clause 7. See table 8.2.14.1. - * Significance: local - * Direction: both - */ - -typedef struct emm_status_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EmmCause emmcause; -} emm_status_msg; - -int decode_emm_status(emm_status_msg *emmstatus, uint8_t *buffer, uint32_t len); - -int encode_emm_status(emm_status_msg *emmstatus, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(EMM_STATUS_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.c deleted file mode 100644 index 85e337bc316d69d01fc6198b839bc16080772fc0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.c +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ExtendedServiceRequest.h" - -int decode_extended_service_request(extended_service_request_msg *extended_service_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_service_type(&extended_service_request->servicetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - if ((decoded_result = decode_u8_nas_key_set_identifier(&extended_service_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_mobile_identity(&extended_service_request->mtmsi, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_extended_service_request(extended_service_request_msg *extended_service_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_service_type(&extended_service_request->servicetype) & 0x0f) << 4) | (encode_u8_nas_key_set_identifier(&extended_service_request->naskeysetidentifier) & 0x0f); - encoded++; - - if ((encode_result = - encode_mobile_identity(&extended_service_request->mtmsi, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((encode_result = - encode_csfb_response(&extended_service_request->csfbresponse, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.h deleted file mode 100644 index 06d40edc195913aecb9ef21f0957e6ea482c4cdc..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ExtendedServiceRequest.h +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "ServiceType.h" -#include "NasKeySetIdentifier.h" -#include "MobileIdentity.h" -#include "CsfbResponse.h" - -#ifndef EXTENDED_SERVICE_REQUEST_H_ -#define EXTENDED_SERVICE_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH ( \ - SERVICE_TYPE_MINIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \ - MOBILE_IDENTITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define EXTENDED_SERVICE_REQUEST_MAXIMUM_LENGTH ( \ - SERVICE_TYPE_MAXIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \ - MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - CSFB_RESPONSE_MAXIMUM_LENGTH ) - - -/* - * Message name: Extended service request - * Description: This message is sent by the UE to the network to initiate a CS fallback call or respond to a mobile terminated CS fallback request from the network. See table 8.2.15.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct extended_service_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - ServiceType servicetype; - NasKeySetIdentifier naskeysetidentifier; - MobileIdentity mtmsi; - /* Optional fields */ - uint32_t presencemask; - CsfbResponse csfbresponse; -} extended_service_request_msg; - -int decode_extended_service_request(extended_service_request_msg *extendedservicerequest, uint8_t *buffer, uint32_t len); - -int encode_extended_service_request(extended_service_request_msg *extendedservicerequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(EXTENDED_SERVICE_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.c deleted file mode 100644 index e3f776413999f57b8059d417c960f0698628ab67..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.c +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "GutiReallocationCommand.h" - -int decode_guti_reallocation_command(guti_reallocation_command_msg *guti_reallocation_command, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, GUTI_REALLOCATION_COMMAND_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_eps_mobile_identity(&guti_reallocation_command->guti, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI: - if ((decoded_result = - decode_tracking_area_identity_list(&guti_reallocation_command->tailist, - GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI, buffer + decoded, - len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - guti_reallocation_command->presencemask |= GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_guti_reallocation_command(guti_reallocation_command_msg *guti_reallocation_command, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, GUTI_REALLOCATION_COMMAND_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_eps_mobile_identity(&guti_reallocation_command->guti, 0, buffer - + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((guti_reallocation_command->presencemask & GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT) - == GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT) { - if ((encode_result = - encode_tracking_area_identity_list(&guti_reallocation_command->tailist, - GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.h deleted file mode 100644 index 7e7ffb7636e145b8e0726878ed83c1941911e5d2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationCommand.h +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EpsMobileIdentity.h" -#include "TrackingAreaIdentityList.h" - -#ifndef GUTI_REALLOCATION_COMMAND_H_ -#define GUTI_REALLOCATION_COMMAND_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define GUTI_REALLOCATION_COMMAND_MINIMUM_LENGTH ( \ - EPS_MOBILE_IDENTITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define GUTI_REALLOCATION_COMMAND_MAXIMUM_LENGTH ( \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT (1<<0) - -typedef enum guti_reallocation_command_iei_tag { - GUTI_REALLOCATION_COMMAND_TAI_LIST_IEI = 0x54, /* 0x54 = 84 */ -} guti_reallocation_command_iei; - -/* - * Message name: GUTI reallocation command - * Description: This message is sent by the network to the UE to reallocate a GUTI and optionally to provide a new TAI list. See table 8.2.16.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct guti_reallocation_command_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EpsMobileIdentity guti; - /* Optional fields */ - uint32_t presencemask; - TrackingAreaIdentityList tailist; -} guti_reallocation_command_msg; - -int decode_guti_reallocation_command(guti_reallocation_command_msg *gutireallocationcommand, uint8_t *buffer, uint32_t len); - -int encode_guti_reallocation_command(guti_reallocation_command_msg *gutireallocationcommand, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(GUTI_REALLOCATION_COMMAND_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.c deleted file mode 100644 index 8c3b0ed9ff21bb9b787d4b2422c144a02e7b6dbe..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.c +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "GutiReallocationComplete.h" - -int decode_guti_reallocation_complete(guti_reallocation_complete_msg *guti_reallocation_complete, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, GUTI_REALLOCATION_COMPLETE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - return decoded; -} - -int encode_guti_reallocation_complete(guti_reallocation_complete_msg *guti_reallocation_complete, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, GUTI_REALLOCATION_COMPLETE_MINIMUM_LENGTH, len); - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.h deleted file mode 100644 index 977e51709aee856e2c762560d0bff44292275b0e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/GutiReallocationComplete.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" - -#ifndef GUTI_REALLOCATION_COMPLETE_H_ -#define GUTI_REALLOCATION_COMPLETE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define GUTI_REALLOCATION_COMPLETE_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define GUTI_REALLOCATION_COMPLETE_MAXIMUM_LENGTH (0) - -/* - * Message name: GUTI reallocation complete - * Description: This message is sent by the UE to the network to indicate that reallocation of a GUTI has taken place. See table 8.2.17.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct guti_reallocation_complete_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; -} guti_reallocation_complete_msg; - -int decode_guti_reallocation_complete(guti_reallocation_complete_msg *gutireallocationcomplete, uint8_t *buffer, uint32_t len); - -int encode_guti_reallocation_complete(guti_reallocation_complete_msg *gutireallocationcomplete, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(GUTI_REALLOCATION_COMPLETE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.c deleted file mode 100644 index 3aafece930616b7d6d92ac4034728ceb567d1c2c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.c +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "IdentityRequest.h" - -int decode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, IDENTITY_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_identity_type_2(&identity_request->identitytype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - decoded++; - return decoded; -} - -int encode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IDENTITY_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = encode_u8_identity_type_2(&identity_request->identitytype) & 0x0f; - encoded++; - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.h deleted file mode 100644 index 18462533894991044dc014936e29123ca36f339a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityRequest.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "IdentityType2.h" - -#ifndef IDENTITY_REQUEST_H_ -#define IDENTITY_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define IDENTITY_REQUEST_MINIMUM_LENGTH ( \ - IDENTITY_TYPE_2_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define IDENTITY_REQUEST_MAXIMUM_LENGTH ( \ - IDENTITY_TYPE_2_MAXIMUM_LENGTH ) - - -/* - * Message name: Identity request - * Description: This message is sent by the network to the UE to request the UE to provide the specified identity. See table 8.2.18.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct identity_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - IdentityType2 identitytype; -} identity_request_msg; - -int decode_identity_request(identity_request_msg *identityrequest, uint8_t *buffer, uint32_t len); - -int encode_identity_request(identity_request_msg *identityrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(IDENTITY_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.c deleted file mode 100644 index bbef1794f76d9c22fafe300db6c2413fb5519468..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.c +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "IdentityResponse.h" - -int decode_identity_response(identity_response_msg *identity_response, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, IDENTITY_RESPONSE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_mobile_identity(&identity_response->mobileidentity, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_identity_response(identity_response_msg *identity_response, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IDENTITY_RESPONSE_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_mobile_identity(&identity_response->mobileidentity, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.h deleted file mode 100644 index cf58487f947a0a1fb14317111d1946b2bdc55c1d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/IdentityResponse.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "MobileIdentity.h" - -#ifndef IDENTITY_RESPONSE_H_ -#define IDENTITY_RESPONSE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define IDENTITY_RESPONSE_MINIMUM_LENGTH ( \ - MOBILE_IDENTITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define IDENTITY_RESPONSE_MAXIMUM_LENGTH ( \ - MOBILE_IDENTITY_MAXIMUM_LENGTH ) - - -/* - * Message name: Identity response - * Description: This message is sent by the UE to the network in response to an IDENTITY REQUEST message and provides the requested identity. See table 8.2.19.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct identity_response_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - MobileIdentity mobileidentity; -} identity_response_msg; - -int decode_identity_response(identity_response_msg *identityresponse, uint8_t *buffer, uint32_t len); - -int encode_identity_response(identity_response_msg *identityresponse, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(IDENTITY_RESPONSE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/Makefile b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/Makefile deleted file mode 100644 index 0b434ba8ab44b42a7e41712cf1d037f8b6dcb5c6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) - -TARGET = $(LIBEMMMSG) -TARGETS = $(TARGET).a $(TARGET).so - -all: $(TARGETS) - -%.o: %.c %.h Makefile $(LIBDIR)/$(LIBIES).a $(UTILDIR)/TLVEncoder.h $(UTILDIR)/TLVDecoder.h - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET).a: $(OBJS) - @$(RM) $@ - @$(AR) $(ARFLAGS) $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -$(TARGET).so: $(OBJS) - @$(LD) -G -o $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -clean: - $(RM) $(OBJS) .bak *~ - -veryclean: clean - $(RM) $(TARGETS) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeCommand.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeCommand.h deleted file mode 100644 index 96bef59660df215c2c8edcd1b040ce274ff090e8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeCommand.h +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "NasSecurityAlgorithms.h" -#include "NasKeySetIdentifier.h" -#include "UeSecurityCapability.h" -#include "ImeisvRequest.h" -#include "Nonce.h" - -#ifndef NAS_SECURITY_MODE_COMMAND_H_ -#define NAS_SECURITY_MODE_COMMAND_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define SECURITY_MODE_COMMAND_MINIMUM_LENGTH ( \ - NAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \ - UE_SECURITY_CAPABILITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define SECURITY_MODE_COMMAND_MAXIMUM_LENGTH ( \ - NAS_SECURITY_ALGORITHMS_MAXIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \ - UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH + \ - IMEISV_REQUEST_MAXIMUM_LENGTH + \ - NONCE_MAXIMUM_LENGTH + \ - NONCE_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT (1<<0) -# define SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT (1<<1) -# define SECURITY_MODE_COMMAND_NONCEMME_PRESENT (1<<2) - -typedef enum security_mode_command_iei_tag { - SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI = 0xC0, /* 0xC0 = 192 */ - SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI = 0x55, /* 0x55 = 85 */ - SECURITY_MODE_COMMAND_NONCEMME_IEI = 0x56, /* 0x56 = 86 */ -} security_mode_command_iei; - -/* - * Message name: Security mode command - * Description: This message is sent by the network to the UE to establish NAS signalling security. See table 8.2.20.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct security_mode_command_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - NasSecurityAlgorithms selectednassecurityalgorithms; - NasKeySetIdentifier naskeysetidentifier; - UeSecurityCapability replayeduesecuritycapabilities; - /* Optional fields */ - uint32_t presencemask; - ImeisvRequest imeisvrequest; - Nonce replayednonceue; - Nonce noncemme; -} security_mode_command_msg; - -int decode_security_mode_command(security_mode_command_msg *securitymodecommand, uint8_t *buffer, uint32_t len); - -int encode_security_mode_command(security_mode_command_msg *securitymodecommand, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(NAS_SECURITY_MODE_COMMAND_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeComplete.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeComplete.h deleted file mode 100644 index 5643e0ef8acb48e32714d13384f9e7b4ac3f0bc4..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/NASSecurityModeComplete.h +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "MobileIdentity.h" - -#ifndef SECURITY_MODE_COMPLETE_H_ -#define SECURITY_MODE_COMPLETE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define SECURITY_MODE_COMPLETE_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH ( \ - MOBILE_IDENTITY_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define SECURITY_MODE_COMPLETE_IMEISV_PRESENT (1<<0) - -typedef enum security_mode_complete_iei_tag { - SECURITY_MODE_COMPLETE_IMEISV_IEI = 0x23, /* 0x23 = 35 */ -} security_mode_complete_iei; - -/* - * Message name: Security mode complete - * Description: This message is sent by the UE to the network in response to a SECURITY MODE COMMAND message. See table 8.2.21.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct security_mode_complete_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - MobileIdentity imeisv; -} security_mode_complete_msg; - -int decode_security_mode_complete(security_mode_complete_msg *securitymodecomplete, uint8_t *buffer, uint32_t len); - -int encode_security_mode_complete(security_mode_complete_msg *securitymodecomplete, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(SECURITY_MODE_COMPLETE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeCommand.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeCommand.c deleted file mode 100644 index 60946cd4ea6ccdf38780c70d03c813121a446a24..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeCommand.c +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "NASSecurityModeCommand.h" - -int decode_security_mode_command(security_mode_command_msg *security_mode_command, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SECURITY_MODE_COMMAND_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_nas_security_algorithms(&security_mode_command->selectednassecurityalgorithms, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_u8_nas_key_set_identifier(&security_mode_command->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_ue_security_capability(&security_mode_command->replayeduesecuritycapabilities, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI: - if ((decoded_result = - decode_imeisv_request(&security_mode_command->imeisvrequest, - SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI, buffer + decoded, - len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - security_mode_command->presencemask |= SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; - break; - - case SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI: - if ((decoded_result = - decode_nonce(&security_mode_command->replayednonceue, - SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - security_mode_command->presencemask |= SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT; - break; - - case SECURITY_MODE_COMMAND_NONCEMME_IEI: - if ((decoded_result = - decode_nonce(&security_mode_command->noncemme, - SECURITY_MODE_COMMAND_NONCEMME_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - security_mode_command->presencemask |= SECURITY_MODE_COMMAND_NONCEMME_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_security_mode_command(security_mode_command_msg *security_mode_command, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMMAND_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_nas_security_algorithms(&security_mode_command->selectednassecurityalgorithms, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - *(buffer + encoded) = (encode_u8_nas_key_set_identifier(&security_mode_command->naskeysetidentifier) & 0x0f); - encoded++; - - if ((encode_result = - encode_ue_security_capability(&security_mode_command->replayeduesecuritycapabilities, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((security_mode_command->presencemask & SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT) - == SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT) { - if ((encode_result = - encode_imeisv_request(&security_mode_command->imeisvrequest, - SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((security_mode_command->presencemask & SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT) - == SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_PRESENT) { - if ((encode_result = - encode_nonce(&security_mode_command->replayednonceue, - SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((security_mode_command->presencemask & SECURITY_MODE_COMMAND_NONCEMME_PRESENT) - == SECURITY_MODE_COMMAND_NONCEMME_PRESENT) { - if ((encode_result = encode_nonce(&security_mode_command->noncemme, - SECURITY_MODE_COMMAND_NONCEMME_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeComplete.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeComplete.c deleted file mode 100644 index 971f94f05f12670d3a8bc0a0a64a2d6f95819c87..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeComplete.c +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "NASSecurityModeComplete.h" - -int decode_security_mode_complete(security_mode_complete_msg *security_mode_complete, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case SECURITY_MODE_COMPLETE_IMEISV_IEI: - if ((decoded_result = - decode_mobile_identity(&security_mode_complete->imeisv, - SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - security_mode_complete->presencemask |= SECURITY_MODE_COMPLETE_IMEISV_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_security_mode_complete(security_mode_complete_msg *security_mode_complete, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len); - - if ((security_mode_complete->presencemask & SECURITY_MODE_COMPLETE_IMEISV_PRESENT) - == SECURITY_MODE_COMPLETE_IMEISV_PRESENT) { - if ((encode_result = - encode_mobile_identity(&security_mode_complete->imeisv, - SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.c deleted file mode 100644 index 6347772667801fb587ee49d6a873668d085ae68b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.c +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "SecurityModeReject.h" - -int decode_security_mode_reject(security_mode_reject_msg *security_mode_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SECURITY_MODE_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_emm_cause(&security_mode_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_security_mode_reject(security_mode_reject_msg *security_mode_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = encode_emm_cause(&security_mode_reject->emmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.h deleted file mode 100644 index 6dcbeea3795eb3139752b38cc9211a250fb0937f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/SecurityModeReject.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EmmCause.h" - -#ifndef SECURITY_MODE_REJECT_H_ -#define SECURITY_MODE_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define SECURITY_MODE_REJECT_MINIMUM_LENGTH ( \ - EMM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define SECURITY_MODE_REJECT_MAXIMUM_LENGTH ( \ - EMM_CAUSE_MAXIMUM_LENGTH ) - - -/* - * Message name: Security mode reject - * Description: This message is sent by the UE to the network to indicate that the corresponding security mode command has been rejected. See table 8.2.22.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct security_mode_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EmmCause emmcause; -} security_mode_reject_msg; - -int decode_security_mode_reject(security_mode_reject_msg *securitymodereject, uint8_t *buffer, uint32_t len); - -int encode_security_mode_reject(security_mode_reject_msg *securitymodereject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(SECURITY_MODE_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.c deleted file mode 100644 index 21a2d8a2ba02a91919c93a65cbbfb62c08096cdf..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.c +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ServiceReject.h" - -int decode_service_reject(service_reject_msg *service_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SERVICE_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_emm_cause(&service_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_service_reject(service_reject_msg *service_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SERVICE_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = encode_emm_cause(&service_reject->emmcause, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((encode_result = encode_gprs_timer(&service_reject->t3442value, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.h deleted file mode 100644 index acafd9247b37eea84a1552407d7c5743d0d5594c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceReject.h +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EmmCause.h" -#include "GprsTimer.h" - -#ifndef SERVICE_REJECT_H_ -#define SERVICE_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define SERVICE_REJECT_MINIMUM_LENGTH ( \ - EMM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define SERVICE_REJECT_MAXIMUM_LENGTH ( \ - EMM_CAUSE_MAXIMUM_LENGTH + \ - GPRS_TIMER_MAXIMUM_LENGTH ) - - -/* - * Message name: Service reject - * Description: This message is sent by the network to the UE in order to reject the service request procedure. See table 8.2.24.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct service_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EmmCause emmcause; - /* Optional fields */ - uint32_t presencemask; - GprsTimer t3442value; -} service_reject_msg; - -int decode_service_reject(service_reject_msg *servicereject, uint8_t *buffer, uint32_t len); - -int encode_service_reject(service_reject_msg *servicereject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(SERVICE_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.c deleted file mode 100644 index 28e22b773d07c2ba06ba45c585d3e5c53f59a502..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.c +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ServiceRequest.h" - -int decode_service_request(service_request_msg *service_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - LOG_FUNC_IN; - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SERVICE_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_ksi_and_sequence_number(&service_request->ksiandsequencenumber, 0, buffer + decoded, len - decoded)) < 0) - LOG_FUNC_RETURN(decoded_result); - else - decoded += decoded_result; - - if ((decoded_result = decode_short_mac(&service_request->messageauthenticationcode, 0, buffer + decoded, len - decoded)) < 0) - LOG_FUNC_RETURN(decoded_result); - else - decoded += decoded_result; - - LOG_FUNC_RETURN(decoded); -} - -int encode_service_request(service_request_msg *service_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - LOG_FUNC_IN; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SERVICE_REQUEST_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_ksi_and_sequence_number(&service_request->ksiandsequencenumber, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - LOG_FUNC_RETURN(encode_result); - else - encoded += encode_result; - - if ((encode_result = - encode_short_mac(&service_request->messageauthenticationcode, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - LOG_FUNC_RETURN(encode_result); - else - encoded += encode_result; - - LOG_FUNC_RETURN(encoded); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.h deleted file mode 100644 index 7f8f78f95d47b8203d63b1c5ab32084eb557c7b0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/ServiceRequest.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "KsiAndSequenceNumber.h" -#include "ShortMac.h" - -#ifndef SERVICE_REQUEST_H_ -#define SERVICE_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define SERVICE_REQUEST_MINIMUM_LENGTH ( \ - KSI_AND_SEQUENCE_NUMBER_MINIMUM_LENGTH + \ - SHORT_MAC_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define SERVICE_REQUEST_MAXIMUM_LENGTH ( \ - KSI_AND_SEQUENCE_NUMBER_MAXIMUM_LENGTH + \ - SHORT_MAC_MAXIMUM_LENGTH ) - - -/* - * Message name: Service request - * Description: This message is sent by the UE to the network to request the establishment of a NAS signalling connection and of the radio and S1 bearers. Its structure does not follow the structure of a standard layer 3 message. See table 8.2.25.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct service_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - KsiAndSequenceNumber ksiandsequencenumber; - ShortMac messageauthenticationcode; -} service_request_msg; - -int decode_service_request(service_request_msg *servicerequest, uint8_t *buffer, uint32_t len); - -int encode_service_request(service_request_msg *servicerequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(SERVICE_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.c deleted file mode 100644 index 267534f18a3884b28efe92bf2f69e91c2508eefe..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.c +++ /dev/null @@ -1,396 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrackingAreaUpdateAccept.h" - -int decode_tracking_area_update_accept(tracking_area_update_accept_msg *tracking_area_update_accept, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_ACCEPT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_eps_update_result(&tracking_area_update_accept->epsupdateresult, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - decoded++; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI: - if ((decoded_result = - decode_gprs_timer(&tracking_area_update_accept->t3412value, - TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI: - if ((decoded_result = - decode_eps_mobile_identity(&tracking_area_update_accept->guti, - TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI, buffer + decoded, len - - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI: - if ((decoded_result = - decode_tracking_area_identity_list(&tracking_area_update_accept->tailist, - TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI, buffer + decoded, - len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI: - if ((decoded_result = - decode_eps_bearer_context_status(&tracking_area_update_accept->epsbearercontextstatus, - TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI: - if ((decoded_result = - decode_location_area_identification(&tracking_area_update_accept->locationareaidentification, - TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI: - if ((decoded_result = - decode_mobile_identity(&tracking_area_update_accept->msidentity, - TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI: - if ((decoded_result = - decode_emm_cause(&tracking_area_update_accept->emmcause, - TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI: - if ((decoded_result = - decode_gprs_timer(&tracking_area_update_accept->t3402value, - TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI: - if ((decoded_result = - decode_gprs_timer(&tracking_area_update_accept->t3423value, - TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI: - if ((decoded_result = - decode_plmn_list(&tracking_area_update_accept->equivalentplmns, - TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI: - if ((decoded_result = - decode_emergency_number_list(&tracking_area_update_accept->emergencynumberlist, - TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI: - if ((decoded_result = - decode_eps_network_feature_support(&tracking_area_update_accept->epsnetworkfeaturesupport, - TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT; - break; - - case TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI: - if ((decoded_result = - decode_additional_update_result(&tracking_area_update_accept->additionalupdateresult, - TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_accept->presencemask |= TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_tracking_area_update_accept(tracking_area_update_accept_msg *tracking_area_update_accept, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_ACCEPT_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_eps_update_result(&tracking_area_update_accept->epsupdateresult) & 0x0f) << 4) | 0x00; - encoded++; - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT) { - if ((encode_result = - encode_gprs_timer(&tracking_area_update_accept->t3412value, - TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT) { - if ((encode_result = - encode_eps_mobile_identity(&tracking_area_update_accept->guti, - TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT) { - if ((encode_result = - encode_tracking_area_identity_list(&tracking_area_update_accept->tailist, - TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT) { - if ((encode_result = - encode_eps_bearer_context_status(&tracking_area_update_accept->epsbearercontextstatus, - TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI, buffer - + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT) { - if ((encode_result = - encode_location_area_identification(&tracking_area_update_accept->locationareaidentification, - TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT) { - if ((encode_result = - encode_mobile_identity(&tracking_area_update_accept->msidentity, - TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT) { - if ((encode_result = - encode_emm_cause(&tracking_area_update_accept->emmcause, - TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT) { - if ((encode_result = - encode_gprs_timer(&tracking_area_update_accept->t3402value, - TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT) { - if ((encode_result = - encode_gprs_timer(&tracking_area_update_accept->t3423value, - TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT) { - if ((encode_result = - encode_plmn_list(&tracking_area_update_accept->equivalentplmns, - TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT) { - if ((encode_result = - encode_emergency_number_list(&tracking_area_update_accept->emergencynumberlist, - TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT) { - if ((encode_result = - encode_eps_network_feature_support(&tracking_area_update_accept->epsnetworkfeaturesupport, - TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_accept->presencemask & TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT) - == TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT) { - if ((encode_result = - encode_additional_update_result(&tracking_area_update_accept->additionalupdateresult, - TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.h deleted file mode 100644 index 1765f38836452a099291bc7c31cb2cd3cf9625bf..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateAccept.h +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EpsUpdateResult.h" -#include "GprsTimer.h" -#include "EpsMobileIdentity.h" -#include "TrackingAreaIdentityList.h" -#include "EpsBearerContextStatus.h" -#include "LocationAreaIdentification.h" -#include "MobileIdentity.h" -#include "EmmCause.h" -#include "PlmnList.h" -#include "EmergencyNumberList.h" -#include "EpsNetworkFeatureSupport.h" -#include "AdditionalUpdateResult.h" - -#ifndef TRACKING_AREA_UPDATE_ACCEPT_H_ -#define TRACKING_AREA_UPDATE_ACCEPT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define TRACKING_AREA_UPDATE_ACCEPT_MINIMUM_LENGTH ( \ - EPS_UPDATE_RESULT_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define TRACKING_AREA_UPDATE_ACCEPT_MAXIMUM_LENGTH ( \ - EPS_UPDATE_RESULT_MAXIMUM_LENGTH + \ - GPRS_TIMER_MAXIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH + \ - EPS_BEARER_CONTEXT_STATUS_MAXIMUM_LENGTH + \ - LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \ - MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - EMM_CAUSE_MAXIMUM_LENGTH + \ - GPRS_TIMER_MAXIMUM_LENGTH + \ - GPRS_TIMER_MAXIMUM_LENGTH + \ - PLMN_LIST_MAXIMUM_LENGTH + \ - EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH + \ - EPS_NETWORK_FEATURE_SUPPORT_MAXIMUM_LENGTH + \ - ADDITIONAL_UPDATE_RESULT_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_PRESENT (1<<0) -# define TRACKING_AREA_UPDATE_ACCEPT_GUTI_PRESENT (1<<1) -# define TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_PRESENT (1<<2) -# define TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT (1<<3) -# define TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<4) -# define TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_PRESENT (1<<5) -# define TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_PRESENT (1<<6) -# define TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_PRESENT (1<<7) -# define TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_PRESENT (1<<8) -# define TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_PRESENT (1<<9) -# define TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_PRESENT (1<<10) -# define TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_PRESENT (1<<11) -# define TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_PRESENT (1<<12) - -typedef enum tracking_area_update_accept_iei_tag { - TRACKING_AREA_UPDATE_ACCEPT_T3412_VALUE_IEI = 0x5A, /* 0x5A = 90 */ - TRACKING_AREA_UPDATE_ACCEPT_GUTI_IEI = 0x50, /* 0x50 = 80 */ - TRACKING_AREA_UPDATE_ACCEPT_TAI_LIST_IEI = 0x54, /* 0x54 = 84 */ - TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_IEI = 0x57, /* 0x57 = 87 */ - TRACKING_AREA_UPDATE_ACCEPT_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */ - TRACKING_AREA_UPDATE_ACCEPT_MS_IDENTITY_IEI = 0x23, /* 0x23 = 35 */ - TRACKING_AREA_UPDATE_ACCEPT_EMM_CAUSE_IEI = 0x53, /* 0x53 = 83 */ - TRACKING_AREA_UPDATE_ACCEPT_T3402_VALUE_IEI = 0x17, /* 0x17 = 23 */ - TRACKING_AREA_UPDATE_ACCEPT_T3423_VALUE_IEI = 0x59, /* 0x59 = 89 */ - TRACKING_AREA_UPDATE_ACCEPT_EQUIVALENT_PLMNS_IEI = 0x4A, /* 0x4A = 74 */ - TRACKING_AREA_UPDATE_ACCEPT_EMERGENCY_NUMBER_LIST_IEI = 0x34, /* 0x34 = 52 */ - TRACKING_AREA_UPDATE_ACCEPT_EPS_NETWORK_FEATURE_SUPPORT_IEI = 0x64, /* 0x64 = 100 */ - TRACKING_AREA_UPDATE_ACCEPT_ADDITIONAL_UPDATE_RESULT_IEI = 0xF0, /* 0xF0 = 240 */ -} tracking_area_update_accept_iei; - -/* - * Message name: Tracking area update accept - * Description: This message is sent by the network to the UE to provide the UE with EPS mobility management related data in response to a tracking area update request message. See table 8.2.26.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct tracking_area_update_accept_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EpsUpdateResult epsupdateresult; - /* Optional fields */ - uint32_t presencemask; - GprsTimer t3412value; - EpsMobileIdentity guti; - TrackingAreaIdentityList tailist; - EpsBearerContextStatus epsbearercontextstatus; - LocationAreaIdentification locationareaidentification; - MobileIdentity msidentity; - EmmCause emmcause; - GprsTimer t3402value; - GprsTimer t3423value; - PlmnList equivalentplmns; - EmergencyNumberList emergencynumberlist; - EpsNetworkFeatureSupport epsnetworkfeaturesupport; - AdditionalUpdateResult additionalupdateresult; -} tracking_area_update_accept_msg; - -int decode_tracking_area_update_accept(tracking_area_update_accept_msg *trackingareaupdateaccept, uint8_t *buffer, uint32_t len); - -int encode_tracking_area_update_accept(tracking_area_update_accept_msg *trackingareaupdateaccept, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(TRACKING_AREA_UPDATE_ACCEPT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.c deleted file mode 100644 index 6ef5b1adcb586befd79e32c9878f215b39810629..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.c +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrackingAreaUpdateComplete.h" - -int decode_tracking_area_update_complete(tracking_area_update_complete_msg *tracking_area_update_complete, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_COMPLETE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - return decoded; -} - -int encode_tracking_area_update_complete(tracking_area_update_complete_msg *tracking_area_update_complete, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_COMPLETE_MINIMUM_LENGTH, len); - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.h deleted file mode 100644 index 3ebb3fe6fb477b0f371a34e8695ca379b28d6eee..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateComplete.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" - -#ifndef TRACKING_AREA_UPDATE_COMPLETE_H_ -#define TRACKING_AREA_UPDATE_COMPLETE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define TRACKING_AREA_UPDATE_COMPLETE_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define TRACKING_AREA_UPDATE_COMPLETE_MAXIMUM_LENGTH (0) - -/* - * Message name: Tracking area update complete - * Description: This message shall be sent by the UE to the network in response to a tracking area update accept message if a GUTI has been changed or a new TMSI has been assigned. See table 8.2.27.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct tracking_area_update_complete_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; -} tracking_area_update_complete_msg; - -int decode_tracking_area_update_complete(tracking_area_update_complete_msg *trackingareaupdatecomplete, uint8_t *buffer, uint32_t len); - -int encode_tracking_area_update_complete(tracking_area_update_complete_msg *trackingareaupdatecomplete, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(TRACKING_AREA_UPDATE_COMPLETE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.c deleted file mode 100644 index ebb6ffd3768c31b6a072c55f0a3f59dcb15fe54a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.c +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrackingAreaUpdateReject.h" - -int decode_tracking_area_update_reject(tracking_area_update_reject_msg *tracking_area_update_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_emm_cause(&tracking_area_update_reject->emmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_tracking_area_update_reject(tracking_area_update_reject_msg *tracking_area_update_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_emm_cause(&tracking_area_update_reject->emmcause, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.h deleted file mode 100644 index 56452a58d4988d67196243fd4d719dfeac365ce7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateReject.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EmmCause.h" - -#ifndef TRACKING_AREA_UPDATE_REJECT_H_ -#define TRACKING_AREA_UPDATE_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define TRACKING_AREA_UPDATE_REJECT_MINIMUM_LENGTH ( \ - EMM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define TRACKING_AREA_UPDATE_REJECT_MAXIMUM_LENGTH ( \ - EMM_CAUSE_MAXIMUM_LENGTH ) - - -/* - * Message name: Tracking area update reject - * Description: This message is sent by the network to the UE in order to reject the tracking area updating procedure. See table 8.2.28.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct tracking_area_update_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EmmCause emmcause; -} tracking_area_update_reject_msg; - -int decode_tracking_area_update_reject(tracking_area_update_reject_msg *trackingareaupdatereject, uint8_t *buffer, uint32_t len); - -int encode_tracking_area_update_reject(tracking_area_update_reject_msg *trackingareaupdatereject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(TRACKING_AREA_UPDATE_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.c deleted file mode 100644 index ca614ce1afa7d21bf2a2fd4ee6519470c0716565..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.c +++ /dev/null @@ -1,532 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrackingAreaUpdateRequest.h" - -int decode_tracking_area_update_request(tracking_area_update_request_msg *tracking_area_update_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - if ((decoded_result = decode_u8_nas_key_set_identifier(&tracking_area_update_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_eps_mobile_identity(&tracking_area_update_request->oldguti, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI: - if ((decoded_result = - decode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier, - TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI: - if ((decoded_result = - decode_ciphering_key_sequence_number(&tracking_area_update_request->gprscipheringkeysequencenumber, - TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI: - if ((decoded_result = - decode_p_tmsi_signature(&tracking_area_update_request->oldptmsisignature, - TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI: - if ((decoded_result = - decode_eps_mobile_identity(&tracking_area_update_request->additionalguti, - TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI: - if ((decoded_result = - decode_nonce(&tracking_area_update_request->nonceue, - TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI, buffer + decoded, - len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI: - if ((decoded_result = - decode_ue_network_capability(&tracking_area_update_request->uenetworkcapability, - TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI: - if ((decoded_result = - decode_tracking_area_identity(&tracking_area_update_request->lastvisitedregisteredtai, - TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI: - if ((decoded_result = - decode_drx_parameter(&tracking_area_update_request->drxparameter, - TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI: - if ((decoded_result = - decode_ue_radio_capability_information_update_needed(&tracking_area_update_request->ueradiocapabilityinformationupdateneeded, - TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI: - if ((decoded_result = - decode_eps_bearer_context_status(&tracking_area_update_request->epsbearercontextstatus, - TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI: - if ((decoded_result = - decode_ms_network_capability(&tracking_area_update_request->msnetworkcapability, - TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI: - if ((decoded_result = - decode_location_area_identification(&tracking_area_update_request->oldlocationareaidentification, - TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI: - if ((decoded_result = - decode_tmsi_status(&tracking_area_update_request->tmsistatus, - TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI: - if ((decoded_result = - decode_mobile_station_classmark_2(&tracking_area_update_request->mobilestationclassmark2, - TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI: - if ((decoded_result = - decode_mobile_station_classmark_3(&tracking_area_update_request->mobilestationclassmark3, - TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI: - if ((decoded_result = - decode_supported_codec_list(&tracking_area_update_request->supportedcodecs, - TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI: - if ((decoded_result = - decode_additional_update_type(&tracking_area_update_request->additionalupdatetype, - TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT; - break; - - case TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI: - if ((decoded_result = - decode_guti_type(&tracking_area_update_request->oldgutitype, - TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - tracking_area_update_request->presencemask |= TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_tracking_area_update_request(tracking_area_update_request_msg *tracking_area_update_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype) & 0x0f) << 4) | (encode_u8_nas_key_set_identifier( - &tracking_area_update_request->naskeysetidentifier) & 0x0f); - encoded++; - - if ((encode_result = - encode_eps_mobile_identity(&tracking_area_update_request->oldguti, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT) { - if ((encode_result = - encode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier, - TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT) { - if ((encode_result = - encode_ciphering_key_sequence_number(&tracking_area_update_request->gprscipheringkeysequencenumber, - TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT) { - if ((encode_result = - encode_p_tmsi_signature(&tracking_area_update_request->oldptmsisignature, - TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT) { - if ((encode_result = - encode_eps_mobile_identity(&tracking_area_update_request->additionalguti, - TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT) { - if ((encode_result = - encode_nonce(&tracking_area_update_request->nonceue, - TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT) { - if ((encode_result = - encode_ue_network_capability(&tracking_area_update_request->uenetworkcapability, - TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) { - if ((encode_result = - encode_tracking_area_identity(&tracking_area_update_request->lastvisitedregisteredtai, - TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT) { - if ((encode_result = - encode_drx_parameter(&tracking_area_update_request->drxparameter, - TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT) { - if ((encode_result = - encode_ue_radio_capability_information_update_needed(&tracking_area_update_request->ueradiocapabilityinformationupdateneeded, - TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT) { - if ((encode_result = - encode_eps_bearer_context_status(&tracking_area_update_request->epsbearercontextstatus, - TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI, buffer - + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) { - if ((encode_result = - encode_ms_network_capability(&tracking_area_update_request->msnetworkcapability, - TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT) { - if ((encode_result = - encode_location_area_identification(&tracking_area_update_request->oldlocationareaidentification, - TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT) { - if ((encode_result = - encode_tmsi_status(&tracking_area_update_request->tmsistatus, - TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT) { - if ((encode_result = - encode_mobile_station_classmark_2(&tracking_area_update_request->mobilestationclassmark2, - TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT) { - if ((encode_result = - encode_mobile_station_classmark_3(&tracking_area_update_request->mobilestationclassmark3, - TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT) { - if ((encode_result = - encode_supported_codec_list(&tracking_area_update_request->supportedcodecs, - TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT) { - if ((encode_result = - encode_additional_update_type(&tracking_area_update_request->additionalupdatetype, - TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT) - == TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT) { - if ((encode_result = - encode_guti_type(&tracking_area_update_request->oldgutitype, - TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.h deleted file mode 100644 index d8ce48027b1dc74dc572edffe51960f8525a310b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/TrackingAreaUpdateRequest.h +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "EpsUpdateType.h" -#include "NasKeySetIdentifier.h" -#include "EpsMobileIdentity.h" -#include "CipheringKeySequenceNumber.h" -#include "PTmsiSignature.h" -#include "Nonce.h" -#include "UeNetworkCapability.h" -#include "TrackingAreaIdentity.h" -#include "DrxParameter.h" -#include "UeRadioCapabilityInformationUpdateNeeded.h" -#include "EpsBearerContextStatus.h" -#include "MsNetworkCapability.h" -#include "LocationAreaIdentification.h" -#include "TmsiStatus.h" -#include "MobileStationClassmark2.h" -#include "MobileStationClassmark3.h" -#include "SupportedCodecList.h" -#include "AdditionalUpdateType.h" -#include "GutiType.h" - -#ifndef TRACKING_AREA_UPDATE_REQUEST_H_ -#define TRACKING_AREA_UPDATE_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH ( \ - EPS_UPDATE_TYPE_MINIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define TRACKING_AREA_UPDATE_REQUEST_MAXIMUM_LENGTH ( \ - EPS_UPDATE_TYPE_MAXIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \ - CIPHERING_KEY_SEQUENCE_NUMBER_MAXIMUM_LENGTH + \ - P_TMSI_SIGNATURE_MAXIMUM_LENGTH + \ - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \ - NONCE_MAXIMUM_LENGTH + \ - UE_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \ - TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH + \ - DRX_PARAMETER_MAXIMUM_LENGTH + \ - UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_MAXIMUM_LENGTH + \ - EPS_BEARER_CONTEXT_STATUS_MAXIMUM_LENGTH + \ - MS_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \ - LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH + \ - TMSI_STATUS_MAXIMUM_LENGTH + \ - MOBILE_STATION_CLASSMARK_2_MAXIMUM_LENGTH + \ - MOBILE_STATION_CLASSMARK_3_MAXIMUM_LENGTH + \ - SUPPORTED_CODEC_LIST_MAXIMUM_LENGTH + \ - ADDITIONAL_UPDATE_TYPE_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT (1<<0) -# define TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_PRESENT (1<<1) -# define TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_PRESENT (1<<2) -# define TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_PRESENT (1<<3) -# define TRACKING_AREA_UPDATE_REQUEST_NONCEUE_PRESENT (1<<4) -# define TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT (1<<5) -# define TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT (1<<6) -# define TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_PRESENT (1<<7) -# define TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_PRESENT (1<<8) -# define TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT (1<<9) -# define TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT (1<<10) -# define TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_PRESENT (1<<11) -# define TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_PRESENT (1<<12) -# define TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_PRESENT (1<<13) -# define TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_PRESENT (1<<14) -# define TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_PRESENT (1<<15) -# define TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_PRESENT (1<<16) -# define TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_PRESENT (1<<17) - -typedef enum tracking_area_update_request_iei_tag { - TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI = 0xB0, /* 0xB0 = 176 */ - TRACKING_AREA_UPDATE_REQUEST_GPRS_CIPHERING_KEY_SEQUENCE_NUMBER_IEI = 0x80, /* 0x80 = 128 */ - TRACKING_AREA_UPDATE_REQUEST_OLD_PTMSI_SIGNATURE_IEI = 0x19, /* 0x19 = 25 */ - TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_GUTI_IEI = 0x50, /* 0x50 = 80 */ - TRACKING_AREA_UPDATE_REQUEST_NONCEUE_IEI = 0x55, /* 0x55 = 85 */ - TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_IEI = 0x58, /* 0x58 = 88 */ - TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI = 0x52, /* 0x52 = 82 */ - TRACKING_AREA_UPDATE_REQUEST_DRX_PARAMETER_IEI = 0x5C, /* 0x5C = 92 */ - TRACKING_AREA_UPDATE_REQUEST_UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_IEI = 0xA0, /* 0xA0 = 160 */ - TRACKING_AREA_UPDATE_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI = 0x57, /* 0x57 = 87 */ - TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_IEI = 0x31, /* 0x31 = 49 */ - TRACKING_AREA_UPDATE_REQUEST_OLD_LOCATION_AREA_IDENTIFICATION_IEI = 0x13, /* 0x13 = 19 */ - TRACKING_AREA_UPDATE_REQUEST_TMSI_STATUS_IEI = 0x90, /* 0x90 = 144 */ - TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_2_IEI = 0x11, /* 0x11 = 17 */ - TRACKING_AREA_UPDATE_REQUEST_MOBILE_STATION_CLASSMARK_3_IEI = 0x20, /* 0x20 = 32 */ - TRACKING_AREA_UPDATE_REQUEST_SUPPORTED_CODECS_IEI = 0x40, /* 0x40 = 64 */ - TRACKING_AREA_UPDATE_REQUEST_ADDITIONAL_UPDATE_TYPE_IEI = 0xF0, /* 0xF0 = 240 */ - TRACKING_AREA_UPDATE_REQUEST_OLD_GUTI_TYPE_IEI = 0xE0, /* 0xE0 = 224 */ -} tracking_area_update_request_iei; - -/* - * Message name: Tracking area update request - * Description: The purposes of sending the tracking area update request by the UE to the network are described in subclause 5.5.3.1. See table 8.2.29.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct tracking_area_update_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - EpsUpdateType epsupdatetype; - NasKeySetIdentifier naskeysetidentifier; - EpsMobileIdentity oldguti; - /* Optional fields */ - uint32_t presencemask; - NasKeySetIdentifier noncurrentnativenaskeysetidentifier; - CipheringKeySequenceNumber gprscipheringkeysequencenumber; - PTmsiSignature oldptmsisignature; - EpsMobileIdentity additionalguti; - Nonce nonceue; - UeNetworkCapability uenetworkcapability; - TrackingAreaIdentity lastvisitedregisteredtai; - DrxParameter drxparameter; - UeRadioCapabilityInformationUpdateNeeded ueradiocapabilityinformationupdateneeded; - EpsBearerContextStatus epsbearercontextstatus; - MsNetworkCapability msnetworkcapability; - LocationAreaIdentification oldlocationareaidentification; - TmsiStatus tmsistatus; - MobileStationClassmark2 mobilestationclassmark2; - MobileStationClassmark3 mobilestationclassmark3; - SupportedCodecList supportedcodecs; - AdditionalUpdateType additionalupdatetype; - GutiType oldgutitype; -} tracking_area_update_request_msg; - -int decode_tracking_area_update_request(tracking_area_update_request_msg *trackingareaupdaterequest, uint8_t *buffer, uint32_t len); - -int encode_tracking_area_update_request(tracking_area_update_request_msg *trackingareaupdaterequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(TRACKING_AREA_UPDATE_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.c deleted file mode 100644 index ad1fe82b302453f4d091f22aa97d133e9c73e7a5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.c +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "UplinkNasTransport.h" - -int decode_uplink_nas_transport(uplink_nas_transport_msg *uplink_nas_transport, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, UPLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_nas_message_container(&uplink_nas_transport->nasmessagecontainer, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_uplink_nas_transport(uplink_nas_transport_msg *uplink_nas_transport, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, UPLINK_NAS_TRANSPORT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_nas_message_container(&uplink_nas_transport->nasmessagecontainer, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.h deleted file mode 100644 index 09f1bd2e00c6b55f859e36f20a96733e63fe122a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/UplinkNasTransport.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "MessageType.h" -#include "NasMessageContainer.h" - -#ifndef UPLINK_NAS_TRANSPORT_H_ -#define UPLINK_NAS_TRANSPORT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define UPLINK_NAS_TRANSPORT_MINIMUM_LENGTH ( \ - NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define UPLINK_NAS_TRANSPORT_MAXIMUM_LENGTH ( \ - NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH ) - - -/* - * Message name: Uplink NAS Transport - * Description: This message is sent by the UE to the network in order to carry an SMS message in encapsulated format. See table 8.2.30.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct uplink_nas_transport_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - SecurityHeaderType securityheadertype:4; - MessageType messagetype; - NasMessageContainer nasmessagecontainer; -} uplink_nas_transport_msg; - -int decode_uplink_nas_transport(uplink_nas_transport_msg *uplinknastransport, uint8_t *buffer, uint32_t len); - -int encode_uplink_nas_transport(uplink_nas_transport_msg *uplinknastransport, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(UPLINK_NAS_TRANSPORT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_cause.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_cause.h deleted file mode 100644 index c5419201d2ff7ae2deec6112f0e72f158e215289..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_cause.h +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_cause.h - -Version 0.1 - -Date 2013/01/30 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines error cause code returned upon receiving unknown, - unforeseen, and erroneous EPS mobility management protocol - data. - -*****************************************************************************/ -#ifndef __EMM_CAUSE_H__ -#define __EMM_CAUSE_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Cause code used to notify that the EPS mobility management procedure - * has been successfully processed - */ -#define EMM_CAUSE_SUCCESS (-1) - -/* - * Causes related to UE identification (TS 24.301 - Annex A1) - */ -#define EMM_CAUSE_IMSI_UNKNOWN_IN_HSS 2 -#define EMM_CAUSE_ILLEGAL_UE 3 -#define EMM_CAUSE_ILLEGAL_ME 6 -#define EMM_CAUSE_INVALID_UE 9 -#define EMM_CAUSE_IMPLICITLY_DETACHED 10 - -/* - * Causes related to subscription options (TS 24.301 - Annex A2) - */ -#define EMM_CAUSE_IMEI_NOT_ACCEPTED 5 -#define EMM_CAUSE_EPS_NOT_ALLOWED 7 -#define EMM_CAUSE_BOTH_NOT_ALLOWED 8 -#define EMM_CAUSE_PLMN_NOT_ALLOWED 11 -#define EMM_CAUSE_TA_NOT_ALLOWED 12 -#define EMM_CAUSE_ROAMING_NOT_ALLOWED 13 -#define EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN 14 -#define EMM_CAUSE_NO_SUITABLE_CELLS 15 -#define EMM_CAUSE_CSG_NOT_AUTHORIZED 25 -#define EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN 35 -#define EMM_CAUSE_NO_EPS_BEARER_CTX_ACTIVE 40 - -/* - * Causes related to PLMN specific network failures and congestion/ - * authentication failures (TS 24.301 - Annex A3) - */ -#define EMM_CAUSE_MSC_NOT_REACHABLE 16 -#define EMM_CAUSE_NETWORK_FAILURE 17 -#define EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE 18 -#define EMM_CAUSE_ESM_FAILURE 19 -#define EMM_CAUSE_MAC_FAILURE 20 -#define EMM_CAUSE_SYNCH_FAILURE 21 -#define EMM_CAUSE_CONGESTION 22 -#define EMM_CAUSE_UE_SECURITY_MISMATCH 23 -#define EMM_CAUSE_SECURITY_MODE_REJECTED 24 -#define EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE 26 -#define EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE 39 - -/* - * Causes related to invalid messages (TS 24.301 - Annex A5) - */ -#define EMM_CAUSE_SEMANTICALLY_INCORRECT 95 -#define EMM_CAUSE_INVALID_MANDATORY_INFO 96 -#define EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED 97 -#define EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE 98 -#define EMM_CAUSE_IE_NOT_IMPLEMENTED 99 -#define EMM_CAUSE_CONDITIONAL_IE_ERROR 100 -#define EMM_CAUSE_MESSAGE_NOT_COMPATIBLE 101 -#define EMM_CAUSE_PROTOCOL_ERROR 111 - -/* - * TS 24.301 - Table 9.9.3.9.1 - * Any other value received by the mobile station shall be treated as cause - * code #111 "protocol error, unspecified". - * Any other value received by the network shall be treated as cause code #111 - * "protocol error, unspecified". - */ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __EMM_CAUSE_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.c b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.c deleted file mode 100644 index 979210c6151c7ac4d3357163a76dff6e6ac240c0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.c +++ /dev/null @@ -1,568 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_msg.c - -Version 0.1 - -Date 2012/09/27 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel, Sebastien Roux - -Description Defines EPS Mobility Management messages - -*****************************************************************************/ - -#include "emm_msg.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "TLVDecoder.h" -#include "TLVEncoder.h" - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) -# include "nas_itti_messaging.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -static int _emm_msg_decode_header(emm_msg_header_t *header, - const uint8_t *buffer, uint32_t len); -static int _emm_msg_encode_header(const emm_msg_header_t *header, - uint8_t *buffer, uint32_t len); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_msg_decode() ** - ** ** - ** Description: Decode EPS Mobility Management messages ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the EMM ** - ** message data ** - ** len: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: msg: The EMM message structure to be filled ** - ** Return: The number of bytes in the buffer if data ** - ** have been successfully decoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len) -{ - LOG_FUNC_IN; - - int header_result; - int decode_result; - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - uint32_t len_log = len; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 0; -# else - down_link = 1; -# endif -#endif - - /* First decode the EMM message header */ - header_result = _emm_msg_decode_header(&msg->header, buffer, len); - - if (header_result < 0) { - LOG_TRACE(ERROR, "EMM-MSG - Failed to decode EMM message header " - "(%d)", header_result); - LOG_FUNC_RETURN(header_result); - } - - buffer += header_result; - len -= header_result; - - LOG_TRACE(INFO, "EMM-MSG - Message Type 0x%02x", msg->header.message_type); - - switch(msg->header.message_type) { - case EMM_INFORMATION: - decode_result = decode_emm_information(&msg->emm_information, buffer, len); - break; - - case UPLINK_NAS_TRANSPORT: - decode_result = decode_uplink_nas_transport(&msg->uplink_nas_transport, buffer, - len); - break; - - case AUTHENTICATION_REJECT: - decode_result = decode_authentication_reject(&msg->authentication_reject, - buffer, len); - break; - - case AUTHENTICATION_FAILURE: - decode_result = decode_authentication_failure(&msg->authentication_failure, - buffer, len); - break; - - case DETACH_ACCEPT: - decode_result = decode_detach_accept(&msg->detach_accept, buffer, len); - break; - - case SERVICE_REJECT: - decode_result = decode_service_reject(&msg->service_reject, buffer, len); - break; - - case AUTHENTICATION_REQUEST: - decode_result = decode_authentication_request(&msg->authentication_request, - buffer, len); - break; - - case TRACKING_AREA_UPDATE_REQUEST: - decode_result = decode_tracking_area_update_request( - &msg->tracking_area_update_request, buffer, len); - break; - - case ATTACH_REQUEST: - decode_result = decode_attach_request(&msg->attach_request, buffer, len); - break; - - case EMM_STATUS: - decode_result = decode_emm_status(&msg->emm_status, buffer, len); - break; - - case IDENTITY_RESPONSE: - decode_result = decode_identity_response(&msg->identity_response, buffer, len); - break; - - case IDENTITY_REQUEST: - decode_result = decode_identity_request(&msg->identity_request, buffer, len); - break; - - case GUTI_REALLOCATION_COMMAND: - decode_result = decode_guti_reallocation_command(&msg->guti_reallocation_command, - buffer, len); - break; - - case TRACKING_AREA_UPDATE_REJECT: - decode_result = decode_tracking_area_update_reject( - &msg->tracking_area_update_reject, buffer, len); - break; - - case ATTACH_ACCEPT: - decode_result = decode_attach_accept(&msg->attach_accept, buffer, len); - break; - - case SECURITY_MODE_COMPLETE: - decode_result = decode_security_mode_complete(&msg->security_mode_complete, - buffer, len); - break; - - case TRACKING_AREA_UPDATE_ACCEPT: - decode_result = decode_tracking_area_update_accept( - &msg->tracking_area_update_accept, buffer, len); - break; - - case ATTACH_REJECT: - decode_result = decode_attach_reject(&msg->attach_reject, buffer, len); - break; - - case ATTACH_COMPLETE: - decode_result = decode_attach_complete(&msg->attach_complete, buffer, len); - break; - - case TRACKING_AREA_UPDATE_COMPLETE: - decode_result = decode_tracking_area_update_complete( - &msg->tracking_area_update_complete, buffer, len); - break; - - case CS_SERVICE_NOTIFICATION: - decode_result = decode_cs_service_notification(&msg->cs_service_notification, - buffer, len); - break; - - case SECURITY_MODE_REJECT: - decode_result = decode_security_mode_reject(&msg->security_mode_reject, buffer, - len); - break; - - case DETACH_REQUEST: - decode_result = decode_detach_request(&msg->detach_request, buffer, len); - break; - - case GUTI_REALLOCATION_COMPLETE: - decode_result = decode_guti_reallocation_complete( - &msg->guti_reallocation_complete, buffer, len); - break; - - case SECURITY_MODE_COMMAND: - decode_result = decode_security_mode_command(&msg->security_mode_command, - buffer, len); - break; - - case DOWNLINK_NAS_TRANSPORT: - decode_result = decode_downlink_nas_transport(&msg->downlink_nas_transport, - buffer, len); - break; - - case EXTENDED_SERVICE_REQUEST: - decode_result = decode_extended_service_request(&msg->extended_service_request, - buffer, len); - break; - - case AUTHENTICATION_RESPONSE: - decode_result = decode_authentication_response(&msg->authentication_response, - buffer, len); - break; - - default: - LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x", - msg->header.message_type); - decode_result = TLV_DECODE_WRONG_MESSAGE_TYPE; - /* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */ - } - - if (decode_result < 0) { - LOG_TRACE(ERROR, "EMM-MSG - Failed to decode L3 EMM message 0x%x " - "(%d)", msg->header.message_type, decode_result); - LOG_FUNC_RETURN (decode_result); - } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Message has been decoded and security header removed, handle it has a plain message */ - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link); -#endif - } - - LOG_FUNC_RETURN (header_result + decode_result); -} - -/**************************************************************************** - ** ** - ** Name: emm_msg_encode() ** - ** ** - ** Description: Encode EPS Mobility Management messages ** - ** ** - ** Inputs: msg: The EMM message structure to encode ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if data ** - ** have been successfully encoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len) -{ - LOG_FUNC_IN; - - int header_result; - int encode_result; - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 1; -# else - down_link = 0; -# endif -#endif - - /* First encode the EMM message header */ - header_result = _emm_msg_encode_header(&msg->header, buffer, len); - - if (header_result < 0) { - LOG_TRACE(ERROR, "EMM-MSG - Failed to encode EMM message header " - "(%d)", header_result); - LOG_FUNC_RETURN(header_result); - } - - buffer += header_result; - len -= header_result; - - switch(msg->header.message_type) { - case EMM_INFORMATION: - encode_result = encode_emm_information(&msg->emm_information, buffer, len); - break; - - case UPLINK_NAS_TRANSPORT: - encode_result = encode_uplink_nas_transport(&msg->uplink_nas_transport, buffer, - len); - break; - - case AUTHENTICATION_REJECT: - encode_result = encode_authentication_reject(&msg->authentication_reject, - buffer, len); - break; - - case AUTHENTICATION_FAILURE: - encode_result = encode_authentication_failure(&msg->authentication_failure, - buffer, len); - break; - - case DETACH_ACCEPT: - encode_result = encode_detach_accept(&msg->detach_accept, buffer, len); - break; - - case SERVICE_REJECT: - encode_result = encode_service_reject(&msg->service_reject, buffer, len); - break; - - case AUTHENTICATION_REQUEST: - encode_result = encode_authentication_request(&msg->authentication_request, - buffer, len); - break; - - case TRACKING_AREA_UPDATE_REQUEST: - encode_result = encode_tracking_area_update_request( - &msg->tracking_area_update_request, buffer, len); - break; - - case ATTACH_REQUEST: - encode_result = encode_attach_request(&msg->attach_request, buffer, len); - break; - - case EMM_STATUS: - encode_result = encode_emm_status(&msg->emm_status, buffer, len); - break; - - case IDENTITY_RESPONSE: - encode_result = encode_identity_response(&msg->identity_response, buffer, len); - break; - - case IDENTITY_REQUEST: - encode_result = encode_identity_request(&msg->identity_request, buffer, len); - break; - - case GUTI_REALLOCATION_COMMAND: - encode_result = encode_guti_reallocation_command(&msg->guti_reallocation_command, - buffer, len); - break; - - case TRACKING_AREA_UPDATE_REJECT: - encode_result = encode_tracking_area_update_reject( - &msg->tracking_area_update_reject, buffer, len); - break; - - case ATTACH_ACCEPT: - encode_result = encode_attach_accept(&msg->attach_accept, buffer, len); - break; - - case SECURITY_MODE_COMPLETE: - encode_result = encode_security_mode_complete(&msg->security_mode_complete, - buffer, len); - break; - - case TRACKING_AREA_UPDATE_ACCEPT: - encode_result = encode_tracking_area_update_accept( - &msg->tracking_area_update_accept, buffer, len); - break; - - case ATTACH_REJECT: - encode_result = encode_attach_reject(&msg->attach_reject, buffer, len); - break; - - case ATTACH_COMPLETE: - encode_result = encode_attach_complete(&msg->attach_complete, buffer, len); - break; - - case TRACKING_AREA_UPDATE_COMPLETE: - encode_result = encode_tracking_area_update_complete( - &msg->tracking_area_update_complete, buffer, len); - break; - - case CS_SERVICE_NOTIFICATION: - encode_result = encode_cs_service_notification(&msg->cs_service_notification, - buffer, len); - break; - - case SECURITY_MODE_REJECT: - encode_result = encode_security_mode_reject(&msg->security_mode_reject, buffer, - len); - break; - - case DETACH_REQUEST: - encode_result = encode_detach_request(&msg->detach_request, buffer, len); - break; - - case GUTI_REALLOCATION_COMPLETE: - encode_result = encode_guti_reallocation_complete( - &msg->guti_reallocation_complete, buffer, len); - break; - - case SECURITY_MODE_COMMAND: - encode_result = encode_security_mode_command(&msg->security_mode_command, - buffer, len); - break; - - case DOWNLINK_NAS_TRANSPORT: - encode_result = encode_downlink_nas_transport(&msg->downlink_nas_transport, - buffer, len); - break; - - case EXTENDED_SERVICE_REQUEST: - encode_result = encode_extended_service_request(&msg->extended_service_request, - buffer, len); - break; - - case AUTHENTICATION_RESPONSE: - encode_result = encode_authentication_response(&msg->authentication_response, - buffer, len); - break; - - case SERVICE_REQUEST: - encode_result = encode_service_request(&msg->service_request, buffer, len); - break; - - default: - LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x", - msg->header.message_type); - encode_result = TLV_ENCODE_WRONG_MESSAGE_TYPE; - /* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */ - } - - if (encode_result < 0) { - LOG_TRACE(ERROR, "EMM-MSG - Failed to encode L3 EMM message 0x%x " - "(%d)", msg->header.message_type, encode_result); - } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link); -#endif - } - - LOG_FUNC_RETURN (header_result + encode_result); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _emm_msg_decode_header() ** - ** ** - ** Description: Decode header of EPS Mobility Management message. ** - ** The protocol discriminator and the security header type ** - ** have already been decoded. ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the EMM ** - ** message ** - ** len: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: header: The EMM message header to be filled ** - ** Return: The size of the header if data have been ** - ** successfully decoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_msg_decode_header(emm_msg_header_t *header, - const uint8_t *buffer, uint32_t len) -{ - int size = 0; - - /* Check the buffer length */ - if (len < sizeof(emm_msg_header_t)) { - return (TLV_DECODE_BUFFER_TOO_SHORT); - } - - /* Decode the security header type and the protocol discriminator */ - DECODE_U8(buffer + size, *(uint8_t *)(header), size); - /* Decode the message type */ - DECODE_U8(buffer + size, header->message_type, size); - - /* Check the protocol discriminator */ - if (header->protocol_discriminator != EPS_MOBILITY_MANAGEMENT_MESSAGE) { - LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x", - header->protocol_discriminator); - return (TLV_DECODE_PROTOCOL_NOT_SUPPORTED); - } - - return (size); -} - -/**************************************************************************** - ** ** - ** Name: _emm_msg_encode_header() ** - ** ** - ** The protocol discriminator and the security header type ** - ** have already been encoded. ** - ** ** - ** Inputs: header: The EMM message header to encode ** - ** len: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if data ** - ** have been successfully encoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_msg_encode_header(const emm_msg_header_t *header, - uint8_t *buffer, uint32_t len) -{ - int size = 0; - - /* Check the buffer length */ - if (len < sizeof(emm_msg_header_t)) { - return (TLV_ENCODE_BUFFER_TOO_SHORT); - } - - /* Check the protocol discriminator */ - if (header->protocol_discriminator != EPS_MOBILITY_MANAGEMENT_MESSAGE) { - LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x", - header->protocol_discriminator); - return (TLV_ENCODE_PROTOCOL_NOT_SUPPORTED); - } - - /* Encode the security header type and the protocol discriminator */ - ENCODE_U8(buffer + size, *(uint8_t *)(header), size); - /* Encode the message type */ - ENCODE_U8(buffer + size, header->message_type, size); - - return (size); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.h deleted file mode 100644 index bb66c5e68bb990d267561dc294fcc06683077525..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msg.h +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_msg.h - -Version 0.1 - -Date 2012/09/27 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines EPS Mobility Management messages and functions used - to encode and decode - -*****************************************************************************/ -#ifndef __EMM_MSG_H__ -#define __EMM_MSG_H__ - -#include "emm_msgDef.h" - -#include "AttachRequest.h" -#include "AttachAccept.h" -#include "AttachComplete.h" -#include "AttachReject.h" -#include "DetachRequest.h" -#include "DetachAccept.h" -#include "TrackingAreaUpdateRequest.h" -#include "TrackingAreaUpdateAccept.h" -#include "TrackingAreaUpdateComplete.h" -#include "TrackingAreaUpdateReject.h" -#include "ExtendedServiceRequest.h" -#include "ServiceRequest.h" -#include "ServiceReject.h" -#include "GutiReallocationCommand.h" -#include "GutiReallocationComplete.h" -#include "AuthenticationRequest.h" -#include "AuthenticationResponse.h" -#include "AuthenticationReject.h" -#include "AuthenticationFailure.h" -#include "IdentityRequest.h" -#include "IdentityResponse.h" -#include "NASSecurityModeCommand.h" -#include "NASSecurityModeComplete.h" -#include "SecurityModeReject.h" -#include "EmmStatus.h" -#include "EmmInformation.h" -#include "DownlinkNasTransport.h" -#include "UplinkNasTransport.h" -#include "CsServiceNotification.h" - -#include <stdint.h> - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Structure of EMM plain NAS message - * ---------------------------------- - */ -typedef union { - emm_msg_header_t header; - attach_request_msg attach_request; - attach_accept_msg attach_accept; - attach_complete_msg attach_complete; - attach_reject_msg attach_reject; - detach_request_msg detach_request; - detach_accept_msg detach_accept; - tracking_area_update_request_msg tracking_area_update_request; - tracking_area_update_accept_msg tracking_area_update_accept; - tracking_area_update_complete_msg tracking_area_update_complete; - tracking_area_update_reject_msg tracking_area_update_reject; - extended_service_request_msg extended_service_request; - service_request_msg service_request; - service_reject_msg service_reject; - guti_reallocation_command_msg guti_reallocation_command; - guti_reallocation_complete_msg guti_reallocation_complete; - authentication_request_msg authentication_request; - authentication_response_msg authentication_response; - authentication_reject_msg authentication_reject; - authentication_failure_msg authentication_failure; - identity_request_msg identity_request; - identity_response_msg identity_response; - security_mode_command_msg security_mode_command; - security_mode_complete_msg security_mode_complete; - security_mode_reject_msg security_mode_reject; - emm_status_msg emm_status; - emm_information_msg emm_information; - downlink_nas_transport_msg downlink_nas_transport; - uplink_nas_transport_msg uplink_nas_transport; - cs_service_notification_msg cs_service_notification; -} EMM_msg; - - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len); - -int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len); - -#endif /* __EMM_MSG_H__ */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msgDef.h b/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msgDef.h deleted file mode 100644 index 862204d37ec109d29e47ee39eb93ef20b9d55331..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/msg/emm_msgDef.h +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Version 0.1 - -Date 2012/09/27 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel, Sebastien Roux - -Description Defines identifiers of the EPS Mobility Management messages. - -*****************************************************************************/ -#ifndef __EMM_MSGDEF_H__ -#define __EMM_MSGDEF_H__ - -#include <stdint.h> -#include <asm/byteorder.h> - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Header length boundaries of EPS Mobility Management messages */ -#define EMM_HEADER_LENGTH sizeof(emm_msg_header_t) -#define EMM_HEADER_MINIMUM_LENGTH EMM_HEADER_LENGTH -#define EMM_HEADER_MAXIMUM_LENGTH EMM_HEADER_LENGTH - -/* EPS Mobility Management Security header type */ -#define SECURITY_HEADER_TYPE_NOT_PROTECTED 0b0000 -#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED 0b0001 -#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED 0b0010 -#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW 0b0011 -#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW 0b0100 -#define SECURITY_HEADER_TYPE_SERVICE_REQUEST 0b1100 - -/* Message identifiers for EPS Mobility Management */ -# define ATTACH_REQUEST 0b01000001 /* 65 = 0x41 */ -# define ATTACH_ACCEPT 0b01000010 /* 66 = 0x42 */ -# define ATTACH_COMPLETE 0b01000011 /* 67 = 0x43 */ -# define ATTACH_REJECT 0b01000100 /* 68 = 0x44 */ -# define DETACH_REQUEST 0b01000101 /* 69 = 0x45 */ -# define DETACH_ACCEPT 0b01000110 /* 70 = 0x46 */ -# define TRACKING_AREA_UPDATE_REQUEST 0b01001000 /* 72 = 0x48 */ -# define TRACKING_AREA_UPDATE_ACCEPT 0b01001001 /* 73 = 0x49 */ -# define TRACKING_AREA_UPDATE_COMPLETE 0b01001010 /* 74 = 0x4a */ -# define TRACKING_AREA_UPDATE_REJECT 0b01001011 /* 75 = 0x4b */ -# define EXTENDED_SERVICE_REQUEST 0b01001100 /* 76 = 0x4c */ -# define SERVICE_REJECT 0b01001110 /* 78 = 0x4e */ -# define GUTI_REALLOCATION_COMMAND 0b01010000 /* 80 = 0x50 */ -# define GUTI_REALLOCATION_COMPLETE 0b01010001 /* 81 = 0x51 */ -# define AUTHENTICATION_REQUEST 0b01010010 /* 82 = 0x52 */ -# define AUTHENTICATION_RESPONSE 0b01010011 /* 83 = 0x53 */ -# define AUTHENTICATION_REJECT 0b01010100 /* 84 = 0x54 */ -# define AUTHENTICATION_FAILURE 0b01011100 /* 92 = 0x5c */ -# define IDENTITY_REQUEST 0b01010101 /* 85 = 0x55 */ -# define IDENTITY_RESPONSE 0b01010110 /* 86 = 0x56 */ -# define SECURITY_MODE_COMMAND 0b01011101 /* 93 = 0x5d */ -# define SECURITY_MODE_COMPLETE 0b01011110 /* 94 = 0x5e */ -# define SECURITY_MODE_REJECT 0b01011111 /* 95 = 0x5f */ -# define EMM_STATUS 0b01100000 /* 96 = 0x60 */ -# define EMM_INFORMATION 0b01100001 /* 97 = 0x61 */ -# define DOWNLINK_NAS_TRANSPORT 0b01100010 /* 98 = 0x62 */ -# define UPLINK_NAS_TRANSPORT 0b01100011 /* 99 = 0x63 */ -# define CS_SERVICE_NOTIFICATION 0b01100100 /* 100 = 0x64 */ - -/* - * Message identifiers for EMM messages that does not follow the structure - * of a standard layer 3 message - */ -# define SERVICE_REQUEST 0b01001101 /* TODO: TBD - 77 = 0x4d */ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Header of EPS Mobility Management plain NAS message - * --------------------------------------------------- - * 8 7 6 5 4 3 2 1 - * +-----------------------+------------------------+ - * | Security header type | Protocol discriminator | - * +-----------------------+------------------------+ - * | Message type | - * +-----------------------+------------------------+ - */ -typedef struct { -#ifdef __LITTLE_ENDIAN_BITFIELD - uint8_t protocol_discriminator:4; - uint8_t security_header_type:4; -#endif -#ifdef __BIG_ENDIAN_BITFIELD - uint8_t security_header_type:4; - uint8_t protocol_discriminator:4; -#endif - uint8_t message_type; -} __attribute__((__packed__)) emm_msg_header_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __EMM_MSGDEF_H__ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/COPYING b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.c deleted file mode 100644 index 98495f7c43aa25dba774971bc50ca919215a095c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmCommonProcedureInitiated.c +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source EmmCommonProcedureInitiated.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-COMMON-PROCEDURE-INITIATED state. - - In EMM-COMMON-PROCEDURE-INITIATED state, the MME has started - a common EMM procedure and is waiting for a response from the - UE. - -*****************************************************************************/ - -#ifdef NAS_MME - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "EmmCommon.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmCommonProcedureInitiated() ** - ** ** - ** Description: Handles the behaviour of the MME while the EMM-SAP is in ** - ** EMM_COMMON_PROCEDURE_INITIATED state. ** - ** ** - ** 3GPP TS 24.301, section 5.1.3.4.2 ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmCommonProcedureInitiated(const emm_reg_t *evt) -{ - int rc = RETURNerror; - - LOG_FUNC_IN; - - assert(emm_fsm_get_status(evt->ueid, - evt->ctx) == EMM_COMMON_PROCEDURE_INITIATED); - - switch (evt->primitive) { - case _EMMREG_PROC_ABORT: - /* - * The EMM procedure that initiated EMM common procedure aborted - */ - rc = emm_proc_common_abort(evt->ueid); - break; - - case _EMMREG_COMMON_PROC_CNF: - - /* - * An EMM common procedure successfully completed; - */ - if (evt->u.common.is_attached) { - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED); - } else { - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED); - } - - if (rc != RETURNerror) { - rc = emm_proc_common_success(evt->ueid); - } - - break; - - case _EMMREG_COMMON_PROC_REJ: - /* - * An EMM common procedure failed; - * enter state EMM-DEREGISTERED. - */ - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED); - - if (rc != RETURNerror) { - rc = emm_proc_common_reject(evt->ueid); - } - - break; - - case _EMMREG_ATTACH_CNF: - /* - * Attach procedure successful and default EPS bearer - * context activated; - * enter state EMM-REGISTERED. - */ - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED); - break; - - case _EMMREG_ATTACH_REJ: - /* - * Attach procedure failed; - * enter state EMM-DEREGISTERED. - */ - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED); - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Data successfully delivered to the network - */ - rc = RETURNok; - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Transmission failure occurred before the EMM common - * procedure being completed - */ - rc = emm_proc_common_failure(evt->ueid); - - if (rc != RETURNerror) { - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED); - } - - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregistered.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregistered.c deleted file mode 100644 index 7c3233312bb8d01b68b5b30e04b19ab66c0737c8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregistered.c +++ /dev/null @@ -1,236 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source EmmDeregistered.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED state. - - In EMM-DEREGISTERED state, no EMM context has been established - or the EMM context is marked as detached. - The UE shall start the attach or combined attach procedure to - establish an EMM context. - - The MME may answer to an attach or a combined attach procedure - initiated by the UE. It may also answer to a tracking area - updating procedure or combined tracking area updating procedure - initiated by a UE if the EMM context is marked as detached. - -*****************************************************************************/ - -#include "emm_fsm.h" -#include "commonDef.h" -#include "networkDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregistered() ** - ** ** - ** Description: Handles the behaviour of the UE and the MME while the ** - ** EMM-SAP is in EMM-DEREGISTERED state. ** - ** ** - ** 3GPP TS 24.301, section 5.2.2.2 ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregistered(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - -#ifdef NAS_UE - assert(emm_fsm_get_status() == EMM_DEREGISTERED); -#endif -#ifdef NAS_MME - assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_DEREGISTERED); -#endif - -#ifdef NAS_UE - /* Delete the authentication data RAND and RES */ - rc = emm_proc_authentication_delete(); - - if (rc != RETURNok) { - LOG_FUNC_RETURN (rc); - } - - /* TODO: 3GPP TS 24.301, section 4.4.2.1 - * The UE shall store the current native EPS security context as specified - * in annex C and mark it as valid only when the UE enters state EMM- - * DEREGISTERED from any other state except EMM-NULL or when the UE aborts - * the attach procedure without having left EMM-DEREGISTERED. - */ -#endif - - switch (evt->primitive) { - -#ifdef NAS_UE - - case _EMMREG_NO_IMSI: - /* - * The UE was powered on without a valid USIM application present - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI); - break; - - case _EMMREG_REGISTER_REQ: - /* - * The default EMM primary substate when the UE is switched on - * with valid USIM application shall be PLMN-SEARCH - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH); - - if (rc != RETURNerror) { - /* Process the network registration request */ - rc = emm_fsm_process(evt); - } - - break; - - case _EMMREG_ATTACH_INIT: - - /* - * Attach procedure has to be restarted (timers T3402 or T3411 - * expired) while the UE locally detached from the network - */ - - /* Move to the corresponding initial EMM state */ - if (evt->u.attach.is_emergency) { - rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE); - } else { - rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE); - } - - if (rc != RETURNerror) { - /* Restart the attach procedure */ - rc = emm_proc_attach_restart(); - } - - break; - -#endif - -#ifdef NAS_MME - - case _EMMREG_PROC_ABORT: - /* - * Ongoing EMM procedure aborted - */ - rc = RETURNok; - break; - - case _EMMREG_COMMON_PROC_REQ: - /* - * An EMM common procedure has been initiated; - * enter state EMM-COMMON-PROCEDURE-INITIATED. - */ - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED); - break; - - case _EMMREG_ATTACH_CNF: - /* - * Attach procedure successful and default EPS bearer - * context activated; - * enter state EMM-REGISTERED. - */ - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_REGISTERED); - break; - -#endif - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Data successfully delivered to the network - */ - rc = RETURNok; - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Data failed to be delivered to the network - */ - rc = RETURNok; - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - -#ifdef NAS_UE - /* TODO: 3GPP TS 24.301, section 4.4.2.1 - * The UE shall mark the EPS security context on the USIM or in the non- - * volatile memory as invalid when the UE initiates an attach procedure - * or when the UE leaves state EMM-DEREGISTERED for any other state except - * EMM-NULL. - */ -#endif - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.c deleted file mode 100644 index 91c161fceb1c7b6f5cefcbbf413e5bde5d87d314..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttachNeeded.c +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredAttachNeeded.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED.ATTACH-NEEDED state. - - In EMM-DEREGISTERED.ATTACH-NEEDED state, Valid subscriber - data are available for the UE and for some reason an attach - must be performed as soon as possible. The access class may - be blocked due to access class control, or the network rejec- - ted the NAS signalling connection establishment. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredAttachNeeded() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-DEREGISTERED.ATTACH-NEEDED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredAttachNeeded(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_DEREGISTERED_ATTACH_NEEDED); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.c deleted file mode 100644 index bdfafe4a7a7c5d5c9c219890370a4ddbfd116aff..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredAttemptingToAttach.c +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredAttemptingToAttach.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH - state. - - In EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH state, the EPS update - status is EU2, and a previous attach was not successful. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredAttemptingToAttach() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH state. ** - ** ** - ** 3GPP TS 24.301, section 5.2.2.3.3 ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredAttemptingToAttach(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - assert(emm_fsm_get_status() == EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH); - - switch (evt->primitive) { - case _EMMREG_ATTACH_INIT: - - /* - * Attach procedure has to be restarted (timers T3402 or T3411 - * expired) - */ - - /* Move to the corresponding initial EMM state */ - if (evt->u.attach.is_emergency) { - rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE); - } else { - rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE); - } - - if (rc != RETURNerror) { - /* Restart the attach procedure */ - rc = emm_proc_attach_restart(); - } - - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Data successfully delivered to the network - */ - rc = emm_proc_lowerlayer_success(); - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Data failed to be delivered to the network - */ - rc = emm_proc_lowerlayer_failure(FALSE); - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.c deleted file mode 100644 index 65443fc4ab3a682ba66ec6713da8b2f5d0204c44..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredInitiated.c +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredInitiated.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED-INITIATED state. - - In EMM-DEREGISTERED-INITIATED state, the UE has requested - release of the EMM context by starting the detach or combined - detach procedure and is waiting for a response from the MME. - The MME has started a detach procedure and is waiting for a - response from the UE. - -*****************************************************************************/ - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredInitiated() ** - ** ** - ** Description: Handles the behaviour of the UE and the MME while the ** - ** EMM-SAP is in EMM-DEREGISTERED-INITIATED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredInitiated(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - -#ifdef NAS_UE - assert(emm_fsm_get_status() == EMM_DEREGISTERED_INITIATED); -#endif -#ifdef NAS_MME - assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_DEREGISTERED_INITIATED); -#endif - - switch (evt->primitive) { -#ifdef NAS_UE - - case _EMMREG_DETACH_CNF: - /* - * The UE explicitly detached from the network (all EPS - * bearer contexts have been deactivated as UE initiated - * detach procedure successfully completed) - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED); - break; - - case _EMMREG_DETACH_FAILED: - - /* - * The detach procedure failed - */ - if (evt->u.detach.type == EMM_DETACH_TYPE_IMSI) { - rc = emm_fsm_set_status(EMM_REGISTERED_NORMAL_SERVICE); - } else { - rc = emm_fsm_set_status(EMM_DEREGISTERED); - } - - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Ignore Detach Request message successful retransmission - */ - rc = RETURNok; - break; - - case _EMMREG_LOWERLAYER_FAILURE: - case _EMMREG_LOWERLAYER_RELEASE: - /* - * Lower layer failure or release of the NAS signalling connection - * before the Detach Accept is received - */ - rc = emm_proc_lowerlayer_release(); - break; -#endif - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.c deleted file mode 100644 index 1c650bfb0a89e26295208d2e17e5187b35132d9a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredLimitedService.c +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredLimitedService.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED.LIMITED-SERVICE state. - - In EMM-DEREGISTERED.LIMITED-SERVICE state, the EPS update - status is EU3, and it is known that a selected cell is unable - to provide normal service. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "networkDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredLimitedService() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-DEREGISTERED.LIMITED-SERVICE state. ** - ** ** - ** 3GPP TS 24.301, section 5.2.2.3.2 ** - ** The UE shall initiate an attach or combined attach proce- ** - ** dure when entering a cell which provides normal service. ** - ** It may initiate attach for emergency bearer services. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredLimitedService(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - assert(emm_fsm_get_status() == EMM_DEREGISTERED_LIMITED_SERVICE); - - switch (evt->primitive) { - case _EMMREG_REGISTER_REQ: - /* - * The user manually re-selected a PLMN to register to - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH); - - if (rc != RETURNerror) { - /* Process the network registration request */ - rc = emm_fsm_process(evt); - } - - break; - - case _EMMREG_ATTACH_INIT: - /* - * Initiate attach procedure for emergency bearer services - */ - rc = emm_proc_attach(EMM_ATTACH_TYPE_EMERGENCY); - break; - - case _EMMREG_ATTACH_REQ: - /* - * An attach for bearer emergency services has been requested - * (Attach Request message successfully delivered to the network); - * enter state EMM-REGISTERED-INITIATED - */ - rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED); - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Initial NAS message has been successfully delivered - * to the network - */ - rc = emm_proc_lowerlayer_success(); - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Initial NAS message failed to be delivered to the network - */ - rc = emm_proc_lowerlayer_failure(TRUE); - break; - - case _EMMREG_LOWERLAYER_RELEASE: - /* - * NAS signalling connection has been released - */ - rc = emm_proc_lowerlayer_release(); - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.c deleted file mode 100644 index 2273b93b90e510e191a92c1aeb9bab3b007777bb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoCellAvailable.c +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredNoCellAvailable.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED.NO-CELL-AVAILABLE - state. - - In EMM-DEREGISTERED.NO-CELL-AVAILABLE state, no E-UTRAN cell - can be selected. A first intensive search failed when in - substate EMM_DEREGISTERED.PLMN-SEARCH. Cells are searched for - at a low rhythm. No EPS services are offered. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "networkDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredNoCellAvailable() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-DEREGISTERED.NO-CELL-AVAILABLE state. ** - ** ** - ** 3GPP TS 24.301, section 5.2.2.3.7 ** - ** The UE shall perform cell selection and choose an appro- ** - ** priate substate when a cell is found. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredNoCellAvailable(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - assert(emm_fsm_get_status() == EMM_DEREGISTERED_NO_CELL_AVAILABLE); - - switch (evt->primitive) { - /* TODO: network re-selection is not allowed when in No Cell - * Available substate. The AS should search for a suitable cell - * and notify the NAS when such a cell is found (TS 24.008 section - * 4.2.4.1.2) */ - case _EMMREG_REGISTER_REQ: - /* - * The user manually re-selected a PLMN to register to - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH); - - if (rc != RETURNerror) { - /* - * Notify EMM that the MT is currently searching an operator - * to register to - */ - rc = emm_proc_registration_notify(NET_REG_STATE_ON); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-FSM - " - "Failed to notify registration update"); - } - - /* - * Perform network re-selection procedure - */ - rc = emm_proc_plmn_selection(evt->u.regist.index); - } - - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.c deleted file mode 100644 index d66ec7c09f8af0b7436b82f6a5b509d7a04962ed..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNoImsi.c +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredNoImsi.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED.NO-IMSI state. - - In EMM-DEREGISTERED.NO-IMSI state, the UE is switched on - without a valid USIM inserted. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredNoImsi() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-DEREGISTERED.NO-IMSI state. ** - ** ** - ** 3GPP TS 24.301, section 5.2.2.3.5 ** - ** The UE shall perform cell selection and may initiate ** - ** attach for emergency bearer services. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredNoImsi(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_DEREGISTERED_NO_IMSI); - - LOG_TRACE(ERROR, "EMM-FSM - USIM is not present or not valid"); - - LOG_FUNC_RETURN (RETURNerror); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.c deleted file mode 100644 index 9068bb24cca802ef483a0761985b5484027f6af1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredNormalService.c +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredNormalService.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED.NORMAL-SERVICE state. - - In EMM-DEREGISTERED.NORMAL-SERVICE state, the EPS update - status is EU1 or EU2, in the meantime a suitable cell has - been found and the PLMN or tracking area is not in the - forbidden list. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "networkDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredNormalService() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-DEREGISTERED.NORMAL-SERVICE state. ** - ** ** - ** 3GPP TS 24.301, section 5.2.2.3.1 ** - ** The UE shall initiate an attach or combined attach proce- ** - ** dure. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredNormalService(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - assert(emm_fsm_get_status() == EMM_DEREGISTERED_NORMAL_SERVICE); - - switch (evt->primitive) { - case _EMMREG_REGISTER_REQ: - /* - * The user manually re-selected a PLMN to register to - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH); - - if (rc != RETURNerror) { - /* Process the network registration request */ - rc = emm_fsm_process(evt); - } - - break; - - case _EMMREG_ATTACH_INIT: - /* - * Initiate the attach procedure for EPS services - */ - rc = emm_proc_attach(EMM_ATTACH_TYPE_EPS); - break; - - case _EMMREG_ATTACH_REQ: - /* - * An EPS network attach has been requested (Attach Request - * message successfully delivered to the network); - * enter state EMM-REGISTERED-INITIATED - */ - rc = emm_fsm_set_status(EMM_REGISTERED_INITIATED); - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Initial NAS message has been successfully delivered - * to the network - */ - rc = emm_proc_lowerlayer_success(); - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Initial NAS message failed to be delivered to the network - */ - rc = emm_proc_lowerlayer_failure(TRUE); - break; - - case _EMMREG_LOWERLAYER_RELEASE: - /* - * NAS signalling connection has been released - */ - rc = emm_proc_lowerlayer_release(); - break; - - case _EMMREG_ATTACH_CNF: - /* - * Attach procedure successful and default EPS bearer - * context activated; - * enter state EMM-REGISTERED. - */ - rc = emm_fsm_set_status(EMM_REGISTERED); - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.c deleted file mode 100644 index 681f5e061b21051ea56e4a21e9406842f66c2e2b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmDeregisteredPlmnSearch.c +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmDeregisteredPlmnSearch.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-DEREGISTERED.PLMN-SEARCH state. - - In EMM-DEREGISTERED.PLMN-SEARCH state, the UE with a valid - USIM is switched on. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "networkDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmDeregisteredPlmnSearch() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-DEREGISTERED.PLMN-SEARCH state. ** - ** ** - ** 3GPP TS 24.301, section 5.2.2.3.4 ** - ** The UE shall perform PLMN selection. If a new PLMN is ** - ** selected, the UE shall reset the attach attempt counter ** - ** and initiate the attach or combined attach procedure. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmDeregisteredPlmnSearch(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - assert(emm_fsm_get_status() == EMM_DEREGISTERED_PLMN_SEARCH); - - switch (evt->primitive) { - case _EMMREG_NO_CELL: - /* - * No suitable cell of the selected PLMN has been found to camp on - */ - rc = emm_proc_registration_notify(NET_REG_STATE_DENIED); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-FSM - " - "Failed to notify registration update"); - } - - rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_CELL_AVAILABLE); - break; - - case _EMMREG_REGISTER_REQ: - /* - * The UE has been switched on and is currently searching an - * operator to register to. The particular PLMN to be contacted - * may be selected either automatically or manually. - * Or the user manually re-selected a PLMN to register to. - */ - rc = emm_proc_registration_notify(NET_REG_STATE_ON); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-FSM - " - "Failed to notify registration update"); - } - - /* - * Perform network selection procedure - */ - rc = emm_proc_plmn_selection(evt->u.regist.index); - break; - - case _EMMREG_REGISTER_REJ: - /* - * The selected cell is known not to be able to provide normal - * service - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE); - break; - - case _EMMREG_REGISTER_CNF: - /* - * A suitable cell of the selected PLMN has been found to camp on - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE); - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmNull.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmNull.c deleted file mode 100644 index 5416fd92f54b1e9818fa230a6a458f755db4345b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmNull.c +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmNull.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-NULL state. - - In EMM-NULL state, the EPS capability is disabled in the UE. - No EPS mobility management function shall be performed. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmNull() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-NULL state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmNull(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc; - - assert(emm_fsm_get_status() == EMM_NULL); - - /* Delete the authentication data RAND and RES */ - rc = emm_proc_authentication_delete(); - - if (rc != RETURNok) { - LOG_FUNC_RETURN (rc); - } - - switch (evt->primitive) { - case _EMMREG_S1_ENABLED: - /* - * The EPS capability has been enabled in the UE: - * Move to the DEREGISTERED state; - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED); - - /* - * And initialize the EMM procedure call manager in order to - * establish an EMM context and make the UE reachable by an MME. - */ - if (rc != RETURNerror) { - rc = emm_proc_initialize(); - } - - break; - - default: - rc = RETURNerror; - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - LOG_TRACE(WARNING, "EMM-FSM - Set phone functionnality to " - "enable EPS capability (+cfun=1)"); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegistered.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegistered.c deleted file mode 100644 index 0bf682b7e1b95e15f45d4a2df9cc0c4b741601a8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegistered.c +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegistered.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED state. - - In EMM-REGISTERED state, an EMM context has been established - and a default EPS bearer context has been activated in the UE - and the MME. - The UE may initiate sending and receiving user data and signal- - ling information and reply to paging. Additionally, tracking - area updating or combined tracking area updating procedure is - performed. - -*****************************************************************************/ - -#include "emm_fsm.h" -#include "commonDef.h" -#include "networkDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegistered() ** - ** ** - ** Description: Handles the behaviour of the UE and the MME while the ** - ** EMM-SAP is in EMM-REGISTERED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegistered(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - -#ifdef NAS_UE - assert(emm_fsm_get_status() == EMM_REGISTERED); -#endif -#ifdef NAS_MME - assert(emm_fsm_get_status(evt->ueid, evt->ctx) == EMM_REGISTERED); -#endif - - switch (evt->primitive) { -#ifdef NAS_UE - - case _EMMREG_DETACH_INIT: - /* - * Initiate detach procedure for EPS services - */ - rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off); - break; - - case _EMMREG_DETACH_REQ: - /* - * Network detach has been requested (Detach Request - * message successfully delivered to the network); - * enter state EMM-DEREGISTERED-INITIATED - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED); - break; - - case _EMMREG_DETACH_CNF: - /* - * The UE implicitly detached from the network (all EPS - * bearer contexts may have been deactivated) - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED); - break; - - case _EMMREG_TAU_REQ: - /* - * TODO: Tracking Area Update has been requested - */ - LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure " - "is not implemented"); - break; - - case _EMMREG_SERVICE_REQ: - /* - * TODO: Service Request has been requested - */ - LOG_TRACE(ERROR, "EMM-FSM - Service Request procedure " - "is not implemented"); - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Data transfer message has been successfully delivered - */ - rc = emm_proc_lowerlayer_success(); - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Data transfer message failed to be delivered - */ - rc = emm_proc_lowerlayer_failure(FALSE); - break; - - case _EMMREG_LOWERLAYER_RELEASE: - /* - * NAS signalling connection has been released - */ - rc = emm_proc_lowerlayer_release(); - break; -#endif - -#ifdef NAS_MME - - case _EMMREG_DETACH_REQ: - /* - * Network detach has been requested (implicit detach); - * enter state EMM-DEREGISTERED - */ - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_DEREGISTERED); - break; - - case _EMMREG_COMMON_PROC_REQ: - /* - * An EMM common procedure has been initiated; - * enter state EMM-COMMON-PROCEDURE-INITIATED. - */ - rc = emm_fsm_set_status(evt->ueid, evt->ctx, EMM_COMMON_PROCEDURE_INITIATED); - break; - - case _EMMREG_TAU_REJ: - /* - * TODO: Tracking Area Update has been rejected - */ - LOG_TRACE(ERROR, "EMM-FSM - Tracking Area Update procedure " - "is not implemented"); - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Data successfully delivered to the network - */ - rc = RETURNok; - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Data failed to be delivered to the network - */ - rc = RETURNok; - break; -#endif - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.c deleted file mode 100644 index 4d96f1a01610787afe38f728f94d288c93724129..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredAttemptingToUpdate.c +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegisteredAttemptingToUpdate.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED.ATTEMPTING-TO-UPDATE - state. - - In EMM-REGISTERED.ATTEMPTING-TO-UPDATE state, the tracking - area updating or combined tracking area updating procedure - failed due to a missing response from the network. - No EMM procedure except the tracking area updating or com- - bined tracking area updating procedure shall be initiated - by the UE in this substate. No data shall be sent or received. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredAttemptingToUpdate() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED.ATTEMPTING-TO-UPDATE state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredAttemptingToUpdate(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_ATTEMPTING_TO_UPDATE); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.c deleted file mode 100644 index ac794db3a02e716458e7330652a811d8cb04aa28..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredImsiDetachInitiated.c +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegisteredImsiDetachInitiated.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED.IMSI-DETACH-INITIATED - state. - - In EMM-REGISTERED.IMSI-DETACH-INITIATED state, the UE performs - a combined detach procedure for non-EPS services only. - The UE was attached for EPS and non-EPS services and wants to - detach for non-EPS services only. User data and signalling - information may be sent and received. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredImsiDetachInitiated() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED.IMSI-DETACH-INITIATED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredImsiDetachInitiated(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_IMSI_DETACH_INITIATED); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.c deleted file mode 100644 index 6a17c2ca09aecca6579b0f86ea9b0857e6218c42..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredInitiated.c +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegisteredInitiated.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED-INITIATED state. - - In EMM-REGISTERED-INITIATED state, the attach or the combined - attach procedure has been started and the UE is waiting for a - response from the MME. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "networkDef.h" -#include "nas_log.h" - -#include "emm_proc.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredInitiated() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED-INITIATED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredInitiated(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - assert(emm_fsm_get_status() == EMM_REGISTERED_INITIATED); - - switch (evt->primitive) { - case _EMMREG_ATTACH_INIT: - - /* - * Attach procedure has to be restarted (timers T3402 or T3411 - * expired) - */ - - /* Move to the corresponding initial EMM state */ - if (evt->u.attach.is_emergency) { - rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE); - } else { - rc = emm_fsm_set_status(EMM_DEREGISTERED_NORMAL_SERVICE); - } - - if (rc != RETURNerror) { - /* Restart the attach procedure */ - rc = emm_proc_attach_restart(); - } - - break; - - case _EMMREG_ATTACH_FAILED: - /* - * Attempt to attach to the network failed (abnormal case or - * timer T3410 expired). The network attach procedure shall be - * restarted when timer T3411 expires. - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH); - break; - - case _EMMREG_ATTACH_EXCEEDED: - /* - * Attempt to attach to the network failed (abnormal case or - * timer T3410 expired) and the attach attempt counter reached - * its maximum value. The state is changed to EMM-DEREGISTERED. - * ATTEMPTING-TO-ATTACH or optionally to EMM-DEREGISTERED.PLMN- - * SEARCH in order to perform a PLMN selection. - */ - /* TODO: ATTEMPTING-TO-ATTACH or PLMN-SEARCH ??? */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH); - break; - - case _EMMREG_ATTACH_CNF: - /* - * EPS network attach accepted by the network; - * enter state EMM-REGISTERED. - */ - rc = emm_fsm_set_status(EMM_REGISTERED); - - if (rc != RETURNerror) { - /* - * Notify EMM that the MT is registered - */ - rc = emm_proc_registration_notify(NET_REG_STATE_HN); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-FSM - " - "Failed to notify registration update"); - } - } - - break; - - case _EMMREG_AUTH_REJ: - - /* - * UE authentication rejected by the network; - * abort any EMM signalling procedure - */ - case _EMMREG_ATTACH_REJ: - /* - * EPS network attach rejected by the network; - * enter state EMM-DEREGISTERED. - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED); - - if (rc != RETURNerror) { - /* - * Notify EMM that the MT's registration is denied - */ - rc = emm_proc_registration_notify(NET_REG_STATE_DENIED); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMM-FSM - " - "Failed to notify registration update"); - } - } - - break; - - case _EMMREG_REGISTER_REQ: - /* - * The UE has to select a new PLMN to register to - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_PLMN_SEARCH); - - if (rc != RETURNerror) { - /* Process the network registration request */ - rc = emm_fsm_process(evt); - } - - break; - - case _EMMREG_REGISTER_REJ: - /* - * The UE failed to register to the network for normal EPS service - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_LIMITED_SERVICE); - break; - - case _EMMREG_NO_IMSI: - /* - * The UE failed to register to the network for emergency - * bearer services - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_NO_IMSI); - break; - - case _EMMREG_DETACH_INIT: - /* - * Initiate detach procedure for EPS services - */ - rc = emm_proc_detach(EMM_DETACH_TYPE_EPS, evt->u.detach.switch_off); - break; - - case _EMMREG_DETACH_REQ: - /* - * An EPS network detach has been requested (Detach Request - * message successfully delivered to the network); - * enter state EMM-DEREGISTERED-INITIATED - */ - rc = emm_fsm_set_status(EMM_DEREGISTERED_INITIATED); - break; - - case _EMMREG_LOWERLAYER_SUCCESS: - /* - * Data transfer message has been successfully delivered; - * The NAS message may be Attach Complete, Detach Request or - * any message transfered by EMM common procedures requested - * by the network. - */ - rc = emm_proc_lowerlayer_success(); - break; - - case _EMMREG_LOWERLAYER_FAILURE: - /* - * Data transfer message failed to be delivered; - * The NAS message may be Attach Complete, Detach Request or - * any message transfered by EMM common procedures requested - * by the network. - */ - rc = emm_proc_lowerlayer_failure(FALSE); - break; - - case _EMMREG_LOWERLAYER_RELEASE: - /* - * NAS signalling connection has been released before the Attach - * Accept, Attach Reject, or any message transfered by EMM common - * procedures requested by the network, is received. - */ - rc = emm_proc_lowerlayer_release(); - break; - - default: - LOG_TRACE(ERROR, "EMM-FSM - Primitive is not valid (%d)", - evt->primitive); - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.c deleted file mode 100644 index b0be7df11a52a1d7a646cd71c6269f62bc1b237c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredLimitedService.c +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegisteredLimitedService.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED.LIMITED-SERVICE state. - - In EMM-REGISTERED.LIMITED-SERVICE state, the cell the UE - selected is known not to be able to provide normal service. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredLimitedService() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED.LIMITED-SERVICE state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredLimitedService(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_LIMITED_SERVICE); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.c deleted file mode 100644 index 38a14a1332ba85ec987f150f9eebe29d96d4347b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNoCellAvailable.c +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegisteredNoCellAvailable.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED.NO-CELL-AVAILABLE state. - - In EMM-REGISTERED.NO-CELL-AVAILABLE state, E-UTRAN coverage - has been lost. The UE shall not initiate any EMM procedures - except for cell and PLMN reselection. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredNoCellAvailable() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED.NO-CELL-AVAILABLE state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredNoCellAvailable(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_NO_CELL_AVAILABLE); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.c deleted file mode 100644 index 8b462348b8f5ba0d9ee9c39193bd9b986d79e94e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredNormalService.c +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegisteredNormalService.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED.NORMAL-SERVICE state. - - The EMM-REGISTERED.NORMAL-SERVICE state is the primary - substate choosen when the UE enters the state EMM-REGISTERED. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredNormalService() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED.NORMAL-SERVICE state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredNormalService(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_NORMAL_SERVICE); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.c deleted file mode 100644 index d659fc082ef859a228a7af23de24b4f480e79869..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredPlmnSearch.c +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmRegisteredPlmnSearch.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED.PLMN-SEARCH state. - - In EMM-REGISTERED.PLMN-SEARCH state, the UE is searching - for PLMNs. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredPlmnSearch() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED.PLMN-SEARCH state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredPlmnSearch(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_PLMN_SEARCH); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -#if 0 -/**************************************************************************** - ** ** - ** Name: EmmRegisteredPlmnSearch_xxx() ** - ** ** - ** Description: Procedure executed when xxx ** - ** while the EMM-SAP is in EMM-REGISTERED.PLMN-SEARCH state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredPlmnSearch_xxx(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_PLMN_SEARCH); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} -#endif - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.c deleted file mode 100644 index 10a9e9b0536cf4e5b2be9a0c6b481b1995ac2cdf..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmRegisteredUpdateNeeded.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -ource EmmRegisteredUpdateNeeded.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-REGISTERED.UPDATE-NEEDED state. - - In EMM-REGISTERED.UPDATE-NEEDED state, the UE has to perform - a tracking area updating or combined tracking area updating - procedure, but access to the current cell is barred. The access - class may be blocked due to access class control, or the - network rejected the NAS signalling connection establishment. - No EMM procedure except tracking area updating or combined - tracking area updating or service request as a response to - paging shall be initiated by the UE in this substate. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmRegisteredUpdateNeeded() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-REGISTERED.UPDATE-NEEDED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmRegisteredUpdateNeeded(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_REGISTERED_UPDATE_NEEDED); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.c deleted file mode 100644 index 464d9ba54fb95eb10ca67984c8265dd45dca7af0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmServiceRequestInitiated.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmServiceRequestInitiated.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-SERVICE-REQUEST-INITIATED - state. - - In EMM-SERVICE-REQUEST-INITIATED state, the UE has started - the service request procedure and is waiting for a response - from the MME. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmServiceRequestInitiated() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-SERVICE-REQUEST-INITIATED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmServiceRequestInitiated(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_SERVICE_REQUEST_INITIATED); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.c deleted file mode 100644 index ab6ba17f365ed85520d45cb81d67405cc0cc7a04..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/EmmTrackingAreaUpdatingInitiated.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EmmTrackingAreaUpdatingInitiated.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Implements the EPS Mobility Management procedures executed - when the EMM-SAP is in EMM-TRACKING-AREA-UPDATING-INITIATED - state. - - In EMM-TRACKING-AREA-UPDATING-INITIATED state, the UE has - started the tracking area updating or combined tracking area - updating procedure and is waiting for a response from the MME. - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: EmmTrackingAreaUpdatingInitiated() ** - ** ** - ** Description: Handles the behaviour of the UE while the EMM-SAP is in ** - ** EMM-TRACKING-AREA-UPDATING-INITIATED state. ** - ** ** - ** Inputs: evt: The received EMM-SAP event ** - ** Others: emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: emm_fsm_status ** - ** ** - ***************************************************************************/ -int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *evt) -{ - LOG_FUNC_IN; - - assert(emm_fsm_get_status() == EMM_TRACKING_AREA_UPDATING_INITIATED); - - /* TODO */ - - LOG_FUNC_RETURN (RETURNok); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/Makefile b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/Makefile deleted file mode 100644 index 735d35bf8eeda3cafd347fbc59c1f4cbad4909dd..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) -I$(MMEAPIDIR) \ - -I$(EMMDIR) -I$(EMMMSGDIR) -I$(ESMDIR) -I$(ESMMSGDIR) -I$(NETAPIDIR) - -TARGET = $(LIBEMMSAP) -TARGETS = $(TARGET).a $(TARGET).so - -all: $(TARGETS) - -%.o: %.c Makefile $(PROJDIR)/Makerules $(PROJDIR)/Makefile.inc - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET).a: $(OBJS) - @$(RM) $@ - @$(AR) $(ARFLAGS) $@ $(OBJS) - @echo Replacing $@ to $(LIBPROCESS) - @$(RM) $(LIBPROCESS)/$@ - @$(CP) $@ $(LIBPROCESS) - -$(TARGET).so: $(OBJS) - @$(LD) -G -o $@ $(OBJS) - @echo Replacing $@ to $(LIBPROCESS) - @$(RM) $(LIBPROCESS)/$@ - @$(CP) $@ $(LIBPROCESS) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGETS) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c deleted file mode 100644 index 12f1874e6c92ace164016699a893cf8bc2f5d39d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.c +++ /dev/null @@ -1,2363 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_as.c - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMAS Service Access Point that provides - services to the EPS Mobility Management for NAS message - transfer to/from the Access Stratum sublayer. - -*****************************************************************************/ - -#include "emm_as.h" -#include "emm_recv.h" -#include "emm_send.h" -#include "emmData.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "TLVDecoder.h" -#include "as_message.h" -#include "nas_message.h" - -#include "emm_cause.h" -#include "LowerLayer.h" - -#include <string.h> // memset -#include <stdlib.h> // malloc, free - -#if (defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(NAS_BUILT_IN_UE) && defined(NAS_UE)) -# include "nas_itti_messaging.h" -#endif -#include "msc.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -#ifdef NAS_UE -extern int emm_proc_plmn_selection_end(int found, tac_t tac, ci_t ci, AcT_t rat); -#endif - -extern int emm_proc_status(unsigned int ueid, int emm_cause); - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * String representation of EMMAS-SAP primitives - */ -static const char *_emm_as_primitive_str[] = { - "EMMAS_SECURITY_REQ", - "EMMAS_SECURITY_IND", - "EMMAS_SECURITY_RES", - "EMMAS_SECURITY_REJ", - "EMMAS_ESTABLISH_REQ", - "EMMAS_ESTABLISH_CNF", - "EMMAS_ESTABLISH_REJ", - "EMMAS_RELEASE_REQ", - "EMMAS_RELEASE_IND", - "EMMAS_DATA_REQ", - "EMMAS_DATA_IND", - "EMMAS_PAGE_IND", - "EMMAS_STATUS_IND", - "EMMAS_CELL_INFO_REQ", - "EMMAS_CELL_INFO_RES", - "EMMAS_CELL_INFO_IND", -}; - -/* - * Functions executed to process EMM procedures upon receiving - * data from the network - */ -static int _emm_as_recv(unsigned int ueid, const char *msg, int len, - int *emm_cause); - -#ifdef NAS_UE -static int _emm_as_establish_cnf(const emm_as_establish_t *msg, int *emm_cause); -static int _emm_as_establish_rej(void); -static int _emm_as_release_ind(const emm_as_release_t *msg); -static int _emm_as_page_ind(const emm_as_page_t *msg); -#endif - -#ifdef NAS_MME -static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause); -#endif - -static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg); -static int _emm_as_cell_info_ind(const emm_as_cell_info_t *msg); - -static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause); - -/* - * Functions executed to send data to the network when requested - * within EMM procedure processing - */ -static EMM_msg *_emm_as_set_header(nas_message_t *msg, - const emm_as_security_data_t *security); -static int -_emm_as_encode( - as_nas_info_t *info, - nas_message_t *msg, - int length, - emm_security_context_t *emm_security_context); - -static int _emm_as_encrypt( - as_nas_info_t *info, - const nas_message_security_header_t *header, - const char *buffer, - int length, - emm_security_context_t *emm_security_context); - -static int _emm_as_send(const emm_as_t *msg); - -#ifdef NAS_UE -static int _emm_as_security_res(const emm_as_security_t *, - ul_info_transfer_req_t *); -static int _emm_as_establish_req(const emm_as_establish_t *, - nas_establish_req_t *); -#endif - -#ifdef NAS_MME -static int _emm_as_security_req(const emm_as_security_t *, - dl_info_transfer_req_t *); -static int _emm_as_security_rej(const emm_as_security_t *, - dl_info_transfer_req_t *); -static int _emm_as_establish_cnf(const emm_as_establish_t *, - nas_establish_rsp_t *); -static int _emm_as_establish_rej(const emm_as_establish_t *, - nas_establish_rsp_t *); -static int _emm_as_page_ind(const emm_as_page_t *, paging_req_t *); -#endif - -static int _emm_as_cell_info_req(const emm_as_cell_info_t *, cell_info_req_t *); - -static int _emm_as_data_req(const emm_as_data_t *, ul_info_transfer_req_t *); -static int _emm_as_status_ind(const emm_as_status_t *, ul_info_transfer_req_t *); -static int _emm_as_release_req(const emm_as_release_t *, nas_release_req_t *); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_as_initialize() ** - ** ** - ** Description: Initializes the EMMAS Service Access Point ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: NONE ** - ** ** - ***************************************************************************/ -void emm_as_initialize(void) -{ - LOG_FUNC_IN; - - /* TODO: Initialize the EMMAS-SAP */ - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: emm_as_send() ** - ** ** - ** Description: Processes the EMMAS Service Access Point primitive. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_as_send(const emm_as_t *msg) -{ - LOG_FUNC_IN; - - int rc; - int emm_cause = EMM_CAUSE_SUCCESS; - emm_as_primitive_t primitive = msg->primitive; - - UInt32_t ueid = 0; - - LOG_TRACE(INFO, "EMMAS-SAP - Received primitive %s (%d)", - _emm_as_primitive_str[primitive - _EMMAS_START - 1], primitive); - - switch (primitive) { - case _EMMAS_DATA_IND: - rc = _emm_as_data_ind(&msg->u.data, &emm_cause); - ueid = msg->u.data.ueid; - break; - -#ifdef NAS_UE - - case _EMMAS_ESTABLISH_CNF: - rc = _emm_as_establish_cnf(&msg->u.establish, &emm_cause); - break; - - case _EMMAS_ESTABLISH_REJ: - rc = _emm_as_establish_rej(); - break; - - case _EMMAS_RELEASE_IND: - rc = _emm_as_release_ind(&msg->u.release); - break; - - case _EMMAS_PAGE_IND: - rc = _emm_as_page_ind(&msg->u.page); - break; -#endif -#ifdef NAS_MME - - case _EMMAS_ESTABLISH_REQ: - rc = _emm_as_establish_req(&msg->u.establish, &emm_cause); - ueid = msg->u.establish.ueid; - break; -#endif - - case _EMMAS_CELL_INFO_RES: - rc = _emm_as_cell_info_res(&msg->u.cell_info); - break; - - case _EMMAS_CELL_INFO_IND: - rc = _emm_as_cell_info_ind(&msg->u.cell_info); - break; - - default: - /* Other primitives are forwarded to the Access Stratum */ - rc = _emm_as_send(msg); - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "EMMAS-SAP - " - "Failed to process primitive %s (%d)", - _emm_as_primitive_str[primitive - _EMMAS_START - 1], - primitive); - LOG_FUNC_RETURN (RETURNerror); - } - - break; - } - - /* Handle decoding errors */ - if (emm_cause != EMM_CAUSE_SUCCESS) { - /* Ignore received message that is too short to contain a complete - * message type information element */ - if (rc == TLV_DECODE_BUFFER_TOO_SHORT) { - LOG_FUNC_RETURN (RETURNok); - } - /* Ignore received message that contains not supported protocol - * discriminator */ - else if (rc == TLV_DECODE_PROTOCOL_NOT_SUPPORTED) { - LOG_FUNC_RETURN (RETURNok); - } else if (rc == TLV_DECODE_WRONG_MESSAGE_TYPE) { - emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED; - } - - /* EMM message processing failed */ - LOG_TRACE(WARNING, "EMMAS-SAP - Received EMM message is not valid " - "(cause=%d)", emm_cause); - /* Return an EMM status message */ - rc = emm_proc_status(ueid, emm_cause); - } - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "EMMAS-SAP - Failed to process primitive %s (%d)", - _emm_as_primitive_str[primitive - _EMMAS_START - 1], - primitive); - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed to process EMM procedures upon receiving data from the - * network - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_as_recv() ** - ** ** - ** Description: Decodes and processes the EPS Mobility Management message ** - ** received from the Access Stratum ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The EMM message to process ** - ** len: The length of the EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_recv(unsigned int ueid, const char *msg, int len, - int *emm_cause) -{ - LOG_FUNC_IN; - - int decoder_rc; - int rc = RETURNerror; - - LOG_TRACE(INFO, "EMMAS-SAP - Received EMM message (length=%d)", len); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - emm_security_context_t *security = NULL; /* Current EPS NAS security context */ -#if defined(NAS_MME) -#if defined(NAS_BUILT_IN_EPC) - emm_data_context_t *emm_ctx = NULL; -#endif - -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, ueid); - - if (emm_ctx) { - security = emm_ctx->security; - } - -#else - - if (ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[ueid]; - - if (emm_ctx) { - security = emm_ctx->security; - } - } - -#endif -#else /* NAS_MME */ - security = _emm_data.security; -#endif - - /* Decode the received message */ - decoder_rc = nas_message_decode(msg, &nas_msg, len, security); - - if (decoder_rc < 0) { - LOG_TRACE(WARNING, "EMMAS-SAP - Failed to decode NAS message " - "(err=%d)", decoder_rc); - *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (decoder_rc); - } - - /* Process NAS message */ - EMM_msg *emm_msg = &nas_msg.plain.emm; - - switch (emm_msg->header.message_type) { - case EMM_STATUS: - rc = emm_recv_status(ueid, &emm_msg->emm_status, emm_cause); - break; - -#ifdef NAS_UE - - case IDENTITY_REQUEST: - rc = emm_recv_identity_request(&emm_msg->identity_request, - emm_cause); - break; - - case AUTHENTICATION_REQUEST: - rc = emm_recv_authentication_request( - &emm_msg->authentication_request, - emm_cause); - break; - - case AUTHENTICATION_REJECT: - rc = emm_recv_authentication_reject( - &emm_msg->authentication_reject, - emm_cause); - break; - - case SECURITY_MODE_COMMAND: - rc = emm_recv_security_mode_command( - &emm_msg->security_mode_command, - emm_cause); - break; - - case DETACH_ACCEPT: - rc = emm_recv_detach_accept(&emm_msg->detach_accept, emm_cause); - break; -#endif - -#ifdef NAS_UE - - case TRACKING_AREA_UPDATE_ACCEPT: - case TRACKING_AREA_UPDATE_REJECT: - case SERVICE_REJECT: - case GUTI_REALLOCATION_COMMAND: - case EMM_INFORMATION: - case DOWNLINK_NAS_TRANSPORT: - case CS_SERVICE_NOTIFICATION: - /* TODO */ - break; -#endif -#ifdef NAS_MME - - case ATTACH_REQUEST: - rc = emm_recv_attach_request( - ueid, - &emm_msg->attach_request, - emm_cause); - break; - - case IDENTITY_RESPONSE: - rc = emm_recv_identity_response( - ueid, - &emm_msg->identity_response, - emm_cause); - break; - - case AUTHENTICATION_RESPONSE: - rc = emm_recv_authentication_response( - ueid, - &emm_msg->authentication_response, - emm_cause); - break; - - case AUTHENTICATION_FAILURE: - rc = emm_recv_authentication_failure( - ueid, - &emm_msg->authentication_failure, - emm_cause); - break; - - case SECURITY_MODE_COMPLETE: - rc = emm_recv_security_mode_complete( - ueid, - &emm_msg->security_mode_complete, - emm_cause); - break; - - case SECURITY_MODE_REJECT: - rc = emm_recv_security_mode_reject(ueid, - &emm_msg->security_mode_reject, - emm_cause); - break; - - case ATTACH_COMPLETE: - rc = emm_recv_attach_complete(ueid, &emm_msg->attach_complete, - emm_cause); - break; - - case TRACKING_AREA_UPDATE_COMPLETE: - case GUTI_REALLOCATION_COMPLETE: - case UPLINK_NAS_TRANSPORT: - /* TODO */ - break; - - case DETACH_REQUEST: - rc = emm_recv_detach_request(ueid, &emm_msg->detach_request, - emm_cause); - break; -#endif - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - EMM message 0x%x is not valid", - emm_msg->header.message_type); - *emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; - break; - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_data_ind() ** - ** ** - ** Description: Processes the EMMAS-SAP data transfer indication ** - ** primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: DATA_IND - Data transfer procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_data_ind(const emm_as_data_t *msg, int *emm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS data transfer indication " - "(ueid=%u, delivered=%s, length=%d)", msg->ueid, - (msg->delivered)? "TRUE" : "FALSE", msg->NASmsg.length); - - if (msg->delivered) { - if (msg->NASmsg.length > 0) { - /* Process the received NAS message */ - char *plain_msg = (char *)malloc(msg->NASmsg.length); - - if (plain_msg) { - nas_message_security_header_t header; - emm_security_context_t *security = NULL; /* Current EPS NAS security context */ - - memset(&header, 0, sizeof(header)); - /* Decrypt the received security protected message */ -#if defined(NAS_MME) - emm_data_context_t *emm_ctx = NULL; -#if defined(NAS_BUILT_IN_EPC) - - if (msg->ueid > 0) { - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); - - if (emm_ctx) { - security = emm_ctx->security; - } - } - -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - - if (emm_ctx) { - security = emm_ctx->security; - } - } - -#endif -#else - security = _emm_data.security; -#endif - int bytes = nas_message_decrypt((char *)(msg->NASmsg.value), - plain_msg, - &header, - msg->NASmsg.length, - security - ); - - if (bytes < 0) { - /* Failed to decrypt the message */ - *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (bytes); - } else if (header.protocol_discriminator == - EPS_MOBILITY_MANAGEMENT_MESSAGE) { - /* Process EMM data */ - rc = _emm_as_recv(msg->ueid, plain_msg, bytes, emm_cause); - } else if (header.protocol_discriminator == - EPS_SESSION_MANAGEMENT_MESSAGE) { - const OctetString data = {bytes, (uint8_t *)plain_msg}; - /* Foward ESM data to EPS session management */ - rc = lowerlayer_data_ind(msg->ueid, &data); - } - - free(plain_msg); - } - } else { - /* Process successfull lower layer transfer indication */ - rc = lowerlayer_success(msg->ueid); - } - } else { - /* Process lower layer transmission failure of NAS message */ - rc = lowerlayer_failure(msg->ueid); - } - - LOG_FUNC_RETURN (rc); -} - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _emm_as_establish_cnf() ** - ** ** - ** Description: Processes the EMMAS-SAP connection establish confirmation ** - ** primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: ESTABLISH_CNF - NAS signalling connection ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_establish_cnf(const emm_as_establish_t *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int decoder_rc; - int rc = RETURNerror; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS connection establish confirm"); - - if (msg->NASmsg.length > 0) { - /* The NAS signalling connection is established */ - (void) lowerlayer_establish(); - } else { - /* The initial NAS message has been successfully delivered to - * lower layers */ - rc = lowerlayer_success(0); - LOG_FUNC_RETURN (rc); - } - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Decode initial NAS message */ - decoder_rc = nas_message_decode((char *)(msg->NASmsg.value), - &nas_msg, - msg->NASmsg.length, - _emm_data.security); - - if (decoder_rc < 0) { - LOG_TRACE(WARNING, "EMMAS-SAP - Failed to decode initial NAS message" - "(err=%d)", decoder_rc); - *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (decoder_rc); - } - - /* Process initial NAS message */ - EMM_msg *emm_msg = &nas_msg.plain.emm; - - switch (emm_msg->header.message_type) { - case ATTACH_ACCEPT: - rc = emm_recv_attach_accept(&emm_msg->attach_accept, emm_cause); - break; - - case ATTACH_REJECT: - rc = emm_recv_attach_reject(&emm_msg->attach_reject, emm_cause); - break; - - case DETACH_ACCEPT: - break; - - case TRACKING_AREA_UPDATE_ACCEPT: - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Initial NAS message 0x%x is " - "not valid", emm_msg->header.message_type); - *emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; - break; - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_establish_rej() ** - ** ** - ** Description: Processes the EMMAS-SAP connection establish reject ** - ** primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: ESTABLISH_REJ - NAS signalling connection ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_establish_rej(void) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS initial NAS message transmission " - "failure"); - - /* Process lower layer transmission failure of initial NAS message */ - rc = lowerlayer_failure(0); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_release_ind() ** - ** ** - ** Description: Processes the EMMAS-SAP connection release indication ** - ** primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: RELEASE_IND - NAS signalling release procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_release_ind(const emm_as_release_t *msg) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS connection release indication " - "(cause=%d)", msg->cause); - - /* Process NAS signalling connection release indication */ - rc = lowerlayer_release(msg->cause); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_page_ind() ** - ** ** - ** Description: Processes the EMMAS-SAP paging data indication primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: PAGE_IND - Paging data procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_page_ind(const emm_as_page_t *msg) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS paging data indication"); - - /* TODO */ - - LOG_FUNC_RETURN (rc); -} - -#endif - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _emm_as_establish_req() ** - ** ** - ** Description: Processes the EMMAS-SAP connection establish request ** - ** primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: ESTABLISH_REQ - NAS signalling connection ** - ** The AS notifies the NAS that establishment of the signal- ** - ** ling connection has been requested to tranfer initial NAS ** - ** message from the UE. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause) -{ - LOG_FUNC_IN; - - struct emm_data_context_s *emm_ctx = NULL; - emm_security_context_t *emm_security_context = NULL; - int decoder_rc; - int rc = RETURNerror; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS connection establish request"); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - -#if defined(NAS_MME) -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - } - -#endif - - if (emm_ctx) { - emm_security_context = emm_ctx->security; - } - -#else /* NAS_MME */ - security = _emm_data.security; -#endif - - - /* Decode initial NAS message */ - decoder_rc = nas_message_decode( - (char *)(msg->NASmsg.value), - &nas_msg, - msg->NASmsg.length, - emm_security_context); - - if (decoder_rc < TLV_DECODE_FATAL_ERROR) { - *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (decoder_rc); - } else if (decoder_rc == TLV_DECODE_UNEXPECTED_IEI) { - *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED; - } else if (decoder_rc < 0) { - *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - } - - /* Process initial NAS message */ - EMM_msg *emm_msg = &nas_msg.plain.emm; - - switch (emm_msg->header.message_type) { - case ATTACH_REQUEST: - rc = emm_recv_attach_request( - msg->ueid, - &emm_msg->attach_request, - emm_cause); - break; - - case DETACH_REQUEST: - rc = RETURNok; /* TODO */ - break; - - case TRACKING_AREA_UPDATE_REQUEST: - rc = emm_recv_tracking_area_update_request( - msg->ueid, - &emm_msg->tracking_area_update_request, - emm_cause); - break; - - case SERVICE_REQUEST: - rc = RETURNok; /* TODO */ - break; - - case EXTENDED_SERVICE_REQUEST: - rc = RETURNok; /* TODO */ - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Initial NAS message 0x%x is " - "not valid", emm_msg->header.message_type); - *emm_cause = EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; - break; - } - - LOG_FUNC_RETURN (rc); -} -#endif - -/**************************************************************************** - ** ** - ** Name: _emm_as_cell_info_res() ** - ** ** - ** Description: Processes the EMMAS-SAP cell information response ** - ** primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: CELL_INFO_RES - PLMN and cell selection procedure ** - ** The NAS received a response to cell selection request pre- ** - ** viously sent to the Access-Startum. If a suitable cell is ** - ** found to serve the selected PLMN with associated Radio Ac- ** - ** cess Technologies, this cell is selected to camp on. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_cell_info_res(const emm_as_cell_info_t *msg) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS cell information response"); - -#ifdef NAS_UE - int AcT = NET_ACCESS_EUTRAN; - - if (msg->found == TRUE) { - /* Get the first supported access technology */ - while (AcT != NET_ACCESS_UNAVAILABLE) { - if (msg->rat & (1 << AcT)) { - break; - } - - AcT -= 1; - } - } - - /* Notify EMM that a cell has been found */ - rc = emm_proc_plmn_selection_end(msg->found, msg->tac, msg->cellID, AcT); -#endif - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_cell_info_ind() ** - ** ** - ** Description: Processes the EMMAS-SAP cell information indication ** - ** primitive ** - ** ** - ** EMMAS-SAP - AS->EMM: CELL_INFO_IND - PLMN and cell selection procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_cell_info_ind(const emm_as_cell_info_t *msg) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received AS cell information indication"); - - /* TODO */ - - LOG_FUNC_RETURN (rc); -} - -/* - * -------------------------------------------------------------------------- - * Functions executed to send data to the network when requested within EMM - * procedure processing - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _emm_as_set_header() ** - ** ** - ** Description: Setup the security header of the given NAS message ** - ** ** - ** Inputs: security: The NAS security data to use ** - ** Others: None ** - ** ** - ** Outputs: msg: The NAS message ** - ** Return: Pointer to the plain NAS message to be se- ** - ** curity protected if setting of the securi- ** - ** ty header succeed; ** - ** NULL pointer otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -static EMM_msg *_emm_as_set_header(nas_message_t *msg, - const emm_as_security_data_t *security) -{ - LOG_FUNC_IN; - - msg->header.protocol_discriminator = EPS_MOBILITY_MANAGEMENT_MESSAGE; - - if ( security && (security->ksi != EMM_AS_NO_KEY_AVAILABLE) ) { - /* A valid EPS security context exists */ - if (security->is_new) { - /* New EPS security context is taken into use */ - if (security->k_int) { - if (security->k_enc) { - /* NAS integrity and cyphering keys are available */ - msg->header.security_header_type = - SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED_NEW; - } else { - /* NAS integrity key only is available */ - msg->header.security_header_type = - SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_NEW; - } - - LOG_FUNC_RETURN (&msg->security_protected.plain.emm); - } - } else if (security->k_int) { - if (security->k_enc) { - /* NAS integrity and cyphering keys are available */ - msg->header.security_header_type = - SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED; - } else { - /* NAS integrity key only is available */ - msg->header.security_header_type = - SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED; - } - - LOG_FUNC_RETURN (&msg->security_protected.plain.emm); - } else { - /* No valid EPS security context exists */ - msg->header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; - LOG_FUNC_RETURN (&msg->plain.emm); - } - } else { - /* No valid EPS security context exists */ - msg->header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; - LOG_FUNC_RETURN (&msg->plain.emm); - } - - /* A valid EPS security context exists but NAS integrity key - * is not available */ - LOG_FUNC_RETURN (NULL); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_encode() ** - ** ** - ** Description: Encodes NAS message into NAS information container ** - ** ** - ** Inputs: msg: The NAS message to encode ** - ** length: The maximum length of the NAS message ** - ** Others: None ** - ** ** - ** Outputs: info: The NAS information container ** - ** msg: The NAS message to encode ** - ** Return: The number of bytes successfully encoded ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int -_emm_as_encode( - as_nas_info_t *info, - nas_message_t *msg, - int length, - emm_security_context_t *emm_security_context) -{ - LOG_FUNC_IN; - - int bytes = 0; - - if (msg->header.security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { - emm_msg_header_t *header = &msg->security_protected.plain.emm.header; - /* Expand size of protected NAS message */ - length += NAS_MESSAGE_SECURITY_HEADER_SIZE; - /* Set header of plain NAS message */ - header->protocol_discriminator = EPS_MOBILITY_MANAGEMENT_MESSAGE; - header->security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; - } - - /* Allocate memory to the NAS information container */ - info->data = (Byte_t *)malloc(length * sizeof(Byte_t)); - - if (info->data != NULL) { - /* Encode the NAS message */ - bytes = nas_message_encode( - (char *)(info->data), - msg, - length, - emm_security_context); - - if (bytes > 0) { - info->length = bytes; - } else { - free(info->data); - info->length = 0; - info->data = NULL; - } - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_encrypt() ** - ** ** - ** Description: Encryts NAS message into NAS information container ** - ** ** - ** Inputs: header: The Security header in used ** - ** msg: The NAS message to encrypt ** - ** length: The maximum length of the NAS message ** - ** Others: None ** - ** ** - ** Outputs: info: The NAS information container ** - ** Return: The number of bytes successfully encrypted ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int -_emm_as_encrypt( - as_nas_info_t *info, - const nas_message_security_header_t *header, - const char *msg, - int length, - emm_security_context_t *emm_security_context) -{ - LOG_FUNC_IN; - - int bytes = 0; - - if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { - /* Expand size of protected NAS message */ - length += NAS_MESSAGE_SECURITY_HEADER_SIZE; - } - - /* Allocate memory to the NAS information container */ - info->data = (Byte_t *)malloc(length * sizeof(Byte_t)); - - if (info->data != NULL) { - /* Encrypt the NAS information message */ - bytes = nas_message_encrypt( - msg, - (char *)(info->data), - header, - length, - emm_security_context); - - if (bytes > 0) { - info->length = bytes; - } else { - free(info->data); - info->length = 0; - info->data = NULL; - } - } - - LOG_FUNC_RETURN (bytes); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_send() ** - ** ** - ** Description: Builds NAS message according to the given EMMAS Service ** - ** Access Point primitive and sends it to the Access Stratum ** - ** sublayer ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to be sent ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_send(const emm_as_t *msg) -{ - LOG_FUNC_IN; - - as_message_t as_msg; - memset(&as_msg, 0 , sizeof(as_message_t)); - - switch (msg->primitive) { - case _EMMAS_DATA_REQ: - as_msg.msgID = _emm_as_data_req( - &msg->u.data, - &as_msg.msg.ul_info_transfer_req); - break; - - case _EMMAS_STATUS_IND: - as_msg.msgID = _emm_as_status_ind( - &msg->u.status, - &as_msg.msg.ul_info_transfer_req); - break; - - case _EMMAS_RELEASE_REQ: - as_msg.msgID = _emm_as_release_req( - &msg->u.release, - &as_msg.msg.nas_release_req); - break; - -#ifdef NAS_UE - - case _EMMAS_SECURITY_RES: - as_msg.msgID = _emm_as_security_res( - &msg->u.security, - &as_msg.msg.ul_info_transfer_req); - break; - - case _EMMAS_ESTABLISH_REQ: - as_msg.msgID = _emm_as_establish_req( - &msg->u.establish, - &as_msg.msg.nas_establish_req); - break; - -#endif -#ifdef NAS_MME - - case _EMMAS_SECURITY_REQ: - as_msg.msgID = _emm_as_security_req( - &msg->u.security, - &as_msg.msg.dl_info_transfer_req); - break; - - case _EMMAS_SECURITY_REJ: - as_msg.msgID = _emm_as_security_rej( - &msg->u.security, - &as_msg.msg.dl_info_transfer_req); - break; - - case _EMMAS_ESTABLISH_CNF: - as_msg.msgID = _emm_as_establish_cnf( - &msg->u.establish, - &as_msg.msg.nas_establish_rsp); - break; - - case _EMMAS_ESTABLISH_REJ: - as_msg.msgID = _emm_as_establish_rej( - &msg->u.establish, - &as_msg.msg.nas_establish_rsp); - break; - - case _EMMAS_PAGE_IND: - as_msg.msgID = _emm_as_page_ind(&msg->u.page, - &as_msg.msg.paging_req); - break; - -#endif - - case _EMMAS_CELL_INFO_REQ: - as_msg.msgID = _emm_as_cell_info_req(&msg->u.cell_info, - &as_msg.msg.cell_info_req); - /* - * TODO: NAS may provide a list of equivalent PLMNs, if available, - * that AS shall use for cell selection and cell reselection. - */ - break; - - default: - as_msg.msgID = 0; - break; - } - - /* Send the message to the Access Stratum or S1AP in case of MME */ - if (as_msg.msgID > 0) { -#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME) - LOG_TRACE(DEBUG, "EMMAS-SAP - " - "Sending msg with id 0x%x, primitive %s (%d) to S1AP layer for transmission", - as_msg.msgID, - _emm_as_primitive_str[msg->primitive - _EMMAS_START - 1], - msg->primitive); - - switch (as_msg.msgID) { - case AS_DL_INFO_TRANSFER_REQ: { - nas_itti_dl_data_req( - as_msg.msg.dl_info_transfer_req.UEid, - as_msg.msg.dl_info_transfer_req.nasMsg.data, - as_msg.msg.dl_info_transfer_req.nasMsg.length); - LOG_FUNC_RETURN (RETURNok); - } - break; - - case AS_NAS_ESTABLISH_RSP: - case AS_NAS_ESTABLISH_CNF: { - if (as_msg.msg.nas_establish_rsp.errCode != AS_SUCCESS) { - nas_itti_dl_data_req( - as_msg.msg.nas_establish_rsp.UEid, - as_msg.msg.nas_establish_rsp.nasMsg.data, - as_msg.msg.nas_establish_rsp.nasMsg.length); - LOG_FUNC_RETURN (RETURNok); - } else { - LOG_TRACE(DEBUG, "EMMAS-SAP - " - "Sending nas_itti_establish_cnf to S1AP UE ID %d" - " selected_encryption_algorithm 0x%04X", - " selected_integrity_algorithm 0x%04X", - as_msg.msg.nas_establish_rsp.UEid, - as_msg.msg.nas_establish_rsp.selected_encryption_algorithm, - as_msg.msg.nas_establish_rsp.selected_integrity_algorithm); - /* Handle success case */ - nas_itti_establish_cnf( - as_msg.msg.nas_establish_rsp.UEid, - as_msg.msg.nas_establish_rsp.errCode, - as_msg.msg.nas_establish_rsp.nasMsg.data, - as_msg.msg.nas_establish_rsp.nasMsg.length, - as_msg.msg.nas_establish_rsp.selected_encryption_algorithm, - as_msg.msg.nas_establish_rsp.selected_integrity_algorithm); - LOG_FUNC_RETURN (RETURNok); - } - } - break; - - default: - break; - } - -#else -# if defined(NAS_BUILT_IN_UE) && defined(NAS_UE) - LOG_TRACE(DEBUG, "EMMAS-SAP - " - "Sending msg with id 0x%x, primitive %s (%d) to RRC layer for transmission", - as_msg.msgID, - _emm_as_primitive_str[msg->primitive - _EMMAS_START - 1], - msg->primitive); - - switch (as_msg.msgID) { - case AS_CELL_INFO_REQ: { - nas_itti_cell_info_req( - as_msg.msg.cell_info_req.plmnID, - as_msg.msg.cell_info_req.rat); - LOG_FUNC_RETURN (RETURNok); - } - break; - - case AS_NAS_ESTABLISH_REQ: { - nas_itti_nas_establish_req( - as_msg.msg.nas_establish_req.cause, - as_msg.msg.nas_establish_req.type, - as_msg.msg.nas_establish_req.s_tmsi, - as_msg.msg.nas_establish_req.plmnID, - as_msg.msg.nas_establish_req.initialNasMsg.data, - as_msg.msg.nas_establish_req.initialNasMsg.length); - LOG_FUNC_RETURN (RETURNok); - } - break; - - case AS_UL_INFO_TRANSFER_REQ: { - nas_itti_ul_data_req( - as_msg.msg.ul_info_transfer_req.UEid, - as_msg.msg.ul_info_transfer_req.nasMsg.data, - as_msg.msg.ul_info_transfer_req.nasMsg.length); - LOG_FUNC_RETURN (RETURNok); - } - break; - - case AS_RAB_ESTABLISH_RSP: { - nas_itti_rab_establish_rsp( - as_msg.msg.rab_establish_rsp.s_tmsi, - as_msg.msg.rab_establish_rsp.rabID, - as_msg.msg.rab_establish_rsp.errCode); - LOG_FUNC_RETURN (RETURNok); - } - break; - - default: - break; - } - -# else - int bytes = as_message_send(&as_msg); - - if (bytes > 0) { - LOG_FUNC_RETURN (RETURNok); - } - -# endif -#endif - } - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_data_req() ** - ** ** - ** Description: Processes the EMMAS-SAP data transfer request ** - ** primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: DATA_REQ - Data transfer procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_data_req(const emm_as_data_t *msg, - ul_info_transfer_req_t *as_msg) -{ - LOG_FUNC_IN; - - int size = 0; - int is_encoded = FALSE; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS data transfer request"); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - if (msg->guti) { - as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi; - } else { - as_msg->UEid = msg->ueid; - } - - /* Setup the NAS security header */ - EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the NAS information message */ - if (emm_msg != NULL) switch (msg->NASinfo) { -#ifdef NAS_UE - - case EMM_AS_NAS_DATA_ATTACH: - size = emm_send_attach_complete(msg, &emm_msg->attach_complete); - break; - - case EMM_AS_NAS_DATA_DETACH: - size = emm_send_detach_request(msg, &emm_msg->detach_request); - break; -#endif - -#ifdef NAS_MME - - case EMM_AS_NAS_DATA_DETACH: - size = emm_send_detach_accept(msg, &emm_msg->detach_accept); - break; -#endif - - default: - /* Send other NAS messages as already encoded ESM messages */ - size = msg->NASmsg.length; - is_encoded = TRUE; - break; - } - - if (size > 0) { - int bytes; - emm_security_context_t *emm_security_context = NULL; -#if defined(NAS_MME) - struct emm_data_context_s *emm_ctx = NULL; -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - } - -#endif - - if (emm_ctx) { - emm_security_context = emm_ctx->security; - } - -#else - emm_security_context = _emm_data.security; -#endif - - if (emm_security_context) { -#ifdef NAS_MME - nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num; -#else - nas_msg.header.sequence_number = emm_security_context->ul_count.seq_num; -#endif - LOG_TRACE(DEBUG, - "Set nas_msg.header.sequence_number -> %u", - nas_msg.header.sequence_number); - } - - if (!is_encoded) { - /* Encode the NAS information message */ - bytes = _emm_as_encode(&as_msg->nasMsg, - &nas_msg, - size, - emm_security_context); - } else { - /* Encrypt the NAS information message */ - bytes = _emm_as_encrypt(&as_msg->nasMsg, - &nas_msg.header, - (char *)(msg->NASmsg.value), - size, - emm_security_context); - } - - if (bytes > 0) { -#ifdef NAS_UE - LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ); -#endif -#ifdef NAS_MME - LOG_FUNC_RETURN (AS_DL_INFO_TRANSFER_REQ); -#endif - } - } - - LOG_FUNC_RETURN (0); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_status_ind() ** - ** ** - ** Description: Processes the EMMAS-SAP status indication primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: STATUS_IND - EMM status report procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_status_ind(const emm_as_status_t *msg, - ul_info_transfer_req_t *as_msg) -{ - LOG_FUNC_IN; - - int size = 0; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS status indication (cause=%d)", - msg->emm_cause); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - if (msg->guti) { - as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi; - } else { - as_msg->UEid = msg->ueid; - } - - /* Setup the NAS security header */ - EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the NAS information message */ - if (emm_msg != NULL) { - size = emm_send_status(msg, &emm_msg->emm_status); - } - - if (size > 0) { - emm_security_context_t *emm_security_context = NULL; -#if defined(NAS_MME) - struct emm_data_context_s *emm_ctx = NULL; -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - } - -#endif - - if (emm_ctx) { - emm_security_context = emm_ctx->security; - } - -#else - emm_security_context = _emm_data.security; -#endif - - if (emm_security_context) { -#ifdef NAS_MME - nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num; -#else - nas_msg.header.sequence_number = emm_security_context->ul_count.seq_num; -#endif - LOG_TRACE(DEBUG, - "Set nas_msg.header.sequence_number -> %u", - nas_msg.header.sequence_number); - } - - /* Encode the NAS information message */ - int bytes = _emm_as_encode( - &as_msg->nasMsg, - &nas_msg, - size, - emm_security_context); - - if (bytes > 0) { -#ifdef NAS_UE - LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ); -#endif -#ifdef NAS_MME - LOG_FUNC_RETURN (AS_DL_INFO_TRANSFER_REQ); -#endif - } - } - - LOG_FUNC_RETURN (0); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_release_req() ** - ** ** - ** Description: Processes the EMMAS-SAP connection release request ** - ** primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: RELEASE_REQ - NAS signalling release procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_release_req(const emm_as_release_t *msg, - nas_release_req_t *as_msg) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS release request"); - - /* Setup the AS message */ - if (msg->guti) { - as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi; - } else { - as_msg->UEid = msg->ueid; - } - - if (msg->cause == EMM_AS_CAUSE_AUTHENTICATION) { - as_msg->cause = AS_AUTHENTICATION_FAILURE; - } else if (msg->cause == EMM_AS_CAUSE_DETACH) { - as_msg->cause = AS_DETACH; - } - - LOG_FUNC_RETURN (AS_NAS_RELEASE_REQ); -} - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _emm_as_security_res() ** - ** ** - ** Description: Processes the EMMAS-SAP security response primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: SECURITY_RES - Security mode control procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_security_res(const emm_as_security_t *msg, - ul_info_transfer_req_t *as_msg) -{ - LOG_FUNC_IN; - - int size = 0; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS security response"); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - if (msg->guti) { - as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi; - } - - /* Setup the NAS security header */ - EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the NAS security message */ - if (emm_msg != NULL) switch (msg->msgType) { - case EMM_AS_MSG_TYPE_IDENT: - size = emm_send_identity_response( - msg, - &emm_msg->identity_response); - break; - - case EMM_AS_MSG_TYPE_AUTH: - if (msg->emm_cause != EMM_CAUSE_SUCCESS) { - size = emm_send_authentication_failure( - msg, - &emm_msg->authentication_failure); - } else { - size = emm_send_authentication_response( - msg, - &emm_msg->authentication_response); - } - - break; - - case EMM_AS_MSG_TYPE_SMC: - if (msg->emm_cause != EMM_CAUSE_SUCCESS) { - size = emm_send_security_mode_reject( - msg, - &emm_msg->security_mode_reject); - } else { - size = emm_send_security_mode_complete( - msg, - &emm_msg->security_mode_complete); - } - - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Type of NAS security " - "message 0x%.2x is not valid", msg->msgType); - } - - if (size > 0) { - /* Encode the NAS security message */ - int bytes = _emm_as_encode(&as_msg->nasMsg, - &nas_msg, - size, - _emm_data.security); - - if (bytes > 0) { - LOG_FUNC_RETURN (AS_UL_INFO_TRANSFER_REQ); - } - } - - LOG_FUNC_RETURN (0); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_establish_req() ** - ** ** - ** Description: Processes the EMMAS-SAP connection establish request ** - ** primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: ESTABLISH_REQ - NAS signalling connection ** - ** The NAS requests the AS to establish signalling connection ** - ** to tranfer initial NAS message to the network. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_establish_req(const emm_as_establish_t *msg, - nas_establish_req_t *as_msg) -{ - LOG_FUNC_IN; - - int size = 0; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish request"); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - as_msg->cause = msg->RRCcause; - as_msg->type = msg->RRCtype; - as_msg->plmnID = *msg->plmnID; - - /* Derive the S-TMSI from the GUTI, if valid */ - if (msg->UEid.guti) { - as_msg->s_tmsi.MMEcode = msg->UEid.guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->UEid.guti->m_tmsi; - } - - /* Setup the NAS security header */ - EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the initial NAS information message */ - if (emm_msg != NULL) switch (msg->NASinfo) { - case EMM_AS_NAS_INFO_ATTACH: - size = emm_send_attach_request(msg, &emm_msg->attach_request); - break; - - case EMM_AS_NAS_INFO_DETACH: - size = emm_send_initial_detach_request(msg, - &emm_msg->detach_request); - break; - - case EMM_AS_NAS_INFO_TAU: - size = emm_send_initial_tau_request(msg, - &emm_msg->tracking_area_update_request); - break; - - case EMM_AS_NAS_INFO_SR: - size = emm_send_initial_sr_request(msg, - &emm_msg->service_request); - break; - - case EMM_AS_NAS_INFO_EXTSR: - size = emm_send_initial_extsr_request(msg, - &emm_msg->extended_service_request); - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS " - "message 0x%.2x is not valid", msg->NASinfo); - break; - } - - if (size > 0) { - /* Encode the initial NAS information message */ - int bytes = _emm_as_encode( - &as_msg->initialNasMsg, - &nas_msg, - size, - _emm_data.security); - - if (bytes > 0) { - LOG_FUNC_RETURN (AS_NAS_ESTABLISH_REQ); - } - } - - LOG_FUNC_RETURN (0); -} -#endif // NAS_UE - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _emm_as_security_req() ** - ** ** - ** Description: Processes the EMMAS-SAP security request primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: SECURITY_REQ - Security mode control procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_security_req(const emm_as_security_t *msg, - dl_info_transfer_req_t *as_msg) -{ - LOG_FUNC_IN; - - int size = 0; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS security request"); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - if (msg->guti) { - as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi; - } else { - as_msg->UEid = msg->ueid; - } - - /* Setup the NAS security header */ - EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the NAS security message */ - if (emm_msg != NULL) switch (msg->msgType) { - case EMM_AS_MSG_TYPE_IDENT: - if (msg->guti) { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send IDENTITY_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); - } else { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send IDENTITY_REQUEST to ue id %u ", as_msg->UEid); - } - size = emm_send_identity_request(msg, - &emm_msg->identity_request); - break; - - case EMM_AS_MSG_TYPE_AUTH: - if (msg->guti) { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REQUEST to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); - } else { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REQUEST to ue id %u ", as_msg->UEid); - } - size = emm_send_authentication_request(msg, - &emm_msg->authentication_request); - break; - - case EMM_AS_MSG_TYPE_SMC: - if (msg->guti) { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send SECURITY_MODE_COMMAND to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); - } else { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send SECURITY_MODE_COMMAND to ue id %u ", as_msg->UEid); - } - size = emm_send_security_mode_command(msg, - &emm_msg->security_mode_command); - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Type of NAS security " - "message 0x%.2x is not valid", msg->msgType); - } - - if (size > 0) { - struct emm_data_context_s *emm_ctx = NULL; - emm_security_context_t *emm_security_context = NULL; -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - } - -#endif - - if (emm_ctx) { - emm_security_context = emm_ctx->security; - - if (emm_security_context) { - nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num; - LOG_TRACE(DEBUG, - "Set nas_msg.header.sequence_number -> %u", - nas_msg.header.sequence_number); - } - } - - /* Encode the NAS security message */ - int bytes = _emm_as_encode( - &as_msg->nasMsg, - &nas_msg, - size, - emm_security_context); - - if (bytes > 0) { - LOG_FUNC_RETURN (AS_DL_INFO_TRANSFER_REQ); - } - } - - LOG_FUNC_RETURN (0); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_security_rej() ** - ** ** - ** Description: Processes the EMMAS-SAP security reject primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: SECURITY_REJ - Security mode control procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_security_rej(const emm_as_security_t *msg, - dl_info_transfer_req_t *as_msg) -{ - LOG_FUNC_IN; - - int size = 0; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS security reject"); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - if (msg->guti) { - as_msg->s_tmsi.MMEcode = msg->guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->guti->m_tmsi; - } else { - as_msg->UEid = msg->ueid; - } - - /* Setup the NAS security header */ - EMM_msg *emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the NAS security message */ - if (emm_msg != NULL) switch (msg->msgType) { - case EMM_AS_MSG_TYPE_AUTH: - if (msg->guti) { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); - } else { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send AUTHENTICATION_REJECT to ue id %x ", as_msg->UEid); - } - size = emm_send_authentication_reject( - &emm_msg->authentication_reject); - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Type of NAS security " - "message 0x%.2x is not valid", msg->msgType); - } - - if (size > 0) { - struct emm_data_context_s *emm_ctx = NULL; - emm_security_context_t *emm_security_context = NULL; -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - } - -#endif - - if (emm_ctx) { - emm_security_context = emm_ctx->security; - if (emm_security_context) { - nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num; - LOG_TRACE(DEBUG, - "Set nas_msg.header.sequence_number -> %u", - nas_msg.header.sequence_number); - } else { - LOG_TRACE(DEBUG, - "No security context, not set nas_msg.header.sequence_number -> %u", - nas_msg.header.sequence_number); - } - } - - /* Encode the NAS security message */ - int bytes = _emm_as_encode( - &as_msg->nasMsg, - &nas_msg, - size, - emm_security_context); - - if (bytes > 0) { - LOG_FUNC_RETURN (AS_DL_INFO_TRANSFER_REQ); - } - } - - LOG_FUNC_RETURN (0); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_establish_cnf() ** - ** ** - ** Description: Processes the EMMAS-SAP connection establish confirm ** - ** primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: ESTABLISH_CNF - NAS signalling connection ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_establish_cnf(const emm_as_establish_t *msg, - nas_establish_rsp_t *as_msg) -{ - EMM_msg *emm_msg; - int size = 0; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish confirmation"); - - nas_message_t nas_msg; - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - as_msg->UEid = msg->ueid; - - if (msg->UEid.guti == NULL) { - LOG_TRACE(WARNING, "EMMAS-SAP - GUTI is NULL..."); - LOG_FUNC_RETURN (0); - } - - as_msg->s_tmsi.MMEcode = msg->UEid.guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->UEid.guti->m_tmsi; - - /* Setup the NAS security header */ - emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the initial NAS information message */ - if (emm_msg != NULL) switch (msg->NASinfo) { - case EMM_AS_NAS_INFO_ATTACH: - LOG_TRACE(WARNING, - "EMMAS-SAP - emm_as_establish.nasMSG.length=%d", - msg->NASmsg.length); - - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_ACCEPT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); - - size = emm_send_attach_accept(msg, &emm_msg->attach_accept); - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS " - "message 0x%.2x is not valid", msg->NASinfo); - break; - } - - if (size > 0) { - struct emm_data_context_s *emm_ctx = NULL; - emm_security_context_t *emm_security_context = NULL; -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - } - -#endif - - if (emm_ctx) { - emm_security_context = emm_ctx->security; - - if (emm_security_context) { - as_msg->nas_ul_count = 0x00000000 | - (emm_security_context->ul_count.overflow << 8) | - emm_security_context->ul_count.seq_num; - LOG_TRACE(DEBUG, "EMMAS-SAP - NAS UL COUNT %8x", - as_msg->nas_ul_count); - } - - nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num; - LOG_TRACE(DEBUG, - "Set nas_msg.header.sequence_number -> %u", - nas_msg.header.sequence_number); - - as_msg->selected_encryption_algorithm = htons(0x8000 >> emm_security_context->selected_algorithms.encryption); - as_msg->selected_integrity_algorithm = htons(0x8000 >> emm_security_context->selected_algorithms.integrity); - - LOG_TRACE(DEBUG, - "Set nas_msg.selected_encryption_algorithm -> NBO: 0x%04X (%u)", - as_msg->selected_encryption_algorithm, - emm_security_context->selected_algorithms.encryption); - LOG_TRACE(DEBUG, - "Set nas_msg.selected_integrity_algorithm -> NBO: 0x%04X (%u)", - as_msg->selected_integrity_algorithm, - emm_security_context->selected_algorithms.integrity); - - } - - /* Encode the initial NAS information message */ - int bytes = _emm_as_encode( - &as_msg->nasMsg, - &nas_msg, - size, - emm_security_context); - - if (bytes > 0) { - as_msg->errCode = AS_SUCCESS; - LOG_FUNC_RETURN (AS_NAS_ESTABLISH_CNF); - } - } - - LOG_TRACE(WARNING, "EMMAS-SAP - Size <= 0"); - LOG_FUNC_RETURN (0); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_establish_rej() ** - ** ** - ** Description: Processes the EMMAS-SAP connection establish reject ** - ** primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: ESTABLISH_REJ - NAS signalling connection ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_establish_rej(const emm_as_establish_t *msg, - nas_establish_rsp_t *as_msg) -{ - EMM_msg *emm_msg; - int size = 0; - nas_message_t nas_msg; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS connection establish reject"); - - memset(&nas_msg, 0 , sizeof(nas_message_t)); - - /* Setup the AS message */ - if (msg->UEid.guti) { - as_msg->s_tmsi.MMEcode = msg->UEid.guti->gummei.MMEcode; - as_msg->s_tmsi.m_tmsi = msg->UEid.guti->m_tmsi; - } else { - as_msg->UEid = msg->ueid; - } - - /* Setup the NAS security header */ - emm_msg = _emm_as_set_header(&nas_msg, &msg->sctx); - - /* Setup the NAS information message */ - if (emm_msg != NULL) switch (msg->NASinfo) { - case EMM_AS_NAS_INFO_ATTACH: - if (msg->UEid.guti) { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); - } else { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send ATTACH_REJECT to ue id 0x%06"PRIX32" ", as_msg->UEid); - } - size = emm_send_attach_reject(msg, &emm_msg->attach_reject); - break; - - case EMM_AS_NAS_INFO_TAU: - if (msg->UEid.guti) { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to s_TMSI %u.%u ", as_msg->s_tmsi.MMEcode, as_msg->s_tmsi.m_tmsi); - } else { - MSC_LOG_EVENT(MSC_NAS_EMM_MME, "send TRACKING_AREA_UPDATE_REJECT to ue id 0x%06"PRIX32" ", as_msg->UEid); - } - size = emm_send_tracking_area_update_reject(msg, - &emm_msg->tracking_area_update_reject); - break; - - default: - LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS " - "message 0x%.2x is not valid", msg->NASinfo); - break; - } - - if (size > 0) { - struct emm_data_context_s *emm_ctx = NULL; - emm_security_context_t *emm_security_context = NULL; -#if defined(NAS_BUILT_IN_EPC) - emm_ctx = emm_data_context_get(&_emm_data, msg->ueid); -#else - - if (msg->ueid < EMM_DATA_NB_UE_MAX) { - emm_ctx = _emm_data.ctx[msg->ueid]; - } - -#endif - - if (emm_ctx) { - emm_security_context = emm_ctx->security; - - if (emm_security_context) { - nas_msg.header.sequence_number = emm_security_context->dl_count.seq_num; - LOG_TRACE(DEBUG, - "Set nas_msg.header.sequence_number -> %u", - nas_msg.header.sequence_number); - } - } - - /* Encode the initial NAS information message */ - int bytes = _emm_as_encode( - &as_msg->nasMsg, - &nas_msg, - size, - emm_security_context); - - if (bytes > 0) { - as_msg->errCode = AS_TERMINATED_NAS; - LOG_FUNC_RETURN (AS_NAS_ESTABLISH_RSP); - } - } - - LOG_FUNC_RETURN (0); -} - -/**************************************************************************** - ** ** - ** Name: _emm_as_page_ind() ** - ** ** - ** Description: Processes the EMMAS-SAP paging data indication primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: PAGE_IND - Paging data procedure ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_page_ind(const emm_as_page_t *msg, paging_req_t *as_msg) -{ - LOG_FUNC_IN; - - int bytes = 0; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS data paging indication"); - - /* TODO */ - - if (bytes > 0) { - LOG_FUNC_RETURN (AS_PAGING_IND); - } - - LOG_FUNC_RETURN (0); -} - -#endif // NAS_MME - -/**************************************************************************** - ** ** - ** Name: _emm_as_cell_info_req() ** - ** ** - ** Description: Processes the EMMAS-SAP cell information request ** - ** primitive ** - ** ** - ** EMMAS-SAP - EMM->AS: CELL_INFO_REQ - PLMN and cell selection procedure ** - ** The NAS requests the AS to select a cell belonging to the ** - ** selected PLMN with associated Radio Access Technologies. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: as_msg: The message to send to the AS ** - ** Return: The identifier of the AS message ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _emm_as_cell_info_req(const emm_as_cell_info_t *msg, - cell_info_req_t *as_msg) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMMAS-SAP - Send AS cell information request"); - - as_msg->plmnID = msg->plmnIDs.plmn[0]; - as_msg->rat = msg->rat; - - LOG_FUNC_RETURN (AS_CELL_INFO_REQ); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.h deleted file mode 100644 index ca4fc449b779b6d2093b827d3721ec9d79416559..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_as.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_as.h - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMAS Service Access Point that provides - services to the EPS Mobility Management for NAS message - transfer to/from the Access Stratum sublayer. - -*****************************************************************************/ -#ifndef __EMM_AS_H__ -#define __EMM_AS_H__ - -#include "emm_asDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void emm_as_initialize(void); - -int emm_as_send(const emm_as_t *msg); - -#endif /* __EMM_AS_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_asDef.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_asDef.h deleted file mode 100644 index e2e0a773f8af9a275e45a4a972c6d51ec894fe34..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_asDef.h +++ /dev/null @@ -1,276 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_asDef.h - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMM primitives available at the EMMAS Service - Access Point to transfer NAS messages to/from the Access - Stratum sublayer. - -*****************************************************************************/ -#ifndef __EMM_ASDEF_H__ -#define __EMM_ASDEF_H__ - -#include "commonDef.h" -#include "OctetString.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * EMMAS-SAP primitives - */ -typedef enum emm_as_primitive_u { - _EMMAS_START = 200, - _EMMAS_SECURITY_REQ, /* EMM->AS: Security request */ - _EMMAS_SECURITY_IND, /* AS->EMM: Security indication */ - _EMMAS_SECURITY_RES, /* EMM->AS: Security response */ - _EMMAS_SECURITY_REJ, /* EMM->AS: Security reject */ - _EMMAS_ESTABLISH_REQ, /* EMM->AS: Connection establish request */ - _EMMAS_ESTABLISH_CNF, /* AS->EMM: Connection establish confirm */ - _EMMAS_ESTABLISH_REJ, /* AS->EMM: Connection establish reject */ - _EMMAS_RELEASE_REQ, /* EMM->AS: Connection release request */ - _EMMAS_RELEASE_IND, /* AS->EMM: Connection release indication */ - _EMMAS_DATA_REQ, /* EMM->AS: Data transfer request */ - _EMMAS_DATA_IND, /* AS->EMM: Data transfer indication */ - _EMMAS_PAGE_IND, /* AS->EMM: Paging data indication */ - _EMMAS_STATUS_IND, /* AS->EMM: Status indication */ - _EMMAS_CELL_INFO_REQ, /* EMM->AS: Cell information request */ - _EMMAS_CELL_INFO_RES, /* AS->EMM: Cell information response */ - _EMMAS_CELL_INFO_IND, /* AS->EMM: Cell information indication */ - _EMMAS_END -} emm_as_primitive_t; - -/* Data used to setup EPS NAS security */ -typedef struct emm_as_security_data_s { - UInt8_t is_new; /* New security data indicator */ -#define EMM_AS_NO_KEY_AVAILABLE 0xff - UInt8_t ksi; /* NAS key set identifier */ - UInt8_t sqn; /* Sequence number */ - UInt32_t count; /* NAS counter */ - const OctetString *k_enc; /* NAS cyphering key */ - const OctetString *k_int; /* NAS integrity key */ -} emm_as_security_data_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * EMMAS primitive for security - * ---------------------------- - */ -typedef struct emm_as_security_s { - UInt32_t ueid; /* UE lower layer identifier */ - const GUTI_t *guti; /* GUTI temporary mobile identity */ - emm_as_security_data_t sctx;/* EPS NAS security context */ - int emm_cause; /* EMM failure cause code */ - /* - * Identity request/response - */ - UInt8_t identType; /* Type of requested UE's identity */ - const imsi_t *imsi; /* The requested IMSI of the UE */ - const imei_t *imei; /* The requested IMEI of the UE */ - UInt32_t tmsi; /* The requested TMSI of the UE */ - /* - * Authentication request/response - */ - UInt8_t ksi; /* NAS key set identifier */ - const OctetString *rand; /* Random challenge number */ - const OctetString *autn; /* Authentication token */ - const OctetString *res; /* Authentication response */ - const OctetString *auts; /* Synchronisation failure */ - /* - * Security Mode Command - */ - UInt8_t eea; /* Replayed EPS encryption algorithms */ - UInt8_t eia; /* Replayed EPS integrity algorithms */ - UInt8_t uea; /* Replayed UMTS encryption algorithms */ - uint8_t ucs2; - UInt8_t uia; /* Replayed UMTS integrity algorithms */ - UInt8_t gea; /* Replayed GPRS encryption algorithms */ - UInt8_t umts_present; - UInt8_t gprs_present; - - // Added by LG - UInt8_t selected_eea; /* Selected EPS encryption algorithms */ - UInt8_t selected_eia; /* Selected EPS integrity algorithms */ - -#define EMM_AS_MSG_TYPE_IDENT 0x01 /* Identification message */ -#define EMM_AS_MSG_TYPE_AUTH 0x02 /* Authentication message */ -#define EMM_AS_MSG_TYPE_SMC 0x03 /* Security Mode Command */ - UInt8_t msgType; /* Type of NAS security message to transfer */ -} emm_as_security_t; - -/* - * EMMAS primitive for connection establishment - * -------------------------------------------- - */ -typedef struct emm_as_EPS_identity_s { - const GUTI_t *guti; /* The GUTI, if valid */ - const tai_t *tai; /* The last visited registered Tracking - * Area Identity, if available */ - const imsi_t *imsi; /* IMSI in case of "AttachWithImsi" */ - const imei_t *imei; /* UE's IMEI for emergency bearer services */ -} emm_as_EPS_identity_t; - -typedef struct emm_as_establish_s { - UInt32_t ueid; /* UE lower layer identifier */ - emm_as_EPS_identity_t UEid; /* UE's EPS mobile identity */ - emm_as_security_data_t sctx;/* EPS NAS security context */ - int switch_off; /* TRUE if the UE is switched off */ - UInt8_t type; /* Network attach/detach type */ - UInt8_t RRCcause; /* Connection establishment cause */ - UInt8_t RRCtype; /* Associated call type */ - const plmn_t *plmnID; /* Identifier of the selected PLMN */ - UInt8_t ksi; /* NAS key set identifier */ - UInt8_t encryption:4; /* Ciphering algorithm */ - UInt8_t integrity:4; /* Integrity protection algorithm */ - int emm_cause; /* EMM failure cause code */ - const GUTI_t *new_guti; /* New GUTI, if re-allocated */ - int n_tacs; /* Number of concecutive tracking areas - * the UE is registered to */ - tac_t tac; /* Code of the first tracking area the UE - * is registered to */ -#define EMM_AS_NAS_INFO_ATTACH 0x01 /* Attach request */ -#define EMM_AS_NAS_INFO_DETACH 0x02 /* Detach request */ -#define EMM_AS_NAS_INFO_TAU 0x03 /* Tracking Area Update request */ -#define EMM_AS_NAS_INFO_SR 0x04 /* Service Request */ -#define EMM_AS_NAS_INFO_EXTSR 0x05 /* Extended Service Request */ - UInt8_t NASinfo; /* Type of initial NAS information to transfer */ - OctetString NASmsg; /* NAS message to be transfered within - * initial NAS information message */ -} emm_as_establish_t; - -/* - * EMMAS primitive for connection release - * -------------------------------------- - */ -typedef struct emm_as_release_s { - UInt32_t ueid; /* UE lower layer identifier */ - const GUTI_t *guti; /* GUTI temporary mobile identity */ -#define EMM_AS_CAUSE_AUTHENTICATION 0x01 /* Authentication failure */ -#define EMM_AS_CAUSE_DETACH 0x02 /* Detach requested */ - UInt8_t cause; /* Release cause */ -} emm_as_release_t; - -/* - * EMMAS primitive for data transfer - * --------------------------------- - */ -typedef struct emm_as_data_s { - UInt32_t ueid; /* UE lower layer identifier */ - const GUTI_t *guti; /* GUTI temporary mobile identity */ - emm_as_security_data_t sctx;/* EPS NAS security context */ - int switch_off; /* TRUE if the UE is switched off */ - UInt8_t type; /* Network detach type */ - UInt8_t delivered; /* Data message delivery indicator */ -#define EMM_AS_NAS_DATA_ATTACH 0x01 /* Attach complete */ -#define EMM_AS_NAS_DATA_DETACH 0x02 /* Detach request */ - UInt8_t NASinfo; /* Type of NAS information to transfer */ - OctetString NASmsg; /* NAS message to be transfered */ -} emm_as_data_t; - -/* - * EMMAS primitive for paging - * -------------------------- - */ -typedef struct emm_as_page_s {} emm_as_page_t; - -/* - * EMMAS primitive for status indication - * ------------------------------------- - */ -typedef struct emm_as_status_s { - UInt32_t ueid; /* UE lower layer identifier */ - const GUTI_t *guti; /* GUTI temporary mobile identity */ - emm_as_security_data_t sctx;/* EPS NAS security context */ - int emm_cause; /* EMM failure cause code */ -} emm_as_status_t; - -/* - * EMMAS primitive for cell information - * ------------------------------------ - */ -typedef struct emm_as_cell_info_s { - UInt8_t found; /* Indicates whether a suitable cell is found */ -#define EMM_AS_PLMN_LIST_SIZE 6 - PLMN_LIST_T(EMM_AS_PLMN_LIST_SIZE) plmnIDs; - /* List of identifiers of available PLMNs */ - Byte_t rat; /* Bitmap of Radio Access Technologies */ - tac_t tac; /* Tracking Area Code */ - ci_t cellID; /* cell identity */ -} emm_as_cell_info_t; - -/* - * -------------------------------- - * Structure of EMMAS-SAP primitive - * -------------------------------- - */ -typedef struct emm_as_s { - emm_as_primitive_t primitive; - union { - emm_as_security_t security; - emm_as_establish_t establish; - emm_as_release_t release; - emm_as_data_t data; - emm_as_page_t page; - emm_as_status_t status; - emm_as_cell_info_t cell_info; - } u; -} emm_as_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * Defined in LowerLayer.c - * Setup security data according to the given EPS security context - */ -void emm_as_set_security_data(emm_as_security_data_t *data, const void *context, - int is_new, int is_ciphered); - -#endif /* __EMM_ASDEF_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.c deleted file mode 100644 index 3c9bf936f7b6369e7c006c9b4e41445cf480c0d9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.c +++ /dev/null @@ -1,468 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_cn.c - -Version 0.1 - -Date 2013/12/05 - -Product NAS stack - -Subsystem EPS Core Network - -Author Sebastien Roux, Lionel GAUTHIER - -Description - -*****************************************************************************/ - -#include <string.h> - -#if defined(NAS_BUILT_IN_EPC) - -#include "nas_log.h" -#include "commonDef.h" - -#include "emm_cn.h" -#include "emm_sap.h" -#include "emm_proc.h" -#include "emm_cause.h" - -#include "esm_send.h" // LG -#include "esm_proc.h" // LG -#include "esm_cause.h" // LG -#include "assertions.h"// LG -#include "emmData.h" // LG -#include "esm_sap.h" // LG -#include "EmmCommon.h" // LG -extern int emm_cn_wrapper_attach_accept(emm_data_context_t *emm_ctx, void *data); - -/* - * Internal data used for attach procedure - */ -typedef struct { - unsigned int ueid; /* UE identifier */ -#define ATTACH_COUNTER_MAX 5 - unsigned int retransmission_count; /* Retransmission counter */ - OctetString esm_msg; /* ESM message to be sent within - * the Attach Accept message */ -} attach_data_t; - -/* - * String representation of EMMCN-SAP primitives - */ -static const char *_emm_cn_primitive_str[] = { - "EMM_CN_AUTHENTICATION_PARAM_RES", - "EMM_CN_AUTHENTICATION_PARAM_FAIL", - "EMM_CN_DEREGISTER_UE", - "EMM_CN_PDN_CONNECTIVITY_RES", - "EMM_CN_PDN_CONNECTIVITY_FAIL", -}; - -#define EMM_CN_SAP_BUFFER_SIZE 4096 -static char _emm_cn_sap_buffer[EMM_CN_SAP_BUFFER_SIZE]; - -static int _emm_cn_authentication_res(const emm_cn_auth_res_t *msg) -{ - emm_data_context_t *emm_ctx = NULL; - int rc = RETURNerror; - OctetString loc_rand; - OctetString autn; - - /* We received security vector from HSS. Try to setup security with UE */ - - LOG_FUNC_IN; - - emm_ctx = emm_data_context_get(&_emm_data, msg->ue_id); - - if (emm_ctx == NULL) { - LOG_TRACE(ERROR, "EMM-PROC - " - "Failed to find UE associated to id %u...", msg->ue_id); - LOG_FUNC_RETURN (rc); - } - - /* Copy provided vector to user context */ - memcpy(emm_ctx->vector.kasme, msg->vector.kasme, AUTH_KASME_SIZE); - memcpy(emm_ctx->vector.autn, msg->vector.autn, AUTH_AUTN_SIZE); - memcpy(emm_ctx->vector.rand, msg->vector.rand, AUTH_RAND_SIZE); - memcpy(emm_ctx->vector.xres, msg->vector.xres.data, msg->vector.xres.size); - - LOG_TRACE(INFO, "EMM-PROC - Received RAND ..: "RAND_FORMAT"\n", - RAND_DISPLAY(msg->vector.rand)); - LOG_TRACE(INFO, "EMM-PROC - Received AUTN ..: "AUTN_FORMAT"\n", - AUTN_DISPLAY(msg->vector.autn)); - LOG_TRACE(INFO, "EMM-PROC - Received KASME .: "KASME_FORMAT" "KASME_FORMAT"\n", - KASME_DISPLAY_1(msg->vector.kasme), - KASME_DISPLAY_2(msg->vector.kasme)); - - loc_rand.value = emm_ctx->vector.rand; - loc_rand.length = AUTH_RAND_SIZE; - - autn.value = emm_ctx->vector.autn; - autn.length = AUTH_AUTN_SIZE; - - emm_ctx->vector.xres_size = msg->vector.xres.size; - - /* 3GPP TS 24.401, Figure 5.3.2.1-1, point 5a - * No EMM context exists for the UE in the network; authentication - * and NAS security setup to activate integrity protection and NAS - * ciphering are mandatory. - */ - rc = emm_proc_authentication(emm_ctx, - emm_ctx->ueid, - 0, // TODO: eksi != 0 - &loc_rand, - &autn, - emm_attach_security, - NULL, - NULL); - - if (rc != RETURNok) { - /* Failed to initiate the authentication procedure */ - LOG_TRACE(WARNING, "EMM-PROC - " - "Failed to initiate authentication procedure"); - emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE; - } - - LOG_FUNC_RETURN (rc); -} - -static int _emm_cn_authentication_fail(const emm_cn_auth_fail_t *msg) -{ - int rc = RETURNerror; - - LOG_FUNC_IN; - - rc = emm_proc_attach_reject(msg->ue_id, msg->cause); - - LOG_FUNC_RETURN (rc); -} - -static int _emm_cn_deregister_ue(const UInt32_t ue_id) -{ - int rc = RETURNok; - - LOG_FUNC_IN; - LOG_TRACE(WARNING, "EMM-PROC - " - "TODO deregister UE %u, following procedure is a test"); - emm_proc_detach_request(ue_id, EMM_DETACH_TYPE_EPS /* ??? emm_proc_detach_type_t*/, - 1 /*switch_off*/, 0 /*native_ksi*/, 0 /*ksi*/, - NULL /*guti*/, NULL /*imsi*/, NULL /*imei*/); - LOG_FUNC_RETURN (rc); -} - -static int _emm_cn_pdn_connectivity_res(const emm_cn_pdn_res_t *msg_pP) -{ - int rc = RETURNok; - struct emm_data_context_s *emm_ctx_p = NULL; - esm_proc_pdn_type_t esm_pdn_type = ESM_PDN_TYPE_IPV4; - esm_proc_data_t *esm_proc_data_p = NULL; - ESM_msg esm_msg; - EpsQualityOfService qos; - ProtocolConfigurationOptions pco; - unsigned int pco_in_index = 0; - signed int length_in_pco = 0; - uint16_t pi_or_ci = 0; // protocol identifier or container identifier; - uint8_t length_pi_or_ci = 0; - - OctetString rsp = { 0, NULL}; - int is_standalone = 0; // warning hardcoded - int triggered_by_ue = 1; // warning hardcoded - attach_data_t *data_p = NULL; - int esm_cause = ESM_CAUSE_SUCCESS; - int pid = 0; - unsigned int new_ebi = 0; - - - LOG_FUNC_IN; - emm_ctx_p = emm_data_context_get(&_emm_data, msg_pP->ue_id); - - if (emm_ctx_p == NULL) { - LOG_TRACE(ERROR, "EMMCN-SAP - " - "Failed to find UE associated to id %u...", msg_pP->ue_id); - LOG_FUNC_RETURN (rc); - } - - memset(&esm_msg, 0 , sizeof(ESM_msg)); - - switch (msg_pP->pdn_type) { - case IPv4: - LOG_TRACE(INFO, "EMM - esm_pdn_type = ESM_PDN_TYPE_IPV4"); - esm_pdn_type = ESM_PDN_TYPE_IPV4; - break; - - case IPv6: - LOG_TRACE(INFO, "EMM - esm_pdn_type = ESM_PDN_TYPE_IPV6"); - esm_pdn_type = ESM_PDN_TYPE_IPV6; - break; - - case IPv4_AND_v6: - LOG_TRACE(INFO, "EMM - esm_pdn_type = ESM_PDN_TYPE_IPV4V6"); - esm_pdn_type = ESM_PDN_TYPE_IPV4V6; - break; - - default: - LOG_TRACE(INFO, "EMM - esm_pdn_type = ESM_PDN_TYPE_IPV4 (forced to default)"); - esm_pdn_type = ESM_PDN_TYPE_IPV4; - } - - LOG_TRACE(INFO, "EMM - qci = %u ", msg_pP->qci); - LOG_TRACE(INFO, "EMM - qos.qci = %u ", msg_pP->qos.qci); - LOG_TRACE(INFO, "EMM - qos.mbrUL = %u ", msg_pP->qos.mbrUL); - LOG_TRACE(INFO, "EMM - qos.mbrDL = %u ", msg_pP->qos.mbrDL); - LOG_TRACE(INFO, "EMM - qos.gbrUL = %u ", msg_pP->qos.gbrUL); - LOG_TRACE(INFO, "EMM - qos.gbrDL = %u ", msg_pP->qos.gbrDL); - qos.bitRatesPresent = 0; - qos.bitRatesExtPresent = 0; -#warning "Some work to do here about qos" - qos.qci = msg_pP->qci; - qos.bitRates.maxBitRateForUL = 0;//msg_pP->qos.mbrUL; - qos.bitRates.maxBitRateForDL = 0;//msg_pP->qos.mbrDL; - qos.bitRates.guarBitRateForUL = 0;//msg_pP->qos.gbrUL; - qos.bitRates.guarBitRateForDL = 0;//msg_pP->qos.gbrDL; - - qos.bitRatesExt.maxBitRateForUL = 0; - qos.bitRatesExt.maxBitRateForDL = 0; - qos.bitRatesExt.guarBitRateForUL = 0; - qos.bitRatesExt.guarBitRateForDL = 0; - - //-------------------------------------------------------------------------- - // PCO processing - //-------------------------------------------------------------------------- - memset(&pco, 0, sizeof(ProtocolConfigurationOptions)); - length_in_pco = msg_pP->pco.byte[1]; - if ((length_in_pco+1+1) != msg_pP->pco.length) { - LOG_TRACE(WARNING, "PCO: mismatch in lengths length_pco+1+1 %u != msg_pP->pco.length %u\n", - length_in_pco+1+1, msg_pP->pco.length); - } - pco.configurationprotol = msg_pP->pco.byte[2] & 0x07; - - for (int i = 0; i < msg_pP->pco.length; i++) { - LOG_TRACE(WARNING, "EMMCN_PDN_CONNECTIVITY_RES.pco.byte[%u] = 0x%x", i, msg_pP->pco.byte[i]); - } - - - if ((length_in_pco > 0) && (msg_pP->pco.byte[2] & 0x80)) { - pco_in_index = PCO_MIN_LENGTH; - while (length_in_pco >= 3) { - pi_or_ci = (((uint16_t)msg_pP->pco.byte[pco_in_index]) << 8) | (uint16_t)msg_pP->pco.byte[pco_in_index+1]; - pco_in_index += 2; - length_pi_or_ci = msg_pP->pco.byte[pco_in_index++]; - pco.protocolid[pco.num_protocol_id_or_container_id] = pi_or_ci; - pco.lengthofprotocolid[pco.num_protocol_id_or_container_id] = length_pi_or_ci; - pco.protocolidcontents[pco.num_protocol_id_or_container_id].value = malloc(length_pi_or_ci); - pco.protocolidcontents[pco.num_protocol_id_or_container_id].length = length_pi_or_ci; - memcpy(pco.protocolidcontents[pco.num_protocol_id_or_container_id].value, - &msg_pP->pco.byte[pco_in_index], - length_pi_or_ci); - - LOG_TRACE(WARNING, "PCO: Found pi_or_ci 0x%x length %u content %s\n", - pi_or_ci, length_pi_or_ci, dump_octet_string(&pco.protocolidcontents[pco.num_protocol_id_or_container_id])); - pco.num_protocol_id_or_container_id++; - pco_in_index += length_pi_or_ci; - - length_in_pco = length_in_pco - (length_pi_or_ci + 2 + 1); - } // while (length_in_pco >= 3) { - } // if ((length_in_pco > 0) && (msg_pP->pco.byte[2] & 0x80)) { - /*************************************************************************/ - /* CODE THAT WAS IN esm_recv.c/esm_recv_pdn_connectivity_request() */ - /*************************************************************************/ - /* Execute the PDN connectivity procedure requested by the UE */ - pid = esm_proc_pdn_connectivity_request( - emm_ctx_p, - msg_pP->pti, - msg_pP->request_type, - &msg_pP->apn, - esm_pdn_type, - &msg_pP->pdn_addr, - NULL, - &esm_cause); - LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value)); - - if (pid != RETURNerror) { - /* Create local default EPS bearer context */ - rc = esm_proc_default_eps_bearer_context( - emm_ctx_p, - pid, - &new_ebi, - &msg_pP->qos, - &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - } else { - LOG_FUNC_RETURN (rc); - } - - /**************************************************************************/ - /* END OF CODE THAT WAS IN esm_recv.c/esm_recv_pdn_connectivity_request() */ - /**************************************************************************/ - LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value)); - - - /*************************************************************************/ - /* CODE THAT WAS IN esm_sap.c/_esm_sap_recv() */ - /*************************************************************************/ - /* Return default EPS bearer context request message */ - rc = esm_send_activate_default_eps_bearer_context_request( - msg_pP->pti, - new_ebi, //msg_pP->ebi, - &esm_msg.activate_default_eps_bearer_context_request, - &msg_pP->apn, - &pco, - esm_pdn_type, - &msg_pP->pdn_addr, - &qos, - ESM_CAUSE_SUCCESS); - - - if (rc != RETURNerror) { - /* Encode the returned ESM response message */ - int size = esm_msg_encode(&esm_msg, (uint8_t *)_emm_cn_sap_buffer, - EMM_CN_SAP_BUFFER_SIZE); - LOG_TRACE(INFO, "ESM encoded MSG size %d ", size); - - if (size > 0) { - rsp.length = size; - rsp.value = (uint8_t *)(_emm_cn_sap_buffer); - } - - /* Complete the relevant ESM procedure */ - rc = esm_proc_default_eps_bearer_context_request( - is_standalone, - emm_ctx_p, - new_ebi, //0, //ESM_EBI_UNASSIGNED, //msg->ebi, - &rsp, - triggered_by_ue); - - if (rc != RETURNok) { - /* Return indication that ESM procedure failed */ - LOG_FUNC_RETURN (rc); - } - } else { - LOG_TRACE(INFO, "ESM send activate_default_eps_bearer_context_request failed"); - } - - /*************************************************************************/ - /* END OF CODE THAT WAS IN esm_sap.c/_esm_sap_recv() */ - /*************************************************************************/ - - LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value)); - data_p = (attach_data_t *)emm_proc_common_get_args(msg_pP->ue_id); - - /* Setup the ESM message container */ - data_p->esm_msg.value = (uint8_t *)malloc(rsp.length); - - if (data_p->esm_msg.value) { - data_p->esm_msg.length = rsp.length; - LOG_TRACE(INFO, "EMM - copy ESM MSG %d bytes", data_p->esm_msg.length); - memcpy(data_p->esm_msg.value, - rsp.value, - rsp.length); - } else { - data_p->esm_msg.length = 0; - } - - /* Send attach accept message to the UE */ - rc = emm_cn_wrapper_attach_accept(emm_ctx_p, data_p); - - if (rc != RETURNerror) { - if (emm_ctx_p->guti_is_new && emm_ctx_p->old_guti) { - /* Implicit GUTI reallocation; - * Notify EMM that common procedure has been initiated - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_COMMON_PROC_REQ; - emm_sap.u.emm_reg.ueid = msg_pP->ue_id; - rc = emm_sap_send(&emm_sap); - } - } - - LOG_TRACE(INFO, "EMM - APN = %s ", (char *)(msg_pP->apn.value)); - LOG_FUNC_RETURN (rc); -} - -static int _emm_cn_pdn_connectivity_fail(const emm_cn_pdn_fail_t *msg) -{ - int rc = RETURNok; - - LOG_FUNC_IN; - - LOG_FUNC_RETURN (rc); -} - -int emm_cn_send(const emm_cn_t *msg) -{ - int rc = RETURNerror; - emm_cn_primitive_t primitive = msg->primitive; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMMCN-SAP - Received primitive %s (%d)", - _emm_cn_primitive_str[primitive - _EMMCN_START - 1], primitive); - - switch (primitive) { - case _EMMCN_AUTHENTICATION_PARAM_RES: - rc = _emm_cn_authentication_res(msg->u.auth_res); - break; - - case _EMMCN_AUTHENTICATION_PARAM_FAIL: - rc = _emm_cn_authentication_fail(msg->u.auth_fail); - break; - - case EMMCN_DEREGISTER_UE: - rc = _emm_cn_deregister_ue(msg->u.deregister.UEid); - break; - - case EMMCN_PDN_CONNECTIVITY_RES: - rc = _emm_cn_pdn_connectivity_res(msg->u.emm_cn_pdn_res); - break; - - case EMMCN_PDN_CONNECTIVITY_FAIL: - rc = _emm_cn_pdn_connectivity_fail(msg->u.emm_cn_pdn_fail); - break; - - default: - /* Other primitives are forwarded to the Access Stratum */ - rc = RETURNerror; - break; - } - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "EMMCN-SAP - Failed to process primitive %s (%d)", - _emm_cn_primitive_str[primitive - _EMMCN_START - 1], - primitive); - } - - LOG_FUNC_RETURN (rc); -} -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.h deleted file mode 100644 index cb4e687b628ed8e02c0281858273b2096e5b2d21..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cn.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_cn.h - -Version 0.1 - -Date 2013/12/05 - -Product NAS stack - -Subsystem EPS Core Network - -Author Sebastien Roux, Lionel GAUTHIER - -Description - -*****************************************************************************/ - -#include "emm_cnDef.h" - -#ifndef _EMM_CN_H_ -#define _EMM_CN_H_ - -#if defined(NAS_BUILT_IN_EPC) -int emm_cn_send(const emm_cn_t *msg); -#endif - -#endif /* _EMM_CN_H_ */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cnDef.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cnDef.h deleted file mode 100644 index d5a88b9923e629186999ac012303c7d767f61fa3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_cnDef.h +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_cnDef.h - -Version 0.1 - -Date 2013/12/05 - -Product NAS stack - -Subsystem EPS Core Network - -Author Sebastien Roux, Lionel GAUTHIER - -Description - -*****************************************************************************/ - -#if defined(NAS_BUILT_IN_EPC) -#include "intertask_interface.h" -#endif - -#ifndef __EMM_CNDEF_H__ -#define __EMM_CNDEF_H__ - -typedef enum emmcn_primitive_s { - _EMMCN_START = 400, -#if defined(NAS_BUILT_IN_EPC) - _EMMCN_AUTHENTICATION_PARAM_RES, - _EMMCN_AUTHENTICATION_PARAM_FAIL, - _EMMCN_DEREGISTER_UE, - _EMMCN_PDN_CONNECTIVITY_RES, // LG - _EMMCN_PDN_CONNECTIVITY_FAIL,// LG -#endif - _EMMCN_END -} emm_cn_primitive_t; - -#if defined(NAS_BUILT_IN_EPC) -typedef nas_auth_param_rsp_t emm_cn_auth_res_t; -typedef nas_auth_param_fail_t emm_cn_auth_fail_t; -typedef nas_pdn_connectivity_rsp_t emm_cn_pdn_res_t; -typedef nas_pdn_connectivity_fail_t emm_cn_pdn_fail_t; - -typedef struct emm_cn_deregister_ue_s { - UInt32_t UEid; -} emm_cn_deregister_ue_t; - -typedef struct emm_mme_ul_s { - emm_cn_primitive_t primitive; - union { - emm_cn_auth_res_t *auth_res; - emm_cn_auth_fail_t *auth_fail; - emm_cn_deregister_ue_t deregister; - emm_cn_pdn_res_t *emm_cn_pdn_res; - emm_cn_pdn_fail_t *emm_cn_pdn_fail; - } u; -} emm_cn_t; -#endif - -#endif /* __EMM_CNDEF_H__ */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.c deleted file mode 100644 index 3ffdecb80ae84d1233453df104c5aeeca0777a97..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.c +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_esm.c - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMESM Service Access Point that provides - interlayer services to the EPS Session Management sublayer - for service registration and activate/deactivate PDN - connections. - -*****************************************************************************/ - -#include "emm_esm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "LowerLayer.h" - -#ifdef NAS_UE -#include "emm_proc.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * String representation of EMMESM-SAP primitives - */ -static const char *_emm_esm_primitive_str[] = { -#ifdef NAS_UE - "EMMESM_ESTABLISH_REQ", - "EMMESM_ESTABLISH_CNF", - "EMMESM_ESTABLISH_REJ", -#endif - "EMMESM_RELEASE_IND", - "EMMESM_UNITDATA_REQ", - "EMMESM_UNITDATA_IND", -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_esm_initialize() ** - ** ** - ** Description: Initializes the EMMESM Service Access Point ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: NONE ** - ** ** - ***************************************************************************/ -void emm_esm_initialize(void) -{ - LOG_FUNC_IN; - - /* TODO: Initialize the EMMESM-SAP */ - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: emm_esm_send() ** - ** ** - ** Description: Processes the EMMESM Service Access Point primitive ** - ** ** - ** Inputs: msg: The EMMESM-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_esm_send(const emm_esm_t *msg) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - emm_esm_primitive_t primitive = msg->primitive; - - LOG_TRACE(INFO, "EMMESM-SAP - Received primitive %s (%d)", - _emm_esm_primitive_str[primitive - _EMMESM_START - 1], primitive); - - switch (primitive) { -#ifdef NAS_UE - - case _EMMESM_ESTABLISH_REQ: - /* ESM requests EMM to initiate an attach procedure before - * requesting subsequent connectivity to additional PDNs */ - rc = emm_proc_attach_restart(); - break; - - case _EMMESM_ESTABLISH_CNF: - - /* ESM notifies EMM that PDN connectivity procedure successfully - * processed */ - if (msg->u.establish.is_attached) { - if (msg->u.establish.is_emergency) { - /* Consider the UE attached for emergency bearer services - * only */ - rc = emm_proc_attach_set_emergency(); - } - } else { - /* Consider the UE locally detached from the network */ - rc = emm_proc_attach_set_detach(); - } - - break; - - case _EMMESM_ESTABLISH_REJ: - /* ESM notifies EMM that PDN connectivity procedure failed */ - break; -#endif - - case _EMMESM_UNITDATA_REQ: - /* ESM requests EMM to transfer ESM data unit to lower layer */ - rc = lowerlayer_data_req(msg->ueid, &msg->u.data.msg); - break; - - default: - break; - - } - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "EMMESM-SAP - Failed to process primitive %s (%d)", - _emm_esm_primitive_str[primitive - _EMMESM_START - 1], - primitive); - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.h deleted file mode 100644 index 6967b97ca16a723f3c2221aa5f8be06da543f7be..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esm.h +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_esm.h - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMESM Service Access Point that provides - interlayer services to the EPS Session Management sublayer - for service registration and activate/deactivate PDP context. - -*****************************************************************************/ -#ifndef __EMM_ESM_H__ -#define __EMM_ESM_H__ - -#include "emm_esmDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void emm_esm_initialize(void); - -int emm_esm_send(const emm_esm_t *msg); - -#endif /* __EMM_ESM_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esmDef.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esmDef.h deleted file mode 100644 index 179cdcb1afb1e6b63931ae0a6dcbe85874aa37a7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_esmDef.h +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_esmDef.h - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMESM Service Access Point that provides - interlayer services to the EPS Session Management sublayer - for service registration and activate/deactivate PDN - connections. - -*****************************************************************************/ -#ifndef __EMM_ESMDEF_H__ -#define __EMM_ESMDEF_H__ - -#include "OctetString.h" -#include "emmData.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * EMMESM-SAP primitives - */ -typedef enum { - _EMMESM_START = 100, -#ifdef NAS_UE - _EMMESM_ESTABLISH_REQ, - _EMMESM_ESTABLISH_CNF, - _EMMESM_ESTABLISH_REJ, -#endif - _EMMESM_RELEASE_IND, - _EMMESM_UNITDATA_REQ, - _EMMESM_UNITDATA_IND, - _EMMESM_END -} emm_esm_primitive_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * EMMESM primitive for connection establishment - * --------------------------------------------- - */ -typedef struct { - int is_emergency; /* Indicates whether the PDN connection is established - * for emergency bearer services only */ - int is_attached; /* Indicates whether the UE remains attached to the - * network */ -} emm_esm_establish_t; - -/* - * EMMESM primitive for data transfer - * ---------------------------------- - */ -typedef struct { - OctetString msg; /* ESM message to be transfered */ -} emm_esm_data_t; - -/* - * --------------------------------- - * Structure of EMMESM-SAP primitive - * --------------------------------- - */ -typedef struct { - emm_esm_primitive_t primitive; - unsigned int ueid; -#if defined(NAS_MME) - emm_data_context_t *ctx; -#endif - union { - emm_esm_establish_t establish; - emm_esm_data_t data; - } u; - /* TODO: complete emm_esm_t structure definition */ -} emm_esm_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __EMM_ESMDEF_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.c deleted file mode 100644 index 7a93c1e92d571a3f3d0af64f851a864cc4230c38..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.c +++ /dev/null @@ -1,442 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_fsm.c - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EPS Mobility Management procedures executed at - the EMMREG Service Access Point. - -*****************************************************************************/ - -#include "emm_fsm.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "mme_api.h" -#include "emmData.h" - -#if defined(NAS_BUILT_IN_EPC) -# include "assertions.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -#ifdef NAS_UE -#define EMM_FSM_NB_UE_MAX 1 -#endif -#ifdef NAS_MME -#define EMM_FSM_NB_UE_MAX (MME_API_NB_UE_MAX + 1) -#endif - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Data used for trace logging - * ----------------------------------------------------------------------------- - */ - -/* String representation of EMM events */ -static const char *_emm_fsm_event_str[] = { -#ifdef NAS_UE - "S1_ENABLED", - "S1_DISABLED", - "NO_IMSI", - "NO_CELL", - "REGISTER_REQ", - "REGISTER_CNF", - "REGISTER_REJ", - "ATTACH_INIT", - "ATTACH_REQ", - "ATTACH_FAILED", - "ATTACH_EXCEEDED", - "AUTHENTICATION_REJ", -#endif -#ifdef NAS_MME - "COMMON_PROC_REQ", - "COMMON_PROC_CNF", - "COMMON_PROC_REJ", - "PROC_ABORT", -#endif - "ATTACH_CNF", - "ATTACH_REJ", - "DETACH_INIT", - "DETACH_REQ", - "DETACH_FAILED", - "DETACH_CNF", - "TAU_REQ", - "TAU_CNF", - "TAU_REJ", - "SERVICE_REQ", - "SERVICE_CNF", - "SERVICE_REJ", - "LOWERLAYER_SUCCESS", - "LOWERLAYER_FAILURE", - "LOWERLAYER_RELEASE", -}; - -/* String representation of EMM status */ -static const char *_emm_fsm_status_str[EMM_STATE_MAX] = { - "INVALID", -#ifdef NAS_UE - "NULL", -#endif - "DEREGISTERED", - "REGISTERED", - "DEREGISTERED-INITIATED", -#ifdef NAS_UE - "DEREGISTERED.NORMAL-SERVICE", - "DEREGISTERED.LIMITED-SERVICE", - "DEREGISTERED.ATTEMPTING-TO-ATTACH", - "DEREGISTERED.PLMN-SEARCH", - "DEREGISTERED.NO-IMSI", - "DEREGISTERED.ATTACH-NEEDED", - "DEREGISTERED.NO-CELL-AVAILABLE", - "REGISTERED-INITIATED", - "REGISTERED.NORMAL-SERVICE", - "REGISTERED.ATTEMPTING-TO-PDATE", - "REGISTERED.LIMITED-SERVICE", - "REGISTERED.PLMN-SEARCH", - "REGISTERED.UPDATE-NEEDED", - "REGISTERED.NO-CELL-AVAILABLE", - "REGISTERED.ATTEMPTING-TO-UPDATE-MM", - "REGISTERED.IMSI-DETACH-INITIATED", - "TRACKING-AREA-UPDATING-INITIATED", - "SERVICE-REQUEST-INITIATED", -#endif -#ifdef NAS_MME - "COMMON-PROCEDURE-INITIATED", -#endif -}; - -/* - * ----------------------------------------------------------------------------- - * EPS Mobility Management state machine handlers - * ----------------------------------------------------------------------------- - */ - -/* Type of the EPS Mobility Management state machine handler */ -typedef int(*emm_fsm_handler_t)(const emm_reg_t *); - -#ifdef NAS_UE -int EmmNull(const emm_reg_t *); -#endif -int EmmDeregistered(const emm_reg_t *); -int EmmRegistered(const emm_reg_t *); -int EmmDeregisteredInitiated(const emm_reg_t *); -#ifdef NAS_UE -int EmmDeregisteredNormalService(const emm_reg_t *); -int EmmDeregisteredLimitedService(const emm_reg_t *); -int EmmDeregisteredAttemptingToAttach(const emm_reg_t *); -int EmmDeregisteredPlmnSearch(const emm_reg_t *); -int EmmDeregisteredNoImsi(const emm_reg_t *); -int EmmDeregisteredAttachNeeded(const emm_reg_t *); -int EmmDeregisteredNoCellAvailable(const emm_reg_t *); -int EmmRegisteredInitiated(const emm_reg_t *); -int EmmRegisteredNormalService(const emm_reg_t *); -int EmmRegisteredAttemptingToUpdate(const emm_reg_t *); -int EmmRegisteredLimitedService(const emm_reg_t *); -int EmmRegisteredPlmnSearch(const emm_reg_t *); -int EmmRegisteredUpdateNeeded(const emm_reg_t *); -int EmmRegisteredNoCellAvailable(const emm_reg_t *); -int EmmRegisteredAttemptingToUpdate(const emm_reg_t *); -int EmmRegisteredImsiDetachInitiated(const emm_reg_t *); -int EmmTrackingAreaUpdatingInitiated(const emm_reg_t *); -int EmmServiceRequestInitiated(const emm_reg_t *); -#endif -#ifdef NAS_MME -int EmmCommonProcedureInitiated(const emm_reg_t *); -#endif - -/* EMM state machine handlers */ -static const emm_fsm_handler_t _emm_fsm_handlers[EMM_STATE_MAX] = { - NULL, -#ifdef NAS_UE - EmmNull, -#endif - EmmDeregistered, - EmmRegistered, - EmmDeregisteredInitiated, -#ifdef NAS_UE - EmmDeregisteredNormalService, - EmmDeregisteredLimitedService, - EmmDeregisteredAttemptingToAttach, - EmmDeregisteredPlmnSearch, - EmmDeregisteredNoImsi, - EmmDeregisteredAttachNeeded, - EmmDeregisteredNoCellAvailable, - EmmRegisteredInitiated, - EmmRegisteredNormalService, - EmmRegisteredAttemptingToUpdate, - EmmRegisteredLimitedService, - EmmRegisteredPlmnSearch, - EmmRegisteredUpdateNeeded, - EmmRegisteredNoCellAvailable, - EmmRegisteredAttemptingToUpdate, - EmmRegisteredImsiDetachInitiated, - EmmTrackingAreaUpdatingInitiated, - EmmServiceRequestInitiated, -#endif -#ifdef NAS_MME - EmmCommonProcedureInitiated, -#endif -}; - -/* - * ----------------------------------------------------------------------------- - * Current EPS Mobility Management status - * ----------------------------------------------------------------------------- - */ - -#if !defined(NAS_BUILT_IN_EPC) -emm_fsm_state_t _emm_fsm_status[EMM_FSM_NB_UE_MAX]; -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_fsm_initialize() ** - ** ** - ** Description: Initializes the EMM state machine ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _emm_fsm_status ** - ** ** - ***************************************************************************/ -void emm_fsm_initialize(void) -{ - int ueid; - LOG_FUNC_IN; - -#ifdef NAS_UE - _emm_fsm_status[0] = EMM_NULL; -#endif - -#if defined(NAS_MME) && !defined(NAS_BUILT_IN_EPC) - - for (ueid = 0; ueid < EMM_FSM_NB_UE_MAX; ueid++) { - _emm_fsm_status[ueid] = EMM_DEREGISTERED; - } - -#endif - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: emm_fsm_set_status() ** - ** ** - ** Description: Set the EPS Mobility Management status to the given state ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** status: The new EMM status ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _emm_fsm_status ** - ** ** - ***************************************************************************/ -int emm_fsm_set_status( -#ifdef NAS_MME - unsigned int ueid, - void *ctx, -#endif - emm_fsm_state_t status) -{ - LOG_FUNC_IN; - -#ifdef NAS_UE - unsigned int ueid = 0; -#endif - -#if defined(NAS_BUILT_IN_EPC) - emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx; - - DevAssert(emm_ctx != NULL); - - if ((status < EMM_STATE_MAX) && (ueid > 0)) { - LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s", - _emm_fsm_status_str[emm_ctx->_emm_fsm_status], - _emm_fsm_status_str[status]); - - if (status != emm_ctx->_emm_fsm_status) { - emm_ctx->_emm_fsm_status = status; - } - - LOG_FUNC_RETURN (RETURNok); - } - -#else - - if ( (status < EMM_STATE_MAX) && (ueid < EMM_FSM_NB_UE_MAX) ) { - LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s", - _emm_fsm_status_str[_emm_fsm_status[ueid]], - _emm_fsm_status_str[status]); - - if (status != _emm_fsm_status[ueid]) { - _emm_fsm_status[ueid] = status; - } - - LOG_FUNC_RETURN (RETURNok); - } - -#endif - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: emm_fsm_get_status() ** - ** ** - ** Description: Get the current value of the EPS Mobility Management ** - ** status ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** Others: _emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: The current value of the EMM status ** - ** Others: None ** - ** ** - ***************************************************************************/ -#ifdef NAS_UE -emm_fsm_state_t emm_fsm_get_status(void) -{ - return (_emm_fsm_status[0]); -} -#endif - -#ifdef NAS_MME -emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx) -{ -# if defined(NAS_BUILT_IN_EPC) - emm_data_context_t *emm_ctx = (emm_data_context_t *)ctx; - - if (emm_ctx != NULL) { - return emm_ctx->_emm_fsm_status; - } - -# else - - if (ueid < EMM_FSM_NB_UE_MAX) { - return (_emm_fsm_status[ueid]); - } - -#endif - return EMM_STATE_MAX; -} -#endif - -/**************************************************************************** - ** ** - ** Name: emm_fsm_process() ** - ** ** - ** Description: Executes the EMM state machine ** - ** ** - ** Inputs: evt: The EMMREG-SAP event to process ** - ** Others: _emm_fsm_status ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_fsm_process(const emm_reg_t *evt) -{ - int rc; - emm_fsm_state_t status; - emm_reg_primitive_t primitive; - - LOG_FUNC_IN; - - primitive = evt->primitive; - -#ifdef NAS_UE - status = _emm_fsm_status[0]; -#endif -#ifdef NAS_MME -# if defined(NAS_BUILT_IN_EPC) - emm_data_context_t *emm_ctx = (emm_data_context_t *)evt->ctx; - - DevAssert(emm_ctx != NULL); - - status = emm_fsm_get_status(0, emm_ctx); -# else - - if (evt->ueid >= EMM_FSM_NB_UE_MAX) { - LOG_FUNC_RETURN (RETURNerror); - } - - status = _emm_fsm_status[evt->ueid]; -# endif -#endif - - LOG_TRACE(INFO, "EMM-FSM - Received event %s (%d) in state %s", - _emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive, - _emm_fsm_status_str[status]); - -#if defined(NAS_BUILT_IN_EPC) - DevAssert(status != EMM_INVALID); -#endif - - /* Execute the EMM state machine */ - rc = (_emm_fsm_handlers[status])(evt); - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.h deleted file mode 100644 index 69e6ae7934959750b959d0b3a39cf1adfaad7724..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_fsm.h +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_fsm.h - -Version 0.1 - -Date 2012/10/03 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EPS Mobility Management procedures executed at - the EMMREG Service Access Point. - -*****************************************************************************/ -#ifndef __EMM_FSM_H__ -#define __EMM_FSM_H__ - -#include "emm_regDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * States of the EPS Mobility Management sublayer - * ---------------------------------------------- - * The EMM protocol of the UE and the network is described by means of two - * different state machines. - */ -typedef enum { - EMM_INVALID, -#ifdef NAS_UE - EMM_NULL, -#endif - EMM_DEREGISTERED, - EMM_REGISTERED, - EMM_DEREGISTERED_INITIATED, -#ifdef NAS_UE - EMM_DEREGISTERED_NORMAL_SERVICE, - EMM_DEREGISTERED_LIMITED_SERVICE, - EMM_DEREGISTERED_ATTEMPTING_TO_ATTACH, - EMM_DEREGISTERED_PLMN_SEARCH, - EMM_DEREGISTERED_NO_IMSI, - EMM_DEREGISTERED_ATTACH_NEEDED, - EMM_DEREGISTERED_NO_CELL_AVAILABLE, - EMM_REGISTERED_INITIATED, - EMM_REGISTERED_NORMAL_SERVICE, - EMM_REGISTERED_ATTEMPTING_TO_UPDATE, - EMM_REGISTERED_LIMITED_SERVICE, - EMM_REGISTERED_PLMN_SEARCH, - EMM_REGISTERED_UPDATE_NEEDED, - EMM_REGISTERED_NO_CELL_AVAILABLE, - EMM_REGISTERED_ATTEMPTING_TO_UPDATE_MM, - EMM_REGISTERED_IMSI_DETACH_INITIATED, - EMM_TRACKING_AREA_UPDATING_INITIATED, - EMM_SERVICE_REQUEST_INITIATED, -#endif -#ifdef NAS_MME - EMM_COMMON_PROCEDURE_INITIATED, -#endif - EMM_STATE_MAX -} emm_fsm_state_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void emm_fsm_initialize(void); - -#ifdef NAS_UE -int emm_fsm_set_status(emm_fsm_state_t status); -emm_fsm_state_t emm_fsm_get_status(void); -#endif -#ifdef NAS_MME -//LG 2015-03-13 struct emm_data_context_t; -int emm_fsm_set_status(unsigned int ueid, void *ctx, emm_fsm_state_t status); -emm_fsm_state_t emm_fsm_get_status(unsigned int ueid, void *ctx); -#endif - -int emm_fsm_process(const emm_reg_t *evt); - -#endif /* __EMM_FSM_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.c deleted file mode 100644 index d37de4fc90bede1bada1cf61d61d8d24ba702546..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.c +++ /dev/null @@ -1,1123 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_recv.c - -Version 0.1 - -Date 2013/01/30 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines functions executed at the EMMAS Service Access - Point upon receiving EPS Mobility Management messages - from the Access Stratum sublayer. - -*****************************************************************************/ - -#include "emm_recv.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_msgDef.h" -#include "emm_cause.h" -#include "emm_proc.h" - -#include <string.h> // memcpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME upon receiving EMM messages - * -------------------------------------------------------------------------- - */ -/**************************************************************************** - ** ** - ** Name: emm_recv_status() ** - ** ** - ** Description: Processes EMM status message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received EMM Status message (cause=%d)", - msg->emmcause); - - /* - * Message checking - */ - *emm_cause = EMM_CAUSE_SUCCESS; - /* - * Message processing - */ - rc = emm_proc_status_ind(ueid, msg->emmcause); - - LOG_FUNC_RETURN (rc); -} - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE upon receiving EMM message from the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_recv_attach_accept() ** - ** ** - ** Description: Processes Attach Accept message ** - ** ** - ** Inputs: msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - int i; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Accept message"); - - /* - * Message checking - */ - if (msg->tailist.typeoflist != - TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) { - /* Only list of TACs belonging to one PLMN with consecutive - * TAC values is supported */ - *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED; - } else if ( (msg->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) && - (msg->guti.guti.typeofidentity != EPS_MOBILE_IDENTITY_GUTI) ) { - /* The only supported type of EPS mobile identity is GUTI */ - *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED; - } - - /* Handle message checking error */ - if (*emm_cause != EMM_CAUSE_SUCCESS) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Message processing - */ - /* Compute timers value */ - long T3412, T3402 = -1, T3423 = -1; - T3412 = gprs_timer_value(&msg->t3412value); - - if (msg->presencemask & ATTACH_ACCEPT_T3402_VALUE_PRESENT) { - T3402 = gprs_timer_value(&msg->t3402value); - } - - if (msg->presencemask & ATTACH_ACCEPT_T3423_VALUE_PRESENT) { - T3423 = gprs_timer_value(&msg->t3423value); - } - - /* Get the tracking area list the UE is registered to */ - - /* LW: number of elements is coded as N-1 (0 -> 1 element, 1 -> 2 elements...), - * see 3GPP TS 24.301, section 9.9.3.33.1 */ - int n_tais = msg->tailist.numberofelements + 1; - tai_t tai[n_tais]; - - for (i = 0; i < n_tais; i++) { - tai[i].plmn.MCCdigit1 = msg->tailist.mccdigit1; - tai[i].plmn.MCCdigit2 = msg->tailist.mccdigit2; - tai[i].plmn.MCCdigit3 = msg->tailist.mccdigit3; - tai[i].plmn.MNCdigit1 = msg->tailist.mncdigit1; - tai[i].plmn.MNCdigit2 = msg->tailist.mncdigit2; - tai[i].plmn.MNCdigit3 = msg->tailist.mncdigit3; - tai[i].tac = msg->tailist.tac + i; - } - - /* Get the GUTI */ - GUTI_t *pguti = NULL; - GUTI_t guti; - - if (msg->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) { - pguti = &guti; - guti.gummei.plmn.MCCdigit1 = msg->guti.guti.mccdigit1; - guti.gummei.plmn.MCCdigit2 = msg->guti.guti.mccdigit2; - guti.gummei.plmn.MCCdigit3 = msg->guti.guti.mccdigit3; - guti.gummei.plmn.MNCdigit1 = msg->guti.guti.mncdigit1; - guti.gummei.plmn.MNCdigit2 = msg->guti.guti.mncdigit2; - guti.gummei.plmn.MNCdigit3 = msg->guti.guti.mncdigit3; - guti.gummei.MMEgid = msg->guti.guti.mmegroupid; - guti.gummei.MMEcode = msg->guti.guti.mmecode; - guti.m_tmsi = msg->guti.guti.mtmsi; - } - - /* Get the list of equivalent PLMNs */ - int n_eplmns = 0; - plmn_t eplmn; - - if (msg->presencemask & ATTACH_ACCEPT_EQUIVALENT_PLMNS_PRESENT) { - n_eplmns = 1; - eplmn.MCCdigit1 = msg->equivalentplmns.mccdigit1; - eplmn.MCCdigit2 = msg->equivalentplmns.mccdigit2; - eplmn.MCCdigit3 = msg->equivalentplmns.mccdigit3; - eplmn.MNCdigit1 = msg->equivalentplmns.mncdigit1; - eplmn.MNCdigit2 = msg->equivalentplmns.mncdigit2; - eplmn.MNCdigit3 = msg->equivalentplmns.mncdigit3; - } - - /* Execute attach procedure accepted by the network */ - rc = emm_proc_attach_accept(T3412, T3402, T3423, n_tais, tai, pguti, - n_eplmns, &eplmn, - &msg->esmmessagecontainer.esmmessagecontainercontents); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_attach_reject() ** - ** ** - ** Description: Processes Attach Reject message ** - ** ** - ** Inputs: msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Reject message (cause=%d)", - msg->emmcause); - - /* - * Message checking - */ - if ( (msg->emmcause == EMM_CAUSE_ESM_FAILURE) && - !(msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) ) { - /* The ATTACH REJECT message shall be combined with a PDN - * CONNECTIVITY REJECT message contained in the ESM message - * container information element */ - *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; - } - - /* Handle message checking error */ - if (*emm_cause != EMM_CAUSE_SUCCESS) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Message processing - */ - if (msg->presencemask & ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT) { - /* Execute attach procedure rejected by the network */ - rc = emm_proc_attach_reject(msg->emmcause, - &msg->esmmessagecontainer.esmmessagecontainercontents); - } else { - /* Execute attach procedure rejected by the network */ - rc = emm_proc_attach_reject(msg->emmcause, NULL); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_detach_accept() ** - ** ** - ** Description: Processes Detach Accept message ** - ** ** - ** Inputs: msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Detach Accept message"); - - /* - * Message processing - */ - /* Execute the UE initiated detach procedure completion by the UE */ - rc = emm_proc_detach_accept(); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_identity_request() ** - ** ** - ** Description: Processes Identity Request message ** - ** ** - ** Inputs: msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Identity Request message"); - - /* - * Message processing - */ - /* Get the requested identity type */ - emm_proc_identity_type_t type; - - if (msg->identitytype == IDENTITY_TYPE_2_IMSI) { - type = EMM_IDENT_TYPE_IMSI; - } else if (msg->identitytype == IDENTITY_TYPE_2_IMEI) { - type = EMM_IDENT_TYPE_IMEI; - } else if (msg->identitytype == IDENTITY_TYPE_2_IMEISV) { - type = EMM_IDENT_TYPE_IMEISV; - } else if (msg->identitytype == IDENTITY_TYPE_2_TMSI) { - type = EMM_IDENT_TYPE_TMSI; - } else { - /* All other values are interpreted as IMSI */ - type = EMM_IDENT_TYPE_IMSI; - } - - /* Execute the identification procedure initiated by the network */ - rc = emm_proc_identification_request(type); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_authentication_request() ** - ** ** - ** Description: Processes Authentication Request message ** - ** ** - ** Inputs: msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_authentication_request(authentication_request_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Request message"); - - /* - * Message checking - */ - if ( (msg->authenticationparameterrand.rand.length == 0) || - (msg->authenticationparameterautn.autn.length == 0) ) { - /* RAND and AUTN parameters shall not be null */ - *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; - } - - /* Handle message checking error */ - if (*emm_cause != EMM_CAUSE_SUCCESS) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Message processing - */ - /* Execute the authentication procedure initiated by the network */ - rc = emm_proc_authentication_request( - msg->naskeysetidentifierasme.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, - msg->naskeysetidentifierasme.naskeysetidentifier, - &msg->authenticationparameterrand.rand, - &msg->authenticationparameterautn.autn); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_authentication_reject() ** - ** ** - ** Description: Processes Authentication Reject message ** - ** ** - ** Inputs: msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_authentication_reject(authentication_reject_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Reject message"); - - /* - * Message processing - */ - /* Execute the authentication procedure not accepted by the network */ - rc = emm_proc_authentication_reject(); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_security_mode_command() ** - ** ** - ** Description: Processes Security Mode Command message ** - ** ** - ** Inputs: msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_security_mode_command(security_mode_command_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Security Mode Command message"); - - /* - * Message processing - */ - /* Execute the security mode control procedure initiated by the network */ - rc = emm_proc_security_mode_command( - msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, - msg->naskeysetidentifier.naskeysetidentifier, - msg->selectednassecurityalgorithms.typeofcipheringalgorithm, - msg->selectednassecurityalgorithms.typeofintegrityalgorithm, - msg->replayeduesecuritycapabilities.eea, - msg->replayeduesecuritycapabilities.eia); - - LOG_FUNC_RETURN (rc); -} - -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME upon receiving EMM message from the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: emm_recv_attach_request() ** - ** ** - ** Description: Processes Attach Request message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_attach_request(unsigned int ueid, const attach_request_msg *msg, - int *emm_cause) -{ - int rc; - uint8_t gea = 0; - emm_proc_attach_type_t type; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Request message"); - - /* - * Message checking - */ -#if !defined(UPDATE_RELEASE_9) - - /* SR: In releases 9 and beyond the mandatory ie (old GUTI) has been removed */ - if ( (msg->oldgutiorimsi.guti.typeofidentity == EPS_MOBILE_IDENTITY_GUTI) && - !(msg->presencemask & ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT) ) { - /* The Old GUTI type IE shall be included if the type of identity - * in the EPS mobile identity IE is set to "GUTI" */ - *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; - LOG_TRACE(WARNING, "EMMAS-SAP - [%08x] - Received GUTI identity without " - "old GUTI IEI", ueid); - } else -#endif /* !defined(UPDATE_RELEASE_9) */ - if (msg->uenetworkcapability.spare != 0b000) { - /* Spare bits shall be coded as zero */ - *emm_cause = EMM_CAUSE_PROTOCOL_ERROR; - LOG_TRACE(WARNING, "EMMAS-SAP - [%08x] - Non zero spare bits is suspicious", - ueid); - } - - /* Handle message checking error */ - if (*emm_cause != EMM_CAUSE_SUCCESS) { - /* 3GPP TS 24.301, section 5.5.1.2.7, case b - * Perform protocol error abnormal case on the network side */ - rc = emm_proc_attach_reject(ueid, *emm_cause); - *emm_cause = EMM_CAUSE_SUCCESS; - LOG_FUNC_RETURN (rc); - } - - /* - * Message processing - */ - /* Get the EPS attach type */ - if (msg->epsattachtype == EPS_ATTACH_TYPE_EPS) { - type = EMM_ATTACH_TYPE_EPS; - } else if (msg->epsattachtype == EPS_ATTACH_TYPE_IMSI) { - type = EMM_ATTACH_TYPE_IMSI; - } else if (msg->epsattachtype == EPS_ATTACH_TYPE_EMERGENCY) { - type = EMM_ATTACH_TYPE_EMERGENCY; - } else if (msg->epsattachtype == EPS_ATTACH_TYPE_RESERVED) { - type = EMM_ATTACH_TYPE_RESERVED; - } else { - /* All other values shall be interpreted as "EPS attach" */ - type = EMM_ATTACH_TYPE_EPS; - } - - /* Get the EPS mobile identity */ - GUTI_t guti, *p_guti = NULL; - imsi_t imsi, *p_imsi = NULL; - imei_t imei, *p_imei = NULL; - - if (msg->oldgutiorimsi.guti.typeofidentity == EPS_MOBILE_IDENTITY_GUTI) { - /* Get the GUTI */ - p_guti = &guti; - guti.gummei.plmn.MCCdigit1 = msg->oldgutiorimsi.guti.mccdigit1; - guti.gummei.plmn.MCCdigit2 = msg->oldgutiorimsi.guti.mccdigit2; - guti.gummei.plmn.MCCdigit3 = msg->oldgutiorimsi.guti.mccdigit3; - guti.gummei.plmn.MNCdigit1 = msg->oldgutiorimsi.guti.mncdigit1; - guti.gummei.plmn.MNCdigit2 = msg->oldgutiorimsi.guti.mncdigit2; - guti.gummei.plmn.MNCdigit3 = msg->oldgutiorimsi.guti.mncdigit3; - guti.gummei.MMEgid = msg->oldgutiorimsi.guti.mmegroupid; - guti.gummei.MMEcode = msg->oldgutiorimsi.guti.mmecode; - guti.m_tmsi = msg->oldgutiorimsi.guti.mtmsi; - } else if (msg->oldgutiorimsi.imsi.typeofidentity == EPS_MOBILE_IDENTITY_IMSI) { - /* Get the IMSI */ - p_imsi = &imsi; - imsi.u.num.digit1 = msg->oldgutiorimsi.imsi.digit1; - imsi.u.num.digit2 = msg->oldgutiorimsi.imsi.digit2; - imsi.u.num.digit3 = msg->oldgutiorimsi.imsi.digit3; - imsi.u.num.digit4 = msg->oldgutiorimsi.imsi.digit4; - imsi.u.num.digit5 = msg->oldgutiorimsi.imsi.digit5; - imsi.u.num.digit6 = msg->oldgutiorimsi.imsi.digit6; - imsi.u.num.digit7 = msg->oldgutiorimsi.imsi.digit7; - imsi.u.num.digit8 = msg->oldgutiorimsi.imsi.digit8; - imsi.u.num.digit9 = msg->oldgutiorimsi.imsi.digit9; - imsi.u.num.digit10 = msg->oldgutiorimsi.imsi.digit10; - imsi.u.num.digit11 = msg->oldgutiorimsi.imsi.digit11; - imsi.u.num.digit12 = msg->oldgutiorimsi.imsi.digit12; - imsi.u.num.digit13 = msg->oldgutiorimsi.imsi.digit13; - imsi.u.num.digit14 = msg->oldgutiorimsi.imsi.digit14; - imsi.u.num.digit15 = msg->oldgutiorimsi.imsi.digit15; - imsi.u.num.parity = msg->oldgutiorimsi.imsi.oddeven; - } else if (msg->oldgutiorimsi.imei.typeofidentity == EPS_MOBILE_IDENTITY_IMEI) { - /* Get the IMEI */ - p_imei = &imei; - imei.u.num.digit1 = msg->oldgutiorimsi.imei.digit1; - imei.u.num.digit2 = msg->oldgutiorimsi.imei.digit2; - imei.u.num.digit3 = msg->oldgutiorimsi.imei.digit3; - imei.u.num.digit4 = msg->oldgutiorimsi.imei.digit4; - imei.u.num.digit5 = msg->oldgutiorimsi.imei.digit5; - imei.u.num.digit6 = msg->oldgutiorimsi.imei.digit6; - imei.u.num.digit7 = msg->oldgutiorimsi.imei.digit7; - imei.u.num.digit8 = msg->oldgutiorimsi.imei.digit8; - imei.u.num.digit9 = msg->oldgutiorimsi.imei.digit9; - imei.u.num.digit10 = msg->oldgutiorimsi.imei.digit10; - imei.u.num.digit11 = msg->oldgutiorimsi.imei.digit11; - imei.u.num.digit12 = msg->oldgutiorimsi.imei.digit12; - imei.u.num.digit13 = msg->oldgutiorimsi.imei.digit13; - imei.u.num.digit14 = msg->oldgutiorimsi.imei.digit14; - imei.u.num.digit15 = msg->oldgutiorimsi.imei.digit15; - imei.u.num.parity = msg->oldgutiorimsi.imei.oddeven; - } - - /* TODO: Get the UE network capabilities */ - - /* Get the Last visited registered TAI */ - tai_t tai, *p_tai = NULL; - - if (msg->presencemask & ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) { - p_tai = &tai; - tai.plmn.MCCdigit1 = msg->lastvisitedregisteredtai.mccdigit1; - tai.plmn.MCCdigit2 = msg->lastvisitedregisteredtai.mccdigit2; - tai.plmn.MCCdigit3 = msg->lastvisitedregisteredtai.mccdigit3; - tai.plmn.MNCdigit1 = msg->lastvisitedregisteredtai.mncdigit1; - tai.plmn.MNCdigit2 = msg->lastvisitedregisteredtai.mncdigit2; - tai.plmn.MNCdigit3 = msg->lastvisitedregisteredtai.mncdigit3; - tai.tac = msg->lastvisitedregisteredtai.tac; - } - - /* Execute the requested UE attach procedure */ -#warning " TODO gea to be review" - - if (msg->msnetworkcapability.msnetworkcapabilityvalue.length > 0) { - gea = (msg->msnetworkcapability.msnetworkcapabilityvalue.value[0] & 0x80) >> 1; - - if ((gea) && (msg->msnetworkcapability.msnetworkcapabilityvalue.length >= 2)) { - gea |= ((msg->msnetworkcapability.msnetworkcapabilityvalue.value[1] & 0x60) >> 1); - } - } - - rc = emm_proc_attach_request(ueid, type, - msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, - msg->naskeysetidentifier.naskeysetidentifier, - msg->oldgutitype != GUTI_MAPPED, p_guti, p_imsi, p_imei, p_tai, - msg->uenetworkcapability.eea, - msg->uenetworkcapability.eia, - msg->uenetworkcapability.ucs2, - msg->uenetworkcapability.uea, - msg->uenetworkcapability.uia, - gea, - msg->uenetworkcapability.umts_present, - msg->uenetworkcapability.gprs_present, - &msg->esmmessagecontainer.esmmessagecontainercontents); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_attach_complete() ** - ** ** - ** Description: Processes Attach Complete message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_attach_complete(unsigned int ueid, const attach_complete_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Attach Complete message"); - - /* Execute the attach procedure completion */ - rc = emm_proc_attach_complete(ueid, - &msg->esmmessagecontainer.esmmessagecontainercontents); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_detach_request() ** - ** ** - ** Description: Processes Detach Request message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_detach_request(unsigned int ueid, const detach_request_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Detach Request message"); - - /* - * Message processing - */ - /* Get the detach type */ - emm_proc_detach_type_t type; - - if (msg->detachtype.typeofdetach == DETACH_TYPE_EPS) { - type = EMM_DETACH_TYPE_EPS; - } else if (msg->detachtype.typeofdetach == DETACH_TYPE_IMSI) { - type = EMM_DETACH_TYPE_IMSI; - } else if (msg->detachtype.typeofdetach == DETACH_TYPE_EPS_IMSI) { - type = EMM_DETACH_TYPE_EPS_IMSI; - } else if (msg->detachtype.typeofdetach == DETACH_TYPE_RESERVED_1) { - type = EMM_DETACH_TYPE_RESERVED; - } else if (msg->detachtype.typeofdetach == DETACH_TYPE_RESERVED_2) { - type = EMM_DETACH_TYPE_RESERVED; - } else { - /* All other values are interpreted as "combined EPS/IMSI detach" */ - type = DETACH_TYPE_EPS_IMSI; - } - - /* Get the EPS mobile identity */ - GUTI_t guti, *p_guti = NULL; - imsi_t imsi, *p_imsi = NULL; - imei_t imei, *p_imei = NULL; - - if (msg->gutiorimsi.guti.typeofidentity == EPS_MOBILE_IDENTITY_GUTI) { - /* Get the GUTI */ - p_guti = &guti; - guti.gummei.plmn.MCCdigit1 = msg->gutiorimsi.guti.mccdigit1; - guti.gummei.plmn.MCCdigit2 = msg->gutiorimsi.guti.mccdigit2; - guti.gummei.plmn.MCCdigit3 = msg->gutiorimsi.guti.mccdigit3; - guti.gummei.plmn.MNCdigit1 = msg->gutiorimsi.guti.mncdigit1; - guti.gummei.plmn.MNCdigit2 = msg->gutiorimsi.guti.mncdigit2; - guti.gummei.plmn.MNCdigit3 = msg->gutiorimsi.guti.mncdigit3; - guti.gummei.MMEgid = msg->gutiorimsi.guti.mmegroupid; - guti.gummei.MMEcode = msg->gutiorimsi.guti.mmecode; - guti.m_tmsi = msg->gutiorimsi.guti.mtmsi; - } else if (msg->gutiorimsi.imsi.typeofidentity == EPS_MOBILE_IDENTITY_IMSI) { - /* Get the IMSI */ - p_imsi = &imsi; - imsi.u.num.digit1 = msg->gutiorimsi.imsi.digit1; - imsi.u.num.digit2 = msg->gutiorimsi.imsi.digit2; - imsi.u.num.digit3 = msg->gutiorimsi.imsi.digit3; - imsi.u.num.digit4 = msg->gutiorimsi.imsi.digit4; - imsi.u.num.digit5 = msg->gutiorimsi.imsi.digit5; - imsi.u.num.digit6 = msg->gutiorimsi.imsi.digit6; - imsi.u.num.digit7 = msg->gutiorimsi.imsi.digit7; - imsi.u.num.digit8 = msg->gutiorimsi.imsi.digit8; - imsi.u.num.digit9 = msg->gutiorimsi.imsi.digit9; - imsi.u.num.digit10 = msg->gutiorimsi.imsi.digit10; - imsi.u.num.digit11 = msg->gutiorimsi.imsi.digit11; - imsi.u.num.digit12 = msg->gutiorimsi.imsi.digit12; - imsi.u.num.digit13 = msg->gutiorimsi.imsi.digit13; - imsi.u.num.digit14 = msg->gutiorimsi.imsi.digit14; - imsi.u.num.digit15 = msg->gutiorimsi.imsi.digit15; - imsi.u.num.parity = msg->gutiorimsi.imsi.oddeven; - } else if (msg->gutiorimsi.imei.typeofidentity == EPS_MOBILE_IDENTITY_IMEI) { - /* Get the IMEI */ - p_imei = &imei; - imei.u.num.digit1 = msg->gutiorimsi.imei.digit1; - imei.u.num.digit2 = msg->gutiorimsi.imei.digit2; - imei.u.num.digit3 = msg->gutiorimsi.imei.digit3; - imei.u.num.digit4 = msg->gutiorimsi.imei.digit4; - imei.u.num.digit5 = msg->gutiorimsi.imei.digit5; - imei.u.num.digit6 = msg->gutiorimsi.imei.digit6; - imei.u.num.digit7 = msg->gutiorimsi.imei.digit7; - imei.u.num.digit8 = msg->gutiorimsi.imei.digit8; - imei.u.num.digit9 = msg->gutiorimsi.imei.digit9; - imei.u.num.digit10 = msg->gutiorimsi.imei.digit10; - imei.u.num.digit11 = msg->gutiorimsi.imei.digit11; - imei.u.num.digit12 = msg->gutiorimsi.imei.digit12; - imei.u.num.digit13 = msg->gutiorimsi.imei.digit13; - imei.u.num.digit14 = msg->gutiorimsi.imei.digit14; - imei.u.num.digit15 = msg->gutiorimsi.imei.digit15; - imei.u.num.parity = msg->gutiorimsi.imei.oddeven; - } - - /* Execute the UE initiated detach procedure completion by the network */ - rc = emm_proc_detach_request(ueid, type, - msg->detachtype.switchoff != DETACH_TYPE_NORMAL_DETACH, - msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, - msg->naskeysetidentifier.naskeysetidentifier, - p_guti, p_imsi, p_imei); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_tracking_area_update_request() ** - ** ** - ** Description: Processes Tracking Area Update Request message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_tracking_area_update_request(unsigned int ueid, - const tracking_area_update_request_msg *msg, - int *emm_cause) -{ - int rc = RETURNok; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Tracking Area Update Request message"); - - /* LW: Not completely implemented; send a Received Tracking Area Update Reject to induce a Attach Request from UE! */ - rc = emm_proc_tracking_area_update_reject(ueid, EMM_CAUSE_IMPLICITLY_DETACHED); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_identity_response() ** - ** ** - ** Description: Processes Identity Response message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_identity_response(unsigned int ueid, identity_response_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Identity Response message"); - - /* - * Message processing - */ - /* Get the mobile identity */ - imsi_t imsi, *p_imsi = NULL; - imei_t imei, *p_imei = NULL; - struct tmsi_struct_t { - uint8_t digit1:4; - uint8_t digit2:4; - uint8_t digit3:4; - uint8_t digit4:4; - uint8_t digit5:4; - uint8_t digit6:4; - uint8_t digit7:4; - uint8_t digit8:4; - } tmsi, *p_tmsi = NULL; - - if (msg->mobileidentity.imsi.typeofidentity == MOBILE_IDENTITY_IMSI) { - /* Get the IMSI */ - p_imsi = &imsi; - imsi.u.num.digit1 = msg->mobileidentity.imsi.digit1; - imsi.u.num.digit2 = msg->mobileidentity.imsi.digit2; - imsi.u.num.digit3 = msg->mobileidentity.imsi.digit3; - imsi.u.num.digit4 = msg->mobileidentity.imsi.digit4; - imsi.u.num.digit5 = msg->mobileidentity.imsi.digit5; - imsi.u.num.digit6 = msg->mobileidentity.imsi.digit6; - imsi.u.num.digit7 = msg->mobileidentity.imsi.digit7; - imsi.u.num.digit8 = msg->mobileidentity.imsi.digit8; - imsi.u.num.digit9 = msg->mobileidentity.imsi.digit9; - imsi.u.num.digit10 = msg->mobileidentity.imsi.digit10; - imsi.u.num.digit11 = msg->mobileidentity.imsi.digit11; - imsi.u.num.digit12 = msg->mobileidentity.imsi.digit12; - imsi.u.num.digit13 = msg->mobileidentity.imsi.digit13; - imsi.u.num.digit14 = msg->mobileidentity.imsi.digit14; - imsi.u.num.digit15 = msg->mobileidentity.imsi.digit15; - imsi.u.num.parity = msg->mobileidentity.imsi.oddeven; - } else if ((msg->mobileidentity.imei.typeofidentity == MOBILE_IDENTITY_IMEI) || - (msg->mobileidentity.imeisv.typeofidentity==MOBILE_IDENTITY_IMEISV)) { - /* Get the IMEI */ - p_imei = &imei; - imei.u.num.digit1 = msg->mobileidentity.imei.digit1; - imei.u.num.digit2 = msg->mobileidentity.imei.digit2; - imei.u.num.digit3 = msg->mobileidentity.imei.digit3; - imei.u.num.digit4 = msg->mobileidentity.imei.digit4; - imei.u.num.digit5 = msg->mobileidentity.imei.digit5; - imei.u.num.digit6 = msg->mobileidentity.imei.digit6; - imei.u.num.digit7 = msg->mobileidentity.imei.digit7; - imei.u.num.digit8 = msg->mobileidentity.imei.digit8; - imei.u.num.digit9 = msg->mobileidentity.imei.digit9; - imei.u.num.digit10 = msg->mobileidentity.imei.digit10; - imei.u.num.digit11 = msg->mobileidentity.imei.digit11; - imei.u.num.digit12 = msg->mobileidentity.imei.digit12; - imei.u.num.digit13 = msg->mobileidentity.imei.digit13; - imei.u.num.digit14 = msg->mobileidentity.imei.digit14; - imei.u.num.digit15 = msg->mobileidentity.imei.digit15; - imei.u.num.parity = msg->mobileidentity.imei.oddeven; - } else if (msg->mobileidentity.tmsi.typeofidentity == MOBILE_IDENTITY_TMSI) { - /* Get the TMSI */ - p_tmsi = &tmsi; - tmsi.digit1 = msg->mobileidentity.tmsi.digit2; - tmsi.digit2 = msg->mobileidentity.tmsi.digit3; - tmsi.digit3 = msg->mobileidentity.tmsi.digit4; - tmsi.digit4 = msg->mobileidentity.tmsi.digit5; - tmsi.digit5 = msg->mobileidentity.tmsi.digit6; - tmsi.digit6 = msg->mobileidentity.tmsi.digit7; - tmsi.digit7 = msg->mobileidentity.tmsi.digit8; - tmsi.digit8 = msg->mobileidentity.tmsi.digit9; - } - - /* Execute the identification completion procedure */ - rc = emm_proc_identification_complete(ueid, p_imsi, p_imei, - (UInt32_t *)(p_tmsi)); - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_authentication_response() ** - ** ** - ** Description: Processes Authentication Response message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_authentication_response(unsigned int ueid, - authentication_response_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Response message"); - - /* - * Message checking - */ - if (msg->authenticationresponseparameter.res.length == 0) { - /* RES parameter shall not be null */ - *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; - } - - /* Handle message checking error */ - if (*emm_cause != EMM_CAUSE_SUCCESS) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Message processing - */ - /* Execute the authentication completion procedure */ - rc = emm_proc_authentication_complete(ueid, EMM_CAUSE_SUCCESS, - &msg->authenticationresponseparameter.res); - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_authentication_failure() ** - ** ** - ** Description: Processes Authentication Failure message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_authentication_failure(unsigned int ueid, - authentication_failure_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Authentication Failure message"); - - /* - * Message checking - */ - if (msg->emmcause == EMM_CAUSE_SUCCESS) { - *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; - } else if ( (msg->emmcause == EMM_CAUSE_SYNCH_FAILURE) && - !(msg->presencemask & - AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) ) { - /* AUTS parameter shall be present in case of "synch failure" */ - *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; - } - - /* Handle message checking error */ - if (*emm_cause != EMM_CAUSE_SUCCESS) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Message processing - */ - /* Execute the authentication completion procedure */ - rc = emm_proc_authentication_complete(ueid, msg->emmcause, - &msg->authenticationfailureparameter.auts); - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_security_mode_complete() ** - ** ** - ** Description: Processes Security Mode Complete message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int -emm_recv_security_mode_complete( - unsigned int ueid, - security_mode_complete_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Security Mode Complete message"); - - /* - * Message processing - */ - /* Execute the NAS security mode control completion procedure */ - rc = emm_proc_security_mode_complete(ueid); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: emm_recv_security_mode_reject() ** - ** ** - ** Description: Processes Security Mode Reject message ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** msg: The received EMM message ** - ** Others: None ** - ** ** - ** Outputs: emm_cause: EMM cause code ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_recv_security_mode_reject(unsigned int ueid, - security_mode_reject_msg *msg, - int *emm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "EMMAS-SAP - Received Security Mode Reject message " - "(cause=%d)", msg->emmcause); - - /* - * Message checking - */ - if (msg->emmcause == EMM_CAUSE_SUCCESS) { - *emm_cause = EMM_CAUSE_INVALID_MANDATORY_INFO; - } - - /* Handle message checking error */ - if (*emm_cause != EMM_CAUSE_SUCCESS) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Message processing - */ - /* Execute the NAS security mode commend not accepted by the UE */ - rc = emm_proc_security_mode_reject(ueid); - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.h deleted file mode 100644 index 2141396207a2734d99e49a6a814bfbb97f8e6d4a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_recv.h +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_recv.h - -Version 0.1 - -Date 2013/01/30 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines functions executed at the EMMAS Service Access - Point upon receiving EPS Mobility Management messages - from the Access Stratum sublayer. - -*****************************************************************************/ -#ifndef __EMM_RECV_H__ -#define __EMM_RECV_H__ - -#include "EmmStatus.h" - -#include "DetachRequest.h" -#include "DetachAccept.h" - -#ifdef NAS_UE -#include "AttachAccept.h" -#include "AttachReject.h" -#include "TrackingAreaUpdateAccept.h" -#include "TrackingAreaUpdateReject.h" -#include "ServiceReject.h" -#include "GutiReallocationCommand.h" -#include "AuthenticationRequest.h" -#include "AuthenticationReject.h" -#include "IdentityRequest.h" -#include "NASSecurityModeCommand.h" -#include "EmmInformation.h" -#include "DownlinkNasTransport.h" -#include "CsServiceNotification.h" -#endif - -#ifdef NAS_MME -#include "AttachRequest.h" -#include "AttachComplete.h" -#include "TrackingAreaUpdateRequest.h" -#include "TrackingAreaUpdateComplete.h" -#include "ServiceRequest.h" -#include "ExtendedServiceRequest.h" -#include "GutiReallocationComplete.h" -#include "AuthenticationResponse.h" -#include "AuthenticationFailure.h" -#include "IdentityResponse.h" -#include "NASSecurityModeComplete.h" -#include "SecurityModeReject.h" -#include "UplinkNasTransport.h" -#endif - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME upon receiving EMM messages - * -------------------------------------------------------------------------- - */ -int emm_recv_status(unsigned int ueid, emm_status_msg *msg, int *emm_cause); - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE upon receiving EMM message from the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause); -int emm_recv_attach_reject(attach_reject_msg *msg, int *emm_cause); - -int emm_recv_detach_accept(detach_accept_msg *msg, int *emm_cause); - -int emm_recv_identity_request(identity_request_msg *msg, int *emm_cause); -int emm_recv_authentication_request(authentication_request_msg *msg, - int *emm_cause); -int emm_recv_authentication_reject(authentication_reject_msg *msg, - int *emm_cause); -int emm_recv_security_mode_command(security_mode_command_msg *msg, - int *emm_cause); -#endif - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME upon receiving EMM message from the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -int emm_recv_attach_request(unsigned int ueid, const attach_request_msg *msg, - int *emm_cause); -int emm_recv_attach_complete(unsigned int ueid, const attach_complete_msg *msg, - int *emm_cause); - -int emm_recv_detach_request(unsigned int ueid, const detach_request_msg *msg, - int *emm_cause); - -int emm_recv_tracking_area_update_request(unsigned int ueid, - const tracking_area_update_request_msg *msg, - int *emm_cause); - -int emm_recv_identity_response(unsigned int ueid, identity_response_msg *msg, - int *emm_cause); -int emm_recv_authentication_response(unsigned int ueid, - authentication_response_msg *msg, int *emm_cause); -int emm_recv_authentication_failure(unsigned int ueid, - authentication_failure_msg *msg, int *emm_cause); -int emm_recv_security_mode_complete(unsigned int ueid, - security_mode_complete_msg *msg, int *emm_cause); -int emm_recv_security_mode_reject(unsigned int ueid, - security_mode_reject_msg *msg, int *emm_cause); -#endif - -#endif /* __EMM_RECV_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.c deleted file mode 100644 index ca19566cb9a15d5b141086c51c2f6f4bcc26a81f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.c +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_reg.c - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMREG Service Access Point that provides - registration services for location updating and attach/detach - procedures. - -*****************************************************************************/ - -#include "emm_reg.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_fsm.h" - -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_reg_initialize() ** - ** ** - ** Description: Initializes the EMMREG Service Access Point ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: NONE ** - ** ** - ***************************************************************************/ -void emm_reg_initialize(void) -{ - LOG_FUNC_IN; - - /* Initialize the EMM state machine */ - emm_fsm_initialize(); - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: emm_reg_send() ** - ** ** - ** Description: Processes the EMMREG Service Access Point primitive ** - ** ** - ** Inputs: msg: The EMMREG-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_reg_send(const emm_reg_t *msg) -{ - LOG_FUNC_IN; - - int rc; - - /* Check the EMM-SAP primitive */ - emm_reg_primitive_t primitive = msg->primitive; - assert( (primitive > _EMMREG_START) && (primitive < _EMMREG_END)); - - /* Execute the EMM procedure */ - rc = emm_fsm_process(msg); - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.h deleted file mode 100644 index 62d333395cec5ab5249e155eeedabe8fe22f6c86..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_reg.h +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_reg.h - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMREG Service Access Point that provides - registration services for location updating and attach/detach - procedures. - -*****************************************************************************/ -#ifndef __EMM_REG_H__ -#define __EMM_REG_H__ - -#include "emm_regDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void emm_reg_initialize(void); - -int emm_reg_send(const emm_reg_t *msg); - -#endif /* __EMM_REG_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_regDef.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_regDef.h deleted file mode 100644 index c3343eabb7e0600dee41b8a6b3b315e2856e8dfa..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_regDef.h +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_regDef.h - -Version 0.1 - -Date 2012/10/16 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMMREG Service Access Point that provides - registration services for location updating and attach/detach - procedures. - -*****************************************************************************/ -#ifndef __EMM_REGDEF_H__ -#define __EMM_REGDEF_H__ - -#include "commonDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * EMMREG-SAP primitives - */ -typedef enum { - _EMMREG_START = 0, -#ifdef NAS_UE - _EMMREG_S1_ENABLED, /* S1 mode is enabled */ - _EMMREG_S1_DISABLED, /* S1 mode is disabled */ - _EMMREG_NO_IMSI, /* The UE is powered on without a valid USIM */ - _EMMREG_NO_CELL, /* No available cell has been found */ - _EMMREG_REGISTER_REQ, /* Network registration procedure requested */ - _EMMREG_REGISTER_CNF, /* Network registration procedure succeed */ - _EMMREG_REGISTER_REJ, /* Network registration procedure rejected */ - _EMMREG_ATTACH_INIT, /* EPS network attach initiated */ - _EMMREG_ATTACH_REQ, /* EPS network attach requested */ - _EMMREG_ATTACH_FAILED, /* Attach attempt failed */ - _EMMREG_ATTACH_EXCEEDED, /* Attach attempt exceeded */ - _EMMREG_AUTH_REJ, /* Authentication rejected */ -#endif -#ifdef NAS_MME - _EMMREG_COMMON_PROC_REQ, /* EMM common procedure requested */ - _EMMREG_COMMON_PROC_CNF, /* EMM common procedure successful */ - _EMMREG_COMMON_PROC_REJ, /* EMM common procedure failed */ - _EMMREG_PROC_ABORT, /* EMM procedure aborted */ -#endif - _EMMREG_ATTACH_CNF, /* EPS network attach accepted */ - _EMMREG_ATTACH_REJ, /* EPS network attach rejected */ - _EMMREG_DETACH_INIT, /* Network detach initiated */ - _EMMREG_DETACH_REQ, /* Network detach requested */ - _EMMREG_DETACH_FAILED, /* Network detach attempt failed */ - _EMMREG_DETACH_CNF, /* Network detach accepted */ - _EMMREG_TAU_REQ, - _EMMREG_TAU_CNF, - _EMMREG_TAU_REJ, - _EMMREG_SERVICE_REQ, - _EMMREG_SERVICE_CNF, - _EMMREG_SERVICE_REJ, - _EMMREG_LOWERLAYER_SUCCESS, /* Data successfully delivered */ - _EMMREG_LOWERLAYER_FAILURE, /* Lower layer failure indication */ - _EMMREG_LOWERLAYER_RELEASE, /* NAS signalling connection released */ - _EMMREG_END -} emm_reg_primitive_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * EMMREG primitive for network registration procedure - * ---------------------------------------------------- - */ -typedef struct { - int index; /* Index of the currently selected PLMN in the ordered - * list of available PLMNs */ -} emm_reg_register_t; -#endif - -/* - * EMMREG primitive for attach procedure - * ------------------------------------- - */ -typedef struct { - int is_emergency; /* TRUE if the UE was attempting to register to - * the network for emergency services only */ -} emm_reg_attach_t; - -/* - * EMMREG primitive for detach procedure - * ------------------------------------- - */ -typedef struct { - int switch_off; /* TRUE if the UE is switched off */ - int type; /* Network detach type */ -} emm_reg_detach_t; - -#ifdef NAS_MME -/* - * EMMREG primitive for EMM common procedures - * ------------------------------------------ - */ -typedef struct { - int is_attached; /* UE context attach indicator */ -} emm_reg_common_t; -#endif - -/* - * Structure of EMMREG-SAP primitive - */ -typedef struct { - emm_reg_primitive_t primitive; - unsigned int ueid; - void *ctx; - - union { - emm_reg_attach_t attach; - emm_reg_detach_t detach; -#ifdef NAS_UE - emm_reg_register_t regist; -#endif -#ifdef NAS_MME - emm_reg_common_t common; -#endif - } u; -} emm_reg_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __EMM_REGDEF_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.c deleted file mode 100644 index b1aa08686465be7f25c0d447365eefa294b3bd4f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.c +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source emm_sap.c - -Version 0.1 - -Date 2012/10/01 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMM Service Access Points at which the EPS - Mobility Management sublayer provides procedures for the - control of security and mobility when the User Equipment - is using the Evolved UTRA Network. - -*****************************************************************************/ - -#include "emm_sap.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_reg.h" -#include "emm_esm.h" -#include "emm_as.h" -#include "emm_cn.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: emm_sap_initialize() ** - ** ** - ** Description: Initializes the EMM Service Access Points ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: NONE ** - ** ** - ***************************************************************************/ -void emm_sap_initialize(void) -{ - LOG_FUNC_IN; - - emm_reg_initialize(); - emm_esm_initialize(); - emm_as_initialize(); - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: emm_sap_send() ** - ** ** - ** Description: Processes the EMM Service Access Point primitive ** - ** ** - ** Inputs: msg: The EMM-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: msg: The EMM-SAP primitive to process ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_sap_send(emm_sap_t *msg) -{ - int rc = RETURNerror; - - emm_primitive_t primitive = msg->primitive; - - LOG_FUNC_IN; - - /* Check the EMM-SAP primitive */ - if ( (primitive > (emm_primitive_t)EMMREG_PRIMITIVE_MIN) && - (primitive < (emm_primitive_t)EMMREG_PRIMITIVE_MAX) ) { - /* Forward to the EMMREG-SAP */ - msg->u.emm_reg.primitive = primitive; - rc = emm_reg_send(&msg->u.emm_reg); - } else if ( (primitive > (emm_primitive_t)EMMESM_PRIMITIVE_MIN) && - (primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX) ) { - /* Forward to the EMMESM-SAP */ - msg->u.emm_esm.primitive = primitive; - rc = emm_esm_send(&msg->u.emm_esm); - } else if ( (primitive > (emm_primitive_t)EMMAS_PRIMITIVE_MIN) && - (primitive < (emm_primitive_t)EMMAS_PRIMITIVE_MAX) ) { - /* Forward to the EMMAS-SAP */ - msg->u.emm_as.primitive = primitive; - rc = emm_as_send(&msg->u.emm_as); - } - -#if defined(NAS_BUILT_IN_EPC) - else if ( (primitive > (emm_primitive_t)EMMCN_PRIMITIVE_MIN) && - (primitive < (emm_primitive_t)EMMCN_PRIMITIVE_MAX) ) { - /* Forward to the EMMCN-SAP */ - msg->u.emm_cn.primitive = primitive; - rc = emm_cn_send(&msg->u.emm_cn); - } - -#endif - else { - LOG_TRACE(WARNING, "EMM-SAP - Out of range primitive (%d)", primitive); - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.h deleted file mode 100644 index 139e8f17bb0fe208c6d152346438c65186a0da74..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_sap.h +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_sap.h - -Version 0.1 - -Date 2012/10/01 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines the EMM Service Access Points at which the EPS - Mobility Management sublayer provides procedures for the - control of security and mobility when the User Equipment - is using the Evolved UTRA Network. - -*****************************************************************************/ -#ifndef __EMM_SAP_H__ -#define __EMM_SAP_H__ - -#include "emmData.h" -#include "emm_regDef.h" -#include "emm_esmDef.h" -#include "emm_asDef.h" -#include "emm_cnDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * EPS Mobility Management primitives - * ---------------------------------- - * EMMREG-SAP provides registration services for location updating and - * attach/detach procedures; - * EMMESM-SAP provides interlayer services to the EPS Session Management - * sublayer for service registration and activate/deactivate PDP context; - * EMMAS-SAP provides services to the Access Stratum sublayer for NAS message - * transfer; - */ -typedef enum { - /* EMMREG-SAP */ -#ifdef NAS_UE - EMMREG_S1_ENABLED = _EMMREG_S1_ENABLED, - EMMREG_S1_DISABLED = _EMMREG_S1_DISABLED, - EMMREG_NO_IMSI = _EMMREG_NO_IMSI, - EMMREG_NO_CELL = _EMMREG_NO_CELL, - EMMREG_REGISTER_REQ = _EMMREG_REGISTER_REQ, - EMMREG_REGISTER_CNF = _EMMREG_REGISTER_CNF, - EMMREG_REGISTER_REJ = _EMMREG_REGISTER_REJ, - EMMREG_ATTACH_INIT = _EMMREG_ATTACH_INIT, - EMMREG_ATTACH_REQ = _EMMREG_ATTACH_REQ, - EMMREG_ATTACH_FAILED = _EMMREG_ATTACH_FAILED, - EMMREG_ATTACH_EXCEEDED = _EMMREG_ATTACH_EXCEEDED, - EMMREG_AUTH_REJ = _EMMREG_AUTH_REJ, -#endif -#ifdef NAS_MME - EMMREG_COMMON_PROC_REQ = _EMMREG_COMMON_PROC_REQ, - EMMREG_COMMON_PROC_CNF = _EMMREG_COMMON_PROC_CNF, - EMMREG_COMMON_PROC_REJ = _EMMREG_COMMON_PROC_REJ, - EMMREG_PROC_ABORT = _EMMREG_PROC_ABORT, -#endif - EMMREG_ATTACH_CNF = _EMMREG_ATTACH_CNF, - EMMREG_ATTACH_REJ = _EMMREG_ATTACH_REJ, - EMMREG_DETACH_INIT = _EMMREG_DETACH_INIT, - EMMREG_DETACH_REQ = _EMMREG_DETACH_REQ, - EMMREG_DETACH_FAILED = _EMMREG_DETACH_FAILED, - EMMREG_DETACH_CNF = _EMMREG_DETACH_CNF, - EMMREG_TAU_REQ = _EMMREG_TAU_REQ, - EMMREG_TAU_CNF = _EMMREG_TAU_CNF, - EMMREG_TAU_REJ = _EMMREG_TAU_REJ, - EMMREG_SERVICE_REQ = _EMMREG_SERVICE_REQ, - EMMREG_SERVICE_CNF = _EMMREG_SERVICE_CNF, - EMMREG_SERVICE_REJ = _EMMREG_SERVICE_REJ, - EMMREG_LOWERLAYER_SUCCESS = _EMMREG_LOWERLAYER_SUCCESS, - EMMREG_LOWERLAYER_FAILURE = _EMMREG_LOWERLAYER_FAILURE, - EMMREG_LOWERLAYER_RELEASE = _EMMREG_LOWERLAYER_RELEASE, - /* EMMESM-SAP */ -#ifdef NAS_UE - EMMESM_ESTABLISH_REQ = _EMMESM_ESTABLISH_REQ, - EMMESM_ESTABLISH_CNF = _EMMESM_ESTABLISH_CNF, - EMMESM_ESTABLISH_REJ = _EMMESM_ESTABLISH_REJ, -#endif - EMMESM_RELEASE_IND = _EMMESM_RELEASE_IND, - EMMESM_UNITDATA_REQ = _EMMESM_UNITDATA_REQ, - EMMESM_UNITDATA_IND = _EMMESM_UNITDATA_IND, - /* EMMAS-SAP */ - EMMAS_SECURITY_REQ = _EMMAS_SECURITY_REQ, - EMMAS_SECURITY_IND = _EMMAS_SECURITY_IND, - EMMAS_SECURITY_RES = _EMMAS_SECURITY_RES, - EMMAS_SECURITY_REJ = _EMMAS_SECURITY_REJ, - EMMAS_ESTABLISH_REQ = _EMMAS_ESTABLISH_REQ, - EMMAS_ESTABLISH_CNF = _EMMAS_ESTABLISH_CNF, - EMMAS_ESTABLISH_REJ = _EMMAS_ESTABLISH_REJ, - EMMAS_RELEASE_REQ = _EMMAS_RELEASE_REQ, - EMMAS_RELEASE_IND = _EMMAS_RELEASE_IND, - EMMAS_DATA_REQ = _EMMAS_DATA_REQ, - EMMAS_DATA_IND = _EMMAS_DATA_IND, - EMMAS_PAGE_IND = _EMMAS_PAGE_IND, - EMMAS_STATUS_IND = _EMMAS_STATUS_IND, - EMMAS_CELL_INFO_REQ = _EMMAS_CELL_INFO_REQ, - EMMAS_CELL_INFO_RES = _EMMAS_CELL_INFO_RES, - EMMAS_CELL_INFO_IND = _EMMAS_CELL_INFO_IND, - -#ifdef NAS_BUILT_IN_EPC - EMMCN_AUTHENTICATION_PARAM_RES = _EMMCN_AUTHENTICATION_PARAM_RES, - EMMCN_AUTHENTICATION_PARAM_FAIL = _EMMCN_AUTHENTICATION_PARAM_FAIL, - EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE, - EMMCN_PDN_CONNECTIVITY_RES = _EMMCN_PDN_CONNECTIVITY_RES, - EMMCN_PDN_CONNECTIVITY_FAIL = _EMMCN_PDN_CONNECTIVITY_FAIL -#endif -} emm_primitive_t; - -/* - * Minimal identifier for EMM-SAP primitives - */ -#define EMMREG_PRIMITIVE_MIN _EMMREG_START -#define EMMESM_PRIMITIVE_MIN _EMMESM_START -#define EMMAS_PRIMITIVE_MIN _EMMAS_START -#define EMMCN_PRIMITIVE_MIN _EMMCN_START - -/* - * Maximal identifier for EMM-SAP primitives - */ -#define EMMREG_PRIMITIVE_MAX _EMMREG_END -#define EMMESM_PRIMITIVE_MAX _EMMESM_END -#define EMMAS_PRIMITIVE_MAX _EMMAS_END -#define EMMCN_PRIMITIVE_MAX _EMMCN_END - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Structure of EPS Mobility Management primitive - */ -typedef struct emm_sap_s { - emm_primitive_t primitive; - union { - emm_reg_t emm_reg; /* EMMREG-SAP primitives */ - emm_esm_t emm_esm; /* EMMESM-SAP primitives */ - emm_as_t emm_as; /* EMMAS-SAP primitives */ -#if defined(NAS_BUILT_IN_EPC) - emm_cn_t emm_cn; /* EMMCN-SAP primitives */ -#endif - } u; -} emm_sap_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void emm_sap_initialize(void); - -int emm_sap_send(emm_sap_t *msg); - -#endif /* __EMM_SAP_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.c b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.c deleted file mode 100644 index d5fac26fe1d601f2f5b05dce13fe13b8a9386711..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.c +++ /dev/null @@ -1,1275 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_send.c - -Version 0.1 - -Date 2013/01/30 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines functions executed at the EMMAS Service Access - Point to send EPS Mobility Management messages to the - Access Stratum sublayer. - -*****************************************************************************/ - -#include "emm_send.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emm_msgDef.h" -#include "emm_proc.h" - -#include <string.h> // strlen - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME to send EMM messages - * -------------------------------------------------------------------------- - */ -/**************************************************************************** - ** ** - ** Name: emm_send_status() ** - ** ** - ** Description: Builds EMM status message ** - ** ** - ** The EMM status message is sent by the UE or the network ** - ** at any time to report certain error conditions. ** - ** ** - ** Inputs: emm_cause: EMM cause code ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_status(const emm_as_status_t *msg, emm_status_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(WARNING, "EMMAS-SAP - Send EMM Status message (cause=%d)", - msg->emm_cause); - - /* Mandatory - Message type */ - emm_msg->messagetype = EMM_STATUS; - - /* Mandatory - EMM cause */ - size += EMM_CAUSE_MAXIMUM_LENGTH; - emm_msg->emmcause = msg->emm_cause; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_detach_accept() ** - ** ** - ** Description: Builds Detach Accept message ** - ** ** - ** The Detach Accept message is sent by the UE or the net- ** - ** work to indicate that the detach procedure has been com- ** - ** pleted. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_detach_accept(const emm_as_data_t *msg, - detach_accept_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Detach Accept message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = DETACH_ACCEPT; - - LOG_FUNC_RETURN (size); -} - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE to send EMM messages to the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: emm_send_attach_request() ** - ** ** - ** Description: Builds Attach Request message ** - ** ** - ** The Attach Request message is sent by the UE to the net- ** - ** work in order to perform an attach procedure. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_attach_request(const emm_as_establish_t *msg, - attach_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Request message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = ATTACH_REQUEST; - - /* Mandatory - EPS attach type */ - size += EPS_ATTACH_TYPE_MAXIMUM_LENGTH; - - if (msg->type == EMM_ATTACH_TYPE_EPS) { - emm_msg->epsattachtype = EPS_ATTACH_TYPE_EPS; - } else if (msg->type == EMM_ATTACH_TYPE_IMSI) { - emm_msg->epsattachtype = EPS_ATTACH_TYPE_IMSI; - } else if (msg->type == EMM_ATTACH_TYPE_EMERGENCY) { - emm_msg->epsattachtype = EPS_ATTACH_TYPE_EMERGENCY; - } else if (msg->type == EMM_ATTACH_TYPE_RESERVED) { - emm_msg->epsattachtype = EPS_ATTACH_TYPE_RESERVED; - } else { - /* All other values shall be interpreted as "EPS attach" */ - emm_msg->epsattachtype = EPS_ATTACH_TYPE_EPS; - } - - /* Mandatory - NAS key set identifier */ - size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH; - - if (msg->ksi != EMM_AS_NO_KEY_AVAILABLE) { - emm_msg->naskeysetidentifier.naskeysetidentifier = msg->ksi; - } else { - emm_msg->naskeysetidentifier.naskeysetidentifier = - NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE; - } - - /* Mandatory - EPS mobile identity */ - size += EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH; - - if (msg->UEid.guti) { - LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Request message with GUTI"); - /* Set GUTI mobile identity */ - GutiEpsMobileIdentity_t *guti = &emm_msg->oldgutiorimsi.guti; - guti->typeofidentity = EPS_MOBILE_IDENTITY_GUTI; - guti->oddeven = EPS_MOBILE_IDENTITY_EVEN; - guti->mmegroupid = msg->UEid.guti->gummei.MMEgid; - guti->mmecode = msg->UEid.guti->gummei.MMEcode; - guti->mtmsi = msg->UEid.guti->m_tmsi; - guti->mccdigit1 = msg->UEid.guti->gummei.plmn.MCCdigit1; - guti->mccdigit2 = msg->UEid.guti->gummei.plmn.MCCdigit2; - guti->mccdigit3 = msg->UEid.guti->gummei.plmn.MCCdigit3; - guti->mncdigit1 = msg->UEid.guti->gummei.plmn.MNCdigit1; - guti->mncdigit2 = msg->UEid.guti->gummei.plmn.MNCdigit2; - guti->mncdigit3 = msg->UEid.guti->gummei.plmn.MNCdigit3; - } else if (msg->UEid.imsi) { - LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Request message with IMSI"); - /* Set IMSI mobile identity */ - ImsiEpsMobileIdentity_t *imsi = &emm_msg->oldgutiorimsi.imsi; - imsi->typeofidentity = EPS_MOBILE_IDENTITY_IMSI; - imsi->oddeven = msg->UEid.imsi->u.num.parity; - imsi->digit1 = msg->UEid.imsi->u.num.digit1; - imsi->digit2 = msg->UEid.imsi->u.num.digit2; - imsi->digit3 = msg->UEid.imsi->u.num.digit3; - imsi->digit4 = msg->UEid.imsi->u.num.digit4; - imsi->digit5 = msg->UEid.imsi->u.num.digit5; - imsi->digit6 = msg->UEid.imsi->u.num.digit6; - imsi->digit7 = msg->UEid.imsi->u.num.digit7; - imsi->digit8 = msg->UEid.imsi->u.num.digit8; - imsi->digit9 = msg->UEid.imsi->u.num.digit9; - imsi->digit10 = msg->UEid.imsi->u.num.digit10; - imsi->digit11 = msg->UEid.imsi->u.num.digit11; - imsi->digit12 = msg->UEid.imsi->u.num.digit12; - imsi->digit13 = msg->UEid.imsi->u.num.digit13; - imsi->digit14 = msg->UEid.imsi->u.num.digit14; - imsi->digit15 = msg->UEid.imsi->u.num.digit15; - } else if (msg->UEid.imei) { - LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Request message with IMEI"); - /* Set IMEI mobile identity */ - ImeiEpsMobileIdentity_t *imei = &emm_msg->oldgutiorimsi.imei; - imei->typeofidentity = EPS_MOBILE_IDENTITY_IMEI; - imei->oddeven = msg->UEid.imei->u.num.parity; - imei->digit1 = msg->UEid.imei->u.num.digit1; - imei->digit2 = msg->UEid.imei->u.num.digit2; - imei->digit3 = msg->UEid.imei->u.num.digit3; - imei->digit4 = msg->UEid.imei->u.num.digit4; - imei->digit5 = msg->UEid.imei->u.num.digit5; - imei->digit6 = msg->UEid.imei->u.num.digit6; - imei->digit7 = msg->UEid.imei->u.num.digit7; - imei->digit8 = msg->UEid.imei->u.num.digit8; - imei->digit9 = msg->UEid.imei->u.num.digit9; - imei->digit10 = msg->UEid.imei->u.num.digit10; - imei->digit11 = msg->UEid.imei->u.num.digit11; - imei->digit12 = msg->UEid.imei->u.num.digit12; - imei->digit13 = msg->UEid.imei->u.num.digit13; - imei->digit14 = msg->UEid.imei->u.num.digit14; - imei->digit15 = msg->UEid.imei->u.num.digit15; - } - - /* Mandatory - UE network capability */ - size += UE_NETWORK_CAPABILITY_MAXIMUM_LENGTH; - emm_msg->uenetworkcapability.eea = (0x80 >> msg->encryption); - emm_msg->uenetworkcapability.eia = (0x80 >> msg->integrity); - emm_msg->uenetworkcapability.uea = 0; - emm_msg->uenetworkcapability.ucs2 = 0; - emm_msg->uenetworkcapability.uia = 0; - emm_msg->uenetworkcapability.csfb = 0; - emm_msg->uenetworkcapability.lpp = 0; - emm_msg->uenetworkcapability.lcs = 0; - emm_msg->uenetworkcapability.srvcc = 0; - emm_msg->uenetworkcapability.nf = 0; - - /* Mandatory - ESM message container */ - size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length; - emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg; - - /* Optional - Last visited registered TAI */ - if (msg->UEid.tai) { - size += TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH; - emm_msg->presencemask |= ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT; - emm_msg->lastvisitedregisteredtai.mccdigit2 = - msg->UEid.tai->plmn.MCCdigit2; - emm_msg->lastvisitedregisteredtai.mccdigit1 = - msg->UEid.tai->plmn.MCCdigit1; - emm_msg->lastvisitedregisteredtai.mncdigit3 = - msg->UEid.tai->plmn.MNCdigit3; - emm_msg->lastvisitedregisteredtai.mccdigit3 = - msg->UEid.tai->plmn.MCCdigit3; - emm_msg->lastvisitedregisteredtai.mncdigit2 = - msg->UEid.tai->plmn.MNCdigit2; - emm_msg->lastvisitedregisteredtai.mncdigit1 = - msg->UEid.tai->plmn.MNCdigit1; - emm_msg->lastvisitedregisteredtai.tac = msg->UEid.tai->tac; - } - - /* Optional - Old GUTI type */ - if (msg->UEid.guti) { - size += GUTI_TYPE_MAXIMUM_LENGTH; - emm_msg->presencemask |= ATTACH_REQUEST_OLD_GUTI_TYPE_PRESENT; - emm_msg->oldgutitype = GUTI_NATIVE; - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_attach_complete() ** - ** ** - ** Description: Builds Attach Complete message ** - ** ** - ** The Attach Complete message is sent by the UE to the net- ** - ** work in response to an Attach Accept message. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_attach_complete(const emm_as_data_t *msg, - attach_complete_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Complete message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = ATTACH_COMPLETE; - - /* Mandatory - ESM message container */ - size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length; - emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_initial_detach_request() ** - ** ** - ** Description: Builds Detach Request message ** - ** ** - ** The Detach Request message is sent by the UE to request ** - ** the release of an EMM context. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_initial_detach_request(const emm_as_establish_t *msg, - detach_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Detach Request message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = DETACH_REQUEST; - - /* Mandatory - Detach type */ - size += DETACH_TYPE_MAXIMUM_LENGTH; - - if (msg->switch_off) { - emm_msg->detachtype.switchoff = DETACH_TYPE_SWITCH_OFF; - } else { - emm_msg->detachtype.switchoff = DETACH_TYPE_NORMAL_DETACH; - } - - if (msg->type == EMM_DETACH_TYPE_EPS) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_EPS; - } else if (msg->type == EMM_DETACH_TYPE_IMSI) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_IMSI; - } else if (msg->type == EMM_DETACH_TYPE_EPS_IMSI) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_EPS_IMSI; - } else if (msg->type == EMM_DETACH_TYPE_RESERVED) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_RESERVED_1; - } else { - /* All other values are interpreted as "combined EPS/IMSI detach" */ - emm_msg->detachtype.typeofdetach = DETACH_TYPE_EPS_IMSI; - } - - /* Mandatory - NAS key set identifier */ - size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH; - - if (msg->ksi != EMM_AS_NO_KEY_AVAILABLE) { - emm_msg->naskeysetidentifier.naskeysetidentifier = msg->ksi; - } else { - emm_msg->naskeysetidentifier.naskeysetidentifier = - NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE; - } - - /* Mandatory - EPS mobile identity */ - size += EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH; - - if (msg->UEid.guti) { - /* Set GUTI mobile identity */ - GutiEpsMobileIdentity_t *guti = &emm_msg->gutiorimsi.guti; - guti->typeofidentity = EPS_MOBILE_IDENTITY_GUTI; - guti->oddeven = EPS_MOBILE_IDENTITY_EVEN; - guti->mmegroupid = msg->UEid.guti->gummei.MMEgid; - guti->mmecode = msg->UEid.guti->gummei.MMEcode; - guti->mtmsi = msg->UEid.guti->m_tmsi; - guti->mccdigit1 = msg->UEid.guti->gummei.plmn.MCCdigit1; - guti->mccdigit2 = msg->UEid.guti->gummei.plmn.MCCdigit2; - guti->mccdigit3 = msg->UEid.guti->gummei.plmn.MCCdigit3; - guti->mncdigit1 = msg->UEid.guti->gummei.plmn.MNCdigit1; - guti->mncdigit2 = msg->UEid.guti->gummei.plmn.MNCdigit2; - guti->mncdigit3 = msg->UEid.guti->gummei.plmn.MNCdigit3; - } else if (msg->UEid.imsi) { - /* Set IMSI mobile identity */ - ImsiEpsMobileIdentity_t *imsi = &emm_msg->gutiorimsi.imsi; - imsi->typeofidentity = EPS_MOBILE_IDENTITY_IMSI; - imsi->oddeven = msg->UEid.imsi->u.num.parity; - imsi->digit1 = msg->UEid.imsi->u.num.digit1; - imsi->digit2 = msg->UEid.imsi->u.num.digit2; - imsi->digit3 = msg->UEid.imsi->u.num.digit3; - imsi->digit4 = msg->UEid.imsi->u.num.digit4; - imsi->digit5 = msg->UEid.imsi->u.num.digit5; - imsi->digit6 = msg->UEid.imsi->u.num.digit6; - imsi->digit7 = msg->UEid.imsi->u.num.digit7; - imsi->digit8 = msg->UEid.imsi->u.num.digit8; - imsi->digit9 = msg->UEid.imsi->u.num.digit9; - imsi->digit10 = msg->UEid.imsi->u.num.digit10; - imsi->digit11 = msg->UEid.imsi->u.num.digit11; - imsi->digit12 = msg->UEid.imsi->u.num.digit12; - imsi->digit13 = msg->UEid.imsi->u.num.digit13; - imsi->digit14 = msg->UEid.imsi->u.num.digit14; - imsi->digit15 = msg->UEid.imsi->u.num.digit15; - } else if (msg->UEid.imei) { - /* Set IMEI mobile identity */ - ImeiEpsMobileIdentity_t *imei = &emm_msg->gutiorimsi.imei; - imei->typeofidentity = EPS_MOBILE_IDENTITY_IMEI; - imei->oddeven = msg->UEid.imei->u.num.parity; - imei->digit1 = msg->UEid.imei->u.num.digit1; - imei->digit2 = msg->UEid.imei->u.num.digit2; - imei->digit3 = msg->UEid.imei->u.num.digit3; - imei->digit4 = msg->UEid.imei->u.num.digit4; - imei->digit5 = msg->UEid.imei->u.num.digit5; - imei->digit6 = msg->UEid.imei->u.num.digit6; - imei->digit7 = msg->UEid.imei->u.num.digit7; - imei->digit8 = msg->UEid.imei->u.num.digit8; - imei->digit9 = msg->UEid.imei->u.num.digit9; - imei->digit10 = msg->UEid.imei->u.num.digit10; - imei->digit11 = msg->UEid.imei->u.num.digit11; - imei->digit12 = msg->UEid.imei->u.num.digit12; - imei->digit13 = msg->UEid.imei->u.num.digit13; - imei->digit14 = msg->UEid.imei->u.num.digit14; - imei->digit15 = msg->UEid.imei->u.num.digit15; - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_detach_request() ** - ** ** - ** Description: Builds Detach Request message ** - ** ** - ** The Detach Request message is sent by the UE to request ** - ** the release of an EMM context. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_detach_request(const emm_as_data_t *msg, - detach_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Detach Request message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = DETACH_REQUEST; - - /* Mandatory - Detach type */ - size += DETACH_TYPE_MAXIMUM_LENGTH; - - if (msg->switch_off) { - emm_msg->detachtype.switchoff = DETACH_TYPE_SWITCH_OFF; - } else { - emm_msg->detachtype.switchoff = DETACH_TYPE_NORMAL_DETACH; - } - - if (msg->type == EMM_DETACH_TYPE_EPS) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_EPS; - } else if (msg->type == EMM_DETACH_TYPE_IMSI) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_IMSI; - } else if (msg->type == EMM_DETACH_TYPE_EPS_IMSI) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_EPS_IMSI; - } else if (msg->type == EMM_DETACH_TYPE_RESERVED) { - emm_msg->detachtype.typeofdetach = DETACH_TYPE_RESERVED_1; - } else { - /* All other values are interpreted as "combined EPS/IMSI detach" */ - emm_msg->detachtype.typeofdetach = DETACH_TYPE_EPS_IMSI; - } - - /* Mandatory - NAS key set identifier */ - size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH; - - if (msg->sctx.ksi != EMM_AS_NO_KEY_AVAILABLE) { - emm_msg->naskeysetidentifier.naskeysetidentifier = msg->sctx.ksi; - } else { - emm_msg->naskeysetidentifier.naskeysetidentifier = - NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE; - } - - /* Mandatory - EPS mobile identity */ - size += EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH; - - if (msg->guti) { - /* Set GUTI mobile identity */ - GutiEpsMobileIdentity_t *guti = &emm_msg->gutiorimsi.guti; - guti->typeofidentity = EPS_MOBILE_IDENTITY_GUTI; - guti->oddeven = EPS_MOBILE_IDENTITY_EVEN; - guti->mmegroupid = msg->guti->gummei.MMEgid; - guti->mmecode = msg->guti->gummei.MMEcode; - guti->mtmsi = msg->guti->m_tmsi; - guti->mccdigit1 = msg->guti->gummei.plmn.MCCdigit1; - guti->mccdigit2 = msg->guti->gummei.plmn.MCCdigit2; - guti->mccdigit3 = msg->guti->gummei.plmn.MCCdigit3; - guti->mncdigit1 = msg->guti->gummei.plmn.MNCdigit1; - guti->mncdigit2 = msg->guti->gummei.plmn.MNCdigit2; - guti->mncdigit3 = msg->guti->gummei.plmn.MNCdigit3; - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_initial_tau_request() ** - ** ** - ** Description: Builds Tracking Area Update Request message ** - ** ** - ** The Tracking Area Update Request message is sent by the ** - ** UE to the network to update the registration of the ac- ** - ** tual tracking area of a UE in the network and to periodi- ** - ** cally notify the availability of the UE to the network. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_initial_tau_request(const emm_as_establish_t *msg, - tracking_area_update_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Tracking Area Update Request message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = TRACKING_AREA_UPDATE_REQUEST; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_initial_sr_request() ** - ** ** - ** Description: Build the Service Request message ** - ** ** - ** The Service Request message is sent by the UE to the ** - ** network to request the establishment of a NAS signalling ** - ** connection and of the radio and S1 bearers. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_initial_sr_request(const emm_as_establish_t *msg, - service_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Service Request message"); - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_initial_extsr_request() ** - ** ** - ** Description: Build the Extended Service Request message ** - ** ** - ** The Extended Service Request message is sent by the UE to ** - ** the network to request the establishment of a NAS signal- ** - ** ling connection and of the radio and S1 bearers for pa- ** - ** cket services, if the UE needs to provide additional in- ** - ** formation that cannot be provided via a SERVICE REQUEST ** - ** message. - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_initial_extsr_request(const emm_as_establish_t *msg, - extended_service_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Extended Service Request message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = EXTENDED_SERVICE_REQUEST; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_identity_response() ** - ** ** - ** Description: Builds Identity Response message ** - ** ** - ** The Identity Response message is sent by the UE to the ** - ** network in response to an Identity Request message and ** - ** provides the requested identity. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_identity_response(const emm_as_security_t *msg, - identity_response_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Identity Response message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = IDENTITY_RESPONSE; - - /* Mandatory - Mobile identity */ - size += MOBILE_IDENTITY_MAXIMUM_LENGTH; - - if (msg->identType == EMM_IDENT_TYPE_IMSI) { - if (msg->imsi) { - ImsiMobileIdentity_t *imsi = &emm_msg->mobileidentity.imsi; - imsi->typeofidentity = MOBILE_IDENTITY_IMSI; - imsi->oddeven = msg->imsi->u.num.parity; - imsi->digit1 = msg->imsi->u.num.digit1; - imsi->digit2 = msg->imsi->u.num.digit2; - imsi->digit3 = msg->imsi->u.num.digit3; - imsi->digit4 = msg->imsi->u.num.digit4; - imsi->digit5 = msg->imsi->u.num.digit5; - imsi->digit6 = msg->imsi->u.num.digit6; - imsi->digit7 = msg->imsi->u.num.digit7; - imsi->digit8 = msg->imsi->u.num.digit8; - imsi->digit9 = msg->imsi->u.num.digit9; - imsi->digit10 = msg->imsi->u.num.digit10; - imsi->digit11 = msg->imsi->u.num.digit11; - imsi->digit12 = msg->imsi->u.num.digit12; - imsi->digit13 = msg->imsi->u.num.digit13; - imsi->digit14 = msg->imsi->u.num.digit14; - imsi->digit15 = msg->imsi->u.num.digit15; - } - } else if (msg->identType == EMM_IDENT_TYPE_TMSI) { - if (msg->tmsi) { - const char *p_tmsi = (char *)(&msg->tmsi); - TmsiMobileIdentity_t *tmsi = &emm_msg->mobileidentity.tmsi; - tmsi->typeofidentity = MOBILE_IDENTITY_TMSI; - tmsi->oddeven = MOBILE_IDENTITY_EVEN; - tmsi->digit1 = 0xf; - tmsi->digit2 = (*p_tmsi & 0xf); - tmsi->digit3 = ((*p_tmsi >> 4) & 0xf); - p_tmsi++; - tmsi->digit4 = (*p_tmsi & 0xf); - tmsi->digit5 = ((*p_tmsi >> 4) & 0xf); - p_tmsi++; - tmsi->digit6 = (*p_tmsi & 0xf); - tmsi->digit7 = ((*p_tmsi >> 4) & 0xf); - p_tmsi++; - tmsi->digit8 = (*p_tmsi & 0xf); - tmsi->digit9 = ((*p_tmsi >> 4) & 0xf); - } - } else if (msg->identType == EMM_IDENT_TYPE_IMEI) { - if (msg->imei) { - ImeiMobileIdentity_t *imei = &emm_msg->mobileidentity.imei; - imei->typeofidentity = MOBILE_IDENTITY_IMEI; - imei->oddeven = msg->imei->u.num.parity; - imei->digit1 = msg->imei->u.num.digit1; - imei->digit2 = msg->imei->u.num.digit2; - imei->digit3 = msg->imei->u.num.digit3; - imei->digit4 = msg->imei->u.num.digit4; - imei->digit5 = msg->imei->u.num.digit5; - imei->digit6 = msg->imei->u.num.digit6; - imei->digit7 = msg->imei->u.num.digit7; - imei->digit8 = msg->imei->u.num.digit8; - imei->digit9 = msg->imei->u.num.digit9; - imei->digit10 = msg->imei->u.num.digit10; - imei->digit11 = msg->imei->u.num.digit11; - imei->digit12 = msg->imei->u.num.digit12; - imei->digit13 = msg->imei->u.num.digit13; - imei->digit14 = msg->imei->u.num.digit14; - imei->digit15 = msg->imei->u.num.digit15; - } - } else if (msg->identType == EMM_IDENT_TYPE_NOT_AVAILABLE) { - NoMobileIdentity_t *no_id = &emm_msg->mobileidentity.no_id; - no_id->typeofidentity = MOBILE_IDENTITY_NOT_AVAILABLE; - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_authentication_response() ** - ** ** - ** Description: Builds Authentication Response message ** - ** ** - ** The Authentication Response message is sent by the UE to ** - ** the network to deliver a calculated authentication res- ** - ** ponse to the network. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_authentication_response(const emm_as_security_t *msg, - authentication_response_msg *emm_msg) -{ - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Response message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = AUTHENTICATION_RESPONSE; - - /* Mandatory - Authentication response parameter */ - size += AUTHENTICATION_RESPONSE_PARAMETER_MAXIMUM_LENGTH; - emm_msg->authenticationresponseparameter.res = *msg->res; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_authentication_failure() ** - ** ** - ** Description: Builds Authentication Failure message ** - ** ** - ** The Authentication Failure message is sent by the UE to ** - ** the network to indicate that authentication of the net- ** - ** work has failed ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_authentication_failure(const emm_as_security_t *msg, - authentication_failure_msg *emm_msg) -{ - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Failure message (cause=%d)", - msg->emm_cause); - - /* Mandatory - Message type */ - emm_msg->messagetype = AUTHENTICATION_FAILURE; - - /* Mandatory - EMM cause */ - size += EMM_CAUSE_MAXIMUM_LENGTH; - emm_msg->emmcause = msg->emm_cause; - - /* Optional - Authentication response parameter */ - if (msg->auts && msg->auts->length > 0) { - size += AUTHENTICATION_RESPONSE_PARAMETER_MAXIMUM_LENGTH; - emm_msg->presencemask |= - AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT; - emm_msg->authenticationfailureparameter.auts = *msg->auts; - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_security_mode_complete() ** - ** ** - ** Description: Builds Security Mode Complete message ** - ** ** - ** The Security Mode Complete message is sent by the UE to ** - ** the network in response to a Security Mode Command mes- ** - ** sage. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_security_mode_complete(const emm_as_security_t *msg, - security_mode_complete_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Security Mode Complete message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = SECURITY_MODE_COMPLETE; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_security_mode_reject() ** - ** ** - ** Description: Builds Security Mode Reject message ** - ** ** - ** The Security Mode Reject message is sent by the UE to the ** - ** network to indicate that the corresponding security mode ** - ** command has been rejected. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_security_mode_reject(const emm_as_security_t *msg, - security_mode_reject_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Security Mode Reject message (cause=%d)", - msg->emm_cause); - - /* Mandatory - Message type */ - emm_msg->messagetype = SECURITY_MODE_REJECT; - - /* Mandatory - EMM cause */ - size += EMM_CAUSE_MAXIMUM_LENGTH; - emm_msg->emmcause = msg->emm_cause; - - LOG_FUNC_RETURN (size); -} - -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME to send EMM messages to the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: emm_send_attach_accept() ** - ** ** - ** Description: Builds Attach Accept message ** - ** ** - ** The Attach Accept message is sent by the network to the ** - ** UE to indicate that the corresponding attach request has ** - ** been accepted. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_attach_accept(const emm_as_establish_t *msg, - attach_accept_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Accept message"); - LOG_TRACE(INFO, "EMMAS-SAP - size = EMM_HEADER_MAXIMUM_LENGTH(%d)", - size); - - /* Mandatory - Message type */ - emm_msg->messagetype = ATTACH_ACCEPT; - - /* Mandatory - EPS attach result */ - size += EPS_ATTACH_RESULT_MAXIMUM_LENGTH; - emm_msg->epsattachresult = EPS_ATTACH_RESULT_EPS; - - /* Mandatory - T3412 value */ - size += GPRS_TIMER_MAXIMUM_LENGTH; - emm_msg->t3412value.unit = GPRS_TIMER_UNIT_0S; - LOG_TRACE(INFO, "EMMAS-SAP - size += GPRS_TIMER_MAXIMUM_LENGTH(%d) (%d)", - GPRS_TIMER_MAXIMUM_LENGTH, size); - - /* Mandatory - Tracking area identity list */ - size += TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH; - emm_msg->tailist.typeoflist = - TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS; - emm_msg->tailist.numberofelements = msg->n_tacs; - emm_msg->tailist.mccdigit1 = msg->UEid.guti->gummei.plmn.MCCdigit1; - emm_msg->tailist.mccdigit2 = msg->UEid.guti->gummei.plmn.MCCdigit2; - emm_msg->tailist.mccdigit3 = msg->UEid.guti->gummei.plmn.MCCdigit3; - emm_msg->tailist.mncdigit1 = msg->UEid.guti->gummei.plmn.MNCdigit1; - emm_msg->tailist.mncdigit2 = msg->UEid.guti->gummei.plmn.MNCdigit2; - emm_msg->tailist.mncdigit3 = msg->UEid.guti->gummei.plmn.MNCdigit3; - emm_msg->tailist.tac = msg->tac; - LOG_TRACE(INFO, - "EMMAS-SAP - size += "\ - "TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH(%d) (%d)", - TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH, - size); - - /* Mandatory - ESM message container */ - size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length; - emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg; - LOG_TRACE(INFO, - "EMMAS-SAP - size += "\ - "ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH(%d) (%d)", - ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH, - size); - - /* Optional - GUTI */ - if (msg->new_guti) { - size += EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH; - emm_msg->presencemask |= ATTACH_ACCEPT_GUTI_PRESENT; - emm_msg->guti.guti.typeofidentity = EPS_MOBILE_IDENTITY_GUTI; - emm_msg->guti.guti.oddeven = EPS_MOBILE_IDENTITY_EVEN; - emm_msg->guti.guti.mmegroupid = msg->new_guti->gummei.MMEgid; - emm_msg->guti.guti.mmecode = msg->new_guti->gummei.MMEcode; - emm_msg->guti.guti.mtmsi = msg->new_guti->m_tmsi; - emm_msg->guti.guti.mccdigit1 = msg->new_guti->gummei.plmn.MCCdigit1; - emm_msg->guti.guti.mccdigit2 = msg->new_guti->gummei.plmn.MCCdigit2; - emm_msg->guti.guti.mccdigit3 = msg->new_guti->gummei.plmn.MCCdigit3; - emm_msg->guti.guti.mncdigit1 = msg->new_guti->gummei.plmn.MNCdigit1; - emm_msg->guti.guti.mncdigit2 = msg->new_guti->gummei.plmn.MNCdigit2; - emm_msg->guti.guti.mncdigit3 = msg->new_guti->gummei.plmn.MNCdigit3; - LOG_TRACE(INFO, - "EMMAS-SAP - size += "\ - "EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH(%d) (%d)", - EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH, - size); - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_attach_reject() ** - ** ** - ** Description: Builds Attach Reject message ** - ** ** - ** The Attach Reject message is sent by the network to the ** - ** UE to indicate that the corresponding attach request has ** - ** been rejected. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_attach_reject(const emm_as_establish_t *msg, - attach_reject_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Attach Reject message (cause=%d)", - msg->emm_cause); - - /* Mandatory - Message type */ - emm_msg->messagetype = ATTACH_REJECT; - - /* Mandatory - EMM cause */ - size += EMM_CAUSE_MAXIMUM_LENGTH; - emm_msg->emmcause = msg->emm_cause; - - /* Optional - ESM message container */ - if (msg->NASmsg.length > 0) { - size += ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH + msg->NASmsg.length; - emm_msg->presencemask |= ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT; - emm_msg->esmmessagecontainer.esmmessagecontainercontents = msg->NASmsg; - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_tracking_area_update_reject() ** - ** ** - ** Description: Builds Tracking Area Update Reject message ** - ** ** - ** The Tracking Area Update Reject message is sent by the ** - ** network to the UE to indicate that the corresponding ** - ** tracking area update has been rejected. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg, - tracking_area_update_reject_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Tracking Area Update Reject message (cause=%d)", - msg->emm_cause); - - /* Mandatory - Message type */ - emm_msg->messagetype = TRACKING_AREA_UPDATE_REJECT; - - /* Mandatory - EMM cause */ - size += EMM_CAUSE_MAXIMUM_LENGTH; - emm_msg->emmcause = msg->emm_cause; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_identity_request() ** - ** ** - ** Description: Builds Identity Request message ** - ** ** - ** The Identity Request message is sent by the network to ** - ** the UE to request the UE to provide the specified identi- ** - ** ty. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_identity_request(const emm_as_security_t *msg, - identity_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Identity Request message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = IDENTITY_REQUEST; - - /* Mandatory - Identity type 2 */ - size += IDENTITY_TYPE_2_MAXIMUM_LENGTH; - - if (msg->identType == EMM_IDENT_TYPE_IMSI) { - emm_msg->identitytype = IDENTITY_TYPE_2_IMSI; - } else if (msg->identType == EMM_IDENT_TYPE_TMSI) { - emm_msg->identitytype = IDENTITY_TYPE_2_TMSI; - } else if (msg->identType == EMM_IDENT_TYPE_IMEI) { - emm_msg->identitytype = IDENTITY_TYPE_2_IMEI; - } else { - /* All other values are interpreted as "IMSI" */ - emm_msg->identitytype = IDENTITY_TYPE_2_IMSI; - } - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_authentication_request() ** - ** ** - ** Description: Builds Authentication Request message ** - ** ** - ** The Authentication Request message is sent by the network ** - ** to the UE to initiate authentication of the UE identity. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_authentication_request(const emm_as_security_t *msg, - authentication_request_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Request message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = AUTHENTICATION_REQUEST; - - /* Mandatory - NAS key set identifier */ - size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH; - emm_msg->naskeysetidentifierasme.tsc = NAS_KEY_SET_IDENTIFIER_NATIVE; - emm_msg->naskeysetidentifierasme.naskeysetidentifier = msg->ksi; - - /* Mandatory - Authentication parameter RAND */ - size += AUTHENTICATION_PARAMETER_RAND_MAXIMUM_LENGTH; - emm_msg->authenticationparameterrand.rand = *msg->rand; - - /* Mandatory - Authentication parameter AUTN */ - size += AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH; - emm_msg->authenticationparameterautn.autn = *msg->autn; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_authentication_reject() ** - ** ** - ** Description: Builds Authentication Reject message ** - ** ** - ** The Authentication Reject message is sent by the network ** - ** to the UE to indicate that the authentication procedure ** - ** has failed and that the UE shall abort all activities. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_authentication_reject(authentication_reject_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Authentication Reject message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = AUTHENTICATION_REJECT; - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: emm_send_security_mode_command() ** - ** ** - ** Description: Builds Security Mode Command message ** - ** ** - ** The Security Mode Command message is sent by the network ** - ** to the UE to establish NAS signalling security. ** - ** ** - ** Inputs: msg: The EMMAS-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: emm_msg: The EMM message to be sent ** - ** Return: The size of the EMM message ** - ** Others: None ** - ** ** - ***************************************************************************/ -int emm_send_security_mode_command(const emm_as_security_t *msg, - security_mode_command_msg *emm_msg) -{ - LOG_FUNC_IN; - - int size = EMM_HEADER_MAXIMUM_LENGTH; - - LOG_TRACE(INFO, "EMMAS-SAP - Send Security Mode Command message"); - - /* Mandatory - Message type */ - emm_msg->messagetype = SECURITY_MODE_COMMAND; - - /* Selected NAS security algorithms */ - size += NAS_SECURITY_ALGORITHMS_MAXIMUM_LENGTH; - emm_msg->selectednassecurityalgorithms.typeofcipheringalgorithm = - msg->selected_eea; - emm_msg->selectednassecurityalgorithms.typeofintegrityalgorithm = - msg->selected_eia; - - /* NAS key set identifier */ - size += NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH; - emm_msg->naskeysetidentifier.tsc = NAS_KEY_SET_IDENTIFIER_NATIVE; - emm_msg->naskeysetidentifier.naskeysetidentifier = msg->ksi; - - /* Replayed UE security capabilities */ - size += UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH; - emm_msg->replayeduesecuritycapabilities.eea = msg->eea; - emm_msg->replayeduesecuritycapabilities.eia = msg->eia; - emm_msg->replayeduesecuritycapabilities.umts_present = msg->umts_present; - emm_msg->replayeduesecuritycapabilities.gprs_present = msg->gprs_present; - - emm_msg->replayeduesecuritycapabilities.uea = msg->uea; - emm_msg->replayeduesecuritycapabilities.uia = msg->uia; - emm_msg->replayeduesecuritycapabilities.gea = msg->gea; - - LOG_FUNC_RETURN (size); -} - -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.h b/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.h deleted file mode 100644 index 72791b028e631a7acd6966110247870261e588a8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/emm/sap/emm_send.h +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Source emm_send.h - -Version 0.1 - -Date 2013/01/30 - -Product NAS stack - -Subsystem EPS Mobility Management - -Author Frederic Maurel - -Description Defines functions executed at the EMMAS Service Access - Point to send EPS Mobility Management messages to the - Access Stratum sublayer. - -*****************************************************************************/ -#ifndef __EMM_SEND_H__ -#define __EMM_SEND_H__ - -#include "EmmStatus.h" - -#include "DetachRequest.h" -#include "DetachAccept.h" - -#ifdef NAS_UE -#include "AttachRequest.h" -#include "AttachComplete.h" -#include "TrackingAreaUpdateRequest.h" -#include "TrackingAreaUpdateComplete.h" -#include "ServiceRequest.h" -#include "ExtendedServiceRequest.h" -#include "GutiReallocationComplete.h" -#include "AuthenticationResponse.h" -#include "AuthenticationFailure.h" -#include "IdentityResponse.h" -#include "NASSecurityModeComplete.h" -#include "SecurityModeReject.h" -#include "UplinkNasTransport.h" -#endif - -#ifdef NAS_MME -#include "AttachAccept.h" -#include "AttachReject.h" -#include "TrackingAreaUpdateAccept.h" -#include "TrackingAreaUpdateReject.h" -#include "ServiceReject.h" -#include "GutiReallocationCommand.h" -#include "AuthenticationRequest.h" -#include "AuthenticationReject.h" -#include "IdentityRequest.h" -#include "NASSecurityModeCommand.h" -#include "EmmInformation.h" -#include "DownlinkNasTransport.h" -#include "CsServiceNotification.h" -#endif - -#include "emm_asDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME to send EMM messages - * -------------------------------------------------------------------------- - */ -int emm_send_status(const emm_as_status_t *, emm_status_msg *); - -int emm_send_detach_accept(const emm_as_data_t *, detach_accept_msg *); - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE to send EMM messages to the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int emm_send_attach_request(const emm_as_establish_t *, attach_request_msg *); -int emm_send_attach_complete(const emm_as_data_t *, attach_complete_msg *); - -int emm_send_initial_detach_request(const emm_as_establish_t *, - detach_request_msg *); -int emm_send_detach_request(const emm_as_data_t *, detach_request_msg *); - - -int emm_send_initial_tau_request(const emm_as_establish_t *, - tracking_area_update_request_msg *); - -int emm_send_initial_sr_request(const emm_as_establish_t *, - service_request_msg *); - -int emm_send_initial_extsr_request(const emm_as_establish_t *, - extended_service_request_msg *); - -int emm_send_identity_response(const emm_as_security_t *, - identity_response_msg *); -int emm_send_authentication_response(const emm_as_security_t *, - authentication_response_msg *); -int emm_send_authentication_failure(const emm_as_security_t *, - authentication_failure_msg *); -int emm_send_security_mode_complete(const emm_as_security_t *, - security_mode_complete_msg *); -int emm_send_security_mode_reject(const emm_as_security_t *, - security_mode_reject_msg *); -#endif - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME to send EMM messages to the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -int emm_send_attach_accept(const emm_as_establish_t *, attach_accept_msg *); -int emm_send_attach_reject(const emm_as_establish_t *, attach_reject_msg *); - -int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg, - tracking_area_update_reject_msg *emm_msg); - -int emm_send_identity_request(const emm_as_security_t *, identity_request_msg *); -int emm_send_authentication_request(const emm_as_security_t *, - authentication_request_msg *); -int emm_send_authentication_reject(authentication_reject_msg *); -int emm_send_security_mode_command(const emm_as_security_t *, - security_mode_command_msg *); -#endif - -#endif /* __EMM_SEND_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/COPYING b/openair-cn/NAS/EURECOM-NAS/src/esm/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.c b/openair-cn/NAS/EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.c deleted file mode 100644 index 303e41285e30745f998c19a0232dcc396eb687c2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/DedicatedEpsBearerContextActivation.c +++ /dev/null @@ -1,670 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source DedicatedEpsBearerContextActivation.c - -Version 0.1 - -Date 2013/07/16 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the dedicated EPS bearer context activation ESM - procedure executed by the Non-Access Stratum. - - The purpose of the dedicated EPS bearer context activation - procedure is to establish an EPS bearer context with specific - QoS and TFT between the UE and the EPC. - - The procedure is initiated by the network, but may be requested - by the UE by means of the UE requested bearer resource alloca- - tion procedure or the UE requested bearer resource modification - procedure. - It can be part of the attach procedure or be initiated together - with the default EPS bearer context activation procedure when - the UE initiated stand-alone PDN connectivity procedure. - -*****************************************************************************/ - -#include "esm_proc.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "esm_cause.h" -#include "esm_ebr.h" -#include "esm_ebr_context.h" - -#include "emm_sap.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the dedicated EPS bearer context activation - * procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Timer handlers - */ -static void *_dedicated_eps_bearer_activate_t3485_handler(void *); - -/* Maximum value of the activate dedicated EPS bearer context request - * retransmission counter */ -#define DEDICATED_EPS_BEARER_ACTIVATE_COUNTER_MAX 5 - -static int _dedicated_eps_bearer_activate(emm_data_context_t *ctx, int ebi, - const OctetString *msg); -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Dedicated EPS bearer context activation procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_proc_dedicated_eps_bearer_context() ** - ** ** - ** Description: Allocates resources required for activation of a dedica- ** - ** ted EPS bearer context. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pid: PDN connection identifier ** - ** esm_qos: EPS bearer level QoS parameters ** - ** tft: Traffic flow template parameters ** - ** Others: None ** - ** ** - ** Outputs: ebi: EPS bearer identity assigned to the new ** - ** dedicated bearer context ** - ** default_ebi: EPS bearer identity of the associated de- ** - ** fault EPS bearer context ** - ** esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_dedicated_eps_bearer_context(emm_data_context_t *ctx, int pid, - unsigned int *ebi, - unsigned int *default_ebi, - const esm_proc_qos_t *qos, - const esm_proc_tft_t *tft, - int *esm_cause) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation " - "(ueid=%u, pid=%d)", ctx->ueid, pid); - - /* Assign new EPS bearer context */ - *ebi = esm_ebr_assign(ctx, ESM_EBI_UNASSIGNED); - - if (*ebi != ESM_EBI_UNASSIGNED) { - /* Create dedicated EPS bearer context */ - *default_ebi = esm_ebr_context_create(ctx, pid, *ebi, FALSE, qos, tft); - - if (*default_ebi == ESM_EBI_UNASSIGNED) { - /* No resource available */ - LOG_TRACE(WARNING, "ESM-PROC - Failed to create dedicated EPS " - "bearer context (ebi=%d)", *ebi); - *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES; - LOG_FUNC_RETURN (RETURNerror); - } - - LOG_FUNC_RETURN (RETURNok); - } - - LOG_TRACE(WARNING, "ESM-PROC - Failed to assign new EPS bearer context"); - *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES; - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_dedicated_eps_bearer_context_request() ** - ** ** - ** Description: Initiates the dedicated EPS bearer context activation pro-** - ** cedure ** - ** ** - ** 3GPP TS 24.301, section 6.4.2.2 ** - ** The MME initiates the dedicated EPS bearer context activa-** - ** tion procedure by sending an ACTIVATE DEDICATED EPS BEA- ** - ** RER CONTEXT REQUEST message, starting timer T3485 and en- ** - ** tering state BEARER CONTEXT ACTIVE PENDING. ** - ** ** - ** Inputs: is_standalone: Not used (always TRUE) ** - ** ueid: UE lower layer identifier ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: TRUE if the EPS bearer context procedure ** - ** was triggered by the UE ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_dedicated_eps_bearer_context_request(int is_standalone, - emm_data_context_t *ctx, int ebi, - OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO,"ESM-PROC - Initiate dedicated EPS bearer context " - "activation (ueid=%d, ebi=%d)", ctx->ueid, ebi); - - /* Send activate dedicated EPS bearer context request message and - * start timer T3485 */ - rc = _dedicated_eps_bearer_activate(ctx, ebi, msg); - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to ACTIVE PENDING */ - rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered); - - if (rc != RETURNok) { - /* The EPS bearer context was already in ACTIVE PENDING state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE PENDING", - ebi); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_dedicated_eps_bearer_context_accept() ** - ** ** - ** Description: Performs dedicated EPS bearer context activation procedu- ** - ** re accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.2.3 ** - ** Upon receipt of the ACTIVATE DEDICATED EPS BEARER CONTEXT ** - ** ACCEPT message, the MME shall stop the timer T3485 and ** - ** enter the state BEARER CONTEXT ACTIVE. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_dedicated_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi, - int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation " - "accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi); - - /* Stop T3485 timer */ - rc = esm_ebr_stop_timer(ctx, ebi); - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to ACTIVE */ - rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE, FALSE); - - if (rc != RETURNok) { - /* The EPS bearer context was already in ACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_dedicated_eps_bearer_context_reject() ** - ** ** - ** Description: Performs dedicated EPS bearer context activation procedu- ** - ** re not accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.2.4 ** - ** Upon receipt of the ACTIVATE DEDICATED EPS BEARER CONTEXT ** - ** REJECT message, the MME shall stop the timer T3485, enter ** - ** the state BEARER CONTEXT INACTIVE and abort the dedicated ** - ** EPS bearer context activation procedure. ** - ** The MME also requests the lower layer to release the ra- ** - ** dio resources that were established during the dedicated ** - ** EPS bearer context activation. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi, - int *esm_cause) -{ - int rc; - - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation " - "not accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi); - - /* Stop T3485 timer if running */ - rc = esm_ebr_stop_timer(ctx, ebi); - - if (rc != RETURNerror) { - int pid, bid; - /* Release the dedicated EPS bearer context and enter state INACTIVE */ - rc = esm_proc_eps_bearer_context_deactivate(ctx, TRUE, ebi, - &pid, &bid, NULL); - - if (rc != RETURNok) { - /* Failed to release the dedicated EPS bearer context */ - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_MME - -/* - * -------------------------------------------------------------------------- - * Dedicated EPS bearer context activation procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_proc_dedicated_eps_bearer_context_request() ** - ** ** - ** Description: Creates local dedicated EPS bearer context upon receipt ** - ** of the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST ** - ** message. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** default_ebi: EPS bearer identity of the associated de- ** - ** fault EPS bearer context ** - ** esm_qos: EPS bearer level QoS parameters ** - ** tft: Traffic flow template parameters ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi, - const esm_proc_qos_t *qos, - const esm_proc_tft_t *tft, - int *esm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(INFO, "ESM-PROC - Dedicated EPS bearer context activation " - "requested by the network (ebi=%d)", ebi); - - /* Get the PDN connection the dedicated EPS bearer is linked to */ - int pid = esm_ebr_context_get_pid(default_ebi); - - if (pid < 0) { - /* 3GPP TS 24.301, section 6.4.2.5, abnormal case c - * No default EPS bearer context with linked EPS bearer identity - * activated - */ - LOG_TRACE(WARNING, "ESM-PROC - Failed to get PDN connection the " - "dedicated EPS bearer is linked to (ebi=%d)", default_ebi); - *esm_cause = ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY; - LOG_FUNC_RETURN (RETURNerror); - } - - /* Assign dedicated EPS bearer context */ - int new_ebi = esm_ebr_assign(ebi, pid+1, FALSE); - - if (new_ebi == ESM_EBI_UNASSIGNED) { - /* 3GPP TS 24.301, section 6.4.2.5, abnormal cases a and b - * Dedicated EPS bearer context activation request for an already - * activated default or dedicated EPS bearer context - */ - int old_pid, old_bid; - /* Locally deactivate the existing EPS bearer context and proceed - * with the requested dedicated EPS bearer context activation */ - rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi, - &old_pid, &old_bid); - - if (rc != RETURNok) { - /* Failed to release EPS bearer context */ - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } else { - /* Assign new dedicated EPS bearer context */ - ebi = esm_ebr_assign(ebi, pid+1, FALSE); - } - } - - if (ebi != ESM_EBI_UNASSIGNED) { - /* Check syntactical errors in packet filters */ - rc = esm_ebr_context_check_tft(pid, ebi, tft, - ESM_EBR_CONTEXT_TFT_CREATE); - - if (rc != RETURNok) { - /* Syntactical errors in packet filters */ - LOG_TRACE(WARNING, "ESM-PROC - Syntactical errors in packet " - "filters"); - *esm_cause = ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER; - } else { - /* Create new dedicated EPS bearer context */ - default_ebi = esm_ebr_context_create(pid, ebi, FALSE, qos, tft); - - if (default_ebi != ESM_EBI_UNASSIGNED) { - /* Dedicated EPS bearer contextx successfully created */ - rc = RETURNok; - } else { - /* No resource available */ - LOG_TRACE(WARNING, "ESM-PROC - Failed to create new dedicated " - "EPS bearer context"); - *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES; - } - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_dedicated_eps_bearer_context_accept() ** - ** ** - ** Description: Performs dedicated EPS bearer context activation proce- ** - ** dure accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.2.3 ** - ** The UE accepts dedicated EPS bearer context activation by ** - ** sending ACTIVATE DEDICATED EPS BEARER CONTEXT ACCEPT mes- ** - ** sage and entering the state BEARER CONTEXT ACTIVE. ** - ** ** - ** Inputs: is_standalone: Not used ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: TRUE if the EPS bearer context procedure ** - ** was triggered by the UE ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi, - OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO,"ESM-PROC - Dedicated EPS bearer context activation " - "accepted by the UE (ebi=%d)", ebi); - - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = msg->length; - emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to ACTIVE */ - rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered); - - if (rc != RETURNok) { - /* The EPS bearer context was already in ACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi); - /* Accept network retransmission of already accepted activate - * dedicated EPS bearer context request */ - LOG_FUNC_RETURN (RETURNok); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_dedicated_eps_bearer_context_reject() ** - ** ** - ** Description: Performs dedicated EPS bearer context activation proce- ** - ** dure not accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.2.4 ** - ** The UE rejects dedicated EPS bearer context activation by ** - ** sending ACTIVATE DEDICATED EPS BEARER CONTEXT REJECT mes- ** - ** sage. ** - ** ** - ** Inputs: is_standalone: Not used ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi, - OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(WARNING, "ESM-PROC - Dedicated EPS bearer context activation " - "not accepted by the UE (ebi=%d)", ebi); - - if ( !esm_ebr_is_not_in_use(ebi) ) { - /* Release EPS bearer data currently in use */ - rc = esm_ebr_release(ebi); - } - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data"); - } else { - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = msg->length; - emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _dedicated_eps_bearer_activate_t3485_handler() ** - ** ** - ** Description: T3485 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 6.4.2.6, case a ** - ** On the first expiry of the timer T3485, the MME shall re- ** - ** send the ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST ** - ** and shall reset and restart timer T3485. This retransmis- ** - ** sion is repeated four times, i.e. on the fifth expiry of ** - ** timer T3485, the MME shall abort the procedure, release ** - ** any resources allocated for this activation and enter the ** - ** state BEARER CONTEXT INACTIVE. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_dedicated_eps_bearer_activate_t3485_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - /* Get retransmission timer parameters data */ - esm_ebr_timer_data_t *data = (esm_ebr_timer_data_t *)(args); - - /* Increment the retransmission counter */ - data->count += 1; - - LOG_TRACE(WARNING, "ESM-PROC - T3485 timer expired (ueid=%d, ebi=%d), " - "retransmission counter = %d", - data->ueid, data->ebi, data->count); - - if (data->count < DEDICATED_EPS_BEARER_ACTIVATE_COUNTER_MAX) { - /* Re-send activate dedicated EPS bearer context request message - * to the UE */ - rc = _dedicated_eps_bearer_activate(data->ctx, data->ebi, &data->msg); - } else { - /* - * The maximum number of activate dedicated EPS bearer context request - * message retransmission has exceed - */ - int pid, bid; - /* Release the dedicated EPS bearer context and enter state INACTIVE */ - rc = esm_proc_eps_bearer_context_deactivate(data->ctx, TRUE, - data->ebi, &pid, &bid, - NULL); - - if (rc != RETURNerror) { - /* Stop timer T3485 */ - rc = esm_ebr_stop_timer(data->ctx, data->ebi); - } - } - - LOG_FUNC_RETURN (NULL); -} - -/* - * -------------------------------------------------------------------------- - * MME specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _dedicated_eps_bearer_activate() ** - ** ** - ** Description: Sends ACTIVATE DEDICATED EPS BEREAR CONTEXT REQUEST mes- ** - ** sage and starts timer T3485 ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3485 ** - ** ** - ***************************************************************************/ -static int _dedicated_eps_bearer_activate(emm_data_context_t *ctx, int ebi, - const OctetString *msg) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify EMM that an activate dedicated EPS bearer context request - * message has to be sent to the UE - */ - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = ctx->ueid; - emm_sap.u.emm_esm.ctx = ctx; - emm_esm->msg = *msg; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Start T3485 retransmission timer */ - rc = esm_ebr_start_timer(ctx, ebi, msg, T3485_DEFAULT_VALUE, - _dedicated_eps_bearer_activate_t3485_handler); - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.c b/openair-cn/NAS/EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.c deleted file mode 100644 index 6163bcd4dac830952c3617f278e68160720bb2d3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/DefaultEpsBearerContextActivation.c +++ /dev/null @@ -1,803 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source DefaultEpsBearerContextActivation.c - -Version 0.1 - -Date 2013/01/28 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the default EPS bearer context activation ESM - procedure executed by the Non-Access Stratum. - - The purpose of the default bearer context activation procedure - is to establish a default EPS bearer context between the UE - and the EPC. - - The procedure is initiated by the network as a response to - the PDN CONNECTIVITY REQUEST message received from the UE. - It can be part of the attach procedure. - -*****************************************************************************/ - -#include "esm_proc.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "esm_cause.h" -#include "esm_ebr.h" -#include "esm_ebr_context.h" - -#include "emm_sap.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the default EPS bearer context activation - * procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -static struct { - int ebi; /* EPS bearer identity of the default EPS bearer associated - * to the PDN connection to be activated */ -} _default_eps_bearer_context_data = {ESM_EBI_UNASSIGNED}; - -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the default EPS bearer context activation - * procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Timer handlers - */ -static void *_default_eps_bearer_activate_t3485_handler(void *); - -/* Maximum value of the activate default EPS bearer context request - * retransmission counter */ -#define DEFAULT_EPS_BEARER_ACTIVATE_COUNTER_MAX 5 - -static int _default_eps_bearer_activate(emm_data_context_t *ctx, int ebi, - const OctetString *msg); -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Default EPS bearer context activation procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context() ** - ** ** - ** Description: Allocates resources required for activation of a default ** - ** EPS bearer context. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pid: PDN connection identifier ** - ** qos: EPS bearer level QoS parameters ** - ** Others: None ** - ** ** - ** Outputs: ebi: EPS bearer identity assigned to the de- ** - ** fault EPS bearer context ** - ** esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context(emm_data_context_t *ctx, int pid, - unsigned int *ebi, - const esm_proc_qos_t *qos, - int *esm_cause) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation " - "(ueid=%u, pid=%d, GBR UL %u GBR DL %u, MBR UL %u MBR DL %u QCI %u)", - ctx->ueid, - pid, - qos->gbrUL, - qos->gbrDL, - qos->mbrUL, - qos->mbrDL, - qos->qci); - - /* Assign new EPS bearer context */ - *ebi = esm_ebr_assign(ctx, ESM_EBI_UNASSIGNED); - - if (*ebi != ESM_EBI_UNASSIGNED) { - /* Create default EPS bearer context */ - *ebi = esm_ebr_context_create(ctx, pid, *ebi, TRUE, qos, NULL); - - if (*ebi == ESM_EBI_UNASSIGNED) { - /* No resource available */ - LOG_TRACE(WARNING, "ESM-PROC - Failed to create new default EPS " - "bearer context (ebi=%d)", *ebi); - *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES; - LOG_FUNC_RETURN (RETURNerror); - } - - LOG_FUNC_RETURN (RETURNok); - } - - LOG_TRACE(WARNING, "ESM-PROC - Failed to assign new EPS bearer context"); - *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES; - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_request() ** - ** ** - ** Description: Initiates the default EPS bearer context activation pro- ** - ** cedure ** - ** ** - ** 3GPP TS 24.301, section 6.4.1.2 ** - ** The MME initiates the default EPS bearer context activa- ** - ** tion procedure by sending an ACTIVATE DEFAULT EPS BEARER ** - ** CONTEXT REQUEST message, starting timer T3485 and ente- ** - ** ring state BEARER CONTEXT ACTIVE PENDING. ** - ** ** - ** Inputs: is_standalone: Indicate whether the default bearer is ** - ** activated as part of the attach procedure ** - ** or as the response to a stand-alone PDN ** - ** CONNECTIVITY REQUEST message ** - ** ueid: UE lower layer identifier ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: TRUE if the EPS bearer context procedure ** - ** was triggered by the UE ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_request(int is_standalone, - emm_data_context_t *ctx, int ebi, - OctetString *msg, int ue_triggered) -{ - int rc = RETURNok; - - LOG_FUNC_IN; - - - if (is_standalone) { - /* Send activate default EPS bearer context request message and - * start timer T3485 */ - LOG_TRACE(INFO,"ESM-PROC - Initiate standalone default EPS bearer context activation " - "(ueid=%u, ebi=%d)", ctx->ueid, ebi); - rc = _default_eps_bearer_activate(ctx, ebi, msg); - } else { - LOG_TRACE(INFO,"ESM-PROC - Initiate non standalone default EPS bearer context activation " - "(ueid=%u, ebi=%d)", ctx->ueid, ebi); - } - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to ACTIVE PENDING */ - rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE_PENDING, ue_triggered); - - if (rc != RETURNok) { - /* The EPS bearer context was already in ACTIVE PENDING state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE PENDING", - ebi); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_accept() ** - ** ** - ** Description: Performs default EPS bearer context activation procedure ** - ** accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.1.3 ** - ** Upon receipt of the ACTIVATE DEFAULT EPS BEARER CONTEXT ** - ** ACCEPT message, the MME shall enter the state BEARER CON- ** - ** TEXT ACTIVE and stop the timer T3485, if it is running. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi, - int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation " - "accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi); - - /* Stop T3485 timer if running */ - rc = esm_ebr_stop_timer(ctx, ebi); - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to ACTIVE */ - rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_ACTIVE, FALSE); - - if (rc != RETURNok) { - /* The EPS bearer context was already in ACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_reject() ** - ** ** - ** Description: Performs default EPS bearer context activation procedure ** - ** not accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.1.4 ** - ** Upon receipt of the ACTIVATE DEFAULT EPS BEARER CONTEXT ** - ** REJECT message, the MME shall enter the state BEARER CON- ** - ** TEXT INACTIVE and stop the timer T3485, if it is running. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi, - int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation " - "not accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi); - - /* Stop T3485 timer if running */ - rc = esm_ebr_stop_timer(ctx, ebi); - - if (rc != RETURNerror) { - int pid, bid; - /* Release the default EPS bearer context and enter state INACTIVE */ - rc = esm_proc_eps_bearer_context_deactivate(ctx, TRUE, ebi, - &pid, &bid, NULL); - - if (rc != RETURNok) { - /* Failed to release the default EPS bearer context */ - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_failure() ** - ** ** - ** Description: Performs default EPS bearer context activation procedure ** - ** upon receiving notification from the EPS Mobility Manage- ** - ** ment sublayer that EMM procedure that initiated EPS de- ** - ** fault bearer context activation locally failed. ** - ** ** - ** The MME releases the default EPS bearer context previous- ** - ** ly allocated when ACTIVATE DEFAULT EPS BEARER CONTEXT RE- ** - ** QUEST message was received. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The identifier of the PDN connection the ** - ** default EPS bearer context belongs to if ** - ** successfully released; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_failure(emm_data_context_t *ctx) -{ - int rc = RETURNerror; - int pid; - - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation " - "failure (ueid=%u)", ctx->ueid); - - /* Get the EPS bearer identity of the EPS bearer context which is still - * pending in the active pending state */ - int ebi = esm_ebr_get_pending_ebi(ctx, ESM_EBR_ACTIVE_PENDING); - - if (ebi != ESM_EBI_UNASSIGNED) { - int bid; - /* Release the default EPS bearer context and enter state INACTIVE */ - rc = esm_proc_eps_bearer_context_deactivate(ctx, TRUE, ebi, - &pid, &bid, NULL); - } - - if (rc != RETURNerror) { - LOG_FUNC_RETURN (pid); - } - - LOG_FUNC_RETURN (RETURNerror); -} - -#endif // NAS_MME - -/* - * -------------------------------------------------------------------------- - * Default EPS bearer context activation procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_request() ** - ** ** - ** Description: Creates local default EPS bearer context upon receipt of ** - ** the ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message. ** - ** ** - ** Inputs: pid: PDN connection identifier ** - ** ebi: EPS bearer identity ** - ** qos: EPS bearer level QoS parameters ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: _default_eps_bearer_context_data ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_request(int pid, int ebi, - const esm_proc_qos_t *qos, - int *esm_cause) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(INFO, "ESM-PROC - Default EPS bearer context activation " - "requested by the network (ebi=%d)", ebi); - - /* Assign default EPS bearer context */ - int new_ebi = esm_ebr_assign(ebi, pid+1, TRUE); - - if (new_ebi == ESM_EBI_UNASSIGNED) { - /* 3GPP TS 24.301, section 6.4.1.5, abnormal cases a and b - * Default EPS bearer context activation request for an already - * activated default or dedicated EPS bearer context - */ - int old_pid, old_bid; - /* Locally deactivate the existing EPS bearer context and proceed - * with the requested default EPS bearer context activation */ - rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi, - &old_pid, &old_bid); - - if (rc != RETURNok) { - /* Failed to release EPS bearer context */ - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } else { - /* Assign new default EPS bearer context */ - ebi = esm_ebr_assign(ebi, pid+1, TRUE); - } - } - - if (ebi != ESM_EBI_UNASSIGNED) { - /* Create new default EPS bearer context */ - ebi = esm_ebr_context_create(pid, ebi, TRUE, qos, NULL); - - if (ebi != ESM_EBI_UNASSIGNED) { - /* Default EPS bearer contextx successfully created */ - _default_eps_bearer_context_data.ebi = ebi; - rc = RETURNok; - } else { - /* No resource available */ - LOG_TRACE(WARNING, "ESM-PROC - Failed to create new default EPS " - "bearer context"); - *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES; - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_accept() ** - ** ** - ** Description: Performs default EPS bearer context activation procedure ** - ** accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.1.3 ** - ** The UE accepts default EPS bearer context activation by ** - ** sending ACTIVATE DEFAULT EPS BEARER CONTEXT ACCEPT mes- ** - ** sage and entering the state BEARER CONTEXT ACTIVE. ** - ** If the default bearer is activated as part of the attach ** - ** procedure, the UE shall send the accept message together ** - ** with ATTACH COMPLETE message. ** - ** ** - ** Inputs: is_standalone: Indicates whether the activate default EPS ** - ** bearer context accept has to be sent stand-** - ** alone or together within an attach comple- ** - ** te message ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: TRUE if the EPS bearer context procedure ** - ** was triggered by the UE (should be always ** - ** TRUE) ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, - OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO,"ESM-PROC - Default EPS bearer context activation " - "accepted by the UE (ebi=%d)", ebi); - - if (is_standalone) { - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = msg->length; - emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - } - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to ACTIVE */ - rc = esm_ebr_set_status(ebi, ESM_EBR_ACTIVE, ue_triggered); - - if (rc != RETURNok) { - /* The EPS bearer context was already in ACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already ACTIVE", ebi); - /* Accept network retransmission of already accepted activate - * default EPS bearer context request */ - LOG_FUNC_RETURN (RETURNok); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_reject() ** - ** ** - ** Description: Performs default EPS bearer context activation procedure ** - ** not accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.1.4 ** - ** The UE rejects default EPS bearer context activation by ** - ** sending ACTIVATE DEFAULT EPS BEARER CONTEXT REJECT mes- ** - ** sage and entering the state BEARER CONTEXT INACTIVE. ** - ** If the default EPS bearer context activation is part of ** - ** the attach procedure, the ESM sublayer shall notify the ** - ** EMM sublayer of an ESM failure. ** - ** ** - ** Inputs: is_standalone: Indicates whether the activate default EPS ** - ** bearer context accept has to be sent stand-** - ** alone or together within an attach comple- ** - ** te message ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, - OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(WARNING, "ESM-PROC - Default EPS bearer context activation " - "not accepted by the UE (ebi=%d)", ebi); - - if ( !esm_ebr_is_not_in_use(ebi) ) { - /* Release EPS bearer data currently in use */ - rc = esm_ebr_release(ebi); - } - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer data"); - } else if (is_standalone) { - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = msg->length; - emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - } else { - /* An error is returned to notify EMM that the default EPS bearer - * activation procedure initiated as part of the initial attach - * procedure has failed - */ - rc = RETURNerror; - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_complete() ** - ** ** - ** Description: Terminates the default EPS bearer context activation pro- ** - ** cedure upon receiving indication from the EPS Mobility ** - ** Management sublayer that the ACTIVATE DEFAULT EPS BEARER ** - ** CONTEXT ACCEPT message has been successfully delivered to ** - ** the MME. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _default_eps_bearer_context_data ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_complete(void) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, - "ESM-PROC - Default EPS bearer context activation complete"); - - /* Reset default EPS bearer context internal data */ - _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED; - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_default_eps_bearer_context_failure() ** - ** ** - ** Description: Performs default EPS bearer context activation procedure ** - ** upon receiving transmission failure of ESM message indi- ** - ** cation from the EPS Mobility Management sublayer ** - ** ** - ** The UE releases the default EPS bearer context previously ** - ** allocated before the ACTIVATE DEFAULT EPS BEARER CONTEXT ** - ** ACCEPT message was sent. ** - ** ** - ** Inputs: None ** - ** Others: _default_eps_bearer_context_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _default_eps_bearer_context_data ** - ** ** - ***************************************************************************/ -int esm_proc_default_eps_bearer_context_failure(void) -{ - LOG_FUNC_IN; - - int ebi = _default_eps_bearer_context_data.ebi; - int pid, bid; - - LOG_TRACE(WARNING, - "ESM-PROC - Default EPS bearer context activation failure"); - - /* Release the default EPS bearer context and enter state INACTIVE */ - int rc = esm_proc_eps_bearer_context_deactivate(TRUE, ebi, &pid, &bid); - - if (rc != RETURNerror) { - /* Reset default EPS bearer context internal data */ - _default_eps_bearer_context_data.ebi = ESM_EBI_UNASSIGNED; - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _default_eps_bearer_activate_t3485_handler() ** - ** ** - ** Description: T3485 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 6.4.1.6, case a ** - ** On the first expiry of the timer T3485, the MME shall re- ** - ** send the ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST and ** - ** shall reset and restart timer T3485. This retransmission ** - ** is repeated four times, i.e. on the fifth expiry of timer ** - ** T3485, the MME shall release possibly allocated resources ** - ** for this activation and shall abort the procedure. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_default_eps_bearer_activate_t3485_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - /* Get retransmission timer parameters data */ - esm_ebr_timer_data_t *data = (esm_ebr_timer_data_t *)(args); - - /* Increment the retransmission counter */ - data->count += 1; - - LOG_TRACE(WARNING, "ESM-PROC - T3485 timer expired (ueid=%d, ebi=%d), " - "retransmission counter = %d", - data->ueid, data->ebi, data->count); - - if (data->count < DEFAULT_EPS_BEARER_ACTIVATE_COUNTER_MAX) { - /* Re-send activate default EPS bearer context request message - * to the UE */ - rc = _default_eps_bearer_activate(data->ctx, data->ebi, &data->msg); - } else { - /* - * The maximum number of activate default EPS bearer context request - * message retransmission has exceed - */ - int pid, bid; - /* Release the default EPS bearer context and enter state INACTIVE */ - rc = esm_proc_eps_bearer_context_deactivate(data->ctx, TRUE, - data->ebi, &pid, &bid, - NULL); - - if (rc != RETURNerror) { - /* Stop timer T3485 */ - rc = esm_ebr_stop_timer(data->ctx, data->ebi); - } - } - - LOG_FUNC_RETURN (NULL); -} - -/* - * -------------------------------------------------------------------------- - * MME specific local functions - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _default_eps_bearer_activate() ** - ** ** - ** Description: Sends ACTIVATE DEFAULT EPS BEREAR CONTEXT REQUEST message ** - ** and starts timer T3485 ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3485 ** - ** ** - ***************************************************************************/ -static int _default_eps_bearer_activate(emm_data_context_t *ctx, int ebi, - const OctetString *msg) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify EMM that an activate default EPS bearer context request message - * has to be sent to the UE - */ - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = ctx->ueid; - emm_sap.u.emm_esm.ctx = ctx; - emm_esm->msg = *msg; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Start T3485 retransmission timer */ - rc = esm_ebr_start_timer(ctx, ebi, msg, T3485_DEFAULT_VALUE, - _default_eps_bearer_activate_t3485_handler); - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/EpsBearerContextDeactivation.c b/openair-cn/NAS/EURECOM-NAS/src/esm/EpsBearerContextDeactivation.c deleted file mode 100644 index 2e4791f90746e1a258aef711b226da64284cdf31..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/EpsBearerContextDeactivation.c +++ /dev/null @@ -1,795 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EpsBearerContextDeactivation.c - -Version 0.1 - -Date 2013/05/22 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the EPS bearer context deactivation ESM procedure - executed by the Non-Access Stratum. - - The purpose of the EPS bearer context deactivation procedure - is to deactivate an EPS bearer context or disconnect from a - PDN by deactivating all EPS bearer contexts to the PDN. - The EPS bearer context deactivation procedure is initiated - by the network, and it may be triggered by the UE by means - of the UE requested bearer resource modification procedure - or UE requested PDN disconnect procedure. - -*****************************************************************************/ - -#include "esm_proc.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emmData.h" -#include "esmData.h" -#include "esm_cause.h" -#include "esm_ebr.h" -#include "esm_ebr_context.h" - -#ifdef NAS_UE -#include "esm_main.h" -#endif - -#include "emm_sap.h" -#include "esm_sap.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the EPS bearer context deactivation procedure - * in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -static int _eps_bearer_release(int ebi, int *pid, int *bid); -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the EPS bearer context deactivation procedure - * in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Timer handlers - */ -static void *_eps_bearer_deactivate_t3495_handler(void *); - -/* Maximum value of the deactivate EPS bearer context request - * retransmission counter */ -#define EPS_BEARER_DEACTIVATE_COUNTER_MAX 5 - -static int _eps_bearer_deactivate(emm_data_context_t *ctx, int ebi, - const OctetString *msg); -static int _eps_bearer_release(emm_data_context_t *ctx, int ebi, int *pid, int *bid); - -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * EPS bearer context deactivation procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_proc_eps_bearer_context_deactivate() ** - ** ** - ** Description: Locally releases the EPS bearer context identified by the ** - ** given EPS bearer identity, without peer-to-peer signal- ** - ** ling between the UE and the MME, or checks whether an EPS ** - ** bearer context with specified EPS bearer identity has ** - ** been activated for the given UE. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** is local: TRUE if the EPS bearer context has to be ** - ** locally released without peer-to-peer si- ** - ** gnalling between the UE and the MME ** - ** ebi: EPS bearer identity of the EPS bearer con- ** - ** text to be deactivated ** - ** Others: _esm_data ** - ** ** - ** Outputs: pid: Identifier of the PDN connection the EPS ** - ** bearer belongs to ** - ** bid: Identifier of the released EPS bearer con- ** - ** text entry ** - ** esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_eps_bearer_context_deactivate(emm_data_context_t *ctx, int is_local, - int ebi, int *pid, int *bid, - int *esm_cause) -{ - int rc = RETURNerror; - - LOG_FUNC_IN; - - if (is_local) { - if (ebi != ESM_SAP_ALL_EBI) { - /* Locally release the specified EPS bearer context */ - rc = _eps_bearer_release(ctx, ebi, pid, bid); - } else if (ctx != NULL) { - /* Locally release all the EPS bearer contexts */ - *bid = 0; - - for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) { - if (ctx->esm_data_ctx.pdn[*pid].data) { - rc = _eps_bearer_release(ctx, ESM_EBI_UNASSIGNED, - pid, bid); - - if (rc != RETURNok) { - break; - } - } - } - } - - LOG_FUNC_RETURN (rc); - } - - LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation " - "(ueid=%u, ebi=%d)", ctx->ueid, ebi); - - if ((ctx != NULL) && - (*pid < ESM_DATA_PDN_MAX) ) { - if (ctx->esm_data_ctx.pdn[*pid].pid != *pid) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d " - "is not valid", *pid); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } else if (ctx->esm_data_ctx.pdn[*pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been " - "allocated", *pid); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } else if (!ctx->esm_data_ctx.pdn[*pid].is_active) { - LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d is not active", - *pid); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } else { - int i; - esm_pdn_t *pdn = ctx->esm_data_ctx.pdn[*pid].data; - - *esm_cause = ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY; - - for (i = 0; i < pdn->n_bearers; i++) { - if (pdn->bearer[i]->ebi != ebi) { - continue; - } - - /* The EPS bearer context to be released is valid */ - rc = RETURNok; - } - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_eps_bearer_context_deactivate_request() ** - ** ** - ** Description: Initiates the EPS bearer context deactivation procedure ** - ** ** - ** 3GPP TS 24.301, section 6.4.4.2 ** - ** If a NAS signalling connection exists, the MME initiates ** - ** the EPS bearer context deactivation procedure by sending ** - ** a DEACTIVATE EPS BEARER CONTEXT REQUEST message to the ** - ** UE, starting timer T3495 and entering state BEARER CON- ** - ** TEXT INACTIVE PENDING. ** - ** ** - ** Inputs: is_standalone: Not used - Always TRUE ** - ** ueid: UE lower layer identifier ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: TRUE if the EPS bearer context procedure ** - ** was triggered by the UE (not used) ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_eps_bearer_context_deactivate_request(int is_standalone, - emm_data_context_t *ctx, int ebi, - OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO,"ESM-PROC - Initiate EPS bearer context deactivation " - "(ueid=%d, ebi=%d)", ctx->ueid, ebi); - - /* Send deactivate EPS bearer context request message and - * start timer T3495 */ - rc = _eps_bearer_deactivate(ctx, ebi, msg); - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to ACTIVE PENDING */ - rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_INACTIVE_PENDING, - ue_triggered); - - if (rc != RETURNok) { - /* The EPS bearer context was already in ACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE PENDING", - ebi); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_eps_bearer_context_deactivate_accept() ** - ** ** - ** Description: Performs EPS bearer context deactivation procedure accep- ** - ** ted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.4.3 ** - ** Upon receipt of the DEACTIVATE EPS BEARER CONTEXT ACCEPT ** - ** message, the MME shall enter the state BEARER CONTEXT ** - ** INACTIVE and stop the timer T3495. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: The identifier of the PDN connection to be ** - ** released, if it exists; ** - ** RETURNerror otherwise. ** - ** Others: T3495 ** - ** ** - ***************************************************************************/ -int esm_proc_eps_bearer_context_deactivate_accept(emm_data_context_t *ctx, int ebi, - int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - int pid = RETURNerror; - - LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation " - "accepted by the UE (ueid=%u, ebi=%d)", ctx->ueid, ebi); - - /* Stop T3495 timer if running */ - rc = esm_ebr_stop_timer(ctx, ebi); - - if (rc != RETURNerror) { - int bid; - /* Release the EPS bearer context */ - rc = _eps_bearer_release(ctx, ebi, &pid, &bid); - - if (rc != RETURNok) { - /* Failed to release the EPS bearer context */ - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - pid = RETURNerror; - } - } - - LOG_FUNC_RETURN (pid); -} - -#endif // NAS_MME - -/* - * -------------------------------------------------------------------------- - * EPS bearer context deactivation procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_proc_eps_bearer_context_deactivate() ** - ** ** - ** Description: Locally releases the EPS bearer context identified by the ** - ** given EPS bearer identity, without peer-to-peer signal- ** - ** ling between the UE and the MME, or checks whether the UE ** - ** has an EPS bearer context with specified EPS bearer iden- ** - ** tity activated. ** - ** ** - ** Inputs: is local: TRUE if the EPS bearer context has to be ** - ** locally released without peer-to-peer si- ** - ** gnalling between the UE and the MME ** - ** ebi: EPS bearer identity of the EPS bearer con- ** - ** text to be deactivated ** - ** Others: _esm_data ** - ** ** - ** Outputs: pid: Identifier of the PDN connection the EPS ** - ** bearer belongs to ** - ** bid: Identifier of the released EPS bearer con- ** - ** text entry ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, - int *pid, int *bid) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - int i; - - if (is_local) { - if (ebi != ESM_SAP_ALL_EBI) { - /* Locally release the EPS bearer context */ - rc = _eps_bearer_release(ebi, pid, bid); - } else { - /* Locally release all the EPS bearer contexts */ - *bid = 0; - - for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) { - if (_esm_data.pdn[*pid].data) { - rc = _eps_bearer_release(ESM_EBI_UNASSIGNED, pid, bid); - - if (rc != RETURNok) { - break; - } - } - } - } - - LOG_FUNC_RETURN (rc); - } - - LOG_TRACE(WARNING, "ESM-PROC - EPS bearer context deactivation (ebi=%d)", - ebi); - - if (*pid < ESM_DATA_PDN_MAX) { - if (_esm_data.pdn[*pid].pid != *pid) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d " - "is not valid", *pid); - } else if (_esm_data.pdn[*pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been " - "allocated", *pid); - } else if (!_esm_data.pdn[*pid].is_active) { - LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d is not active", - *pid); - } else { - esm_pdn_t *pdn = _esm_data.pdn[*pid].data; - - for (i = 0; i < pdn->n_bearers; i++) { - if (pdn->bearer[i]->ebi != ebi) { - continue; - } - - /* The EPS bearer context to be released is valid */ - rc = RETURNok; - } - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_eps_bearer_context_deactivate_request() ** - ** ** - ** Description: Deletes the EPS bearer context identified by the EPS bea- ** - ** rer identity upon receipt of the DEACTIVATE EPS BEARER ** - ** CONTEXT REQUEST message. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause) -{ - LOG_FUNC_IN; - - int pid, bid; - int rc = RETURNok; - - LOG_TRACE(INFO, "ESM-PROC - EPS bearer context deactivation " - "requested by the network (ebi=%d)", ebi); - - /* Release the EPS bearer context entry */ - if (esm_ebr_context_release(ebi, &pid, &bid) == ESM_EBI_UNASSIGNED) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context"); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (RETURNerror); - } - - if (bid == 0) { - /* The EPS bearer identity is that of the default bearer assigned to - * the PDN connection */ - if (*esm_cause == ESM_CAUSE_REACTIVATION_REQUESTED) { - esm_sap_t esm_sap; - int active = FALSE; - - /* 3GPP TS 24.301, section 6.4.4.3 - * The UE should re-initiate the UE requested PDN connectivity - * procedure for the APN associated to the PDN it was connected - * to in order to reactivate the EPS bearer context - */ - LOG_TRACE(WARNING, "ESM-PROC - The network requests PDN " - "connection reactivation"); - - /* Get PDN context parameters */ - rc = esm_main_get_pdn(pid + 1, &esm_sap.data.pdn_connect.pdn_type, - &esm_sap.data.pdn_connect.apn, - &esm_sap.data.pdn_connect.is_emergency, - &active); - - if (rc != RETURNerror) { - if (active) { - LOG_TRACE(ERROR, "ESM-PROC - Connectivity to APN %s " - "has not been deactivated", - esm_sap.data.pdn_connect.apn); - *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED; - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Notify ESM to re-initiate PDN connectivity procedure - */ - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ; - esm_sap.is_standalone = TRUE; - esm_sap.data.pdn_connect.is_defined = TRUE; - esm_sap.data.pdn_connect.cid = pid + 1; - rc = esm_sap_send(&esm_sap); - } - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_eps_bearer_context_deactivate_accept() ** - ** ** - ** Description: Performs EPS bearer context deactivation procedure accep- ** - ** ted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.4.4.3 ** - ** The UE accepts EPS bearer context deactivation by sending ** - ** DEACTIVATE EPS BEARER CONTEXT ACCEPT message and entering ** - ** the state BEARER CONTEXT INACTIVE. ** - ** ** - ** Inputs: is_standalone: Should be always TRUE ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** ue_triggered: TRUE if the EPS bearer context procedure ** - ** was triggered by the UE ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, - OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO,"ESM-PROC - EPS bearer context deactivation accepted"); - - if (is_standalone) { - emm_sap_t emm_sap; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_sap.u.emm_esm.u.data.msg.length = msg->length; - emm_sap.u.emm_esm.u.data.msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - } - - if (rc != RETURNerror) { - /* Set the EPS bearer context state to INACTIVE */ - rc = esm_ebr_set_status(ebi, ESM_EBR_INACTIVE, ue_triggered); - - if (rc != RETURNok) { - /* The EPS bearer context was already in INACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE", ebi); - /* Accept network retransmission of already accepted deactivate - * EPS bearer context request */ - LOG_FUNC_RETURN (RETURNok); - } - - /* Release EPS bearer data */ - rc = esm_ebr_release(ebi); - } - - LOG_FUNC_RETURN (rc); -} - -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _eps_bearer_deactivate_t3495_handler() ** - ** ** - ** Description: T3495 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 6.4.4.5, case a ** - ** On the first expiry of the timer T3495, the MME shall re- ** - ** send the DEACTIVATE EPS BEARER CONTEXT REQUEST and shall ** - ** reset and restart timer T3495. This retransmission is ** - ** repeated four times, i.e. on the fifth expiry of timer ** - ** T3495, the MME shall abort the procedure and deactivate ** - ** the EPS bearer context locally. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_eps_bearer_deactivate_t3495_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - /* Get retransmission timer parameters data */ - esm_ebr_timer_data_t *data = (esm_ebr_timer_data_t *)(args); - - /* Increment the retransmission counter */ - data->count += 1; - - LOG_TRACE(WARNING, "ESM-PROC - T3495 timer expired (ueid=%d, ebi=%d), " - "retransmission counter = %d", - data->ueid, data->ebi, data->count); - - if (data->count < EPS_BEARER_DEACTIVATE_COUNTER_MAX) { - /* Re-send deactivate EPS bearer context request message to the UE */ - rc = _eps_bearer_deactivate(data->ctx, data->ebi, &data->msg); - } else { - /* - * The maximum number of deactivate EPS bearer context request - * message retransmission has exceed - */ - int pid, bid; - /* Deactivate the EPS bearer context locally without peer-to-peer - * signalling between the UE and the MME */ - rc = _eps_bearer_release(data->ctx, data->ebi, &pid, &bid); - - if (rc != RETURNerror) { - /* Stop timer T3495 */ - rc = esm_ebr_stop_timer(data->ctx, data->ebi); - } - } - - LOG_FUNC_RETURN (NULL); -} -#endif // NAS_MME - -/* - * -------------------------------------------------------------------------- - * MME specific local functions - * -------------------------------------------------------------------------- - */ - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _eps_bearer_deactivate() ** - ** ** - ** Description: Sends DEACTIVATE EPS BEREAR CONTEXT REQUEST message and ** - ** starts timer T3495 ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** msg: Encoded ESM message to be sent ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: T3495 ** - ** ** - ***************************************************************************/ -static int _eps_bearer_deactivate(emm_data_context_t *ctx, int ebi, - const OctetString *msg) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify EMM that a deactivate EPS bearer context request message - * has to be sent to the UE - */ - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = ctx->ueid; - emm_sap.u.emm_esm.ctx = ctx; - emm_esm->msg = *msg; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Start T3495 retransmission timer */ - rc = esm_ebr_start_timer(ctx, ebi, msg, T3495_DEFAULT_VALUE, - _eps_bearer_deactivate_t3495_handler); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _eps_bearer_release() ** - ** ** - ** Description: Releases the EPS bearer context identified by the given ** - ** EPS bearer identity and enters state INACTIVE. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: pid: Identifier of the PDN connection the EPS ** - ** bearer belongs to ** - ** bid: Identifier of the released EPS bearer con- ** - ** text entry ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _eps_bearer_release(emm_data_context_t *ctx, int ebi, int *pid, int *bid) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - /* Release the EPS bearer context entry */ - ebi = esm_ebr_context_release(ctx, ebi, pid, bid); - - if (ebi == ESM_EBI_UNASSIGNED) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context"); - } else { - /* Set the EPS bearer context state to INACTIVE */ - rc = esm_ebr_set_status(ctx, ebi, ESM_EBR_INACTIVE, FALSE); - - if (rc != RETURNok) { - /* The EPS bearer context was already in INACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE", ebi); - } else { - /* Release EPS bearer data */ - rc = esm_ebr_release(ctx, ebi); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, - "ESM-PROC - Failed to release EPS bearer data"); - } - } - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_MME - -/* - * -------------------------------------------------------------------------- - * UE specific local functions - * -------------------------------------------------------------------------- - */ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _eps_bearer_release() ** - ** ** - ** Description: Releases the EPS bearer context identified by the given ** - ** EPS bearer identity and enters state INACTIVE. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: pid: Identifier of the PDN connection the EPS ** - ** bearer belongs to ** - ** bid: Identifier of the released EPS bearer con- ** - ** text entry ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _eps_bearer_release(int ebi, int *pid, int *bid) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - /* Release the EPS bearer context entry */ - ebi = esm_ebr_context_release(ebi, pid, bid); - - if (ebi == ESM_EBI_UNASSIGNED) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release EPS bearer context"); - } else { - /* Set the EPS bearer context state to INACTIVE */ - rc = esm_ebr_set_status(ebi, ESM_EBR_INACTIVE, FALSE); - - if (rc != RETURNok) { - /* The EPS bearer context was already in INACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - EBI %d was already INACTIVE", ebi); - } else { - /* Release EPS bearer data */ - rc = esm_ebr_release(ebi); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, - "ESM-PROC - Failed to release EPS bearer data"); - } - } - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/EsmStatusHdl.c b/openair-cn/NAS/EURECOM-NAS/src/esm/EsmStatusHdl.c deleted file mode 100644 index d01020f39560e0a2a4fa62b02f3043f881010692..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/EsmStatusHdl.c +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source EsmStatus.c - -Version 0.1 - -Date 2013/06/17 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the ESM status procedure executed by the Non-Access - Stratum. - - ESM status procedure can be related to an EPS bearer context - or to a procedure transaction. - - The purpose of the sending of the ESM STATUS message is to - report at any time certain error conditions detected upon - receipt of ESM protocol data. The ESM STATUS message can be - sent by both the MME and the UE. - -*****************************************************************************/ - -#include "esm_proc.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "esm_cause.h" - -#include "emm_sap.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: esm_proc_status_ind() ** - ** ** - ** Description: Processes received ESM status message. ** - ** ** - ** 3GPP TS 24.301, section 6.7 ** - ** Upon receiving ESM Status message the UE/MME shall take ** - ** different actions depending on the received ESM cause ** - ** value. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** esm_cause: Received ESM cause code ** - ** failure ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_status_ind( -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int pti, int ebi, int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(INFO,"ESM-PROC - ESM status procedure requested (cause=%d)", - *esm_cause); - - LOG_TRACE(DEBUG, "ESM-PROC - To be implemented"); - - switch (*esm_cause) { - case ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY: - /* - * Abort any ongoing ESM procedure related to the received EPS - * bearer identity, stop any related timer, and deactivate the - * corresponding EPS bearer context locally - */ - /* TODO */ - rc = RETURNok; - break; - - case ESM_CAUSE_INVALID_PTI_VALUE: - /* - * Abort any ongoing ESM procedure related to the received PTI - * value and stop any related timer - */ - /* TODO */ - rc = RETURNok; - break; - - case ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED: - /* - * Abort any ongoing ESM procedure related to the PTI or - * EPS bearer identity and stop any related timer - */ - /* TODO */ - rc = RETURNok; - break; - - default: - /* - * No state transition and no specific action shall be taken; - * local actions are possible - */ - /* TODO */ - rc = RETURNok; - break; - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_status() ** - ** ** - ** Description: Initiates ESM status procedure. ** - ** ** - ** Inputs: is_standalone: Not used - Always TRUE ** - ** ueid: UE lower layer identifier ** - ** ebi: Not used ** - ** msg: Encoded ESM status message to be sent ** - ** ue_triggered: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_status(int is_standalone, -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int ebi, OctetString *msg, - int ue_triggered) -{ - LOG_FUNC_IN; - - int rc; - emm_sap_t emm_sap; - - LOG_TRACE(INFO,"ESM-PROC - ESM status procedure requested"); - - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; -#ifdef NAS_UE - emm_sap.u.emm_esm.ueid = 0; -#endif -#ifdef NAS_MME - emm_sap.u.emm_esm.ueid = ctx->ueid; - emm_sap.u.emm_esm.ctx = ctx; -#endif - emm_sap.u.emm_esm.u.data.msg.length = msg->length; - emm_sap.u.emm_esm.u.data.msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/Makefile b/openair-cn/NAS/EURECOM-NAS/src/esm/Makefile deleted file mode 100644 index eda83656ac0471058b4cc1a20641d7af89d65aae..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) -I$(MMEAPIDIR) \ - -I$(EMMSAPDIR) -I$(ESMSAPDIR) -I$(ESMMSGDIR) -I$(EMMDIR) - -all: $(OBJS) - @$(CD) $(ESMMSGDIR) && $(MAKE) - @$(CD) $(ESMSAPDIR) && $(MAKE) - -clean: - $(RM) $(OBJS) *.bak *~ - @$(CD) $(ESMSAPDIR) && $(MAKE) $@ - -veryclean: clean - @$(CD) $(ESMSAPDIR) && $(MAKE) $@ - @$(CD) $(ESMMSGDIR) && $(MAKE) $@ - $(RM) $(TARGET) - -%.o: %.c Makefile $(PROJDIR)/Makerules $(PROJDIR)/Makefile.inc - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnConnectivity.c b/openair-cn/NAS/EURECOM-NAS/src/esm/PdnConnectivity.c deleted file mode 100644 index 76552f12c33b771000dae3ec2a13a697d9b81949..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnConnectivity.c +++ /dev/null @@ -1,1513 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source PdnConnectivity.c - -Version 0.1 - -Date 2013/01/02 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the PDN connectivity ESM procedure executed by the - Non-Access Stratum. - - The PDN connectivity procedure is used by the UE to request - the setup of a default EPS bearer to a PDN. - - The procedure is used either to establish the 1st default - bearer by including the PDN CONNECTIVITY REQUEST message - into the initial attach message, or to establish subsequent - default bearers to additional PDNs in order to allow the UE - simultaneous access to multiple PDNs by sending the message - stand-alone. - -*****************************************************************************/ - -#include <stdlib.h> // malloc, free -#include <string.h> // memset, memcpy, memcmp -#include <ctype.h> // isprint - -#include "esm_proc.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "esmData.h" -#include "esm_cause.h" -#include "esm_pt.h" - -#ifdef NAS_MME -# include "mme_api.h" -#endif - -#include "emm_sap.h" - -#if defined(ENABLE_ITTI) -# include "assertions.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the PDN connectivity procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * PDN connection handlers - */ -static int _pdn_connectivity_create(int pid, const OctetString *apn, - esm_proc_pdn_type_t pdn_type, int is_emergency); -static int _pdn_connectivity_update(int pid, const OctetString *apn, - esm_proc_pdn_type_t pdn_type, const OctetString *pdn_addr, int esm_cause); -static int _pdn_connectivity_delete(int pid); - -static int _pdn_connectivity_set_pti(int pid, int pti); -static int _pdn_connectivity_find_apn(const OctetString *apn); -static int _pdn_connectivity_find_pdn(const OctetString *apn, - esm_proc_pdn_type_t pdn_type); - -/* - * Timer handlers - */ -static void *_pdn_connectivity_t3482_handler(void *); - -/* Maximum value of the PDN connectivity request retransmission counter */ -#define ESM_PDN_CONNECTIVITY_COUNTER_MAX 5 - -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the PDN connectivity procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * PDN connection handlers - */ -static int _pdn_connectivity_create(emm_data_context_t *ctx, - int pti, - const OctetString *apn, - esm_proc_pdn_type_t pdn_type, - const OctetString *pdn_addr, - int is_emergency); -int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid); - -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * PDN connectivity procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity() ** - ** ** - ** Description: Defines a new PDN connection for the specified Access ** - ** Point Name or undefines the PDN connection with the given ** - ** identifier ** - ** ** - ** Inputs: cid: PDN connection identifier ** - ** is_to_define: Indicates whether the PDN connection has ** - ** to be defined or undefined ** - ** pdn_type: PDN connection type (IPv4, IPv6, IPv4v6) ** - ** apn: Access Point logical Name to be used ** - ** is_emergency: TRUE if the PDN connection has to be esta- ** - ** blished for emergency bearer services ** - ** Others: None ** - ** ** - ** Outputs: pti: Procedure transaction identity assigned to ** - ** the new PDN connection or the released PDN ** - ** connection ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity(int cid, int is_to_define, - esm_proc_pdn_type_t pdn_type, - const OctetString *apn, int is_emergency, - unsigned int *pti) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - int pid = cid - 1; - - if (!is_to_define) { - LOG_TRACE(INFO, "ESM-PROC - Undefine PDN connection (cid=%d)", cid); - /* Delete the PDN connection entry */ - int pti = _pdn_connectivity_delete(pid); - - if (pti != ESM_PT_UNASSIGNED) { - /* Release the procedure transaction data */ - rc = esm_pt_release(pti); - } - - LOG_FUNC_RETURN(rc); - } else if (pti != NULL) { - LOG_TRACE(INFO, "ESM-PROC - Assign new procedure transaction identity " - "(cid=%d)", cid); - /* Assign new procedure transaction identity */ - *pti = esm_pt_assign(); - - if (*pti == ESM_PT_UNASSIGNED) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to assign new procedure " - "transaction identity"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Update the PDN connection data */ - rc = _pdn_connectivity_set_pti(pid, *pti); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to update PDN connection"); - } - - LOG_FUNC_RETURN (rc); - } - - LOG_TRACE(INFO,"ESM-PROC - Define new %s PDN connection to APN %s (cid=%d)", - (pdn_type == ESM_PDN_TYPE_IPV4)? "IPv4" : - (pdn_type == ESM_PDN_TYPE_IPV6)? "IPv6" : "IPv4v6", - apn->value, cid); - - if (is_emergency && _esm_data.emergency) { - /* The UE shall not request additional PDN connection for - * emergency bearer services */ - LOG_TRACE(WARNING, "ESM-PROC - PDN connection for emergency bearer " - "services is already active"); - LOG_FUNC_RETURN (RETURNerror); - } else if (pid < ESM_DATA_PDN_MAX) { - if ((pid == _esm_data.pdn[pid].pid) && (_esm_data.pdn[pid].is_active)) { - /* PDN connection with the specified identifier is active */ - LOG_TRACE(WARNING, "ESM-PROC - PDN connection is active"); - LOG_FUNC_RETURN (RETURNerror); - } - } else { - LOG_TRACE(WARNING, "ESM-PROC - PDN connection identifier is not valid"); - LOG_FUNC_RETURN (RETURNerror); - } - - if (apn && apn->length > 0) { - /* The UE requested subsequent connectivity to additionnal PDNs */ - int pid = _pdn_connectivity_find_apn(apn); - - if ( (pid >= 0) && _esm_data.pdn[pid].is_active ) { - /* An active PDN connection to this APN already exists */ - if ( (_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV4V6) && - (_esm_data.pdn[pid].data->type != pdn_type) ) { - /* The UE is requesting PDN connection for other IP version - * than the one already activated */ - if (!_esm_data.pdn[pid].data->addr_realloc) { - /* The network does not allow PDN connectivity using - * IPv4 and IPv6 address versions to the same APN */ - if (pdn_type != ESM_PDN_TYPE_IPV4V6) { - LOG_TRACE(WARNING, "ESM-PROC - %s PDN connectivity to " - "%s is not allowed by the network", - (pdn_type != ESM_PDN_TYPE_IPV4)? "IPv6" : - "IPv4", apn->value); - } else { - LOG_TRACE(WARNING, "ESM-PROC - %s PDN connection to %s " - "already exists", - (_esm_data.pdn[pid].data->type != - ESM_PDN_TYPE_IPV4)? "IPv6" : "IPv4", - apn->value); - } - - LOG_FUNC_RETURN (RETURNerror); - } - } else { - /* The UE is requesting PDN connection to this APN using the - * same IP version than the one already activated */ - LOG_TRACE(WARNING, "ESM-PROC - %s PDN connection to %s " - "already exists", - (_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV4)? - (_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV6)? - "IPv4v6" : "IPv6" : "IPv4", apn->value); - LOG_FUNC_RETURN (RETURNerror); - } - } - } - - /* - * New PDN context has to be defined to allow connectivity to an APN: - * The UE may attempt to attach to the network using the default APN, - * or request PDN connectivity to emergency bearer services. The UE - * may also subsequently request connectivity to additional PDNs if - * not already established, or may have been allowed to request PDN - * connectivity for other IP version than the one already activated - */ - rc = _pdn_connectivity_create(pid, apn, pdn_type, is_emergency); - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_request() ** - ** ** - ** Description: Initiates PDN connectivity procedure to request setup of ** - ** a default EPS bearer to a PDN. ** - ** ** - ** 3GPP TS 24.301, section 6.5.1.2 ** - ** The UE requests connectivity to an additional PDN by sen- ** - ** ding a PDN CONNECTIVITY REQUEST message to the MME, star- ** - ** ting timer T3482 and entering state PROCEDURE TRANSACTION ** - ** PENDING. ** - ** ** - ** Inputs: is_standalone: Indicates whether the PDN connectivity ** - ** procedure is initiated as part of the at- ** - ** tach procedure ** - ** pti: Procedure transaction identity ** - ** msg: Encoded PDN connectivity request message ** - ** to be sent ** - ** sent_by_ue: Not used - Always TRUE ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_request(int is_standalone, int pti, - OctetString *msg, int sent_by_ue) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "ESM-PROC - Initiate PDN connectivity (pti=%d)", pti); - - if (is_standalone) { - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = msg->length; - emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Start T3482 retransmission timer */ - rc = esm_pt_start_timer(pti, msg, T3482_DEFAULT_VALUE, - _pdn_connectivity_t3482_handler); - } - } - - if (rc != RETURNerror) { - /* Set the procedure transaction state to PENDING */ - rc = esm_pt_set_status(pti, ESM_PT_PENDING); - - if (rc != RETURNok) { - /* The procedure transaction was already in PENDING state */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already PENDING", pti); - } - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_accept() ** - ** ** - ** Description: Performs PDN connectivity procedure accepted by the net- ** - ** work. ** - ** ** - ** 3GPP TS 24.301, section 6.5.1.3 ** - ** The UE shall stop timer T3482 and enter the state PROCE- ** - ** DURE TRANSACTION INACTIVE. ** - ** ** - ** Inputs: pti: Identifies the UE requested PDN connecti- ** - ** vity procedure accepted by the network ** - ** pdn_type: PDN type value (IPv4, IPv6, IPv4v6) ** - ** pdn_addr: PDN address ** - ** apn: Access Point Name of the PDN connection ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: The identifier of the PDN connection when ** - ** successfully updated; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type, - const OctetString *pdn_addr, - const OctetString *apn, int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - int pid = RETURNerror; - char apn_first_char[4]; - - if (isprint(apn->value[0])) { - apn_first_char[0] = '\0'; - } else { - sprintf (apn_first_char, "%02X", apn->value[0]); - } - - LOG_TRACE(INFO, "ESM-PROC - PDN connectivity accepted by the network " - "(pti=%d) APN = %s\"%s\", IP address = %s", pti, apn_first_char, isprint(apn->value[0]) ? &apn->value[0] : &apn->value[1], - (pdn_type == ESM_PDN_TYPE_IPV4)? esm_data_get_ipv4_addr(pdn_addr) : - (pdn_type == ESM_PDN_TYPE_IPV6)? esm_data_get_ipv6_addr(pdn_addr) : - esm_data_get_ipv4v6_addr(pdn_addr)); - - /* Stop T3482 timer if running */ - (void) esm_pt_stop_timer(pti); - /* Set the procedure transaction state to INACTIVE */ - rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); - - if (rc != RETURNok) { - /* The procedure transaction was already in INACTIVE state - * as the request may have already been accepted; consider - * this request message with same PTI as a network re- - * transmission */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d network retransmission", pti); - *esm_cause = ESM_CAUSE_PTI_ALREADY_IN_USE; - } else { - /* XXX - 3GPP TS 24.301, section 6.5.1.3 and 7.3.1 - * The UE should ensure that the procedure transaction identity - * (PTI) assigned to this procedure is not released immediately. - * While the PTI value is not released, the UE regards any received - * ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST message with the same - * PTI value as a network retransmission. - * The way to achieve this is implementation dependent. - */ - - /* Check whether a PDN connection exists to this APN */ - pid = _pdn_connectivity_find_pdn(apn, pdn_type); - - if (pid < 0) { - /* No any PDN connection has been defined to establish connectivity - * to this APN */ - LOG_TRACE(WARNING, "ESM-PROC - PDN connection entry for " - "APN \"%s\" (type=%d) not found", apn->value, pdn_type); - *esm_cause = ESM_CAUSE_UNKNOWN_ACCESS_POINT_NAME; - LOG_FUNC_RETURN(RETURNerror); - } - - /* Update the PDN connection */ - rc = _pdn_connectivity_update(pid, apn, pdn_type, pdn_addr, *esm_cause); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to update PDN connection " - "(pid=%d)", pid); - *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED; - LOG_FUNC_RETURN(RETURNerror); - } - } - - LOG_FUNC_RETURN (pid); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_reject() ** - ** ** - ** Description: Performs PDN connectivity procedure not accepted by the ** - ** network. ** - ** ** - ** 3GPP TS 24.301, section 6.5.1.4 ** - ** Upon receipt of the PDN CONNECTIVITY REJECT message, the ** - ** UE shall stop timer T3482 and enter the state PROCEDURE ** - ** TRANSACTION INACTIVE. ** - ** ** - ** Inputs: pti: Identifies the UE requested PDN connecti- ** - ** vity procedure rejected by the network ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity rejected by " - "the network (pti=%d), ESM cause = %d", pti, *esm_cause); - - /* Stop T3482 timer if running */ - (void) esm_pt_stop_timer(pti); - /* Set the procedure transaction state to INACTIVE */ - rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); - - if (rc != RETURNok) { - /* The procedure transaction was already in INACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", pti); - *esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; - } else { - /* Release the procedure transaction identity */ - rc = esm_pt_release(pti); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); - *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED; - } - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_complete() ** - ** ** - ** Description: Terminates the PDN connectivity procedure upon receiving ** - ** indication from the EPS Mobility Management sublayer that ** - ** the ACTIVATE DEFAULT EPS BEARER CONTEXT ACCEPT message ** - ** has been successfully delivered to the MME. ** - ** ** - ** The UE releases the transaction identity assigned to this ** - ** PDN connectivity procedure. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_complete(void) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(INFO, "ESM-PROC - PDN connectivity complete"); - - /* Get the procedure transaction identity assigned to the PDN connection - * entry which is still pending in the inactive state */ - int pti = esm_pt_get_pending_pti(ESM_PT_INACTIVE); - - if (pti != ESM_PT_UNASSIGNED) { - /* Release the procedure transaction identity */ - rc = esm_pt_release(pti); - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_failure() ** - ** ** - ** Description: Performs PDN connectivity procedure upon receiving trans- ** - ** mission failure of ESM message indication from the EPS ** - ** Mobility Management sublayer ** - ** ** - ** The UE releases the transaction identity allocated to the ** - ** PDN connectivity procedure which is still pending in the ** - ** PROCEDURE TRANSACTION INACTIVE or PENDING state. ** - ** ** - ** Inputs: is_pending: TRUE if this PDN connectivity procedure ** - ** transaction is in the PENDING state ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_failure(int is_pending) -{ - LOG_FUNC_IN; - - int rc; - int pti; - - LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity failure in state %s", - (is_pending)? "PENDING" : "INACTIVE"); - - if (is_pending) { - /* Get the procedure transaction identity assigned to the pending PDN - * connection entry */ - pti = esm_pt_get_pending_pti(ESM_PT_PENDING); - - if (pti == ESM_PT_UNASSIGNED) { - LOG_TRACE(ERROR, "ESM-PROC - No procedure transaction is PENDING"); - return (RETURNerror); - } - - /* Set the procedure transaction state to INACTIVE */ - (void) esm_pt_set_status(pti, ESM_PT_INACTIVE); - } else { - /* Get the procedure transaction identity assigned to the PDN - * connection entry which is still pending in the inactive state */ - pti = esm_pt_get_pending_pti(ESM_PT_INACTIVE); - } - - /* Release the procedure transaction identity */ - rc = esm_pt_release(pti); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); - } - - LOG_FUNC_RETURN(rc); -} - -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * PDN connectivity procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_request() ** - ** ** - ** Description: Performs PDN connectivity procedure requested by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.5.1.3 ** - ** Upon receipt of the PDN CONNECTIVITY REQUEST message, the ** - ** MME checks if connectivity with the requested PDN can be ** - ** established. If no requested APN is provided the MME ** - ** shall use the default APN as the requested APN if the ** - ** request type is different from "emergency", or the APN ** - ** configured for emergency bearer services if the request ** - ** type is "emergency". ** - ** If connectivity with the requested PDN is accepted by the ** - ** network, the MME shall initiate the default EPS bearer ** - ** context activation procedure. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Identifies the PDN connectivity procedure ** - ** requested by the UE ** - ** request_type: Type of the PDN request ** - ** pdn_type: PDN type value (IPv4, IPv6, IPv4v6) ** - ** apn: Requested Access Point Name ** - ** Others: _esm_data ** - ** ** - ** Outputs: apn: Default Access Point Name ** - ** pdn_addr: Assigned IPv4 address and/or IPv6 suffix ** - ** esm_qos: EPS bearer level QoS parameters ** - ** esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: The identifier of the PDN connection if ** - ** successfully created; ** - ** RETURNerror otherwise. ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti, - esm_proc_pdn_request_t request_type, - OctetString *apn, - esm_proc_pdn_type_t pdn_type, - OctetString *pdn_addr, - esm_proc_qos_t *esm_qos, - int *esm_cause) -{ - int rc = RETURNerror; - int pid = RETURNerror; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-PROC - PDN connectivity requested by the UE " - "(ueid=%u, pti=%d) PDN type = %s, APN = %s pdn addr = %s", ctx->ueid, pti, - (pdn_type == ESM_PDN_TYPE_IPV4)? "IPv4" : - (pdn_type == ESM_PDN_TYPE_IPV6)? "IPv6" : "IPv4v6", - (apn) ? (char *)(apn->value) : "null", - (pdn_addr) ? (char *)(pdn_addr->value) : "null"); - -#if !defined(NAS_BUILT_IN_EPC) - - /* UE identifier sanity check */ - if (ctx->ueid >= ESM_DATA_NB_UE_MAX) { - LOG_TRACE(WARNING, "ESM-PROC - Number of connected UEs exceeded"); - LOG_FUNC_RETURN (RETURNerror); - } - -#endif - - /* - * Check network IP capabilities - */ - *esm_cause = ESM_CAUSE_SUCCESS; - LOG_TRACE(INFO, "ESM-PROC - _esm_data.conf.features %08x", _esm_data.conf.features); -#warning "Uncomment code about _esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6) later" -#if defined(ORIGINAL_CODE) - - switch (_esm_data.conf.features & (MME_API_IPV4 | MME_API_IPV6)) { - case (MME_API_IPV4 | MME_API_IPV6): - - /* The network supports both IPv4 and IPv6 connection */ - if ( (pdn_type == ESM_PDN_TYPE_IPV4V6) && - (_esm_data.conf.features & MME_API_SINGLE_ADDR_BEARERS) ) { - /* The network supports single IP version bearers only */ - *esm_cause = ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED; - } - - rc = RETURNok; - break; - - case MME_API_IPV6: - /* The network supports connection to IPv6 only */ - *esm_cause = ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; - - if (pdn_type != ESM_PDN_TYPE_IPV4) { - rc = RETURNok; - } - - break; - - case MME_API_IPV4: - /* The network supports connection to IPv4 only */ - *esm_cause = ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; - - if (pdn_type != ESM_PDN_TYPE_IPV6) { - rc = RETURNok; - } - - break; - - default: - LOG_TRACE(ERROR, - "ESM-PROC - _esm_data.conf.features incorrect value (no IPV4 or IPV6 ) %X", - _esm_data.conf.features); - } - -#else - rc = RETURNok; -#endif - - if (rc != RETURNerror) { - int is_emergency = (request_type == ESM_PDN_REQUEST_EMERGENCY); -#if defined(ORIGINAL_CODE) - mme_api_ip_version_t mme_pdn_index; - mme_api_qos_t qos; - - switch (pdn_type) { - case ESM_PDN_TYPE_IPV4: - mme_pdn_index = MME_API_IPV4_ADDR; - break; - - case ESM_PDN_TYPE_IPV6: - mme_pdn_index = MME_API_IPV6_ADDR; - break; - - case ESM_PDN_TYPE_IPV4V6: - default: - mme_pdn_index = MME_API_IPV4V6_ADDR; - break; - } - - /* Check if connectivity with the requested PDN can be established */ - rc = mme_api_subscribe(apn, mme_pdn_index, pdn_addr, is_emergency, &qos); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Connectivity to the requested PDN " - "cannot be established"); - *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED; - LOG_FUNC_RETURN (RETURNerror); - } - -#endif - - /* Create new PDN connection */ - pid = _pdn_connectivity_create(ctx, pti, apn, pdn_type, - pdn_addr, is_emergency); -#if defined(ORIGINAL_CODE) - - /* Setup ESM QoS parameters */ - if (esm_qos) { - esm_qos->gbrUL = qos.gbr[MME_API_UPLINK]; - esm_qos->gbrDL = qos.gbr[MME_API_DOWNLINK]; - esm_qos->mbrUL = qos.mbr[MME_API_UPLINK]; - esm_qos->mbrDL = qos.mbr[MME_API_DOWNLINK]; - esm_qos->qci = qos.qci; - } - -#endif - - if (pid < 0) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to create PDN connection"); - *esm_cause = ESM_CAUSE_INSUFFICIENT_RESOURCES; - LOG_FUNC_RETURN(RETURNerror); - } - } - - LOG_FUNC_RETURN(pid); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_reject() ** - ** ** - ** Description: Performs PDN connectivity procedure not accepted by the ** - ** network. ** - ** ** - ** 3GPP TS 24.301, section 6.5.1.4 ** - ** If connectivity with the requested PDN cannot be accepted ** - ** by the network, the MME shall send a PDN CONNECTIVITY RE- ** - ** JECT message to the UE. ** - ** ** - ** Inputs: is_standalone: Indicates whether the PDN connectivity ** - ** procedure was initiated as part of the at- ** - ** tach procedure ** - ** ueid: UE lower layer identifier ** - ** ebi: Not used ** - ** msg: Encoded PDN connectivity reject message to ** - ** be sent ** - ** ue_triggered: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_reject(int is_standalone, emm_data_context_t *ctx, - int ebi, OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity not accepted by the " - "network (ueid=%d)", ctx->ueid); - - if (is_standalone) { - emm_sap_t emm_sap; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ctx = ctx; - emm_sap.u.emm_esm.u.data.msg.length = msg->length; - emm_sap.u.emm_esm.u.data.msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - } - - /* If the PDN connectivity procedure initiated as part of the initial - * attach procedure has failed, an error is returned to notify EMM that - * the ESM sublayer did not accept UE requested PDN connectivity */ - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_connectivity_failure() ** - ** ** - ** Description: Performs PDN connectivity procedure upon receiving noti- ** - ** fication from the EPS Mobility Management sublayer that ** - ** EMM procedure that initiated PDN connectivity activation ** - ** locally failed. ** - ** ** - ** The MME releases the PDN connection entry allocated when ** - ** the PDN connectivity procedure was requested by the UE. ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pid: Identifier of the PDN connection to be ** - ** released ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_connectivity_failure(emm_data_context_t *ctx, int pid) -{ - int pti; - - LOG_FUNC_IN; - - LOG_TRACE(WARNING, "ESM-PROC - PDN connectivity failure (ueid=%u, pid=%d)", - ctx->ueid, pid); - - /* Delete the PDN connection entry */ - pti = _pdn_connectivity_delete(ctx, pid); - - if (pti != ESM_PT_UNASSIGNED) { - LOG_FUNC_RETURN (RETURNok); - } - - LOG_FUNC_RETURN (RETURNerror); -} -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - *--------------------------------------------------------------------------- - * Timer handlers - *--------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_t3482_handler() ** - ** ** - ** Description: T3482 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 6.5.1.5, case a ** - ** On the first expiry of the timer T3482, the UE shall re- ** - ** send the PDN CONNECTIVITY REQUEST and shall reset and re- ** - ** start timer T3482. This retransmission is repeated four ** - ** times, i.e. on the fifth expiry of timer T3482, the UE ** - ** shall abort the procedure, release the PTI allocated for ** - ** this invocation and enter the state PROCEDURE TRANSACTION ** - ** INACTIVE. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_pdn_connectivity_t3482_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - /* Get retransmission timer parameters data */ - esm_pt_timer_data_t *data = (esm_pt_timer_data_t *)(args); - - /* Increment the retransmission counter */ - data->count += 1; - - LOG_TRACE(WARNING, "ESM-PROC - T3482 timer expired (pti=%d), " - "retransmission counter = %d", data->pti, data->count); - - if (data->count < ESM_PDN_CONNECTIVITY_COUNTER_MAX) { - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notify EMM that the PDN connectivity request message - * has to be sent again - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = data->msg.length; - emm_esm->msg.value = data->msg.value; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Restart the timer T3482 */ - rc = esm_pt_start_timer(data->pti, &data->msg, T3482_DEFAULT_VALUE, - _pdn_connectivity_t3482_handler); - } - } else { - /* Set the procedure transaction state to INACTIVE */ - rc = esm_pt_set_status(data->pti, ESM_PT_INACTIVE); - - if (rc != RETURNok) { - /* The procedure transaction was already in INACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", - data->pti); - } else { - /* Release the transaction identity assigned to this procedure */ - rc = esm_pt_release(data->pti); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", - data->pti); - } - } - } - - LOG_FUNC_RETURN(NULL); -} - -/* - *--------------------------------------------------------------------------- - * PDN connection handlers - *--------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_create() ** - ** ** - ** Description: Creates a new PDN connection entry or updates existing ** - ** non-active PDN connection entry ** - ** ** - ** Inputs: pid: Identifier of the PDN connection entry ** - ** apn: Access Point Name of the PDN connection ** - ** pdn_type: PDN type (IPv4, IPv6, IPv4v6) ** - ** is_emergency: TRUE if the PDN connection has to be esta- ** - ** blished for emergency bearer services ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -static int _pdn_connectivity_create(int pid, const OctetString *apn, - esm_proc_pdn_type_t pdn_type, - int is_emergency) -{ - esm_pdn_t *pdn = NULL; - - LOG_TRACE(INFO, "ESM-PROC - Create new PDN connection (pid=%d)", pid); - - if (pid >= ESM_DATA_PDN_MAX) { - return (RETURNerror); - } else if (_esm_data.pdn[pid].is_active) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active"); - return (RETURNerror); - } - - if (_esm_data.pdn[pid].data != NULL) { - /* Update existing non-active PDN connection */ - pdn = _esm_data.pdn[pid].data; - } else { - /* Create new PDN connection */ - pdn = (esm_pdn_t *)malloc(sizeof(esm_pdn_t)); - - if (pdn == NULL) { - LOG_TRACE(WARNING, "ESM-PROC - " - "Failed to create new PDN connection"); - return (RETURNerror); - } - - memset(pdn, 0, sizeof(esm_pdn_t)); - /* Increment the number of PDN connections */ - _esm_data.n_pdns += 1; - /* Set the PDN connection identifier */ - _esm_data.pdn[pid].pid = pid; - /* Reset the PDN connection active indicator */ - _esm_data.pdn[pid].is_active = FALSE; - /* Setup the PDN connection data */ - _esm_data.pdn[pid].data = pdn; - } - - /* Update the PDN connection data */ - pdn->is_emergency = is_emergency; - - if ( apn && (apn->length > 0) ) { - if (pdn->apn.length > 0) { - free(pdn->apn.value); - pdn->apn.length = 0; - } - - pdn->apn.value = (uint8_t *)malloc(apn->length + 1); - - if (pdn->apn.value) { - pdn->apn.length = apn->length; - memcpy(pdn->apn.value, apn->value, apn->length); - pdn->apn.value[pdn->apn.length] = '\0'; - } - } - - pdn->type = pdn_type; - pdn->addr_realloc = FALSE; - - return (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_update() ** - ** ** - ** Description: Updates PDN connection entry with the given identifier ** - ** ** - ** Inputs: pid: Identifier of the PDN connection entry ** - ** pdn_type: PDN type (IPv4, IPv6, IPv4v6) ** - ** pdn_addr: Network allocated PDN IPv4 or IPv6 address ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -static int _pdn_connectivity_update(int pid, const OctetString *apn, - esm_proc_pdn_type_t pdn_type, - const OctetString *pdn_addr, - int esm_cause) -{ - LOG_TRACE(INFO, "ESM-PROC - Update PDN connection (pid=%d)", pid); - - if (pid >= ESM_DATA_PDN_MAX) { - return (RETURNerror); - } else if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier is not valid"); - return (RETURNerror); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection has not been allocated"); - return (RETURNerror); - } else if (_esm_data.pdn[pid].is_active) { - LOG_TRACE(WARNING, "ESM-PROC - Active %s PDN connection to %s already " - "exists", (_esm_data.pdn[pid].data->type != ESM_PDN_TYPE_IPV4)? - "IPv6" : "IPv4", _esm_data.pdn[pid].data->apn.value); - return (RETURNerror); - } - - /* Get the PDN connection */ - esm_pdn_t *pdn = _esm_data.pdn[pid].data; - - /* Setup the Access Point Name value */ - if ( apn && (apn->length > 0) ) { - if (pdn->apn.length > 0) { - free(pdn->apn.value); - pdn->apn.length = 0; - } - - pdn->apn.value = (uint8_t *)malloc(apn->length + 1); - - if (pdn->apn.value) { - pdn->apn.length = apn->length; - memcpy(pdn->apn.value, apn->value, apn->length); - pdn->apn.value[pdn->apn.length] = '\0'; - } - } - - /* Setup the IP address allocated by the network */ - if ( pdn_addr && (pdn_addr->length > 0) ) { - int length = ((pdn_addr->length < ESM_DATA_IP_ADDRESS_SIZE) ? - pdn_addr->length : ESM_DATA_IP_ADDRESS_SIZE); - memcpy(pdn->ip_addr, pdn_addr->value, length); - pdn->type = pdn_type; - } - - /* - * 3GPP TS 24.301, section 6.2.2 - * Update the address re-allocation indicator - */ - if (esm_cause == ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED) { - /* The UE requested IPv4 or IPv6 address and the network allows - * single addressing per bearer: - * The UE should subsequently request another PDN connection for - * the other IP version using the UE requested PDN connectivity - * procedure to the same APN with a single address PDN type - * (IPv4 or IPv6) other than the one already activated */ - pdn->addr_realloc = TRUE; - } else if ( (esm_cause == ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED) || - (esm_cause == ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED) ) { - /* The UE requested IPv4 or IPv6 address and the network allows - * IPv4 or IPv6 PDN address only: - * The UE shall not subsequently initiate another UE requested - * PDN connectivity procedure to the same APN to obtain a PDN - * type different from the one allowed by the network */ - pdn->addr_realloc = FALSE; - } else if (pdn_type != ESM_PDN_TYPE_IPV4V6) { - pdn->addr_realloc = TRUE; - } - - return (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_delete() ** - ** ** - ** Description: Deletes the PDN connection entry with given identifier ** - ** ** - ** Inputs: pid: Identifier of the PDN connection to be ** - ** released ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The identity of the procedure transaction ** - ** assigned to the PDN connection when suc- ** - ** cessfully released; ** - ** UNASSIGNED value otherwise. ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -static int _pdn_connectivity_delete(int pid) -{ - int pti = ESM_PT_UNASSIGNED; - - if (pid < ESM_DATA_PDN_MAX) { - if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(ERROR, - "ESM-PROC - PDN connection identifier is not valid"); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, - "ESM-PROC - PDN connection has not been allocated"); - } else if (_esm_data.pdn[pid].is_active) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active"); - } else { - /* Get the identity of the procedure transaction that created - * the PDN connection */ - pti = _esm_data.pdn[pid].data->pti; - } - } - - if (pti != ESM_PT_UNASSIGNED) { - /* Decrement the number of PDN connections */ - _esm_data.n_pdns -= 1; - /* Set the PDN connection as available */ - _esm_data.pdn[pid].pid = -1; - - /* Release allocated PDN connection data */ - if (_esm_data.pdn[pid].data->apn.length > 0) { - free(_esm_data.pdn[pid].data->apn.value); - } - - free(_esm_data.pdn[pid].data); - _esm_data.pdn[pid].data = NULL; - LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d released", pid); - } - - /* Return the procedure transaction identity */ - return (pti); -} - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_set_pti() ** - ** ** - ** Description: Update the procedure transaction identity assigned to the ** - ** PDN connection entry with the given identifier ** - ** ** - ** Inputs: pid: PDN connection identifier ** - ** pti: Procedure transaction identity ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -static int _pdn_connectivity_set_pti(int pid, int pti) -{ - if (pid < ESM_DATA_PDN_MAX) { - if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(ERROR, - "ESM-PROC - PDN connection identifier is not valid"); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, - "ESM-PROC - PDN connection has not been allocated"); - } else if (_esm_data.pdn[pid].is_active) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active"); - } else { - /* Update the identity of the procedure transaction assigned to - * the PDN connection */ - _esm_data.pdn[pid].data->pti = pti; - return (RETURNok); - } - } - - return (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_find_apn() ** - ** ** - ** Description: Search the list of PDN connections for an entry defined ** - ** for the specified APN ** - ** ** - ** Inputs: apn: Access Point Name of the PDN connection ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The identifier of the PDN connection if ** - ** found in the list; -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _pdn_connectivity_find_apn(const OctetString *apn) -{ - int i; - - for (i = 0; i < ESM_DATA_PDN_MAX; i++) { - if ( (_esm_data.pdn[i].pid != -1) && _esm_data.pdn[i].data ) { - if (_esm_data.pdn[i].data->apn.length != apn->length) { - continue; - } - - if (memcmp(_esm_data.pdn[i].data->apn.value, - apn->value, apn->length) != 0) { - continue; - } - - /* PDN entry found */ - break; - } - } - - /* Return the identifier of the PDN connection */ - return (_esm_data.pdn[i].pid); -} - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_find_pdn() ** - ** ** - ** Description: Search the list of PDN connections for an entry defined ** - ** for the specified APN with the same PDN type ** - ** ** - ** Inputs: apn: Access Point Name of the PDN connection ** - ** pdn_type: PDN address type ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The identifier of the PDN connection if ** - ** found in the list; -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _pdn_connectivity_find_pdn(const OctetString *apn, - const esm_proc_pdn_type_t pdn_type) -{ - int i; - - for (i = 0; i < ESM_DATA_PDN_MAX; i++) { - if ( (_esm_data.pdn[i].pid != -1) && _esm_data.pdn[i].data ) { - /* PDN connection established during initial network attachment */ - if (_esm_data.pdn[i].data->apn.length == 0) { - break; - } - - /* Subsequent PDN connection established for the specified APN */ - if (_esm_data.pdn[i].data->apn.length != apn->length) { - continue; - } - - if (memcmp(_esm_data.pdn[i].data->apn.value, - apn->value, apn->length) != 0) { - continue; - } - - if (_esm_data.pdn[i].data->type == ESM_PDN_TYPE_IPV4V6) { - break; - } - - if (_esm_data.pdn[i].data->type == pdn_type) { - break; - } - } - } - - /* Return the identifier of the PDN connection */ - return (_esm_data.pdn[i].pid); -} -#endif // NAS_UE - -#ifdef NAS_MME -/* - *--------------------------------------------------------------------------- - * PDN connection handlers - *--------------------------------------------------------------------------- - */ -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_create() ** - ** ** - ** Description: Creates a new PDN connection entry for the specified UE ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** ctx: UE context ** - ** pti: Procedure transaction identity ** - ** apn: Access Point Name of the PDN connection ** - ** pdn_type: PDN type (IPv4, IPv6, IPv4v6) ** - ** pdn_addr: Network allocated PDN IPv4 or IPv6 address ** - ** is_emergency: TRUE if the PDN connection has to be esta- ** - ** blished for emergency bearer services ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The identifier of the PDN connection if ** - ** successfully created; -1 otherwise. ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -static int _pdn_connectivity_create(emm_data_context_t *ctx, - int pti, - const OctetString *apn, - esm_proc_pdn_type_t pdn_type, - const OctetString *pdn_addr, - int is_emergency) -{ - int pid = ESM_DATA_PDN_MAX; - - LOG_TRACE(INFO, "ESM-PROC - Create new PDN connection " - "(pti=%d) APN = %s, IP address = %s (ueid=%u)", pti, apn->value, - (pdn_type == ESM_PDN_TYPE_IPV4)? esm_data_get_ipv4_addr(pdn_addr) : - (pdn_type == ESM_PDN_TYPE_IPV6)? esm_data_get_ipv6_addr(pdn_addr) : - esm_data_get_ipv4v6_addr(pdn_addr), ctx->ueid); - - /* Search for an available PDN connection entry */ - for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) { - if (ctx->esm_data_ctx.pdn[pid].data != NULL) { - continue; - } - - break; - } - - if (pid < ESM_DATA_PDN_MAX) { - /* Create new PDN connection */ - esm_pdn_t *pdn = (esm_pdn_t *)malloc(sizeof(esm_pdn_t)); - - if (pdn != NULL) { - memset(pdn, 0, sizeof(esm_pdn_t)); - /* Increment the number of PDN connections */ - ctx->esm_data_ctx.n_pdns += 1; - /* Set the PDN connection identifier */ - ctx->esm_data_ctx.pdn[pid].pid = pid; - /* Reset the PDN connection active indicator */ - ctx->esm_data_ctx.pdn[pid].is_active = FALSE; - /* Setup the PDN connection data */ - ctx->esm_data_ctx.pdn[pid].data = pdn; - - /* Set the procedure transaction identity */ - pdn->pti = pti; - /* Set the emergency bearer services indicator */ - pdn->is_emergency = is_emergency; - - /* Setup the Access Point Name */ - if ( apn && (apn->length > 0) ) { - pdn->apn.value = (uint8_t *)malloc(apn->length + 1); - - if (pdn->apn.value) { - pdn->apn.length = apn->length; - memcpy(pdn->apn.value, apn->value, apn->length); - pdn->apn.value[pdn->apn.length] = '\0'; - } - } - - /* Setup the IP address allocated by the network */ - if ( pdn_addr && (pdn_addr->length > 0) ) { - int length = - ((pdn_addr->length < ESM_DATA_IP_ADDRESS_SIZE) ? - pdn_addr->length : ESM_DATA_IP_ADDRESS_SIZE); - memcpy(pdn->ip_addr, pdn_addr->value, length); - pdn->type = pdn_type; - } - - /* Return the identifier of the new PDN connection */ - return (ctx->esm_data_ctx.pdn[pid].pid); - } - - LOG_TRACE(WARNING, "ESM-PROC - Failed to create new PDN connection " - "(pid=%d)", pid); - } - - return (-1); -} - -/**************************************************************************** - ** ** - ** Name: _pdn_connectivity_delete() ** - ** ** - ** Description: Deletes PDN connection to the specified UE associated to ** - ** PDN connection entry with given identifier ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pid: Identifier of the PDN connection to be ** - ** released ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The identity of the procedure transaction ** - ** assigned to the PDN connection when suc- ** - ** cessfully released; ** - ** UNASSIGNED value otherwise. ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid) -{ - int pti = ESM_PT_UNASSIGNED; - - if (ctx == NULL) { - return pti; - } - - if (pid < ESM_DATA_PDN_MAX) { - if (pid != ctx->esm_data_ctx.pdn[pid].pid) { - LOG_TRACE(ERROR, - "ESM-PROC - PDN connection identifier is not valid"); - } else if (ctx->esm_data_ctx.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, - "ESM-PROC - PDN connection has not been allocated"); - } else if (ctx->esm_data_ctx.pdn[pid].is_active) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection is active"); - } else { - /* Get the identity of the procedure transaction that created - * the PDN connection */ - pti = ctx->esm_data_ctx.pdn[pid].data->pti; - } - } - - if (pti != ESM_PT_UNASSIGNED) { - /* Decrement the number of PDN connections */ - ctx->esm_data_ctx.n_pdns -= 1; - /* Set the PDN connection as available */ - ctx->esm_data_ctx.pdn[pid].pid = -1; - - /* Release allocated PDN connection data */ - if (ctx->esm_data_ctx.pdn[pid].data->apn.length > 0) { - free(ctx->esm_data_ctx.pdn[pid].data->apn.value); - } - - free(ctx->esm_data_ctx.pdn[pid].data); - ctx->esm_data_ctx.pdn[pid].data = NULL; - LOG_TRACE(WARNING, "ESM-PROC - PDN connection %d released", pid); - } - - /* Return the procedure transaction identity */ - return (pti); -} - -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnDisconnect.c b/openair-cn/NAS/EURECOM-NAS/src/esm/PdnDisconnect.c deleted file mode 100644 index 6fb091ae43af7c340fc9af17f7cb4c2bcde54b0d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/PdnDisconnect.c +++ /dev/null @@ -1,732 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source PdnDisconnect.c - -Version 0.1 - -Date 2013/05/15 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the PDN disconnect ESM procedure executed by the - Non-Access Stratum. - - The PDN disconnect procedure is used by the UE to request - disconnection from one PDN. - - All EPS bearer contexts established towards this PDN, inclu- - ding the default EPS bearer context, are released. - -*****************************************************************************/ - -#include "esm_proc.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "esmData.h" -#include "esm_cause.h" -#include "esm_pt.h" - -#ifdef NAS_UE -#include "esm_sap.h" -#endif - -#include "emm_sap.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -#ifdef NAS_MME -extern int _pdn_connectivity_delete(emm_data_context_t *ctx, int pid); -#endif - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the PDN disconnect procedure in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * PDN disconnection handlers - */ -static int _pdn_disconnect_get_default_ebi(int pti); - -/* - * Timer handlers - */ -static void *_pdn_disconnect_t3492_handler(void *); - -/* Maximum value of the PDN disconnect request retransmission counter */ -#define ESM_PDN_DISCONNECT_COUNTER_MAX 5 - -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Internal data handled by the PDN disconnect procedure in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * PDN disconnection handlers - */ -static int _pdn_disconnect_get_pid(esm_data_context_t *ctx, int pti); - -#endif // NAS_MME - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * PDN disconnect procedure executed by the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_disconnect() ** - ** ** - ** Description: Return the procedure transaction identity assigned to the ** - ** PDN connection and the EPS bearer identity of the default ** - ** bearer associated to the PDN context with specified iden- ** - ** tifier ** - ** ** - ** Inputs: cid: PDN context identifier ** - ** Others: _esm_data ** - ** ** - ** Outputs: pti: Procedure transaction identity assigned to ** - ** the PDN connection to be released ** - ** ebi: EPS bearer identity of the default bearer ** - ** associated to the specified PDN context ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - int pid = cid - 1; - - if (pid < ESM_DATA_PDN_MAX) { - if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(WARNING, "ESM-PROC - PDN connection identifier %d is " - "not valid", pid); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been " - "allocated", pid); - } else if (!_esm_data.pdn[pid].is_active) { - LOG_TRACE(WARNING, "ESM-PROC - PDN connection is not active"); - } else { - /* Get the procedure transaction identity assigned to the PDN - * connection to be released */ - *pti = _esm_data.pdn[pid].data->pti; - /* Get the EPS bearer identity of the default bearer associated - * with the PDN to disconnect from */ - *ebi = _esm_data.pdn[pid].data->bearer[0]->ebi; - rc = RETURNok; - } - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_disconnect_request() ** - ** ** - ** Description: Initiates PDN disconnection procedure in order to request ** - ** disconnection from a PDN. ** - ** ** - ** 3GPP TS 24.301, section 6.5.2.2 ** - ** The UE requests PDN disconnection from a PDN by sending a ** - ** PDN DISCONNECT REQUEST message to the MME, starting timer ** - ** T3492 and entering state PROCEDURE TRANSACTION PENDING. ** - ** ** - ** Inputs: is_standalone: Should be always TRUE ** - ** pti: Procedure transaction identity ** - ** msg: Encoded PDN disconnect request message to ** - ** be sent ** - ** sent_by_ue: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_disconnect_request(int is_standalone, int pti, - OctetString *msg, int sent_by_ue) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - LOG_TRACE(INFO, "ESM-PROC - Initiate PDN disconnection (pti=%d)", pti); - - if (is_standalone) { - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = msg->length; - emm_esm->msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Start T3482 retransmission timer */ - rc = esm_pt_start_timer(pti, msg, T3492_DEFAULT_VALUE, - _pdn_disconnect_t3492_handler); - } - } - - if (rc != RETURNerror) { - /* Set the procedure transaction state to PENDING */ - rc = esm_pt_set_status(pti, ESM_PT_PENDING); - - if (rc != RETURNok) { - /* The procedure transaction was already in PENDING state */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already PENDING", pti); - } - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_disconnect_accept() ** - ** ** - ** Description: Performs PDN disconnection procedure accepted by the net- ** - ** work. ** - ** ** - ** 3GPP TS 24.301, section 6.5.2.3 ** - ** The shall stop timer T3492 and enter the state PROCEDURE ** - ** TRANSACTION INACTIVE. ** - ** ** - ** Inputs: pti: Identifies the UE requested PDN disconnect ** - ** procedure accepted by the network ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: The identifier of the PDN context to de- ** - ** activate when successfully found; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-PROC - PDN disconnection accepted by the network " - "(pti=%d)", pti); - - /* Stop T3492 timer if running */ - (void) esm_pt_stop_timer(pti); - /* Set the procedure transaction state to INACTIVE */ - int rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); - - if (rc != RETURNok) { - /* The procedure transaction was already in INACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", pti); - *esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; - } else { - /* Immediately release the transaction identity assigned to this - * procedure */ - rc = esm_pt_release(pti); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_disconnect_reject() ** - ** ** - ** Description: Performs PDN disconnection procedure not accepted by the ** - ** network. ** - ** ** - ** 3GPP TS 24.301, section 6.5.2.4 ** - ** Upon receipt of the PDN DISCONNECT REJECT message, the UE ** - ** shall stop timer T3492 and enter the state PROCEDURE ** - ** TRANSACTION INACTIVE and abort the PDN disconnection pro- ** - ** cedure. ** - ** ** - ** Inputs: pti: Identifies the UE requested PDN disconnec- ** - ** tion procedure rejected by the network ** - ** Others: None ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause) -{ - LOG_FUNC_IN; - - int rc; - - LOG_TRACE(WARNING, "ESM-PROC - PDN disconnection rejected by the network " - "(pti=%d), ESM cause = %d", pti, *esm_cause); - - /* Stop T3492 timer if running */ - (void) esm_pt_stop_timer(pti); - /* Set the procedure transaction state to INACTIVE */ - rc = esm_pt_set_status(pti, ESM_PT_INACTIVE); - - if (rc != RETURNok) { - /* The procedure transaction was already in INACTIVE state - * as the request may have already been rejected */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", pti); - *esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE; - } else { - /* Release the transaction identity assigned to this procedure */ - rc = esm_pt_release(pti); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", pti); - *esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED; - } else if (*esm_cause != ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED) { - /* Get the identity of the default EPS bearer context allocated to - * the PDN connection entry assigned to this procedure transaction */ - int ebi = _pdn_disconnect_get_default_ebi(pti); - - if (ebi < 0) { - LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found"); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (RETURNerror); - } - - /* - * Notify ESM that all EPS bearer contexts to this PDN have to be - * locally deactivated - */ - esm_sap_t esm_sap; - esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; - esm_sap.is_standalone = TRUE; - esm_sap.recv = NULL; - esm_sap.send.length = 0; - esm_sap.data.eps_bearer_context_deactivate.ebi = ebi; - rc = esm_sap_send(&esm_sap); - - if (rc != RETURNok) { - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } - } - } - - LOG_FUNC_RETURN(rc); -} - -#endif // NAS_UE - - -/* - * -------------------------------------------------------------------------- - * PDN disconnect procedure executed by the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_disconnect_request() ** - ** ** - ** Description: Performs PDN disconnect procedure requested by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.5.2.3 ** - ** Upon receipt of the PDN DISCONNECT REQUEST message, if it ** - ** is accepted by the network, the MME shall initiate the ** - ** bearer context deactivation procedure. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** pti: Identifies the PDN disconnect procedure ** - ** requested by the UE ** - ** Others: _esm_data ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: The identifier of the PDN connection to be ** - ** released, if it exists; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_disconnect_request(emm_data_context_t *ctx, int pti, int *esm_cause) -{ - int pid = RETURNerror; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-PROC - PDN disconnect requested by the UE " - "(ueid=%d, pti=%d)", ctx->ueid, pti); - - /* Get UE's ESM context */ - if (ctx->esm_data_ctx.n_pdns > 1) { - /* Get the identifier of the PDN connection entry assigned to the - * procedure transaction identity */ - pid = _pdn_disconnect_get_pid(&ctx->esm_data_ctx, pti); - - if (pid < 0) { - LOG_TRACE(ERROR, "ESM-PROC - No PDN connection found (pti=%d)", - pti); - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (RETURNerror); - } - } else { - /* Attempt to disconnect from the last PDN disconnection - * is not allowed */ - *esm_cause = ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED; - } - - LOG_FUNC_RETURN(pid); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_disconnect_accept() ** - ** ** - ** Description: Performs PDN disconnect procedure accepted by the UE. ** - ** ** - ** 3GPP TS 24.301, section 6.5.2.3 ** - ** On reception of DEACTIVATE EPS BEARER CONTEXT ACCEPT mes- ** - ** sage from the UE, the MME releases all the resources re- ** - ** served for the PDN in the network. ** - ** ** - ** Inputs: ueid: UE lower layer identifier ** - ** pid: Identifier of the PDN connection to be ** - ** released ** - ** Others: _esm_data ** - ** ** - ** Outputs: esm_cause: Cause code returned upon ESM procedure ** - ** failure ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_disconnect_accept(emm_data_context_t *ctx, int pid, int *esm_cause) -{ - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-PROC - PDN disconnect accepted by the UE " - "(ueid=%d, pid=%d)", ctx->ueid, pid); - - /* Release the connectivity with the requested PDN */ - int rc = mme_api_unsubscribe(NULL); - - if (rc != RETURNerror) { - /* Delete the PDN connection entry */ - int pti = _pdn_connectivity_delete(ctx, pid); - - if (pti != ESM_PT_UNASSIGNED) { - LOG_FUNC_RETURN (RETURNok); - } - } - - *esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: esm_proc_pdn_disconnect_reject() ** - ** ** - ** Description: Performs PDN disconnect procedure not accepted by the ** - ** network. ** - ** ** - ** 3GPP TS 24.301, section 6.5.2.4 ** - ** Upon receipt of the PDN DISCONNECT REQUEST message, if it ** - ** is not accepted by the network, the MME shall send a PDN ** - ** DISCONNECT REJECT message to the UE. ** - ** ** - ** Inputs: is_standalone: Not used - Always TRUE ** - ** ueid: UE lower layer identifier ** - ** ebi: Not used ** - ** msg: Encoded PDN disconnect reject message to ** - ** be sent ** - ** ue_triggered: Not used ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_proc_pdn_disconnect_reject(int is_standalone, emm_data_context_t *ctx, - int ebi, OctetString *msg, int ue_triggered) -{ - LOG_FUNC_IN; - - int rc; - emm_sap_t emm_sap; - - LOG_TRACE(WARNING, "ESM-PROC - PDN disconnect not accepted by the network " - "(ueid=%d)", ctx->ueid); - - /* - * Notity EMM that ESM PDU has to be forwarded to lower layers - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = ctx->ueid; - emm_sap.u.emm_esm.ctx = ctx; - emm_sap.u.emm_esm.u.data.msg.length = msg->length; - emm_sap.u.emm_esm.u.data.msg.value = msg->value; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN(rc); -} -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Timer handlers - * -------------------------------------------------------------------------- - */ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _pdn_disconnect_t3492_handler() ** - ** ** - ** Description: T3492 timeout handler ** - ** ** - ** 3GPP TS 24.301, section 6.5.2.5, case a ** - ** On the first expiry of the timer T3492, the UE shall re- ** - ** send the PDN DISCONNECT REQUEST and shall reset and re- ** - ** start timer T3492. This retransmission is repeated four ** - ** times, i.e. on the fifth expiry of timer T3492, the UE ** - ** shall abort the procedure, deactivate all EPS bearer con- ** - ** texts for this PDN connection locally, release the PTI ** - ** allocated for this invocation and enter the state PROCE- ** - ** DURE TRANSACTION INACTIVE. ** - ** ** - ** Inputs: args: handler parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void *_pdn_disconnect_t3492_handler(void *args) -{ - LOG_FUNC_IN; - - int rc; - - /* Get retransmission timer parameters data */ - esm_pt_timer_data_t *data = (esm_pt_timer_data_t *)(args); - - /* Increment the retransmission counter */ - data->count += 1; - - LOG_TRACE(WARNING, "ESM-PROC - T3492 timer expired (pti=%d), " - "retransmission counter = %d", data->pti, data->count); - - if (data->count < ESM_PDN_DISCONNECT_COUNTER_MAX) { - emm_sap_t emm_sap; - emm_esm_data_t *emm_esm = &emm_sap.u.emm_esm.u.data; - /* - * Notify EMM that the PDN connectivity request message - * has to be sent again - */ - emm_sap.primitive = EMMESM_UNITDATA_REQ; - emm_sap.u.emm_esm.ueid = 0; - emm_esm->msg.length = data->msg.length; - emm_esm->msg.value = data->msg.value; - rc = emm_sap_send(&emm_sap); - - if (rc != RETURNerror) { - /* Restart the timer T3492 */ - rc = esm_pt_start_timer(data->pti, &data->msg, T3492_DEFAULT_VALUE, - _pdn_disconnect_t3492_handler); - } - } else { - /* Set the procedure transaction state to INACTIVE */ - rc = esm_pt_set_status(data->pti, ESM_PT_INACTIVE); - - if (rc != RETURNok) { - /* The procedure transaction was already in INACTIVE state */ - LOG_TRACE(WARNING, "ESM-PROC - PTI %d was already INACTIVE", - data->pti); - } else { - /* Release the transaction identity assigned to this procedure */ - rc = esm_pt_release(data->pti); - - if (rc != RETURNok) { - LOG_TRACE(WARNING, "ESM-PROC - Failed to release PTI %d", - data->pti); - } else { - /* Get the identity of the default EPS bearer context - * allocated to the PDN connection entry assigned to - * this procedure transaction */ - int ebi = _pdn_disconnect_get_default_ebi(data->pti); - - if (ebi < 0) { - LOG_TRACE(ERROR, "ESM-PROC - No default EPS bearer found"); - LOG_FUNC_RETURN (NULL); - } - - /* - * Notify ESM that all EPS bearer contexts to this PDN have - * to be locally deactivated - */ - esm_sap_t esm_sap; - esm_sap.primitive = ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ; - esm_sap.is_standalone = TRUE; - esm_sap.recv = NULL; - esm_sap.send.length = 0; - esm_sap.data.eps_bearer_context_deactivate.ebi = ebi; - rc = esm_sap_send(&esm_sap); - } - } - } - - LOG_FUNC_RETURN(NULL); -} -#endif // NAS_UE - -/* - *--------------------------------------------------------------------------- - * PDN disconnection handlers - *--------------------------------------------------------------------------- - */ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _pdn_disconnect_get_default_ebi() ** - ** ** - ** Description: Returns the EPS bearer identity of the default EPS bearer ** - ** context allocated to the PDN connection to which the gi- ** - ** ven procedure transaction identity has been assigned ** - ** ** - ** Inputs: pti: The procedure transaction identity ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The EPS bearer identity of the default EPS ** - ** bearer context, if it exists; -1 otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _pdn_disconnect_get_default_ebi(int pti) -{ - int ebi = -1; - int i; - - for (i = 0; i < ESM_DATA_PDN_MAX; i++) { - if ( (_esm_data.pdn[i].pid != -1) && _esm_data.pdn[i].data ) { - if (_esm_data.pdn[i].data->pti != pti) { - continue; - } - - /* PDN entry found */ - if (_esm_data.pdn[i].data->bearer[0] != NULL) { - /* Get the EPS bearer identity of the default EPS bearer - * context associated to the PDN connection */ - ebi = _esm_data.pdn[i].data->bearer[0]->ebi; - } - - break; - } - } - - return (ebi); -} -#endif // NAS_UE - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: _pdn_disconnect_get_pid() ** - ** ** - ** Description: Returns the identifier of the PDN connection to which the ** - ** given procedure transaction identity has been assigned ** - ** to establish connectivity to the specified UE ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: The procedure transaction identity ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The identifier of the PDN connection if ** - ** found in the list; -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _pdn_disconnect_get_pid(esm_data_context_t *ctx, int pti) -{ - int i = ESM_DATA_PDN_MAX; - - if (ctx != NULL) { - for (i = 0; i < ESM_DATA_PDN_MAX; i++) { - if ( (ctx->pdn[i].pid != -1) && - (ctx->pdn[i].data != NULL) ) { - if (ctx->pdn[i].data->pti != pti) { - continue; - } - - /* PDN entry found */ - break; - } - } - } - - /* Return the identifier of the PDN connection */ - return (ctx->pdn[i].pid); -} -#endif // NAS_MME diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esmData.h b/openair-cn/NAS/EURECOM-NAS/src/esm/esmData.h deleted file mode 100644 index 1e5b9cfc2ca37d5dc9a903600721f39821d66270..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esmData.h +++ /dev/null @@ -1,291 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esmData.h - -Version 0.1 - -Date 2012/12/04 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines internal private data handled by EPS Session - Management sublayer. - -*****************************************************************************/ -#include <stdio.h> // sprintf - -#include "networkDef.h" -#include "OctetString.h" -#include "EpsBearerIdentity.h" - -#ifdef NAS_MME -#include "mme_api.h" -#endif - -#if defined(NAS_BUILT_IN_EPC) -# include "tree.h" -#endif - -#ifndef __ESMDATA_H__ -#define __ESMDATA_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Total number of active EPS bearers */ -#define ESM_DATA_EPS_BEARER_TOTAL 11 - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Minimal and maximal value of an EPS bearer identity: - * The EPS Bearer Identity (EBI) identifies a message flow - */ -#define ESM_EBI_MIN (EPS_BEARER_IDENTITY_FIRST) -#define ESM_EBI_MAX (EPS_BEARER_IDENTITY_LAST) - -/* EPS bearer context states */ -typedef enum { - ESM_EBR_INACTIVE, /* No EPS bearer context exists */ - ESM_EBR_ACTIVE, /* The EPS bearer context is active, - * in the UE, in the network */ -#ifdef NAS_MME - ESM_EBR_INACTIVE_PENDING, /* The network has initiated an EPS bearer - * context deactivation towards the UE */ - ESM_EBR_MODIFY_PENDING, /* The network has initiated an EPS bearer - * context modification towards the UE */ - ESM_EBR_ACTIVE_PENDING, /* The network has initiated an EPS bearer - * context activation towards the UE */ -#endif - ESM_EBR_STATE_MAX -} esm_ebr_state; - -#ifdef NAS_MME -/* ESM message timer retransmission data */ -typedef struct esm_ebr_timer_data_s { - void *ctx; - unsigned int ueid; /* Lower layers UE identifier */ - unsigned int ebi; /* EPS bearer identity */ - unsigned int count; /* Retransmission counter */ - OctetString msg; /* Encoded ESM message to re-transmit */ -} esm_ebr_timer_data_t; -#endif - -/* - * ----------------------- - * EPS bearer context data - * ----------------------- - */ -typedef struct esm_ebr_context_s { - unsigned char ebi; /* EPS bearer identity */ - esm_ebr_state status; /* EPS bearer context status */ -#ifdef NAS_UE - int is_default_ebr; /* TRUE if the bearer context is associated - * to a default EPS bearer */ - char cid; /* Identifier of the PDN context the EPS - * bearer context has been assigned to */ -#endif -#ifdef NAS_MME - struct nas_timer_t timer; /* Retransmission timer */ - esm_ebr_timer_data_t *args; /* Retransmission timer parameters data */ -#endif -} esm_ebr_context_t; - -typedef struct esm_ebr_data_s { - unsigned char index; /* Index of the next EPS bearer context - * identity to be used */ -#define ESM_EBR_DATA_SIZE (ESM_EBI_MAX - ESM_EBI_MIN + 1) - esm_ebr_context_t *context[ESM_EBR_DATA_SIZE + 1]; -} esm_ebr_data_t; - -/* - * -------------------------------------------------------------------------- - * Structure of data handled by EPS Session Management sublayer in the UE - * and in the MME - * -------------------------------------------------------------------------- - */ - -/* - * Structure of an EPS bearer - * -------------------------- - * An EPS bearer is a logical concept which applies to the connection - * between two endpoints (UE and PDN Gateway) with specific QoS attri- - * butes. An EPS bearer corresponds to one Quality of Service policy - * applied within the EPC and E-UTRAN. - */ -typedef struct esm_bearer_s { - int bid; /* Identifier of the EPS bearer */ - unsigned int ebi; /* EPS bearer identity */ - network_qos_t qos; /* EPS bearer level QoS parameters */ - network_tft_t tft; /* Traffic Flow Template for packet filtering */ -} esm_bearer_t; - -/* - * Structure of a PDN connection - * ----------------------------- - * A PDN connection is the association between a UE represented by - * one IPv4 address and/or one IPv6 prefix and a PDN represented by - * an Access Point Name (APN). - */ -typedef struct esm_pdn_s { - unsigned int pti; /* Identity of the procedure transaction executed - * to activate the PDN connection entry */ - int is_emergency; /* Emergency bearer services indicator */ - OctetString apn; /* Access Point Name currently in used */ - int ambr; /* Aggregate Maximum Bit Rate of this APN */ - int type; /* Address PDN type (IPv4, IPv6, IPv4v6) */ -#define ESM_DATA_IPV4_ADDRESS_SIZE 4 -#define ESM_DATA_IPV6_ADDRESS_SIZE 8 -#define ESM_DATA_IP_ADDRESS_SIZE (ESM_DATA_IPV4_ADDRESS_SIZE + \ - ESM_DATA_IPV6_ADDRESS_SIZE) - /* IPv4 PDN address and/or IPv6 prefix */ - char ip_addr[ESM_DATA_IP_ADDRESS_SIZE+1]; - int addr_realloc; /* Indicates whether the UE is allowed to subsequently - * request another PDN connectivity to the same APN - * using an address PDN type (IPv4 or IPv6) other - * than the one already activated */ - int n_bearers; /* Number of allocated EPS bearers; - * default EPS bearer is defined at index 0 */ -#define ESM_DATA_EPS_BEARER_MAX 4 - esm_bearer_t *bearer[ESM_DATA_EPS_BEARER_MAX]; -} esm_pdn_t; - -/* - * Structure of the ESM data - * ------------------------- - * The EPS Session Management sublayer handles data related to PDN - * connections and EPS bearers. Each active PDN connection has a de- - * fault EPS bearer. Several dedicated EPS bearers may exist within - * a PDN connection. - */ -typedef struct esm_data_context_s { - unsigned int ue_id; - - int n_ebrs; /* Total number of active EPS bearer contexts */ - int n_pdns; /* Number of active PDN connections */ - int emergency; /* Indicates whether a PDN connection for emergency - * bearer services is established */ -#define ESM_DATA_PDN_MAX 4 - struct { - int pid; /* Identifier of the PDN connection */ - int is_active; /* TRUE/FALSE if the PDN connection is active/inactive - * or the process to activate/deactivate the PDN - * connection is in progress */ - esm_pdn_t *data; /* Active PDN connection data */ - } pdn[ESM_DATA_PDN_MAX+1]; - - esm_ebr_data_t ebr; -} esm_data_context_t; - -/* - * -------------------------------------------------------------------------- - * ESM internal data handled by EPS Session Management sublayer in the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Structure of the ESM data - * ------------------------- - */ -typedef esm_data_context_t esm_data_t; -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * ESM internal data handled by EPS Session Management sublayer in the MME - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Structure of the ESM data - * ------------------------- - */ -typedef struct esm_data_s { - /* - * MME configuration - * ----------------- - */ - mme_api_esm_config_t conf; - /* - * ESM contexts - * ------------ - */ -# if defined(NAS_BUILT_IN_EPC) - /* Use a tree for ue data context within MME */ - RB_HEAD(esm_data_context_map, esm_data_context_s) ctx_map; -# else -# define ESM_DATA_NB_UE_MAX (MME_API_NB_UE_MAX + 1) - esm_data_context_t *ctx[ESM_DATA_NB_UE_MAX]; -# endif -} esm_data_t; - -# if defined(NAS_BUILT_IN_EPC) -struct esm_data_context_s *esm_data_context_get( - esm_data_t *esm_data, unsigned int _ueid); - -struct esm_data_context_s *esm_data_context_remove( - esm_data_t *esm_data, struct esm_data_context_s *elm); - -void esm_data_context_add(esm_data_t *esm_data, struct esm_data_context_s *elm); - -# endif - -#endif //NAS_MME - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/* - * ESM internal data (used within ESM only) - * ---------------------------------------- - */ -esm_data_t _esm_data; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -extern char ip_addr_str[100]; - -extern char *esm_data_get_ipv4_addr(const OctetString *ip_addr); - -extern char *esm_data_get_ipv6_addr(const OctetString *ip_addr); - -extern char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr); - -#endif /* __ESMDATA_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.c b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.c deleted file mode 100644 index 1b24bee2f6d20197d35a28ff9475880d74efc042..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.c +++ /dev/null @@ -1,833 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_ebr.c - -Version 0.1 - -Date 2013/01/29 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions used to handle state of EPS bearer contexts - and manage ESM messages re-transmission. - -*****************************************************************************/ - -#include <stdlib.h> // malloc, free -#include <string.h> // memcpy - -#include "emmData.h" -#include "esm_ebr.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "mme_api.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -#ifdef NAS_UE -#define ESM_EBR_NB_UE_MAX 1 -#endif -#ifdef NAS_MME -#define ESM_EBR_NB_UE_MAX (MME_API_NB_UE_MAX + 1) -#endif - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* String representation of EPS bearer context status */ -static const char *_esm_ebr_state_str[ESM_EBR_STATE_MAX] = { - "BEARER CONTEXT INACTIVE", - "BEARER CONTEXT ACTIVE", -#ifdef NAS_MME - "BEARER CONTEXT INACTIVE PENDING", - "BEARER CONTEXT MODIFY PENDING", - "BEARER CONTEXT ACTIVE PENDING" -#endif -}; - -/* - * ---------------------------------- - * List of EPS bearer contexts per UE - * ---------------------------------- - */ - -#if !defined(NAS_BUILT_IN_EPC) -static esm_ebr_data_t _esm_ebr_data[ESM_EBR_NB_UE_MAX]; -#endif - -/* - * ---------------------- - * User notification data - * ---------------------- - */ -#ifdef NAS_UE -/* User notification callback executed whenever an EPS bearer context becomes - * active or inactive */ -static esm_indication_callback_t _esm_ebr_callback; -/* PDN connection and EPS bearer status [NW/UE][Dedicated/Default][status] */ -static const network_pdn_state_t _esm_ebr_pdn_state[2][2][2] = { - /* Status modification triggerer by the network */ - { - /* Dedicated EPS bearer */ - {NET_PDN_NW_DEDICATED_DEACT, NET_PDN_NW_DEDICATED_ACT}, - /* Default EPS bearer */ - {NET_PDN_NW_DEFAULT_DEACT, 0} - }, - /* Status modification triggered by the UE */ - { - /* Dedicated EPS bearer */ - {NET_PDN_MT_DEDICATED_DEACT, NET_PDN_MT_DEDICATED_ACT}, - /* Default EPS bearer */ - {NET_PDN_MT_DEFAULT_DEACT, NET_PDN_MT_DEFAULT_ACT} - } -}; -#endif - -/* Returns the index of the next available entry in the list of EPS bearer - * context data */ -#ifdef NAS_MME -static int _esm_ebr_get_available_entry(emm_data_context_t *ctx); -#endif -#ifdef NAS_UE -static int _esm_ebr_get_available_entry(unsigned int ueid); -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: esm_ebr_initialize() ** - ** ** - ** Description: Initialize EPS bearer context data ** - ** ** - ** Inputs: cb: User notification callback ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _esm_ebr_data ** - ** ** - ***************************************************************************/ -void esm_ebr_initialize( -#ifdef NAS_UE - esm_indication_callback_t cb -#endif -) -{ -#if !defined(NAS_BUILT_IN_EPC) - int ueid, i; - - LOG_FUNC_IN; - - for (ueid = 0; ueid < ESM_EBR_NB_UE_MAX; ueid++) { - _esm_ebr_data[ueid].index = 0; - - /* Initialize EPS bearer context data */ - for (i = 0; i < ESM_EBR_DATA_SIZE + 1; i++) { - _esm_ebr_data[ueid].context[i] = NULL; - } - } - -# ifdef NAS_UE - /* Initialize the user notification callback */ - _esm_ebr_callback = *cb; -# endif - - LOG_FUNC_OUT; -#endif -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_assign() ** - ** ** - ** Description: Assigns a new EPS bearer context ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** ebi: Identity of the new EPS bearer context ** - ** cid: Identifier of the PDN context the EPS bea- ** - ** rer context is associated to ** - ** default_ebr TRUE if the new bearer context is associa- ** - ** ted to a default EPS bearer ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The identity of the new EPS bearer context ** - ** if successfully assigned; ** - ** the not assigned EBI (0) otherwise. ** - ** Others: _esm_ebr_data ** - ** ** - ***************************************************************************/ -#ifdef NAS_UE -int esm_ebr_assign(int ebi, int cid, int default_ebr) -#endif -#ifdef NAS_MME -int esm_ebr_assign(emm_data_context_t *ctx, int ebi) -#endif -{ - esm_ebr_context_t *ebr_ctx = NULL; - unsigned int ueid = 0; - int i; - - LOG_FUNC_IN; - -#if defined(NAS_UE) - ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]; -#else - ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]; -#endif - - if (ebi != ESM_EBI_UNASSIGNED) { - if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) { - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); - } else if (ebr_ctx != NULL) { - LOG_TRACE(WARNING, "ESM-FSM - EPS bearer context already " - "assigned (ebi=%d)", ebi); - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); - } - - /* The specified EPS bearer context is available */ - i = ebi - ESM_EBI_MIN; - } else { - /* Search for an available EPS bearer identity */ -#ifdef NAS_UE - i = _esm_ebr_get_available_entry(ueid); -#else - i = _esm_ebr_get_available_entry(ctx); -#endif - - if (i < 0) { - LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED); - } - - /* An available EPS bearer context is found */ - ebi = i + ESM_EBI_MIN; - } - - /* Assign new EPS bearer context */ - ebr_ctx = - (esm_ebr_context_t *)malloc(sizeof(esm_ebr_context_t)); - - if (ebr_ctx == NULL) { - LOG_FUNC_RETURN(ESM_EBI_UNASSIGNED); - } - -#if defined(NAS_BUILT_IN_EPC) - ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN] = ebr_ctx; -#else - _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] = ebr_ctx; -#endif - - /* Store the index of the next available EPS bearer identity */ -#ifdef NAS_MME - ctx->esm_data_ctx.ebr.index = i + 1; -#else - _esm_ebr_data[ueid].index = i + 1; -#endif - - /* Set the EPS bearer identity */ - ebr_ctx->ebi = ebi; - /* Set the EPS bearer context status to INACTIVE */ - ebr_ctx->status = ESM_EBR_INACTIVE; -#ifdef NAS_UE - /* Set the default EPS bearer indicator */ - ebr_ctx->is_default_ebr = default_ebr; - /* Set the identifier of the PDN context the EPS bearer is assigned to */ - ebr_ctx->cid = cid; -#endif -#ifdef NAS_MME - /* Disable the retransmission timer */ - ebr_ctx->timer.id = NAS_TIMER_INACTIVE_ID; - /* Setup retransmission timer parameters */ - ebr_ctx->args = NULL; -#endif - - LOG_TRACE(INFO, "ESM-FSM - EPS bearer context %d assigned", ebi); - LOG_FUNC_RETURN(ebr_ctx->ebi); -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_release() ** - ** ** - ** Description: Release the given EPS bearer identity ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** ebi: The identity of the EPS bearer context to ** - ** be released ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok if the EPS bearer context has ** - ** been successfully released; ** - ** RETURNerror otherwise. ** - ** Others: _esm_ebr_data ** - ** ** - ***************************************************************************/ -int esm_ebr_release( -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int ebi) -{ -#ifdef NAS_UE - unsigned int ueid = 0; -#endif - esm_ebr_context_t *ebr_ctx; - - LOG_FUNC_IN; - - if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get EPS bearer context data */ -#if defined(NAS_MME) - ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]; -#else - ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]; -#endif - - if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) { - /* EPS bearer context not assigned */ - LOG_FUNC_RETURN (RETURNerror); - } - - /* Do not release active EPS bearer context */ - if (ebr_ctx->status != ESM_EBR_INACTIVE) { - LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context is not INACTIVE"); - LOG_FUNC_RETURN (RETURNerror); - } - -#ifdef NAS_MME - - /* Stop the retransmission timer if still running */ - if (ebr_ctx->timer.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d", - ebr_ctx->timer.id); - ebr_ctx->timer.id = nas_timer_stop(ebr_ctx->timer.id); - } - - /* Release the retransmisison timer parameters */ - if (ebr_ctx->args) { - if (ebr_ctx->args->msg.length > 0) { - free(ebr_ctx->args->msg.value); - } - - free(ebr_ctx->args); - ebr_ctx->args = NULL; - } - -#endif - - /* Release EPS bearer context data */ - free(ebr_ctx); - ebr_ctx = NULL; - - LOG_TRACE(INFO, "ESM-FSM - EPS bearer context %d released", ebi); - LOG_FUNC_RETURN (RETURNok); -} - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_ebr_start_timer() ** - ** ** - ** Description: Start the timer of the specified EPS bearer context to ** - ** expire after a given time interval. Timer expiration will ** - ** schedule execution of the callback function where stored ** - ** ESM message should be re-transmit. ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** ebi: The identity of the EPS bearer ** - ** msg: The encoded ESM message to be stored ** - ** sec: The value of the time interval in seconds ** - ** cb: Function executed upon timer expiration ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_ebr_data ** - ** ** - ***************************************************************************/ -int esm_ebr_start_timer(emm_data_context_t *ctx, int ebi, const OctetString *msg, - long sec, nas_timer_callback_t cb) -{ - esm_ebr_context_t *ebr_ctx; - - LOG_FUNC_IN; - - if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) { - LOG_TRACE(ERROR, "ESM-FSM - Retransmission timer bad ebi %d", - ebi); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get EPS bearer context data */ - ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]; - - if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) { - /* EPS bearer context not assigned */ - LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context not assigned"); - LOG_FUNC_RETURN (RETURNerror); - } - - if (ebr_ctx->timer.id != NAS_TIMER_INACTIVE_ID) { - if (ebr_ctx->args) { - /* Re-start the retransmission timer */ - ebr_ctx->timer.id = nas_timer_restart(ebr_ctx->timer.id); - } - } else { - /* Setup the retransmission timer parameters */ - ebr_ctx->args = (esm_ebr_timer_data_t *)malloc(sizeof(esm_ebr_timer_data_t)); - - if (ebr_ctx->args) { - /* Set the UE identifier */ - ebr_ctx->args->ueid = ctx->ueid; - /* Set the EPS bearer identity */ - ebr_ctx->args->ebi = ebi; - /* Reset the retransmission counter */ - ebr_ctx->args->count = 0; - /* Set the ESM message to be re-transmited */ - ebr_ctx->args->msg.value = (uint8_t *)malloc(msg->length); - ebr_ctx->args->msg.length = 0; - - if (ebr_ctx->args->msg.value) { - memcpy(ebr_ctx->args->msg.value, msg->value, msg->length); - ebr_ctx->args->msg.length = msg->length; - } - - /* Setup the retransmission timer to expire at the given - * time interval */ - ebr_ctx->timer.id = nas_timer_start(sec, cb, ebr_ctx->args); - ebr_ctx->timer.sec = sec; - } - } - - if ( (ebr_ctx->args != NULL) && (ebr_ctx->timer.id != NAS_TIMER_INACTIVE_ID) ) { - LOG_TRACE(INFO, "ESM-FSM - Retransmission timer %d expires in " - "%ld seconds", ebr_ctx->timer.id, ebr_ctx->timer.sec); - LOG_FUNC_RETURN (RETURNok); - } else { - LOG_TRACE(ERROR, "ESM-FSM - ebr_ctx->args == NULL(%p) or ebr_ctx->timer.id == NAS_TIMER_INACTIVE_ID == -1 (%d)" , - ebr_ctx->args, - ebr_ctx->timer.id); - } - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_stop_timer() ** - ** ** - ** Description: Stop the timer previously started for the given EPS bea- ** - ** rer context ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** ebi: The identity of the EPS bearer ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_ebr_data ** - ** ** - ***************************************************************************/ -int esm_ebr_stop_timer(emm_data_context_t *ctx, int ebi) -{ - esm_ebr_context_t *ebr_ctx ; - - LOG_FUNC_IN; - - if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get EPS bearer context data */ - ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]; - - if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) { - /* EPS bearer context not assigned */ - LOG_FUNC_RETURN (RETURNerror); - } - - /* Stop the retransmission timer if still running */ - if (ebr_ctx->timer.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d", - ebr_ctx->timer.id); - ebr_ctx->timer.id = nas_timer_stop(ebr_ctx->timer.id); - } - - /* Release the retransmisison timer parameters */ - if (ebr_ctx->args) { - if (ebr_ctx->args->msg.length > 0) { - free(ebr_ctx->args->msg.value); - } - - free(ebr_ctx->args); - ebr_ctx->args = NULL; - } - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_get_pending_ebi() ** - ** ** - ** Description: Returns the EPS bearer identity assigned to the first EPS ** - ** bearer context entry which is pending in the given state ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** status: The EPS bearer context status ** - ** Others: _esm_ebr_data ** - ** ** - ** Outputs: None ** - ** Return: The EPS bearer identity of the EPS bearer ** - ** context entry if it exists; ** - ** the not assigned EBI (0) otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_ebr_get_pending_ebi(emm_data_context_t *ctx, esm_ebr_state status) -{ - int i; - - LOG_FUNC_IN; - - for (i = 0; i < ESM_EBR_DATA_SIZE; i++) { - if (ctx->esm_data_ctx.ebr.context[i] == NULL) { - continue; - } - - if (ctx->esm_data_ctx.ebr.context[i]->status != status) { - continue; - } - - /* EPS bearer context entry found */ - break; - } - - if (i < ESM_EBR_DATA_SIZE) { - LOG_FUNC_RETURN (ctx->esm_data_ctx.ebr.context[i]->ebi); - } - - /* EPS bearer context entry not found */ - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); -} -#endif - -/**************************************************************************** - ** ** - ** Name: esm_ebr_set_status() ** - ** ** - ** Description: Set the status of the specified EPS bearer context to the ** - ** given state ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** ebi: The identity of the EPS bearer ** - ** status: The new EPS bearer context status ** - ** ue_requested: TRUE/FALSE if the modification of the EPS ** - ** bearer context status was requested by the ** - ** UE/network ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_ebr_data ** - ** ** - ***************************************************************************/ -int esm_ebr_set_status( -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int ebi, esm_ebr_state status, int ue_requested) -{ - esm_ebr_context_t *ebr_ctx; - esm_ebr_state old_status; - - LOG_FUNC_IN; - -#ifdef NAS_UE - unsigned int ueid = 0; - - if (ueid >= ESM_EBR_NB_UE_MAX) { - LOG_FUNC_RETURN (RETURNerror); - } - -#else - - if (ctx == NULL) { - LOG_FUNC_RETURN (RETURNerror); - } - -#endif - - if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get EPS bearer context data */ -#ifdef NAS_UE - ebr_ctx = _esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]; -#else - ebr_ctx = ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]; -#endif - - if ( (ebr_ctx == NULL) || (ebr_ctx->ebi != ebi) ) { - /* EPS bearer context not assigned */ - LOG_TRACE(ERROR, "ESM-FSM - EPS bearer context not assigned " - "(ebi=%d)", ebi); - LOG_FUNC_RETURN (RETURNerror); - } - - old_status = ebr_ctx->status; - - if (status < ESM_EBR_STATE_MAX) { - LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d changed:" - " %s ===> %s", ebi, - _esm_ebr_state_str[old_status], _esm_ebr_state_str[status]); - - if (status != old_status) { - ebr_ctx->status = status; -#ifdef NAS_UE - /* - * Notify the user that the state of the EPS bearer has changed - */ - (*_esm_ebr_callback)(ebr_ctx->cid, - _esm_ebr_pdn_state[ue_requested][ebr_ctx->is_default_ebr][status]); -#endif - LOG_FUNC_RETURN (RETURNok); - } - } - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_get_status() ** - ** ** - ** Description: Get the current status value of the specified EPS bearer ** - ** context ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** ebi: The identity of the EPS bearer ** - ** Others: _esm_ebr_data ** - ** ** - ** Outputs: None ** - ** Return: The current value of the EPS bearer con- ** - ** text status ** - ** Others: None ** - ** ** - ***************************************************************************/ -#ifdef NAS_MME -esm_ebr_state esm_ebr_get_status( - emm_data_context_t *ctx, - int ebi) -{ - if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) { - return (ESM_EBR_INACTIVE); - } - - if (ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN] == NULL) { - /* EPS bearer context not allocated */ - return (ESM_EBR_INACTIVE); - } - - if (ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]->ebi != ebi) { - /* EPS bearer context not assigned */ - return (ESM_EBR_INACTIVE); - } - - return (ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]->status); -} -#endif - -#ifdef NAS_UE -esm_ebr_state esm_ebr_get_status( - int ebi) -{ - unsigned int ueid = 0; - - if ( (ebi < ESM_EBI_MIN) || (ebi > ESM_EBI_MAX) ) { - return (ESM_EBR_INACTIVE); - } - - if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) { - /* EPS bearer context not allocated */ - return (ESM_EBR_INACTIVE); - } - - if (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi != ebi) { - /* EPS bearer context not assigned */ - return (ESM_EBR_INACTIVE); - } - - return (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->status); -} -#endif - -/**************************************************************************** - ** ** - ** Name: esm_ebr_is_reserved() ** - ** ** - ** Description: Check whether the given EPS bearer identity is a reserved ** - ** value ** - ** ** - ** Inputs: ebi: The identity of the EPS bearer ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: TRUE, FALSE ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_ebr_is_reserved(int ebi) -{ - return ( (ebi != ESM_EBI_UNASSIGNED) && (ebi < ESM_EBI_MIN) ); -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_is_not_in_use() ** - ** ** - ** Description: Check whether the given EPS bearer identity does not ** - ** match an assigned EBI value currently in use ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** ebi: The identity of the EPS bearer ** - ** Others: _esm_ebr_data ** - ** ** - ** Outputs: None ** - ** Return: TRUE, FALSE ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_ebr_is_not_in_use( -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int ebi) -{ -#ifdef NAS_UE - unsigned int ueid = 0; - - return ( (ebi == ESM_EBI_UNASSIGNED) || - (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN] == NULL) || - (_esm_ebr_data[ueid].context[ebi - ESM_EBI_MIN]->ebi) != ebi); -#else - return ( (ebi == ESM_EBI_UNASSIGNED) || - (ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN] == NULL) || - (ctx->esm_data_ctx.ebr.context[ebi - ESM_EBI_MIN]->ebi) != ebi); -#endif -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _esm_ebr_get_available_entry() ** - ** ** - ** Description: Returns the index of the next available entry in the list ** - ** of EPS bearer context data ** - ** ** - ** Inputs: ueid: Lower layers UE identifier ** - ** Others: _esm_ebr_data ** - ** ** - ** Outputs: None ** - ** Return: The index of the next available EPS bearer ** - ** context data entry; -1 if no any entry is ** - ** available. ** - ** Others: None ** - ** ** - ***************************************************************************/ -#ifdef NAS_MME -static int _esm_ebr_get_available_entry(emm_data_context_t *ctx) -{ - int i; - - for (i = ctx->esm_data_ctx.ebr.index; i < ESM_EBR_DATA_SIZE; i++) { - if (ctx->esm_data_ctx.ebr.context[i] != NULL) { - continue; - } - - return i; - } - - for (i = 0; i < ctx->esm_data_ctx.ebr.index; i++) { - if (ctx->esm_data_ctx.ebr.context[i] != NULL) { - continue; - } - - return i; - } - - /* No available EBI entry found */ - return (-1); -} -#endif -#ifdef NAS_UE -static int _esm_ebr_get_available_entry(unsigned int ueid) -{ - int i; - - for (i = _esm_ebr_data[ueid].index; i < ESM_EBR_DATA_SIZE; i++) { - if (_esm_ebr_data[ueid].context[i] != NULL) { - continue; - } - - return i; - } - - for (i = 0; i < _esm_ebr_data[ueid].index; i++) { - if (_esm_ebr_data[ueid].context[i] != NULL) { - continue; - } - - return i; - } - - /* No available EBI entry found */ - return (-1); -} -#endif diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.h b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.h deleted file mode 100644 index 15f7523b3f36ffe037d1af51a265c6fa3c0c44b2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr.h +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_ebr.h - -Version 0.1 - -Date 2013/01/29 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions used to handle state of EPS bearer contexts - and manage ESM messages re-transmission. - -*****************************************************************************/ -#ifndef __ESM_EBR_H__ -#define __ESM_EBR_H__ - -#include "OctetString.h" - -#ifdef NAS_UE -#include "networkDef.h" -#endif - -#include "nas_timer.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Unassigned EPS bearer identity value */ -#define ESM_EBI_UNASSIGNED (EPS_BEARER_IDENTITY_UNASSIGNED) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int esm_ebr_is_reserved(int ebi); - -#ifdef NAS_UE -void esm_ebr_initialize(esm_indication_callback_t cb); -int esm_ebr_assign(int ebi, int cid, int default_ebr); -int esm_ebr_release(int ebi); - -int esm_ebr_set_status(int ebi, esm_ebr_state status, int ue_requested); -esm_ebr_state esm_ebr_get_status(int ebi); - -int esm_ebr_is_not_in_use(int ebi); -#endif - -#ifdef NAS_MME -void esm_ebr_initialize(void); -int esm_ebr_assign(emm_data_context_t *ctx, int ebi); -int esm_ebr_release(emm_data_context_t *ctx, int ebi); - -int esm_ebr_start_timer(emm_data_context_t *ctx, int ebi, const OctetString *msg, - long sec, nas_timer_callback_t cb); -int esm_ebr_stop_timer(emm_data_context_t *ctx, int ebi); - -int esm_ebr_get_pending_ebi(emm_data_context_t *ctx, esm_ebr_state status); - -int esm_ebr_set_status(emm_data_context_t *ctx, int ebi, esm_ebr_state status, - int ue_requested); -esm_ebr_state esm_ebr_get_status(emm_data_context_t *ctx, int ebi); - -int esm_ebr_is_not_in_use(emm_data_context_t *ctx, int ebi); -#endif - -#endif /* __ESM_EBR_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.c b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.c deleted file mode 100644 index 05a2ae473a433be2f1516fac10fd1ae5ef722823..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.c +++ /dev/null @@ -1,791 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_ebr_context.h - -Version 0.1 - -Date 2013/05/28 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions used to handle EPS bearer contexts. - -*****************************************************************************/ -#include <stdlib.h> // malloc, free -#include <string.h> // memset - -#include "commonDef.h" -#include "nas_log.h" - -#include "emmData.h" -#include "esm_ebr.h" - -#include "esm_ebr_context.h" - -#include "emm_sap.h" - -#if defined(ENABLE_ITTI) -# include "assertions.h" -#endif - - -#ifdef NAS_UE -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#endif - - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -static int _esm_ebr_context_check_identifiers(const network_tft_t *, - const network_tft_t *); -static int _esm_ebr_context_check_precedence(const network_tft_t *, - const network_tft_t *); -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: esm_ebr_context_create() ** - ** ** - ** Description: Creates a new EPS bearer context to the PDN with the spe- ** - ** cified PDN connection identifier ** - ** ** - ** Inputs: ueid: UE identifier ** - ** pid: PDN connection identifier ** - ** ebi: EPS bearer identity ** - ** is_default: TRUE if the new bearer is a default EPS ** - ** bearer context ** - ** esm_qos: EPS bearer level QoS parameters ** - ** tft: Traffic flow template parameters ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The EPS bearer identity of the default EPS ** - ** bearer associated to the new EPS bearer ** - ** context if successfully created; ** - ** UNASSIGN EPS bearer value otherwise. ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -int esm_ebr_context_create( -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int pid, int ebi, int is_default, - const network_qos_t *qos, const network_tft_t *tft) -{ - int bid = 0; - esm_data_context_t *esm_ctx = NULL; - esm_pdn_t *pdn = NULL; - unsigned int ueid = 0; - - LOG_FUNC_IN; - -#ifdef NAS_UE - esm_ctx = &_esm_data; -#endif -#ifdef NAS_MME -# if defined(NAS_BUILT_IN_EPC) - esm_ctx = &ctx->esm_data_ctx; -# else - - if (ueid < ESM_DATA_NB_UE_MAX) { - ctx = _esm_data.ctx[ueid]; - } else { - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); - } - -# endif -#endif - - bid = ESM_DATA_EPS_BEARER_MAX; - - LOG_TRACE(INFO, "ESM-PROC - Create new %s EPS bearer context (ebi=%d) " - "for PDN connection (pid=%d)", - (is_default)? "default" : "dedicated", ebi, pid); - - if (pid < ESM_DATA_PDN_MAX) { - if (pid != esm_ctx->pdn[pid].pid) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d is " - "not valid", pid); - } else if (esm_ctx->pdn[pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been " - "allocated", pid); - } - /* Check the total number of active EPS bearers */ - else if (esm_ctx->n_ebrs > ESM_DATA_EPS_BEARER_TOTAL) { - LOG_TRACE(WARNING, "ESM-PROC - The total number of active EPS" - "bearers is exceeded"); - } else { - /* Get the PDN connection entry */ - pdn = esm_ctx->pdn[pid].data; - - if (is_default) { - /* Default EPS bearer entry is defined at index 0 */ - bid = 0; - - if (pdn->bearer[bid] != NULL) { - LOG_TRACE(ERROR, "ESM-PROC - A default EPS bearer context " - "is already allocated"); - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); - } - } else { - /* Search for an available EPS bearer context entry */ - for (bid = 1; bid < ESM_DATA_EPS_BEARER_MAX; bid++) { - if (pdn->bearer[bid] != NULL) { - continue; - } - - break; - } - } - } - } - - if (bid < ESM_DATA_EPS_BEARER_MAX) { - /* Create new EPS bearer context */ - esm_bearer_t *ebr = (esm_bearer_t *)malloc(sizeof(esm_bearer_t)); - - if (ebr != NULL) { - memset(ebr, 0 , sizeof(esm_bearer_t)); - /* Increment the total number of active EPS bearers */ - esm_ctx->n_ebrs += 1; - /* Increment the number of EPS bearer for this PDN connection */ - pdn->n_bearers += 1; - /* Setup the EPS bearer data */ - pdn->bearer[bid] = ebr; - ebr->bid = bid; - ebr->ebi = ebi; - - if (qos != NULL) { - /* EPS bearer level QoS parameters */ - ebr->qos = *qos; - } - - if ( (tft != NULL) && (tft->n_pkfs < NET_PACKET_FILTER_MAX) ) { - int i; - - /* Traffic flow template parameters */ - for (i = 0; i < tft->n_pkfs; i++) { - ebr->tft.pkf[i] = - (network_pkf_t *)malloc(sizeof(network_pkf_t)); - - if (ebr->tft.pkf[i] != NULL) { - *(ebr->tft.pkf[i]) = *(tft->pkf[i]); - ebr->tft.n_pkfs += 1; - } - } - } - - if (is_default) { - /* Set the PDN connection activation indicator */ - esm_ctx->pdn[pid].is_active = TRUE; - - /* Update the emergency bearer services indicator */ - if (pdn->is_emergency) { - esm_ctx->emergency = TRUE; - } - -#ifdef NAS_UE - // LG ADD TEMP - { - char *tmp = NULL; - char ipv4_addr[INET_ADDRSTRLEN]; - char ipv6_addr[INET6_ADDRSTRLEN]; - char *netmask = NULL; - char broadcast[INET_ADDRSTRLEN]; - struct in_addr in_addr; - char command_line[128]; - int res; - - switch (pdn->type) { - case NET_PDN_TYPE_IPV4V6: - ipv6_addr[0] = pdn->ip_addr[4]; - - // etc - case NET_PDN_TYPE_IPV4: - // in_addr is in network byte order - in_addr.s_addr = pdn->ip_addr[0] << 24 | - ((pdn->ip_addr[1] << 16) & 0x00FF0000) | - ((pdn->ip_addr[2] << 8) & 0x0000FF00) | - ( pdn->ip_addr[3] & 0x000000FF); - - in_addr.s_addr = htonl(in_addr.s_addr); - - tmp = inet_ntoa(in_addr); - //AssertFatal(tmp , - // "error in PDN IPv4 address %x", - // in_addr.s_addr); - strcpy(ipv4_addr, tmp); - - if (IN_CLASSA(ntohl(in_addr.s_addr))) { - netmask = "255.0.0.0"; - in_addr.s_addr = pdn->ip_addr[0] << 24 | - ((255 << 16) & 0x00FF0000) | - ((255 << 8) & 0x0000FF00) | - ( 255 & 0x000000FF); - in_addr.s_addr = htonl(in_addr.s_addr); - tmp = inet_ntoa(in_addr); - // AssertFatal(tmp , - // "error in PDN IPv4 address %x", - // in_addr.s_addr); - strcpy(broadcast, tmp); - } else if (IN_CLASSB(ntohl(in_addr.s_addr))) { - netmask = "255.255.0.0"; - in_addr.s_addr = pdn->ip_addr[0] << 24 | - ((pdn->ip_addr[1] << 16) & 0x00FF0000) | - ((255 << 8) & 0x0000FF00) | - ( 255 & 0x000000FF); - in_addr.s_addr = htonl(in_addr.s_addr); - tmp = inet_ntoa(in_addr); - // AssertFatal(tmp , - // "error in PDN IPv4 address %x", - // in_addr.s_addr); - strcpy(broadcast, tmp); - } else if (IN_CLASSC(ntohl(in_addr.s_addr))) { - netmask = "255.255.255.0"; - in_addr.s_addr = pdn->ip_addr[0] << 24 | - ((pdn->ip_addr[1] << 16) & 0x00FF0000) | - ((pdn->ip_addr[2] << 8) & 0x0000FF00) | - ( 255 & 0x000000FF); - in_addr.s_addr = htonl(in_addr.s_addr); - tmp = inet_ntoa(in_addr); - // AssertFatal(tmp , - // "error in PDN IPv4 address %x", - // in_addr.s_addr); - strcpy(broadcast, tmp); - } else { - netmask = "255.255.255.255"; - strcpy(broadcast, ipv4_addr); - } - - res = sprintf(command_line, - "ifconfig oip1 %s netmask %s broadcast %s up", - ipv4_addr, netmask, broadcast); - // AssertFatal((res > 0) && (res < 128), - // "error in system command line"); - LOG_TRACE(INFO, "ESM-PROC - executing %s ", - command_line); - system(command_line); - break; - - case NET_PDN_TYPE_IPV6: - break; - - default: - break; - } - } - // AssertFatal(0, "Forced stop in NAS UE"); -#endif - } - - /* Return the EPS bearer identity of the default EPS bearer - * associated to the new EPS bearer context */ - LOG_FUNC_RETURN (pdn->bearer[0]->ebi); - } - - LOG_TRACE(WARNING, "ESM-PROC - Failed to create new EPS bearer " - "context (ebi=%d)", ebi); - } - - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_context_release() ** - ** ** - ** Description: Releases EPS bearer context entry previously allocated ** - ** to the EPS bearer with the specified EPS bearer identity ** - ** ** - ** Inputs: ueid: UE identifier ** - ** ebi: EPS bearer identity ** - ** Others: _esm_data ** - ** ** - ** Outputs: pid: Identifier of the PDN connection entry the ** - ** EPS bearer context belongs to ** - ** bid: Identifier of the released EPS bearer con- ** - ** text entry ** - ** Return: The EPS bearer identity associated to the ** - ** EPS bearer context if successfully relea- ** - ** sed; UNASSIGN EPS bearer value otherwise. ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -int esm_ebr_context_release( -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int ebi, int *pid, int *bid) -{ - int found = FALSE; - esm_pdn_t *pdn = NULL; - esm_data_context_t *esm_ctx; - - unsigned int ueid = 0; - - LOG_FUNC_IN; - -#ifdef NAS_UE - esm_ctx = &_esm_data; -#endif - -#ifdef NAS_MME -# if defined(NAS_BUILT_IN_EPC) - esm_ctx = &ctx->esm_data_ctx; -# else - - if (ueid < ESM_DATA_NB_UE_MAX) { - ctx = &_esm_data.ctx[ueid]; - } else { - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); - } - -# endif -#endif - - if (ebi != ESM_EBI_UNASSIGNED) { - /* - * The identity of the EPS bearer to released is given; - * Release the EPS bearer context entry that match the specified EPS - * bearer identity - */ - - /* Search for active PDN connection */ - for (*pid = 0; *pid < ESM_DATA_PDN_MAX; (*pid)++) { - if ( !esm_ctx->pdn[*pid].is_active ) { - continue; - } - - /* An active PDN connection is found */ - if (esm_ctx->pdn[*pid].data != NULL) { - pdn = esm_ctx->pdn[*pid].data; - - /* Search for the specified EPS bearer context entry */ - for (*bid = 0; *bid < pdn->n_bearers; (*bid)++) { - if (pdn->bearer[*bid] != NULL) { - if (pdn->bearer[*bid]->ebi != ebi) { - continue; - } - - /* The EPS bearer context entry is found */ - found = TRUE; - break; - } - } - } - - if (found) { - break; - } - } - } else { - /* - * The identity of the EPS bearer to released is not given; - * Release the EPS bearer context entry allocated with the EPS - * bearer context identifier (bid) to establish connectivity to - * the PDN identified by the PDN connection identifier (pid). - * Default EPS bearer to a given PDN is always identified by the - * first EPS bearer context entry at index bid = 0 - */ - if (*pid < ESM_DATA_PDN_MAX) { - if (*pid != esm_ctx->pdn[*pid].pid) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d " - "is not valid", *pid); - } else if (!esm_ctx->pdn[*pid].is_active) { - LOG_TRACE(WARNING,"ESM-PROC - PDN connection %d is not active", - *pid); - } else if (esm_ctx->pdn[*pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been " - "allocated", *pid); - } else { - pdn = esm_ctx->pdn[*pid].data; - - if (pdn->bearer[*bid] != NULL) { - ebi = pdn->bearer[*bid]->ebi; - found = TRUE; - } - } - } - } - - if (found) { - int i, j; - - /* - * Delete the specified EPS bearer context entry - */ - if (pdn->bearer[*bid]->bid != *bid) { - LOG_TRACE(ERROR, "ESM-PROC - EPS bearer identifier %d is " - "not valid", *bid); - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); - } - - LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context " - "(ebi=%d)", ebi); - - /* Delete the TFT */ - for (i = 0; i < pdn->bearer[*bid]->tft.n_pkfs; i++) { - free(pdn->bearer[*bid]->tft.pkf[i]); - } - - /* Release the specified EPS bearer data */ - free(pdn->bearer[*bid]); - pdn->bearer[*bid] = NULL; - /* Decrement the number of EPS bearer context allocated - * to the PDN connection */ - pdn->n_bearers -= 1; - /* Decrement the total number of active EPS bearers */ - esm_ctx->n_ebrs -= 1; - - if (*bid == 0) { - /* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6 - * If the EPS bearer identity is that of the default bearer to a - * PDN, the UE shall delete all EPS bearer contexts associated to - * that PDN connection. - */ - for (i = 1; pdn->n_bearers > 0; i++) { - if (pdn->bearer[i]) { - - LOG_TRACE(WARNING, "ESM-PROC - Release EPS bearer context " - "(ebi=%d)", pdn->bearer[i]->ebi); - - /* Delete the TFT */ - for (j = 0; j < pdn->bearer[i]->tft.n_pkfs; j++) { - free(pdn->bearer[i]->tft.pkf[j]); - } - - /* Set the EPS bearer context state to INACTIVE */ -#ifdef NAS_UE - (void) esm_ebr_set_status(pdn->bearer[i]->ebi, - ESM_EBR_INACTIVE, TRUE); -#endif -#ifdef NAS_MME - (void) esm_ebr_set_status(ctx, pdn->bearer[i]->ebi, - ESM_EBR_INACTIVE, TRUE); -#endif - /* Release EPS bearer data */ -#ifdef NAS_UE - (void) esm_ebr_release(pdn->bearer[i]->ebi); -#endif -#ifdef NAS_MME - (void) esm_ebr_release(ctx, pdn->bearer[i]->ebi); -#endif - // esm_ebr_release() - /* Release dedicated EPS bearer data */ - free(pdn->bearer[i]); - pdn->bearer[i] = NULL; - /* Decrement the number of EPS bearer context allocated - * to the PDN connection */ - pdn->n_bearers -= 1; - /* Decrement the total number of active EPS bearers */ - esm_ctx->n_ebrs -= 1; - } - } - - /* Reset the PDN connection activation indicator */ - esm_ctx->pdn[*pid].is_active = FALSE; - - /* Update the emergency bearer services indicator */ - if (pdn->is_emergency) { - esm_ctx->emergency = FALSE; - } - } - -#ifdef NAS_UE - - /* 3GPP TS 24.301, section 6.4.4.6 - * If the UE locally deactivated all EPS bearer contexts, the UE - * shall perform a local detach and enter state EMM-DEREGISTERED. - */ - if (esm_ctx->n_ebrs == 0) { - emm_sap_t emm_sap; - emm_sap.primitive = EMMESM_ESTABLISH_CNF; - emm_sap.u.emm_esm.u.establish.is_attached = FALSE; - (void) emm_sap_send(&emm_sap); - } - /* 3GPP TS 24.301, section 6.4.4.3, 6.4.4.6 - * If due to the EPS bearer context deactivation only the PDN - * connection for emergency bearer services remains established, - * the UE shall consider itself attached for emergency bearer - * services only. - */ - else if (esm_ctx->emergency && (esm_ctx->n_ebrs == 1) ) { - emm_sap_t emm_sap; - emm_sap.primitive = EMMESM_ESTABLISH_CNF; - emm_sap.u.emm_esm.u.establish.is_attached = TRUE; - emm_sap.u.emm_esm.u.establish.is_emergency = TRUE; - (void) emm_sap_send(&emm_sap); - } - -#endif // NAS_UE -#ifdef NAS_MME - - if (esm_ctx->n_ebrs == 0) { - /* TODO: Release the PDN connection and marked the UE as inactive - * in the network for EPS services (is_attached = FALSE) */ - } - -#endif - - LOG_FUNC_RETURN (ebi); - } - - LOG_FUNC_RETURN (ESM_EBI_UNASSIGNED); -} - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_ebr_context_get_pid() ** - ** ** - ** Description: Returns the identifier of the PDN connection entry the ** - ** default EPS bearer context with the specified EPS bearer ** - ** identity belongs to ** - ** ** - ** Inputs: ebi: The EPS bearer identity of the default EPS ** - ** bearer context ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The identifier of the PDN connection entry ** - ** associated to the specified default EPS ** - ** bearer context if it exists; -1 otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_ebr_context_get_pid(int ebi) -{ - LOG_FUNC_IN; - - int pid; - - for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) { - if (_esm_data.pdn[pid].data == NULL) { - continue; - } - - if (_esm_data.pdn[pid].data->bearer[0] == NULL) { - continue; - } - - if (_esm_data.pdn[pid].data->bearer[0]->ebi == ebi) { - break; - } - } - - if (pid < ESM_DATA_PDN_MAX) { - LOG_FUNC_RETURN (pid); - } - - LOG_FUNC_RETURN (-1); -} - -/**************************************************************************** - ** ** - ** Name: esm_ebr_context_check_tft() ** - ** ** - ** Description: Checks syntactical errors in packet filters associated to ** - ** the EPS bearer context with the specified EPS bearer ** - ** identity for the PDN connection entry with the given ** - ** identifier ** - ** ** - ** Inputs: pid: Identifier of the PDN connection entry the ** - ** EPS bearer context belongs to ** - ** ebi: The EPS bearer identity of the EPS bearer ** - ** context with associated packet filter list ** - ** tft: The traffic flow template (set of packet ** - ** filters) to be checked ** - ** operation: Traffic flow template operation ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_ebr_context_check_tft(int pid, int ebi, - const network_tft_t *tft, - esm_ebr_context_tft_t operation) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - int i; - - if (pid < ESM_DATA_PDN_MAX) { - if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection identifier %d " - "is not valid", pid); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-PROC - PDN connection %d has not been " - "allocated", pid); - } else if (operation == ESM_EBR_CONTEXT_TFT_CREATE) { - esm_pdn_t *pdn = _esm_data.pdn[pid].data; - - /* For each EPS bearer context associated to the PDN connection */ - for (i = 0; i < pdn->n_bearers; i++) { - if (pdn->bearer[i]) { - if (pdn->bearer[i]->ebi == ebi) { - /* Check the packet filter identifiers */ - rc = _esm_ebr_context_check_identifiers(tft, - &pdn->bearer[i]->tft); - - if (rc != RETURNok) { - break; - } - } - - /* Check the packet filter precedence values */ - rc = _esm_ebr_context_check_precedence(tft, - &pdn->bearer[i]->tft); - - if (rc != RETURNok) { - break; - } - } - } - } - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _esm_ebr_context_check_identifiers() ** - ** ** - ** Description: Compares traffic flow templates to check whether two or ** - ** more packet filters have identical packet filter identi- ** - ** fiers ** - ** ** - ** Inputs: tft1: The first set of packet filters ** - ** tft2: The second set of packet filters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNerror if at least one packet filter ** - ** has same identifier in both traffic flow ** - ** templates; RETURNok otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _esm_ebr_context_check_identifiers(const network_tft_t *tft1, - const network_tft_t *tft2) -{ - int i; - int j; - - if ( (tft1 == NULL) || (tft2 == NULL) ) { - return (RETURNok); - } - - for (i = 0; i < tft1->n_pkfs; i++) { - for (j = 0; j < tft2->n_pkfs; j++) { - /* Packet filters should have been allocated */ - if (tft1->pkf[i]->id == tft2->pkf[i]->id) { - /* 3GPP TS 24.301, section 6.4.2.5, abnormal cases d.1 - * Packet filters have same identifier */ - return (RETURNerror); - } - } - } - - return (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: _esm_ebr_context_check_precedence() ** - ** ** - ** Description: Compares traffic flow templates to check whether two or ** - ** more packet filters have identical precedence values ** - ** ** - ** Inputs: tft1: The first set of packet filters ** - ** tft2: The second set of packet filters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNerror if at least one packet filter ** - ** has same precedence value in both traffic ** - ** flow templates; RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _esm_ebr_context_check_precedence(const network_tft_t *tft1, - const network_tft_t *tft2) -{ - int i; - int j; - - if ( (tft1 == NULL) || (tft2 == NULL) ) { - return (RETURNok); - } - - for (i = 0; i < tft1->n_pkfs; i++) { - for (j = 0; j < tft2->n_pkfs; j++) { - /* Packet filters should have been allocated */ - if (tft1->pkf[i]->precedence == tft2->pkf[i]->precedence) { - /* 3GPP TS 24.301, section 6.4.2.5, abnormal cases d.2 - * Packet filters have same precedence value */ - /* TODO: Actually if the old packet filters do not belong - * to the default EPS bearer context, the UE shall not - * diagnose an error (see 6.4.2.5, abnormal cases d.2) */ - return (RETURNerror); - } - } - } - - return (RETURNok); -} -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.h b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.h deleted file mode 100644 index 8ec48a52c119c4f9ff3136851741c95de0c95de2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ebr_context.h +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_ebr_context.h - -Version 0.1 - -Date 2013/05/28 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions used to handle EPS bearer contexts. - -*****************************************************************************/ -#ifndef __ESM_EBR_CONTEXT_H__ -#define __ESM_EBR_CONTEXT_H__ - -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* Traffic flow template operation */ -typedef enum { - ESM_EBR_CONTEXT_TFT_CREATE, - ESM_EBR_CONTEXT_TFT_DELETE, - ESM_EBR_CONTEXT_TFT_ADD_PACKET, - ESM_EBR_CONTEXT_TFT_REPLACE_PACKET, - ESM_EBR_CONTEXT_TFT_DELETE_PACKET, -} esm_ebr_context_tft_t; -#endif - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_UE -int esm_ebr_context_create(int pid, int ebi, int is_default, - const network_qos_t *qos, const network_tft_t *tft); - -int esm_ebr_context_release(int ebi, int *pid, int *bid); - -int esm_ebr_context_get_pid(int ebi); - -int esm_ebr_context_check_tft(int pid, int ebi, const network_tft_t *tft, - esm_ebr_context_tft_t operation); -#endif - -#ifdef NAS_MME -int esm_ebr_context_create(emm_data_context_t *ctx, int pid, int ebi, int is_default, - const network_qos_t *qos, const network_tft_t *tft); - -int esm_ebr_context_release(emm_data_context_t *ctx, int ebi, int *pid, int *bid); -#endif - -#endif /* __ESM_EBR_CONTEXT_H__ */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ip.c b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ip.c deleted file mode 100644 index b2fb84b9708787a14fcb5af40e7bad5155914827..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_ip.c +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include "emmData.h" -#include "esmData.h" - -char ip_addr_str[100]; - -inline char *esm_data_get_ipv4_addr(const OctetString *ip_addr) -{ - if (ip_addr->length > 0) { - sprintf(ip_addr_str, "%u.%u.%u.%u", - ip_addr->value[0], ip_addr->value[1], - ip_addr->value[2], ip_addr->value[3]); - return ip_addr_str; - } - - return (NULL); -} - -inline char *esm_data_get_ipv6_addr(const OctetString *ip_addr) -{ - if (ip_addr->length > 0) { - sprintf(ip_addr_str, "%x%.2x:%x%.2x:%x%.2x:%x%.2x", - ip_addr->value[0], ip_addr->value[1], - ip_addr->value[2], ip_addr->value[3], - ip_addr->value[4], ip_addr->value[5], - ip_addr->value[6], ip_addr->value[7]); - return ip_addr_str; - } - - return (NULL); -} - -inline char *esm_data_get_ipv4v6_addr(const OctetString *ip_addr) -{ - if (ip_addr->length > 0) { - sprintf(ip_addr_str, "%u.%u.%u.%u / %x%.2x:%x%.2x:%x%.2x:%x%.2x", - ip_addr->value[0], ip_addr->value[1], - ip_addr->value[2], ip_addr->value[3], - ip_addr->value[4], ip_addr->value[5], - ip_addr->value[6], ip_addr->value[7], - ip_addr->value[8], ip_addr->value[9], - ip_addr->value[10], ip_addr->value[11]); - return ip_addr_str; - } - - return (NULL); -} diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.c b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.c deleted file mode 100644 index a87b0830bbf43d4d929ddf953c87a595e35c4e3f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.c +++ /dev/null @@ -1,437 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_main.c - -Version 0.1 - -Date 2012/12/04 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the EPS Session Management procedure call manager, - the main entry point for elementary ESM processing. - -*****************************************************************************/ - -#include "esm_main.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "emmData.h" -#include "esmData.h" -#include "esm_pt.h" -#include "esm_ebr.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_main_initialize() ** - ** ** - ** Description: Initializes ESM internal data ** - ** ** - ** Inputs: cb: The user notification callback ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _esm_data ** - ** ** - ***************************************************************************/ -void esm_main_initialize(esm_indication_callback_t cb) -{ - LOG_FUNC_IN; - - int i; - - /* Total number of active EPS bearer contexts */ - _esm_data.n_ebrs = 0; - /* List of active PDN connections */ - _esm_data.n_pdns = 0; - - for (i = 0; i < ESM_DATA_PDN_MAX + 1; i++) { - _esm_data.pdn[i].pid = -1; - _esm_data.pdn[i].is_active = FALSE; - _esm_data.pdn[i].data = NULL; - } - - /* Emergency bearer services indicator */ - _esm_data.emergency = FALSE; - - /* Initialize the procedure transaction identity manager */ - esm_pt_initialize(); - - /* Initialize the EPS bearer context manager */ - esm_ebr_initialize(cb); - - LOG_FUNC_OUT; -} -#endif -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_main_initialize() ** - ** ** - ** Description: Initializes ESM internal data ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void esm_main_initialize(void) -{ - int i; - - LOG_FUNC_IN; - - /* Retreive MME supported configuration data */ - if (mme_api_get_esm_config(&_esm_data.conf) != RETURNok) { - LOG_TRACE(ERROR, "ESM-MAIN - Failed to get MME configuration data"); - } - -# if !defined(NAS_BUILT_IN_EPC) - - /* Initialize ESM contexts */ - for (i = 0; i < ESM_DATA_NB_UE_MAX; i++) { - _esm_data.ctx[i] = NULL; - } - -# endif - - /* Initialize the EPS bearer context manager */ - esm_ebr_initialize(); - - LOG_FUNC_OUT; -} -#endif - -/**************************************************************************** - ** ** - ** Name: esm_main_cleanup() ** - ** ** - ** Description: Performs the EPS Session Management clean up procedure ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void esm_main_cleanup(void) -{ - LOG_FUNC_IN; - -#ifdef NAS_UE - { - int i; - int pid; - int bid; - - /* De-activate EPS bearers and clean up PDN connections */ - for (pid = 0; pid < ESM_DATA_PDN_MAX; pid++) { - if (_esm_data.pdn[pid].data) { - esm_pdn_t *pdn = _esm_data.pdn[pid].data; - - if (pdn->apn.length > 0) { - free(pdn->apn.value); - } - - /* Release EPS bearer contexts */ - for (bid = 0; bid < pdn->n_bearers; bid++) { - if (pdn->bearer[bid]) { - LOG_TRACE(WARNING, "ESM-MAIN - Release EPS bearer " - "context (ebi=%d)", pdn->bearer[bid]->ebi); - - /* Delete the TFT */ - for (i = 0; i < pdn->bearer[bid]->tft.n_pkfs; i++) { - if (pdn->bearer[bid]->tft.pkf[i]) { - free(pdn->bearer[bid]->tft.pkf[i]); - } - } - - free(pdn->bearer[bid]); - } - } - - /* Release the PDN connection */ - free(_esm_data.pdn[pid].data); - } - } - } -#endif - - LOG_FUNC_OUT; -} - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_main_get_nb_pdn_max() ** - ** ** - ** Description: Get the maximum number of PDN connections that may be in ** - ** a defined state at the same time ** - ** ** - ** Inputs: None ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The maximum number of PDN connections that ** - ** may be defined ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_main_get_nb_pdns_max(void) -{ - LOG_FUNC_IN; - - LOG_FUNC_RETURN (ESM_DATA_PDN_MAX); -} - -/**************************************************************************** - ** ** - ** Name: esm_main_get_nb_pdns() ** - ** ** - ** Description: Get the number of active PDN connections ** - ** ** - ** Inputs: None ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: The number of active PDN connections ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_main_get_nb_pdns(void) -{ - LOG_FUNC_IN; - - LOG_FUNC_RETURN (_esm_data.n_pdns); -} - -/**************************************************************************** - ** ** - ** Name: esm_main_has_emergency() ** - ** ** - ** Description: Check whether a PDN connection for emergency bearer ser- ** - ** vices is established ** - ** ** - ** Inputs: None ** - ** Others: _esm_data ** - ** ** - ** Outputs: None ** - ** Return: TRUE if a PDN connection for emergency ** - ** bearer services is established ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_main_has_emergency(void) -{ - LOG_FUNC_IN; - - LOG_FUNC_RETURN (_esm_data.emergency); -} - -/**************************************************************************** - ** ** - ** Name: esm_main_get_pdn_status() ** - ** ** - ** Description: Get the status of the specified PDN connection ** - ** ** - ** Inputs: cid: PDN connection identifier ** - ** Others: _esm_data ** - ** ** - ** Outputs: state: TRUE if the current state of the PDN con- ** - ** nection is ACTIVE; FALSE otherwise. ** - ** Return: TRUE if the specified PDN connection has a ** - ** PDN context defined; FALSE if no any PDN ** - ** context has been defined for the specified ** - ** connection. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_main_get_pdn_status(int cid, int *state) -{ - LOG_FUNC_IN; - - unsigned int pid = cid - 1; - - if (pid >= ESM_DATA_PDN_MAX) { - return (FALSE); - } else if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid); - return (FALSE); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated", - cid); - return (FALSE); - } - - if (_esm_data.pdn[pid].data->bearer[0] != NULL) { - /* The status of a PDN connection is the status of the default EPS bearer - * that has been assigned to this PDN connection at activation time */ - int ebi = _esm_data.pdn[pid].data->bearer[0]->ebi; - *state = (esm_ebr_get_status(ebi) == ESM_EBR_ACTIVE); - } - - /* The PDN connection has not been activated yet */ - LOG_FUNC_RETURN (TRUE); -} - -/**************************************************************************** - ** ** - ** Name: esm_main_get_pdn() ** - ** ** - ** Description: Get parameters defined for the specified PDN connection ** - ** ** - ** Inputs: cid: PDN connection identifier ** - ** Others: _esm_data ** - ** ** - ** Outputs: type: PDN connection type (IPv4, IPv6, IPv4v6) ** - ** apn: Access Point logical Name in used ** - ** is_emergency: Emergency bearer services indicator ** - ** is_active: Active PDN connection indicator ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_main_get_pdn(int cid, int *type, const char **apn, - int *is_emergency, int *is_active) -{ - LOG_FUNC_IN; - - unsigned int pid = cid - 1; - - if (pid >= ESM_DATA_PDN_MAX) { - return (RETURNerror); - } else if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid); - return (RETURNerror); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated", - cid); - return (RETURNerror); - } - - /* Get the PDN type */ - *type = _esm_data.pdn[pid].data->type; - - /* Get the Access Point Name */ - if (_esm_data.pdn[pid].data->apn.length > 0) { - *apn = (char *)(_esm_data.pdn[pid].data->apn.value); - } else { - *apn = NULL; - } - - /* Get the emergency bearer services indicator */ - *is_emergency = _esm_data.pdn[pid].data->is_emergency; - /* Get the active PDN connection indicator */ - *is_active = _esm_data.pdn[pid].is_active; - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_main_get_pdn_addr() ** - ** ** - ** Description: Get IP address(es) assigned to the specified PDN connec- ** - ** tion ** - ** ** - ** Inputs: cid: PDN connection identifier ** - ** Others: _esm_data ** - ** ** - ** Outputs: ipv4adddr: IPv4 address ** - ** ipv6adddr: IPv6 address ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr) -{ - LOG_FUNC_IN; - - unsigned int pid = cid - 1; - - if (pid >= ESM_DATA_PDN_MAX) { - return (RETURNerror); - } else if (pid != _esm_data.pdn[pid].pid) { - LOG_TRACE(WARNING, "ESM-MAIN - PDN connection %d is not defined", cid); - return (RETURNerror); - } else if (_esm_data.pdn[pid].data == NULL) { - LOG_TRACE(ERROR, "ESM-MAIN - PDN connection %d has not been allocated", - cid); - return (RETURNerror); - } else if (!_esm_data.pdn[pid].is_active) { - /* No any IP address has been assigned to this PDN connection */ - return (RETURNok); - } - - if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV4) { - /* Get IPv4 address */ - *ipv4addr = _esm_data.pdn[pid].data->ip_addr; - } else if (_esm_data.pdn[pid].data->type == NET_PDN_TYPE_IPV6) { - /* Get IPv6 address */ - *ipv6addr = _esm_data.pdn[pid].data->ip_addr; - } else { - /* IPv4v6 dual-stack terminal */ - *ipv4addr = _esm_data.pdn[pid].data->ip_addr; - *ipv6addr = _esm_data.pdn[pid].data->ip_addr+ESM_DATA_IPV4_ADDRESS_SIZE; - } - - LOG_FUNC_RETURN (RETURNok); -} - -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.h b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.h deleted file mode 100644 index d7a5a3696c29b71db99710d8cbf51cbbc2818d37..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_main.h +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_main.h - -Version 0.1 - -Date 2012/12/04 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the EPS Session Management procedure call manager, - the main entry point for elementary ESM processing. - -*****************************************************************************/ - -#ifndef __ESM_MAIN_H__ -#define __ESM_MAIN_H__ - -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_UE -void esm_main_initialize(esm_indication_callback_t cb); -#endif -#ifdef NAS_MME -void esm_main_initialize(void); -#endif -void esm_main_cleanup(void); - -#ifdef NAS_UE - -/* User's getter for PDN connections and EPS bearer contexts */ -int esm_main_get_nb_pdns_max(void); -int esm_main_get_nb_pdns(void); -int esm_main_has_emergency(void); -int esm_main_get_pdn_status(int cid, int *state); -int esm_main_get_pdn(int cid, int *type, const char **apn, int *is_emergency, - int *is_active); -int esm_main_get_pdn_addr(int cid, const char **ipv4addr, const char **ipv6addr); - -#endif // NAS_UE - -#endif /* __ESM_MAIN_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_proc.h b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_proc.h deleted file mode 100644 index 8749c8018bc6fae6bd41cab6e281a15cc9a74d11..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_proc.h +++ /dev/null @@ -1,278 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_proc.h - -Version 0.1 - -Date 2013/01/02 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the EPS Session Management procedures executed at - the ESM Service Access Points. - -*****************************************************************************/ -#ifndef __ESM_PROC_H__ -#define __ESM_PROC_H__ - -#include "networkDef.h" -#include "OctetString.h" -#include "emmData.h" -#include "ProtocolConfigurationOptions.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * ESM retransmission timers - * ------------------------- - */ -#ifdef NAS_UE -#define T3482_DEFAULT_VALUE 8 /* PDN connectivity request */ -#define T3492_DEFAULT_VALUE 6 /* PDN disconnect request */ -#endif - -#ifdef NAS_MME -#define T3485_DEFAULT_VALUE 8 /* Activate EPS bearer request */ -#define T3495_DEFAULT_VALUE 8 /* Deactivate EPS bearer request */ -#endif - -/* Type of PDN address */ -typedef enum { - ESM_PDN_TYPE_IPV4 = NET_PDN_TYPE_IPV4, - ESM_PDN_TYPE_IPV6 = NET_PDN_TYPE_IPV6, - ESM_PDN_TYPE_IPV4V6 = NET_PDN_TYPE_IPV4V6 -} esm_proc_pdn_type_t; - -/* Type of PDN request */ -typedef enum { - ESM_PDN_REQUEST_INITIAL = 1, - ESM_PDN_REQUEST_HANDOVER, - ESM_PDN_REQUEST_EMERGENCY -} esm_proc_pdn_request_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Type of the ESM procedure callback executed when requested by the UE - * or initiated by the network - */ -#ifdef NAS_UE -typedef int (*esm_proc_procedure_t) (int, int, OctetString *, int); -#endif -#ifdef NAS_MME -typedef int (*esm_proc_procedure_t) (int, emm_data_context_t *, int, OctetString *, int); -#endif - -/* EPS bearer level QoS parameters */ -typedef network_qos_t esm_proc_qos_t; - -/* Traffic Flow Template for packet filtering */ -typedef network_tft_t esm_proc_tft_t; - -typedef ProtocolConfigurationOptions esm_proc_pco_t; - -/* PDN connection and EPS bearer context data */ -typedef struct { - OctetString apn; - esm_proc_pdn_type_t pdn_type; - OctetString pdn_addr; - esm_proc_qos_t qos; - esm_proc_tft_t tft; - esm_proc_pco_t pco; -} esm_proc_data_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * ESM status procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int esm_proc_status_ind(int pti, int ebi, int *esm_cause); -int esm_proc_status(int is_standalone, int pti, OctetString *msg, - int sent_by_ue); -#endif - -#ifdef NAS_MME -int esm_proc_status_ind(emm_data_context_t *ctx, int pti, int ebi, int *esm_cause); -int esm_proc_status(int is_standalone, emm_data_context_t *ctx, int pti, - OctetString *msg, int sent_by_ue); -#endif - - -/* - * -------------------------------------------------------------------------- - * PDN connectivity procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int esm_proc_pdn_connectivity(int cid, int to_define, - esm_proc_pdn_type_t pdn_type, const OctetString *apn, int is_emergency, - unsigned int *pti); -int esm_proc_pdn_connectivity_request(int is_standalone, int pti, - OctetString *msg, int sent_by_ue); -int esm_proc_pdn_connectivity_accept(int pti, esm_proc_pdn_type_t pdn_type, - const OctetString *pdn_address, const OctetString *apn, int *esm_cause); -int esm_proc_pdn_connectivity_reject(int pti, int *esm_cause); -int esm_proc_pdn_connectivity_complete(void); -int esm_proc_pdn_connectivity_failure(int is_pending); -#endif - -#ifdef NAS_MME -int esm_proc_pdn_connectivity_request(emm_data_context_t *ctx, int pti, - esm_proc_pdn_request_t request_type, OctetString *apn, - esm_proc_pdn_type_t pdn_type, OctetString *pdn_addr, esm_proc_qos_t *esm_qos, - int *esm_cause); - -int esm_proc_pdn_connectivity_reject(int is_standalone, emm_data_context_t *ctx, - int ebi, OctetString *msg, int ue_triggered); -int esm_proc_pdn_connectivity_failure(emm_data_context_t *ctx, int pid); -#endif - -/* - * -------------------------------------------------------------------------- - * PDN disconnect procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int esm_proc_pdn_disconnect(int cid, unsigned int *pti, unsigned int *ebi); -int esm_proc_pdn_disconnect_request(int is_standalone, int pti, - OctetString *msg, int sent_by_ue); - -int esm_proc_pdn_disconnect_accept(int pti, int *esm_cause); -int esm_proc_pdn_disconnect_reject(int pti, int *esm_cause); -#endif - -#ifdef NAS_MME -int esm_proc_pdn_disconnect_request(emm_data_context_t *ctx, int pti, int *esm_cause); - -int esm_proc_pdn_disconnect_accept(emm_data_context_t *ctx, int pid, int *esm_cause); -int esm_proc_pdn_disconnect_reject(int is_standalone, emm_data_context_t *ctx, - int ebi, OctetString *msg, int ue_triggered); -#endif - -/* - * -------------------------------------------------------------------------- - * Default EPS bearer context activation procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -int esm_proc_default_eps_bearer_context(emm_data_context_t *ctx, int pid, - unsigned int *ebi, const esm_proc_qos_t *esm_qos, int *esm_cause); -int esm_proc_default_eps_bearer_context_request(int is_standalone, - emm_data_context_t *ctx, int ebi, OctetString *msg, int ue_triggered); -int esm_proc_default_eps_bearer_context_failure(emm_data_context_t *ctx); - -int esm_proc_default_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi, - int *esm_cause); -int esm_proc_default_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi, - int *esm_cause); -#endif - -#ifdef NAS_UE -int esm_proc_default_eps_bearer_context_request(int pid, int ebi, - const esm_proc_qos_t *esm_qos, int *esm_cause); -int esm_proc_default_eps_bearer_context_complete(void); -int esm_proc_default_eps_bearer_context_failure(void); - -int esm_proc_default_eps_bearer_context_accept(int is_standalone, int ebi, - OctetString *msg, int ue_triggered); -int esm_proc_default_eps_bearer_context_reject(int is_standalone, int ebi, - OctetString *msg, int ue_triggered); -#endif - -/* - * -------------------------------------------------------------------------- - * Dedicated EPS bearer context activation procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -int esm_proc_dedicated_eps_bearer_context(emm_data_context_t *ctx, int pid, - unsigned int *ebi, unsigned int *default_ebi, const esm_proc_qos_t *qos, - const esm_proc_tft_t *tft, int *esm_cause); -int esm_proc_dedicated_eps_bearer_context_request(int is_standalone, - emm_data_context_t *ctx, int ebi, OctetString *msg, int ue_triggered); - -int esm_proc_dedicated_eps_bearer_context_accept(emm_data_context_t *ctx, int ebi, - int *esm_cause); -int esm_proc_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, int ebi, - int *esm_cause); -#endif - -#ifdef NAS_UE -int esm_proc_dedicated_eps_bearer_context_request(int ebi, int default_ebi, - const esm_proc_qos_t *qos, const esm_proc_tft_t *tft, int *esm_cause); - -int esm_proc_dedicated_eps_bearer_context_accept(int is_standalone, int ebi, - OctetString *msg, int ue_triggered); -int esm_proc_dedicated_eps_bearer_context_reject(int is_standalone, int ebi, - OctetString *msg, int ue_triggered); -#endif - -/* - * -------------------------------------------------------------------------- - * EPS bearer context deactivation procedure - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -int esm_proc_eps_bearer_context_deactivate(emm_data_context_t *ctx, int is_local, - int ebi, int *pid, int *bid, - int *esm_cause); -int esm_proc_eps_bearer_context_deactivate_request(int is_standalone, - emm_data_context_t *ctx, int ebi, OctetString *msg, int ue_triggered); -int esm_proc_eps_bearer_context_deactivate_accept(emm_data_context_t *ctx, int ebi, - int *esm_cause); -#endif - -#ifdef NAS_UE -int esm_proc_eps_bearer_context_deactivate(int is_local, int ebi, int *pid, - int *bid); -int esm_proc_eps_bearer_context_deactivate_request(int ebi, int *esm_cause); - -int esm_proc_eps_bearer_context_deactivate_accept(int is_standalone, int ebi, - OctetString *msg, int ue_triggered); -#endif - -#endif /* __ESM_PROC_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.c b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.c deleted file mode 100644 index 96b18625ff78109aaa556f97ee9fa3eecf968b58..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.c +++ /dev/null @@ -1,606 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_pt.c - -Version 0.1 - -Date 2013/01/03 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions used to handle ESM procedure transactions. - -*****************************************************************************/ - -#include "esm_pt.h" - -#ifdef NAS_UE -#include "commonDef.h" -#include "nas_log.h" - -#include <stdlib.h> // malloc, free -#include <string.h> // memcpy -#endif // NAS_UE - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/* - * Minimal and maximal value of a procedure transaction identity: - * The Procedure Transaction Identity (PTI) identifies bi-directional - * messages flows - */ -#define ESM_PTI_MIN (PROCEDURE_TRANSACTION_IDENTITY_FIRST) -#define ESM_PTI_MAX (PROCEDURE_TRANSACTION_IDENTITY_LAST) - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* String representation of ESM procedure transaction status */ -static const char *_esm_pt_state_str[ESM_PT_STATE_MAX] = { - "PROCEDURE TRANSACTION INACTIVE", - "PROCEDURE TRANSACTION PENDING" -}; - -/* - * -------------------------- - * Procedure transaction data - * -------------------------- - */ -typedef struct { - unsigned char pti; /* Procedure transaction identity */ - esm_pt_state status; /* Procedure transaction status */ - struct nas_timer_t timer; /* Retransmission timer */ - esm_pt_timer_data_t *args; /* Retransmission timer parameters data */ -} esm_pt_context_t; - -/* - * ------------------------------ - * List of procedure transactions - * ------------------------------ - */ -static struct { - unsigned char index; /* Index of the next procedure transaction - * identity to be used */ -#define ESM_PT_DATA_SIZE (ESM_PTI_MAX - ESM_PTI_MIN + 1) - esm_pt_context_t *context[ESM_PT_DATA_SIZE + 1]; -} _esm_pt_data; - -/* Return the index of the next available entry in the list of procedure - * transaction data */ -static int _esm_pt_get_available_entry(void); -#endif // NAS_UE - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_pt_initialize() ** - ** ** - ** Description: Initialize ESM procedure transaction data ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _esm_pt_data ** - ** ** - ***************************************************************************/ -void esm_pt_initialize(void) -{ - LOG_FUNC_IN; - - int i; - - _esm_pt_data.index = 0; - - for (i = 0; i < ESM_PT_DATA_SIZE + 1; i++) { - _esm_pt_data.context[i] = NULL; - } - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_assign() ** - ** ** - ** Description: Assigns a new procedure transaction identity ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The identity of the new procedure transac- ** - ** tion when successfully assigned; ** - ** the unassigned PTI (0) otherwise. ** - ** Others: _esm_pt_data ** - ** ** - ***************************************************************************/ -int esm_pt_assign(void) -{ - LOG_FUNC_IN; - - /* Search for an available procedure transaction identity */ - int i = _esm_pt_get_available_entry(); - - if (i < 0) { - LOG_FUNC_RETURN (ESM_PT_UNASSIGNED); - } - - /* Assign new procedure transaction */ - _esm_pt_data.context[i] = - (esm_pt_context_t *)malloc(sizeof(esm_pt_context_t)); - - if (_esm_pt_data.context[i] == NULL) { - LOG_FUNC_RETURN (ESM_PT_UNASSIGNED); - } - - /* Store the index of the next available procedure transaction identity */ - _esm_pt_data.index = i + 1; - - /* An available procedure transaction identity is found */ - _esm_pt_data.context[i]->pti = i + ESM_PTI_MIN; - /* Set the procedure transaction status to INACTIVE */ - _esm_pt_data.context[i]->status = ESM_PT_INACTIVE; - /* Disable the retransmission timer */ - _esm_pt_data.context[i]->timer.id = NAS_TIMER_INACTIVE_ID; - /* Setup retransmission timer parameters */ - _esm_pt_data.context[i]->args = NULL; - - LOG_TRACE(INFO, "ESM-FSM - Procedure transaction identity %d assigned", - _esm_pt_data.context[i]->pti); - LOG_FUNC_RETURN (_esm_pt_data.context[i]->pti); -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_release() ** - ** ** - ** Description: Release the given procedure transaction identity ** - ** ** - ** Inputs: pti: The identity of the procedure transaction ** - ** to release ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok if the procedure transaction iden-** - ** tity has been successfully released; ** - ** RETURNerror otherwise. ** - ** Others: _esm_pt_data ** - ** ** - ***************************************************************************/ -int esm_pt_release(int pti) -{ - LOG_FUNC_IN; - - if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get procedure transaction data */ - esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN]; - - if ( (ctx == NULL) || (ctx->pti != pti) ) { - /* Procedure transaction not assigned */ - LOG_FUNC_RETURN (RETURNerror); - } - - /* Do not release active procedure transaction */ - if (ctx->status != ESM_PT_INACTIVE) { - LOG_TRACE(ERROR, "ESM-FSM - Procedure transaction is not INACTIVE"); - LOG_FUNC_RETURN (RETURNerror); - } - - /* Stop the retransmission timer if still running */ - if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d", - ctx->timer.id); - ctx->timer.id = nas_timer_stop(ctx->timer.id); - } - - /* Release the retransmisison timer parameters */ - if (ctx->args) { - if (ctx->args->msg.length > 0) { - free(ctx->args->msg.value); - } - - free(ctx->args); - ctx->args = NULL; - } - - /* Release transaction procedure data */ - free(_esm_pt_data.context[pti - ESM_PTI_MIN]); - _esm_pt_data.context[pti - ESM_PTI_MIN] = NULL; - - LOG_TRACE(INFO, "ESM-FSM - Procedure transaction %d released", pti); - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_start_timer() ** - ** ** - ** Description: Start the timer of the specified procedure transaction to ** - ** expire after a given time interval. Timer expiration will ** - ** schedule execution of the callback function where stored ** - ** ESM message should be re-transmit. ** - ** ** - ** Inputs: pti: The identity of the procedure transaction ** - ** msg: The encoded ESM message to be stored ** - ** sec: The value of the time interval in seconds ** - ** cb: Function executed upon timer expiration ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_pt_data ** - ** ** - ***************************************************************************/ -int esm_pt_start_timer(int pti, const OctetString *msg, - long sec, nas_timer_callback_t cb) -{ - LOG_FUNC_IN; - - if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get procedure transaction data */ - esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN]; - - if ( (ctx == NULL) || (ctx->pti != pti) ) { - /* Procedure transaction not assigned */ - LOG_FUNC_RETURN (RETURNerror); - } - - if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) { - if (ctx->args) { - /* Re-start the retransmission timer */ - ctx->timer.id = nas_timer_restart(ctx->timer.id); - } - } else { - /* Setup the retransmission timer parameters */ - ctx->args = (esm_pt_timer_data_t *)malloc(sizeof(esm_pt_timer_data_t)); - - if (ctx->args) { - /* Set the EPS bearer identity */ - ctx->args->pti = pti; - /* Reset the retransmission counter */ - ctx->args->count = 0; - /* Set the ESM message to be re-transmited */ - ctx->args->msg.value = (uint8_t *)malloc(msg->length); - ctx->args->msg.length = 0; - - if (ctx->args->msg.value) { - memcpy(ctx->args->msg.value, msg->value, msg->length); - ctx->args->msg.length = msg->length; - } - - /* Setup the retransmission timer to expire at the given - * time interval */ - ctx->timer.id = nas_timer_start(sec, cb, ctx->args); - ctx->timer.sec = sec; - } - } - - if ( (ctx->args != NULL) && (ctx->timer.id != NAS_TIMER_INACTIVE_ID) ) { - LOG_TRACE(INFO, "ESM-FSM - Retransmission timer %d expires in " - "%ld seconds", ctx->timer.id, ctx->timer.sec); - LOG_FUNC_RETURN (RETURNok); - } - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_stop_timer() ** - ** ** - ** Description: Stop the timer previously started for the given procedure ** - ** transaction ** - ** ** - ** Inputs: pti: The identity of the procedure transaction ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_pt_data ** - ** ** - ***************************************************************************/ -int esm_pt_stop_timer(int pti) -{ - LOG_FUNC_IN; - - if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get procedure transaction data */ - esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN]; - - if ( (ctx == NULL) || (ctx->pti != pti) ) { - /* Procedure transaction not assigned */ - LOG_FUNC_RETURN (RETURNerror); - } - - /* Stop the retransmission timer if still running */ - if (ctx->timer.id != NAS_TIMER_INACTIVE_ID) { - LOG_TRACE(INFO, "ESM-FSM - Stop retransmission timer %d", - ctx->timer.id); - ctx->timer.id = nas_timer_stop(ctx->timer.id); - } - - /* Release the retransmisison timer parameters */ - if (ctx->args) { - if (ctx->args->msg.length > 0) { - free(ctx->args->msg.value); - } - - free(ctx->args); - ctx->args = NULL; - } - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_set_status() ** - ** ** - ** Description: Set the status of the specified procedure transaction to ** - ** the given state ** - ** ** - ** Inputs: pti: The identity of the procedure transaction ** - ** status: The new ESM procedure transaction status ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_pt_data ** - ** ** - ***************************************************************************/ -int esm_pt_set_status(int pti, esm_pt_state status) -{ - LOG_FUNC_IN; - - esm_pt_state old_status; - - if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) { - LOG_FUNC_RETURN (RETURNerror); - } - - /* Get procedure transaction data */ - esm_pt_context_t *ctx = _esm_pt_data.context[pti - ESM_PTI_MIN]; - - if ( (ctx == NULL) || (ctx->pti != pti) ) { - /* Procedure transaction not assigned */ - LOG_TRACE(ERROR, "ESM-FSM - Procedure transaction not assigned " - "(pti=%d)", pti); - LOG_FUNC_RETURN (RETURNerror); - } - - old_status = ctx->status; - - if (status < ESM_PT_STATE_MAX) { - LOG_TRACE(INFO, "ESM-FSM - Status of procedure transaction %d changed:" - " %s ===> %s", pti, - _esm_pt_state_str[old_status], _esm_pt_state_str[status]); - - if (status != old_status) { - ctx->status = status; - LOG_FUNC_RETURN (RETURNok); - } - } - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_get_status() ** - ** ** - ** Description: Get the current status value of the specified procedure ** - ** transaction ** - ** ** - ** Inputs: pti: The identity of the procedure transaction ** - ** Others: _esm_pt_data ** - ** ** - ** Outputs: None ** - ** Return: The current value of the ESM procedure ** - ** transaction status ** - ** Others: None ** - ** ** - ***************************************************************************/ -esm_pt_state esm_pt_get_status(int pti) -{ - if ( (pti < ESM_PTI_MIN) || (pti > ESM_PTI_MAX) ) { - return (ESM_PT_INACTIVE); - } - - if (_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) { - /* Procedure transaction not allocated */ - return (ESM_PT_INACTIVE); - } - - if (_esm_pt_data.context[pti - ESM_PTI_MIN]->pti != pti) { - /* Procedure transaction not assigned */ - return (ESM_PT_INACTIVE); - } - - return (_esm_pt_data.context[pti - ESM_PTI_MIN]->status); -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_get_pending_pti() ** - ** ** - ** Description: Returns the procedure transaction identity assigned to ** - ** the first PDN connection entry which is pending in the ** - ** given state ** - ** ** - ** Inputs: status: The PDN connection status ** - ** Others: _esm_pt_data ** - ** ** - ** Outputs: None ** - ** Return: The procedure transaction identity of the ** - ** PDN connection entry if it exists; ** - ** the unassigned PTI (0) otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_pt_get_pending_pti(esm_pt_state status) -{ - LOG_FUNC_IN; - - int i; - - for (i = 0; i < ESM_PT_DATA_SIZE; i++) { - if (_esm_pt_data.context[i] == NULL) { - continue; - } - - if (_esm_pt_data.context[i]->status != status) { - continue; - } - - /* PDN connection entry found */ - break; - } - - if (i < ESM_PT_DATA_SIZE) { - LOG_FUNC_RETURN (_esm_pt_data.context[i]->pti); - } - - /* PDN connection entry not found */ - LOG_FUNC_RETURN (ESM_PT_UNASSIGNED); -} - -/**************************************************************************** - ** ** - ** Name: esm_pt_is_not_in_use() ** - ** ** - ** Description: Check whether the given procedure transaction identity ** - ** does not match an assigned PTI value currently in use ** - ** ** - ** Inputs: pti: The identity of the procedure transaction ** - ** Others: _esm_pt_data ** - ** ** - ** Outputs: None ** - ** Return: TRUE, FALSE ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_pt_is_not_in_use(int pti) -{ - return ( (pti == ESM_PT_UNASSIGNED) || - (_esm_pt_data.context[pti - ESM_PTI_MIN] == NULL) || - (_esm_pt_data.context[pti - ESM_PTI_MIN]->pti) != pti); -} -#endif // NAS_UE - -/**************************************************************************** - ** ** - ** Name: esm_pt_is_reserved() ** - ** ** - ** Description: Check whether the given procedure transaction identity is ** - ** a reserved value ** - ** ** - ** Inputs: pti: The identity of the procedure transaction ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: TRUE, FALSE ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_pt_is_reserved(int pti) -{ - return ( (pti != ESM_PT_UNASSIGNED) && (pti > ESM_PTI_MAX) ); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _esm_pt_get_available_entry() ** - ** ** - ** Description: Returns the index of the next available entry in the list ** - ** of procedure transaction data ** - ** ** - ** Inputs: None ** - ** Others: _esm_pt_data ** - ** ** - ** Outputs: None ** - ** Return: The index of the next available procedure ** - ** transaction data entry; -1 if no any entry ** - ** is available. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _esm_pt_get_available_entry(void) -{ - int i; - - for (i = _esm_pt_data.index; i < ESM_PT_DATA_SIZE; i++) { - if (_esm_pt_data.context[i] != NULL) { - continue; - } - - return i; - } - - for (i = 0; i < _esm_pt_data.index; i++) { - if (_esm_pt_data.context[i] != NULL) { - continue; - } - - return i; - } - - /* No available PTI entry found */ - return (-1); -} -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.h b/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.h deleted file mode 100644 index a2aa313c9ae2332c2e87a9032f21e93d7fa5b70c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/esm_pt.h +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_pt.h - -Version 0.1 - -Date 2013/01/03 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions used to handle ESM procedure transactions. - -*****************************************************************************/ -#ifndef __ESM_PT_H__ -#define __ESM_PT_H__ - -#ifdef NAS_UE -#include "OctetString.h" -#include "nas_timer.h" -#endif - -#include "ProcedureTransactionIdentity.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Unassigned procedure transaction identity value */ -#define ESM_PT_UNASSIGNED (PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* Procedure transaction states */ -typedef enum { - ESM_PT_INACTIVE, /* No procedure transaction exists */ - ESM_PT_PENDING, /* The UE has initiated a procedure transaction - * towards the network */ - ESM_PT_STATE_MAX -} esm_pt_state; - -/* ESM message timer retransmission data */ -typedef struct { - unsigned char pti; /* Procedure transaction identity */ - unsigned int count; /* Retransmission counter */ - OctetString msg; /* Encoded ESM message to re-transmit */ -} esm_pt_timer_data_t; -#endif // NAS_UE - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int esm_pt_is_reserved(int pti); - -#ifdef NAS_UE -void esm_pt_initialize(void); - -int esm_pt_assign(void); -int esm_pt_release(int pti); - -int esm_pt_start_timer(int pti, const OctetString *msg, long sec, - nas_timer_callback_t cb); -int esm_pt_stop_timer(int pti); - -int esm_pt_set_status(int pti, esm_pt_state status); -esm_pt_state esm_pt_get_status(int pti); -int esm_pt_get_pending_pti(esm_pt_state status); - -int esm_pt_is_not_in_use(int pti); -#endif // NAS_UE - -#endif /* __ESM_PT_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.c deleted file mode 100644 index c377e11680fe7c270bf05cc7b80c4417844d337d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.c +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ActivateDedicatedEpsBearerContextAccept.h" - -int decode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activate_dedicated_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_accept->protocolconfigurationoptions, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_accept->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activate_dedicated_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - if ((activate_dedicated_eps_bearer_context_accept->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_accept->protocolconfigurationoptions, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.h deleted file mode 100644 index c8e12750866f7af07dc7d36ae813c42dda3fa35f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextAccept.h +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_H_ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_MAXIMUM_LENGTH ( \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum activate_dedicated_eps_bearer_context_accept_iei_tag { - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} activate_dedicated_eps_bearer_context_accept_iei; - -/* - * Message name: Activate dedicated EPS bearer context accept - * Description: This message is sent by the UE to the network to acknowledge activation of a dedicated EPS bearer context associated with the same PDN address(es) and APN as an already active EPS bearer context. See table 8.3.1.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct activate_dedicated_eps_bearer_context_accept_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} activate_dedicated_eps_bearer_context_accept_msg; - -int decode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activatededicatedepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -int encode_activate_dedicated_eps_bearer_context_accept(activate_dedicated_eps_bearer_context_accept_msg *activatededicatedepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.c deleted file mode 100644 index 95c6591281748eea2e4d91dc1d1cde8be1eecbd5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.c +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ActivateDedicatedEpsBearerContextReject.h" - -int decode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activate_dedicated_eps_bearer_context_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&activate_dedicated_eps_bearer_context_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_reject->protocolconfigurationoptions, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_reject->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activate_dedicated_eps_bearer_context_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_esm_cause(&activate_dedicated_eps_bearer_context_reject->esmcause, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((activate_dedicated_eps_bearer_context_reject->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_reject->protocolconfigurationoptions, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.h deleted file mode 100644 index e766ba18fee3f198a12ef6fb51694f7e1bfa6881..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextReject.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_H_ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum activate_dedicated_eps_bearer_context_reject_iei_tag { - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} activate_dedicated_eps_bearer_context_reject_iei; - -/* - * Message name: Activate dedicated EPS bearer context reject - * Description: This message is sent by UE to the network to reject activation of a dedicated EPS bearer context. See table 8.3.2.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct activate_dedicated_eps_bearer_context_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} activate_dedicated_eps_bearer_context_reject_msg; - -int decode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activatededicatedepsbearercontextreject, uint8_t *buffer, uint32_t len); - -int encode_activate_dedicated_eps_bearer_context_reject(activate_dedicated_eps_bearer_context_reject_msg *activatededicatedepsbearercontextreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.c deleted file mode 100644 index 750793784d22eb0933993a343a7c324178366b08..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.c +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ActivateDedicatedEpsBearerContextRequest.h" - -int decode_activate_dedicated_eps_bearer_context_request(activate_dedicated_eps_bearer_context_request_msg *activate_dedicated_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_linked_eps_bearer_identity(&activate_dedicated_eps_bearer_context_request->linkedepsbeareridentity, 0, *(buffer + decoded), len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_eps_quality_of_service(&activate_dedicated_eps_bearer_context_request->epsqos, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_traffic_flow_template(&activate_dedicated_eps_bearer_context_request->tft, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI: - if ((decoded_result = - decode_transaction_identifier(&activate_dedicated_eps_bearer_context_request->transactionidentifier, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT; - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI: - if ((decoded_result = - decode_quality_of_service(&activate_dedicated_eps_bearer_context_request->negotiatedqos, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT; - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI: - if ((decoded_result = - decode_llc_service_access_point_identifier(&activate_dedicated_eps_bearer_context_request->negotiatedllcsapi, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI: - if ((decoded_result = - decode_radio_priority(&activate_dedicated_eps_bearer_context_request->radiopriority, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI: - if ((decoded_result = - decode_packet_flow_identifier(&activate_dedicated_eps_bearer_context_request->packetflowidentifier, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_request->protocolconfigurationoptions, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_dedicated_eps_bearer_context_request->presencemask |= ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_activate_dedicated_eps_bearer_context_request(activate_dedicated_eps_bearer_context_request_msg *activate_dedicated_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = encode_u8_linked_eps_bearer_identity(&activate_dedicated_eps_bearer_context_request->linkedepsbeareridentity) & 0x0f; - encoded++; - - if ((encode_result = - encode_eps_quality_of_service(&activate_dedicated_eps_bearer_context_request->epsqos, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((encode_result = - encode_traffic_flow_template(&activate_dedicated_eps_bearer_context_request->tft, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) { - if ((encode_result = - encode_transaction_identifier(&activate_dedicated_eps_bearer_context_request->transactionidentifier, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) { - if ((encode_result = - encode_quality_of_service(&activate_dedicated_eps_bearer_context_request->negotiatedqos, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { - if ((encode_result = - encode_llc_service_access_point_identifier(&activate_dedicated_eps_bearer_context_request->negotiatedllcsapi, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) { - if ((encode_result = - encode_radio_priority(&activate_dedicated_eps_bearer_context_request->radiopriority, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { - if ((encode_result = - encode_packet_flow_identifier(&activate_dedicated_eps_bearer_context_request->packetflowidentifier, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((activate_dedicated_eps_bearer_context_request->presencemask & ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&activate_dedicated_eps_bearer_context_request->protocolconfigurationoptions, - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.h deleted file mode 100644 index cc7d65555a6704970d15bdb9706800d706db1f5b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDedicatedEpsBearerContextRequest.h +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "LinkedEpsBearerIdentity.h" -#include "EpsQualityOfService.h" -#include "TrafficFlowTemplate.h" -#include "TransactionIdentifier.h" -#include "QualityOfService.h" -#include "LlcServiceAccessPointIdentifier.h" -#include "RadioPriority.h" -#include "PacketFlowIdentifier.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_H_ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH ( \ - EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH + \ - TRAFFIC_FLOW_TEMPLATE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ - EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - TRAFFIC_FLOW_TEMPLATE_MAXIMUM_LENGTH + \ - TRANSACTION_IDENTIFIER_MAXIMUM_LENGTH + \ - QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MAXIMUM_LENGTH + \ - RADIO_PRIORITY_MAXIMUM_LENGTH + \ - PACKET_FLOW_IDENTIFIER_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT (1<<0) -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT (1<<1) -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT (1<<2) -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT (1<<3) -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT (1<<4) -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<5) - -typedef enum activate_dedicated_eps_bearer_context_request_iei_tag { - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI = 0x5D, /* 0x5D = 93 */ - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI = 0x30, /* 0x30 = 48 */ - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI = 0x32, /* 0x32 = 50 */ - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI = 0x80, /* 0x80 = 128 */ - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI = 0x34, /* 0x34 = 52 */ - ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} activate_dedicated_eps_bearer_context_request_iei; - -/* - * Message name: Activate dedicated EPS bearer context request - * Description: This message is sent by the network to the UE to request activation of a dedicated EPS bearer context associated with the same PDN address(es) and APN as an already active default EPS bearer context. See table 8.3.3.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct activate_dedicated_eps_bearer_context_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - LinkedEpsBearerIdentity linkedepsbeareridentity; - EpsQualityOfService epsqos; - TrafficFlowTemplate tft; - /* Optional fields */ - uint32_t presencemask; - TransactionIdentifier transactionidentifier; - QualityOfService negotiatedqos; - LlcServiceAccessPointIdentifier negotiatedllcsapi; - RadioPriority radiopriority; - PacketFlowIdentifier packetflowidentifier; - ProtocolConfigurationOptions protocolconfigurationoptions; -} activate_dedicated_eps_bearer_context_request_msg; - -int decode_activate_dedicated_eps_bearer_context_request(activate_dedicated_eps_bearer_context_request_msg *activatededicatedepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -int encode_activate_dedicated_eps_bearer_context_request(activate_dedicated_eps_bearer_context_request_msg *activatededicatedepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.c deleted file mode 100644 index a4806d58d4b4a6c2d2ae29c59d15141708a75f59..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.c +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ActivateDefaultEpsBearerContextAccept.h" - -int decode_activate_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activate_default_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&activate_default_eps_bearer_context_accept->protocolconfigurationoptions, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_accept->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_activate_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activate_default_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - if ((activate_default_eps_bearer_context_accept->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&activate_default_eps_bearer_context_accept->protocolconfigurationoptions, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.h deleted file mode 100644 index c678d9b9d2898d6c37cc711b4c06541c530c0621..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextAccept.h +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_H_ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_MAXIMUM_LENGTH ( \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum activate_default_eps_bearer_context_accept_iei_tag { - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} activate_default_eps_bearer_context_accept_iei; - -/* - * Message name: Activate default EPS bearer context accept - * Description: This message is sent by the UE to the network to acknowledge activation of a default EPS bearer context. See table 8.3.4.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct activate_default_eps_bearer_context_accept_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} activate_default_eps_bearer_context_accept_msg; - -int decode_activate_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activatedefaultepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -int encode_activate_default_eps_bearer_context_accept(activate_default_eps_bearer_context_accept_msg *activatedefaultepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.c deleted file mode 100644 index a8252622c865fbf94a138bac6d17a9ed571010f6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.c +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ActivateDefaultEpsBearerContextReject.h" - -int decode_activate_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activate_default_eps_bearer_context_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&activate_default_eps_bearer_context_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&activate_default_eps_bearer_context_reject->protocolconfigurationoptions, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_reject->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_activate_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activate_default_eps_bearer_context_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_esm_cause(&activate_default_eps_bearer_context_reject->esmcause, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((activate_default_eps_bearer_context_reject->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&activate_default_eps_bearer_context_reject->protocolconfigurationoptions, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.h deleted file mode 100644 index 2bfe844c6b3ac44dd1ce169939c39027552c5e1e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextReject.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_H_ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum activate_default_eps_bearer_context_reject_iei_tag { - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} activate_default_eps_bearer_context_reject_iei; - -/* - * Message name: Activate default EPS bearer context reject - * Description: This message is sent by UE to the network to reject activation of a default EPS bearer context. See table 8.3.5.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct activate_default_eps_bearer_context_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} activate_default_eps_bearer_context_reject_msg; - -int decode_activate_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activatedefaultepsbearercontextreject, uint8_t *buffer, uint32_t len); - -int encode_activate_default_eps_bearer_context_reject(activate_default_eps_bearer_context_reject_msg *activatedefaultepsbearercontextreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c deleted file mode 100644 index 3dec0a429a6a1292e629cb679d32c69e566e377f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.c +++ /dev/null @@ -1,341 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ActivateDefaultEpsBearerContextRequest.h" - -int decode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activate_default_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_eps_quality_of_service(&activate_default_eps_bearer_context_request->epsqos, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_access_point_name(&activate_default_eps_bearer_context_request->accesspointname, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_pdn_address(&activate_default_eps_bearer_context_request->pdnaddress, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI: - if ((decoded_result = - decode_transaction_identifier(&activate_default_eps_bearer_context_request->transactionidentifier, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT; - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI: - if ((decoded_result = - decode_quality_of_service(&activate_default_eps_bearer_context_request->negotiatedqos, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT; - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI: - if ((decoded_result = - decode_llc_service_access_point_identifier(&activate_default_eps_bearer_context_request->negotiatedllcsapi, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI: - if ((decoded_result = - decode_radio_priority(&activate_default_eps_bearer_context_request->radiopriority, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI: - if ((decoded_result = - decode_packet_flow_identifier(&activate_default_eps_bearer_context_request->packetflowidentifier, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI: - if ((decoded_result = - decode_apn_aggregate_maximum_bit_rate(&activate_default_eps_bearer_context_request->apnambr, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT; - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI: - if ((decoded_result = - decode_esm_cause(&activate_default_eps_bearer_context_request->esmcause, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&activate_default_eps_bearer_context_request->protocolconfigurationoptions, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activate_default_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_eps_quality_of_service(&activate_default_eps_bearer_context_request->epsqos, - 0, buffer + encoded, len - encoded)) < 0) { //Return in case of error - LOG_TRACE(ERROR, "ESM ENCODE epsqos"); - return encode_result; - } else - encoded += encode_result; - - if ((encode_result = - encode_access_point_name(&activate_default_eps_bearer_context_request->accesspointname, - 0, buffer + encoded, len - encoded)) < 0) { //Return in case of error - LOG_TRACE(ERROR, "ESM ENCODE accesspointname"); - return encode_result; - } else - encoded += encode_result; - - if ((encode_result = - encode_pdn_address(&activate_default_eps_bearer_context_request->pdnaddress, - 0, buffer + encoded, len - encoded)) < 0) { //Return in case of error - LOG_TRACE(ERROR, "ESM ENCODE pdnaddress"); - return encode_result; - } else - encoded += encode_result; - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT) { - if ((encode_result = - encode_transaction_identifier(&activate_default_eps_bearer_context_request->transactionidentifier, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI, - buffer + encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE transactionidentifier"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT) { - if ((encode_result = - encode_quality_of_service(&activate_default_eps_bearer_context_request->negotiatedqos, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI, - buffer + encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE negotiatedqos"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { - if ((encode_result = - encode_llc_service_access_point_identifier(&activate_default_eps_bearer_context_request->negotiatedllcsapi, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, - buffer + encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE negotiatedllcsapi"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) { - if ((encode_result = - encode_radio_priority(&activate_default_eps_bearer_context_request->radiopriority, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, - buffer + encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE radiopriority"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { - if ((encode_result = - encode_packet_flow_identifier(&activate_default_eps_bearer_context_request->packetflowidentifier, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, - buffer + encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE packetflowidentifier"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) { - if ((encode_result = - encode_apn_aggregate_maximum_bit_rate(&activate_default_eps_bearer_context_request->apnambr, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, buffer + - encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE apnambr"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) { - if ((encode_result = - encode_esm_cause(&activate_default_eps_bearer_context_request->esmcause, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI, buffer - + encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE esmcause"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - -#if 0 /* LW: force Protocol Configuration Options to be included in the ESM message */ - { -#define CONFIGURATION_PROTOCOL_PPP 0 - -#define PROTOCOL_ID_IPCP 0x8021 -#define PROTOCOL_ID_DNS_SERVER_IPV4_ADDRESS 0x000D - - /* Force this item to be present */ - activate_default_eps_bearer_context_request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - /* Fill this item with data from PFT trace */ - activate_default_eps_bearer_context_request->protocolconfigurationoptions.configurationprotol = CONFIGURATION_PROTOCOL_PPP; - activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolid = PROTOCOL_ID_IPCP; - activate_default_eps_bearer_context_request->protocolconfigurationoptions.lengthofprotocolid = 16; /* Size of PROTOCOL_ID_IPCP */ - activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolidcontents.value = (uint8_t *) - /* PROTOCOL_ID_IPCP data */ - "\x03\x00\x00\x10\x81\x06\xC0\xA8\x0C\x64\x83\x06\xC0\xA8\x6A\x0C"; - /* Additional parameters PROTOCOL_ID_DNS_SERVER_IPV4_ADDRESS data */ - //"\x00\x0d\x04\x52\x61\x00\x78" - /* Additional parameters PROTOCOL_ID_DNS_SERVER_IPV4_ADDRESS data */ - //"\x00\x0d\x04\x52\x61\x01\x78"; - //activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolidcontents.length = 16 + 7 + 7; - activate_default_eps_bearer_context_request->protocolconfigurationoptions.protocolidcontents.length = 16; - } -#endif - - if ((activate_default_eps_bearer_context_request->presencemask & ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&activate_default_eps_bearer_context_request->protocolconfigurationoptions, - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) { - LOG_TRACE(ERROR, "ESM ENCODE protocolconfigurationoptions"); - // Return in case of error - return encode_result; - } else - encoded += encode_result; - } - - LOG_TRACE(INFO, "ESM ENCODED activate_default_eps_bearer_context_request"); - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.h deleted file mode 100644 index 749c64f93d0bacbb02138c39b9ab17985dade2bf..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ActivateDefaultEpsBearerContextRequest.h +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EpsQualityOfService.h" -#include "AccessPointName.h" -#include "PdnAddress.h" -#include "TransactionIdentifier.h" -#include "QualityOfService.h" -#include "LlcServiceAccessPointIdentifier.h" -#include "RadioPriority.h" -#include "PacketFlowIdentifier.h" -#include "ApnAggregateMaximumBitRate.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_H_ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH ( \ - EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH + \ - ACCESS_POINT_NAME_MINIMUM_LENGTH + \ - PDN_ADDRESS_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ - EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - ACCESS_POINT_NAME_MAXIMUM_LENGTH + \ - PDN_ADDRESS_MAXIMUM_LENGTH + \ - TRANSACTION_IDENTIFIER_MAXIMUM_LENGTH + \ - QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MAXIMUM_LENGTH + \ - RADIO_PRIORITY_MAXIMUM_LENGTH + \ - PACKET_FLOW_IDENTIFIER_MAXIMUM_LENGTH + \ - APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_LENGTH + \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_PRESENT (1<<0) -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_PRESENT (1<<1) -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT (1<<2) -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT (1<<3) -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT (1<<4) -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT (1<<5) -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT (1<<6) -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<7) - -typedef enum activate_default_eps_bearer_context_request_iei_tag { - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_TRANSACTION_IDENTIFIER_IEI = 0x5D, /* 0x5D = 93 */ - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_QOS_IEI = 0x30, /* 0x30 = 48 */ - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI = 0x32, /* 0x32 = 50 */ - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI = 0x80, /* 0x80 = 128 */ - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI = 0x34, /* 0x34 = 52 */ - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI = 0x5E, /* 0x5E = 94 */ - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_IEI = 0x58, /* 0x58 = 88 */ - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} activate_default_eps_bearer_context_request_iei; - -/* - * Message name: Activate default EPS bearer context request - * Description: This message is sent by the network to the UE to request activation of a default EPS bearer context. See table 8.3.6.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct activate_default_eps_bearer_context_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EpsQualityOfService epsqos; - AccessPointName accesspointname; - PdnAddress pdnaddress; - /* Optional fields */ - uint32_t presencemask; - TransactionIdentifier transactionidentifier; - QualityOfService negotiatedqos; - LlcServiceAccessPointIdentifier negotiatedllcsapi; - RadioPriority radiopriority; - PacketFlowIdentifier packetflowidentifier; - ApnAggregateMaximumBitRate apnambr; - EsmCause esmcause; - ProtocolConfigurationOptions protocolconfigurationoptions; -} activate_default_eps_bearer_context_request_msg; - -int decode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activatedefaultepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -int encode_activate_default_eps_bearer_context_request(activate_default_eps_bearer_context_request_msg *activatedefaultepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.c deleted file mode 100644 index 9ca43d45f809afe00eb66775ac10197b3d70ccd4..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.c +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "BearerResourceAllocationReject.h" - -int decode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearer_resource_allocation_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, BEARER_RESOURCE_ALLOCATION_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&bearer_resource_allocation_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&bearer_resource_allocation_reject->protocolconfigurationoptions, - BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - bearer_resource_allocation_reject->presencemask |= BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearer_resource_allocation_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, BEARER_RESOURCE_ALLOCATION_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_esm_cause(&bearer_resource_allocation_reject->esmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((bearer_resource_allocation_reject->presencemask & BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&bearer_resource_allocation_reject->protocolconfigurationoptions, - BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.h deleted file mode 100644 index e31a6f6d8a40111045b5bc675227902d0c8047f8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationReject.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef BEARER_RESOURCE_ALLOCATION_REJECT_H_ -#define BEARER_RESOURCE_ALLOCATION_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define BEARER_RESOURCE_ALLOCATION_REJECT_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define BEARER_RESOURCE_ALLOCATION_REJECT_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum bearer_resource_allocation_reject_iei_tag { - BEARER_RESOURCE_ALLOCATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} bearer_resource_allocation_reject_iei; - -/* - * Message name: Bearer resource allocation reject - * Description: This message is sent by the network to the UE to reject the allocation of a dedicated bearer resource. See table 8.3.7.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct bearer_resource_allocation_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} bearer_resource_allocation_reject_msg; - -int decode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearerresourceallocationreject, uint8_t *buffer, uint32_t len); - -int encode_bearer_resource_allocation_reject(bearer_resource_allocation_reject_msg *bearerresourceallocationreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(BEARER_RESOURCE_ALLOCATION_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.c deleted file mode 100644 index 73968f489bc2b85e52f4b5c7d6d16e2ae86ccd0c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.c +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "BearerResourceAllocationRequest.h" - -int decode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearer_resource_allocation_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, BEARER_RESOURCE_ALLOCATION_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_linked_eps_bearer_identity(&bearer_resource_allocation_request->linkedepsbeareridentity, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_traffic_flow_aggregate_description(&bearer_resource_allocation_request->trafficflowaggregate, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - if ((decoded_result = decode_eps_quality_of_service(&bearer_resource_allocation_request->requiredtrafficflowqos, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&bearer_resource_allocation_request->protocolconfigurationoptions, - BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - bearer_resource_allocation_request->presencemask |= BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearer_resource_allocation_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, BEARER_RESOURCE_ALLOCATION_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_linked_eps_bearer_identity(&bearer_resource_allocation_request->linkedepsbeareridentity) & 0x0f) << 4) | 0x00; - encoded++; - - if ((encode_result = - encode_traffic_flow_aggregate_description(&bearer_resource_allocation_request->trafficflowaggregate, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((encode_result = - encode_eps_quality_of_service(&bearer_resource_allocation_request->requiredtrafficflowqos, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((bearer_resource_allocation_request->presencemask & BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&bearer_resource_allocation_request->protocolconfigurationoptions, - BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.h deleted file mode 100644 index 48a28c5090b134f5e94cd9bd0f39fb20b84c944e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceAllocationRequest.h +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "LinkedEpsBearerIdentity.h" -#include "TrafficFlowAggregateDescription.h" -#include "EpsQualityOfService.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef BEARER_RESOURCE_ALLOCATION_REQUEST_H_ -#define BEARER_RESOURCE_ALLOCATION_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define BEARER_RESOURCE_ALLOCATION_REQUEST_MINIMUM_LENGTH ( \ - TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MINIMUM_LENGTH + \ - EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define BEARER_RESOURCE_ALLOCATION_REQUEST_MAXIMUM_LENGTH ( \ - TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MAXIMUM_LENGTH + \ - EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum bearer_resource_allocation_request_iei_tag { - BEARER_RESOURCE_ALLOCATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} bearer_resource_allocation_request_iei; - -/* - * Message name: Bearer resource allocation request - * Description: This message is sent by the UE to the network to request the allocation of a dedicated bearer resource. See table 8.3.8.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct bearer_resource_allocation_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - LinkedEpsBearerIdentity linkedepsbeareridentity; - TrafficFlowAggregateDescription trafficflowaggregate; - EpsQualityOfService requiredtrafficflowqos; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} bearer_resource_allocation_request_msg; - -int decode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearerresourceallocationrequest, uint8_t *buffer, uint32_t len); - -int encode_bearer_resource_allocation_request(bearer_resource_allocation_request_msg *bearerresourceallocationrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(BEARER_RESOURCE_ALLOCATION_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.c deleted file mode 100644 index 52fbc55b69fb24f803b27bc97e64c8bd97046749..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.c +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "BearerResourceModificationReject.h" - -int decode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearer_resource_modification_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, BEARER_RESOURCE_MODIFICATION_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&bearer_resource_modification_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&bearer_resource_modification_reject->protocolconfigurationoptions, - BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - bearer_resource_modification_reject->presencemask |= BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearer_resource_modification_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, BEARER_RESOURCE_MODIFICATION_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_esm_cause(&bearer_resource_modification_reject->esmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((bearer_resource_modification_reject->presencemask & BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&bearer_resource_modification_reject->protocolconfigurationoptions, - BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.h deleted file mode 100644 index 07a9d00e0856f2659e88943c6bcef91dca80419b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationReject.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef BEARER_RESOURCE_MODIFICATION_REJECT_H_ -#define BEARER_RESOURCE_MODIFICATION_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define BEARER_RESOURCE_MODIFICATION_REJECT_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define BEARER_RESOURCE_MODIFICATION_REJECT_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum bearer_resource_modification_reject_iei_tag { - BEARER_RESOURCE_MODIFICATION_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} bearer_resource_modification_reject_iei; - -/* - * Message name: Bearer resource modification reject - * Description: This message is sent by the network to the UE to reject the modification of a dedicated bearer resource. See table 8.3.9.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct bearer_resource_modification_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} bearer_resource_modification_reject_msg; - -int decode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearerresourcemodificationreject, uint8_t *buffer, uint32_t len); - -int encode_bearer_resource_modification_reject(bearer_resource_modification_reject_msg *bearerresourcemodificationreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(BEARER_RESOURCE_MODIFICATION_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.c deleted file mode 100644 index a3b821ee4766392c8c05114bc843e9c570e9bea7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.c +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "BearerResourceModificationRequest.h" - -int decode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearer_resource_modification_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, BEARER_RESOURCE_MODIFICATION_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_linked_eps_bearer_identity(&bearer_resource_modification_request->epsbeareridentityforpacketfilter, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - decoded++; - - if ((decoded_result = decode_traffic_flow_aggregate_description(&bearer_resource_modification_request->trafficflowaggregate, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI: - if ((decoded_result = - decode_eps_quality_of_service(&bearer_resource_modification_request->requiredtrafficflowqos, - BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - bearer_resource_modification_request->presencemask |= BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT; - break; - - case BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI: - if ((decoded_result = - decode_esm_cause(&bearer_resource_modification_request->esmcause, - BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI, buffer - + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - bearer_resource_modification_request->presencemask |= BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT; - break; - - case BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&bearer_resource_modification_request->protocolconfigurationoptions, - BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - bearer_resource_modification_request->presencemask |= BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearer_resource_modification_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, BEARER_RESOURCE_MODIFICATION_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_linked_eps_bearer_identity(&bearer_resource_modification_request->epsbeareridentityforpacketfilter) & 0x0f) << 4) | 0x00; - encoded++; - - if ((encode_result = - encode_traffic_flow_aggregate_description(&bearer_resource_modification_request->trafficflowaggregate, - 0, buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((bearer_resource_modification_request->presencemask & BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT) - == BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT) { - if ((encode_result = - encode_eps_quality_of_service(&bearer_resource_modification_request->requiredtrafficflowqos, - BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((bearer_resource_modification_request->presencemask & BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT) - == BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT) { - if ((encode_result = - encode_esm_cause(&bearer_resource_modification_request->esmcause, - BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((bearer_resource_modification_request->presencemask & BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&bearer_resource_modification_request->protocolconfigurationoptions, - BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.h deleted file mode 100644 index f17a89b3481dcaa3b4980e57d079c5b606aa43d7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/BearerResourceModificationRequest.h +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "LinkedEpsBearerIdentity.h" -#include "TrafficFlowAggregateDescription.h" -#include "EpsQualityOfService.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef BEARER_RESOURCE_MODIFICATION_REQUEST_H_ -#define BEARER_RESOURCE_MODIFICATION_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define BEARER_RESOURCE_MODIFICATION_REQUEST_MINIMUM_LENGTH ( \ - TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define BEARER_RESOURCE_MODIFICATION_REQUEST_MAXIMUM_LENGTH ( \ - TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MAXIMUM_LENGTH + \ - EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_PRESENT (1<<0) -# define BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_PRESENT (1<<1) -# define BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<2) - -typedef enum bearer_resource_modification_request_iei_tag { - BEARER_RESOURCE_MODIFICATION_REQUEST_REQUIRED_TRAFFIC_FLOW_QOS_IEI = 0x5B, /* 0x5B = 91 */ - BEARER_RESOURCE_MODIFICATION_REQUEST_ESM_CAUSE_IEI = 0x58, /* 0x58 = 88 */ - BEARER_RESOURCE_MODIFICATION_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} bearer_resource_modification_request_iei; - -/* - * Message name: Bearer resource modification request - * Description: This message is sent by the UE to the network to request the modification of a dedicated bearer resource. See table 8.3.10.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct bearer_resource_modification_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - LinkedEpsBearerIdentity epsbeareridentityforpacketfilter; - TrafficFlowAggregateDescription trafficflowaggregate; - /* Optional fields */ - uint32_t presencemask; - EpsQualityOfService requiredtrafficflowqos; - EsmCause esmcause; - ProtocolConfigurationOptions protocolconfigurationoptions; -} bearer_resource_modification_request_msg; - -int decode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearerresourcemodificationrequest, uint8_t *buffer, uint32_t len); - -int encode_bearer_resource_modification_request(bearer_resource_modification_request_msg *bearerresourcemodificationrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(BEARER_RESOURCE_MODIFICATION_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/COPYING b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.c deleted file mode 100644 index 38383ecc07c208a540b1104fb0278a9edd2b3bc1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.c +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DeactivateEpsBearerContextAccept.h" - -int decode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivate_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&deactivate_eps_bearer_context_accept->protocolconfigurationoptions, - DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - deactivate_eps_bearer_context_accept->presencemask |= DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivate_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - if ((deactivate_eps_bearer_context_accept->presencemask & DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&deactivate_eps_bearer_context_accept->protocolconfigurationoptions, - DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.h deleted file mode 100644 index 0ef58548f5860d499285dd1898af02e2d123a0d4..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextAccept.h +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_H_ -#define DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_MAXIMUM_LENGTH ( \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum deactivate_eps_bearer_context_accept_iei_tag { - DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} deactivate_eps_bearer_context_accept_iei; - -/* - * Message name: Deactivate EPS bearer context accept - * Description: This message is sent by the UE to acknowledge deactivation of the EPS bearer context requested in the corresponding Deactivate EPS bearer context request message. See table 8.3.11.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct deactivate_eps_bearer_context_accept_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} deactivate_eps_bearer_context_accept_msg; - -int decode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivateepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -int encode_deactivate_eps_bearer_context_accept(deactivate_eps_bearer_context_accept_msg *deactivateepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.c deleted file mode 100644 index 6030a119a3907d3924c80f15c6ae450ae06769c3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.c +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DeactivateEpsBearerContextRequest.h" - -int decode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivate_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&deactivate_eps_bearer_context_request->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&deactivate_eps_bearer_context_request->protocolconfigurationoptions, - DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - deactivate_eps_bearer_context_request->presencemask |= DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivate_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_esm_cause(&deactivate_eps_bearer_context_request->esmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((deactivate_eps_bearer_context_request->presencemask & DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&deactivate_eps_bearer_context_request->protocolconfigurationoptions, - DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.h deleted file mode 100644 index b85c5710e8ac78dc9c8a4145ea4af370314f37b1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/DeactivateEpsBearerContextRequest.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_H_ -#define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum deactivate_eps_bearer_context_request_iei_tag { - DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} deactivate_eps_bearer_context_request_iei; - -/* - * Message name: Deactivate EPS bearer context request - * Description: This message is sent by the network to request deactivation of an active EPS bearer context. See table 8.3.12.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct deactivate_eps_bearer_context_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} deactivate_eps_bearer_context_request_msg; - -int decode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivateepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -int encode_deactivate_eps_bearer_context_request(deactivate_eps_bearer_context_request_msg *deactivateepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.c deleted file mode 100644 index 0f3d22f63f56efd9e151a665e84837c981ed1dc5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.c +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EsmInformationRequest.h" - -int decode_esm_information_request(esm_information_request_msg *esm_information_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ESM_INFORMATION_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - return decoded; -} - -int encode_esm_information_request(esm_information_request_msg *esm_information_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ESM_INFORMATION_REQUEST_MINIMUM_LENGTH, len); - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.h deleted file mode 100644 index 21bf9bc0ca0406b57de26adf700b4542052750ae..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationRequest.h +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" - -#ifndef ESM_INFORMATION_REQUEST_H_ -#define ESM_INFORMATION_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ESM_INFORMATION_REQUEST_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ESM_INFORMATION_REQUEST_MAXIMUM_LENGTH (0) - -/* - * Message name: ESM information request - * Description: This message is sent by the network to the UE to request the UE to provide ESM information, i.e. protocol configuration options or APN or both. See table 8.3.13.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct esm_information_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; -} esm_information_request_msg; - -int decode_esm_information_request(esm_information_request_msg *esminformationrequest, uint8_t *buffer, uint32_t len); - -int encode_esm_information_request(esm_information_request_msg *esminformationrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ESM_INFORMATION_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.c deleted file mode 100644 index 1609de75f4cf75fe1023773b6006ea388c2032c0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.c +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EsmInformationResponse.h" - -int decode_esm_information_response(esm_information_response_msg *esm_information_response, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ESM_INFORMATION_RESPONSE_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI: - if ((decoded_result = - decode_access_point_name(&esm_information_response->accesspointname, - ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - esm_information_response->presencemask |= ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT; - break; - - case ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&esm_information_response->protocolconfigurationoptions, - ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - esm_information_response->presencemask |= ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_esm_information_response(esm_information_response_msg *esm_information_response, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ESM_INFORMATION_RESPONSE_MINIMUM_LENGTH, len); - - if ((esm_information_response->presencemask & ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT) - == ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT) { - if ((encode_result = - encode_access_point_name(&esm_information_response->accesspointname, - ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((esm_information_response->presencemask & ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&esm_information_response->protocolconfigurationoptions, - ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.h deleted file mode 100644 index 186c582e91a67c1c8a682db7053957bc8d9fece4..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmInformationResponse.h +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "AccessPointName.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef ESM_INFORMATION_RESPONSE_H_ -#define ESM_INFORMATION_RESPONSE_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ESM_INFORMATION_RESPONSE_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ESM_INFORMATION_RESPONSE_MAXIMUM_LENGTH ( \ - ACCESS_POINT_NAME_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT (1<<0) -# define ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<1) - -typedef enum esm_information_response_iei_tag { - ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_IEI = 0x28, /* 0x28 = 40 */ - ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} esm_information_response_iei; - -/* - * Message name: ESM information response - * Description: This message is sent by the UE to the network in response to an ESM INFORMATION REQUEST message and provides the requested ESM information. See table 8.3.14.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct esm_information_response_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - AccessPointName accesspointname; - ProtocolConfigurationOptions protocolconfigurationoptions; -} esm_information_response_msg; - -int decode_esm_information_response(esm_information_response_msg *esminformationresponse, uint8_t *buffer, uint32_t len); - -int encode_esm_information_response(esm_information_response_msg *esminformationresponse, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ESM_INFORMATION_RESPONSE_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.c deleted file mode 100644 index 0297b0eecd8c0afe24c286497aa039211a37984a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.c +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EsmStatus.h" - -int decode_esm_status(esm_status_msg *esm_status, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ESM_STATUS_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&esm_status->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - return decoded; -} - -int encode_esm_status(esm_status_msg *esm_status, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ESM_STATUS_MINIMUM_LENGTH, len); - - if ((encode_result = encode_esm_cause(&esm_status->esmcause, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.h deleted file mode 100644 index 5bbce9e06de45890e855cada05257c25cef97986..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/EsmStatus.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" - -#ifndef ESM_STATUS_H_ -#define ESM_STATUS_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define ESM_STATUS_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define ESM_STATUS_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH ) - - -/* - * Message name: ESM status - * Description: This message is sent by the network or the UE to pass information on the status of the indicated EPS bearer context and report certain error conditions (e.g. as listed in clause 7). See table 8.3.15.1. - * Significance: dual - * Direction: both - */ - -typedef struct esm_status_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; -} esm_status_msg; - -int decode_esm_status(esm_status_msg *esmstatus, uint8_t *buffer, uint32_t len); - -int encode_esm_status(esm_status_msg *esmstatus, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(ESM_STATUS_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/Makefile b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/Makefile deleted file mode 100644 index 8786e88c13376fcee693750ae9eea827dc9e79be..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(IESDIR) - -TARGET = $(LIBESMMSG) -TARGETS = $(TARGET).a $(TARGET).so - -all: $(TARGETS) - -%.o: %.c %.h Makefile $(LIBDIR)/$(LIBIES).a $(UTILDIR)/TLVEncoder.h $(UTILDIR)/TLVDecoder.h - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET).a: $(OBJS) - @$(RM) $@ - @$(AR) $(ARFLAGS) $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -$(TARGET).so: $(OBJS) - @$(LD) -G -o $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGETS) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.c deleted file mode 100644 index b7da151edbfdc645e72889dbf7ebe212bcc20f0c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.c +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ModifyEpsBearerContextAccept.h" - -int decode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modify_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&modify_eps_bearer_context_accept->protocolconfigurationoptions, - MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_accept->presencemask |= MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modify_eps_bearer_context_accept, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH, len); - - if ((modify_eps_bearer_context_accept->presencemask & MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&modify_eps_bearer_context_accept->protocolconfigurationoptions, - MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.h deleted file mode 100644 index e80a7f8dbc1de8fd4b08cbb1a2e7d5d4559953f3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextAccept.h +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef MODIFY_EPS_BEARER_CONTEXT_ACCEPT_H_ -#define MODIFY_EPS_BEARER_CONTEXT_ACCEPT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define MODIFY_EPS_BEARER_CONTEXT_ACCEPT_MAXIMUM_LENGTH ( \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum modify_eps_bearer_context_accept_iei_tag { - MODIFY_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} modify_eps_bearer_context_accept_iei; - -/* - * Message name: Modify EPS bearer context accept - * Description: This message is sent by the UE to the network to acknowledge the modification of an active EPS bearer context. See table 8.3.16.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct modify_eps_bearer_context_accept_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} modify_eps_bearer_context_accept_msg; - -int decode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modifyepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -int encode_modify_eps_bearer_context_accept(modify_eps_bearer_context_accept_msg *modifyepsbearercontextaccept, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(MODIFY_EPS_BEARER_CONTEXT_ACCEPT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.c deleted file mode 100644 index c3b216bb242b0ba6f219b8f55243604cb651f7d8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.c +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ModifyEpsBearerContextReject.h" - -int decode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modify_eps_bearer_context_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, MODIFY_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&modify_eps_bearer_context_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&modify_eps_bearer_context_reject->protocolconfigurationoptions, - MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_reject->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modify_eps_bearer_context_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MODIFY_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = - encode_esm_cause(&modify_eps_bearer_context_reject->esmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((modify_eps_bearer_context_reject->presencemask & MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&modify_eps_bearer_context_reject->protocolconfigurationoptions, - MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.h deleted file mode 100644 index 2c023c914bd07c73a0638bde5e04e01f810d3f3f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextReject.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef MODIFY_EPS_BEARER_CONTEXT_REJECT_H_ -#define MODIFY_EPS_BEARER_CONTEXT_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define MODIFY_EPS_BEARER_CONTEXT_REJECT_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define MODIFY_EPS_BEARER_CONTEXT_REJECT_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum modify_eps_bearer_context_reject_iei_tag { - MODIFY_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} modify_eps_bearer_context_reject_iei; - -/* - * Message name: Modify EPS bearer context reject - * Description: This message is sent by the UE or the network to reject a modification of an active EPS bearer context. See table 8.3.17.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct modify_eps_bearer_context_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} modify_eps_bearer_context_reject_msg; - -int decode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modifyepsbearercontextreject, uint8_t *buffer, uint32_t len); - -int encode_modify_eps_bearer_context_reject(modify_eps_bearer_context_reject_msg *modifyepsbearercontextreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(MODIFY_EPS_BEARER_CONTEXT_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.c deleted file mode 100644 index 62e7fc8a2283b4c8ef6c38eeaf24affee3faf8a3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.c +++ /dev/null @@ -1,268 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ModifyEpsBearerContextRequest.h" - -int decode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modify_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, MODIFY_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI: - if ((decoded_result = - decode_eps_quality_of_service(&modify_eps_bearer_context_request->newepsqos, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT; - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI: - if ((decoded_result = - decode_traffic_flow_template(&modify_eps_bearer_context_request->tft, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT; - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI: - if ((decoded_result = - decode_quality_of_service(&modify_eps_bearer_context_request->newqos, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT; - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI: - if ((decoded_result = - decode_llc_service_access_point_identifier(&modify_eps_bearer_context_request->negotiatedllcsapi, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT; - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI: - if ((decoded_result = - decode_radio_priority(&modify_eps_bearer_context_request->radiopriority, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT; - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI: - if ((decoded_result = - decode_packet_flow_identifier(&modify_eps_bearer_context_request->packetflowidentifier, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT; - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI: - if ((decoded_result = - decode_apn_aggregate_maximum_bit_rate(&modify_eps_bearer_context_request->apnambr, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT; - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&modify_eps_bearer_context_request->protocolconfigurationoptions, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - modify_eps_bearer_context_request->presencemask |= MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modify_eps_bearer_context_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MODIFY_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH, len); - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT) { - if ((encode_result = - encode_eps_quality_of_service(&modify_eps_bearer_context_request->newepsqos, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT) { - if ((encode_result = - encode_traffic_flow_template(&modify_eps_bearer_context_request->tft, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI, buffer + encoded, len - - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT) { - if ((encode_result = - encode_quality_of_service(&modify_eps_bearer_context_request->newqos, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT) { - if ((encode_result = - encode_llc_service_access_point_identifier(&modify_eps_bearer_context_request->negotiatedllcsapi, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI, buffer - + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT) { - if ((encode_result = - encode_radio_priority(&modify_eps_bearer_context_request->radiopriority, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT) { - if ((encode_result = - encode_packet_flow_identifier(&modify_eps_bearer_context_request->packetflowidentifier, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT) { - if ((encode_result = - encode_apn_aggregate_maximum_bit_rate(&modify_eps_bearer_context_request->apnambr, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((modify_eps_bearer_context_request->presencemask & MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&modify_eps_bearer_context_request->protocolconfigurationoptions, - MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.h deleted file mode 100644 index 1c2f24950c17bbf79da6a5c77ee63acdc5b47115..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/ModifyEpsBearerContextRequest.h +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EpsQualityOfService.h" -#include "TrafficFlowTemplate.h" -#include "QualityOfService.h" -#include "LlcServiceAccessPointIdentifier.h" -#include "RadioPriority.h" -#include "PacketFlowIdentifier.h" -#include "ApnAggregateMaximumBitRate.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef MODIFY_EPS_BEARER_CONTEXT_REQUEST_H_ -#define MODIFY_EPS_BEARER_CONTEXT_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define MODIFY_EPS_BEARER_CONTEXT_REQUEST_MINIMUM_LENGTH (0) - -/* Maximum length macro. Formed by maximum length of each field */ -#define MODIFY_EPS_BEARER_CONTEXT_REQUEST_MAXIMUM_LENGTH ( \ - EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - TRAFFIC_FLOW_TEMPLATE_MAXIMUM_LENGTH + \ - QUALITY_OF_SERVICE_MAXIMUM_LENGTH + \ - LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MAXIMUM_LENGTH + \ - RADIO_PRIORITY_MAXIMUM_LENGTH + \ - PACKET_FLOW_IDENTIFIER_MAXIMUM_LENGTH + \ - APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_PRESENT (1<<0) -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_PRESENT (1<<1) -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_PRESENT (1<<2) -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_PRESENT (1<<3) -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_PRESENT (1<<4) -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_PRESENT (1<<5) -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT (1<<6) -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<7) - -typedef enum modify_eps_bearer_context_request_iei_tag { - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_EPS_QOS_IEI = 0x5B, /* 0x5B = 91 */ - MODIFY_EPS_BEARER_CONTEXT_REQUEST_TFT_IEI = 0x36, /* 0x36 = 54 */ - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEW_QOS_IEI = 0x30, /* 0x30 = 48 */ - MODIFY_EPS_BEARER_CONTEXT_REQUEST_NEGOTIATED_LLC_SAPI_IEI = 0x32, /* 0x32 = 50 */ - MODIFY_EPS_BEARER_CONTEXT_REQUEST_RADIO_PRIORITY_IEI = 0x80, /* 0x80 = 128 */ - MODIFY_EPS_BEARER_CONTEXT_REQUEST_PACKET_FLOW_IDENTIFIER_IEI = 0x34, /* 0x34 = 52 */ - MODIFY_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_IEI = 0x5E, /* 0x5E = 94 */ - MODIFY_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} modify_eps_bearer_context_request_iei; - -/* - * Message name: Modify EPS bearer context request - * Description: This message is sent by the network to the UE to request modification of an active EPS bearer context. See table 8.3.18.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct modify_eps_bearer_context_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - /* Optional fields */ - uint32_t presencemask; - EpsQualityOfService newepsqos; - TrafficFlowTemplate tft; - QualityOfService newqos; - LlcServiceAccessPointIdentifier negotiatedllcsapi; - RadioPriority radiopriority; - PacketFlowIdentifier packetflowidentifier; - ApnAggregateMaximumBitRate apnambr; - ProtocolConfigurationOptions protocolconfigurationoptions; -} modify_eps_bearer_context_request_msg; - -int decode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modifyepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -int encode_modify_eps_bearer_context_request(modify_eps_bearer_context_request_msg *modifyepsbearercontextrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(MODIFY_EPS_BEARER_CONTEXT_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.c deleted file mode 100644 index 6d08e046cced7f3b25ab588f2866dcc7b73ececb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.c +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PdnConnectivityReject.h" - -int decode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdn_connectivity_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, PDN_CONNECTIVITY_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&pdn_connectivity_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&pdn_connectivity_reject->protocolconfigurationoptions, - PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - pdn_connectivity_reject->presencemask |= PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdn_connectivity_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDN_CONNECTIVITY_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = encode_esm_cause(&pdn_connectivity_reject->esmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((pdn_connectivity_reject->presencemask & PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&pdn_connectivity_reject->protocolconfigurationoptions, - PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, buffer - + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.h deleted file mode 100644 index 9712f2118c2ad4ef6d60b31753a7325f998e3d7b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityReject.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef PDN_CONNECTIVITY_REJECT_H_ -#define PDN_CONNECTIVITY_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define PDN_CONNECTIVITY_REJECT_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define PDN_CONNECTIVITY_REJECT_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum pdn_connectivity_reject_iei_tag { - PDN_CONNECTIVITY_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} pdn_connectivity_reject_iei; - -/* - * Message name: PDN connectivity reject - * Description: This message is sent by the network to the UE to reject establishment of a PDN connection. See table 8.3.19.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct pdn_connectivity_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} pdn_connectivity_reject_msg; - -int decode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdnconnectivityreject, uint8_t *buffer, uint32_t len); - -int encode_pdn_connectivity_reject(pdn_connectivity_reject_msg *pdnconnectivityreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(PDN_CONNECTIVITY_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.c deleted file mode 100644 index 6ff9acab121118f96d7208a69edd049ffb20c631..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.c +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PdnConnectivityRequest.h" - -int decode_pdn_connectivity_request(pdn_connectivity_request_msg *pdn_connectivity_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, PDN_CONNECTIVITY_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_request_type(&pdn_connectivity_request->pdntype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) - return decoded_result; - - if ((decoded_result = decode_u8_pdn_type(&pdn_connectivity_request->requesttype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) - return decoded_result; - - decoded++; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI: - if ((decoded_result = - decode_esm_information_transfer_flag(&pdn_connectivity_request->esminformationtransferflag, - PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - pdn_connectivity_request->presencemask |= PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT; - break; - - case PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI: - if ((decoded_result = - decode_access_point_name(&pdn_connectivity_request->accesspointname, - PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI, buffer + - decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - pdn_connectivity_request->presencemask |= PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT; - break; - - case PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&pdn_connectivity_request->protocolconfigurationoptions, - PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - pdn_connectivity_request->presencemask |= PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_pdn_connectivity_request(pdn_connectivity_request_msg *pdn_connectivity_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDN_CONNECTIVITY_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = ((encode_u8_pdn_type(&pdn_connectivity_request->pdntype) & 0x0f) << 4) | (encode_u8_request_type(&pdn_connectivity_request->requesttype) & 0x0f); - encoded++; - - if ((pdn_connectivity_request->presencemask & PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT) - == PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT) { - if ((encode_result = - encode_esm_information_transfer_flag(&pdn_connectivity_request->esminformationtransferflag, - PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI, buffer - + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((pdn_connectivity_request->presencemask & PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) - == PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) { - if ((encode_result = - encode_access_point_name(&pdn_connectivity_request->accesspointname, - PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI, buffer + encoded, - len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - if ((pdn_connectivity_request->presencemask & PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&pdn_connectivity_request->protocolconfigurationoptions, - PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.h deleted file mode 100644 index 2a30138f9e315836807795999d88ead27e72a055..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnConnectivityRequest.h +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "NasRequestType.h" -#include "PdnType.h" -#include "EsmInformationTransferFlag.h" -#include "AccessPointName.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef PDN_CONNECTIVITY_REQUEST_H_ -#define PDN_CONNECTIVITY_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define PDN_CONNECTIVITY_REQUEST_MINIMUM_LENGTH ( \ - PDN_TYPE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define PDN_CONNECTIVITY_REQUEST_MAXIMUM_LENGTH ( \ - PDN_TYPE_MAXIMUM_LENGTH + \ - ESM_INFORMATION_TRANSFER_FLAG_MAXIMUM_LENGTH + \ - ACCESS_POINT_NAME_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT (1<<0) -# define PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT (1<<1) -# define PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<2) - -typedef enum pdn_connectivity_request_iei_tag { - PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_IEI = 0xD0, /* 0xD0 = 208 */ - PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_IEI = 0x28, /* 0x28 = 40 */ - PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} pdn_connectivity_request_iei; - -/* - * Message name: PDN connectivity request - * Description: This message is sent by the UE to the network to initiate establishment of a PDN connection. See table 8.3.20.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct pdn_connectivity_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - RequestType requesttype; - PdnType pdntype; - /* Optional fields */ - uint32_t presencemask; - EsmInformationTransferFlag esminformationtransferflag; - AccessPointName accesspointname; - ProtocolConfigurationOptions protocolconfigurationoptions; -} pdn_connectivity_request_msg; - -int decode_pdn_connectivity_request(pdn_connectivity_request_msg *pdnconnectivityrequest, uint8_t *buffer, uint32_t len); - -int encode_pdn_connectivity_request(pdn_connectivity_request_msg *pdnconnectivityrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(PDN_CONNECTIVITY_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.c deleted file mode 100644 index 0e710bf96833c6c4f1e432b0bef509c76c5af93d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.c +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PdnDisconnectReject.h" - -int decode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdn_disconnect_reject, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, PDN_DISCONNECT_REJECT_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_esm_cause(&pdn_disconnect_reject->esmcause, 0, buffer + decoded, len - decoded)) < 0) - return decoded_result; - else - decoded += decoded_result; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&pdn_disconnect_reject->protocolconfigurationoptions, - PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - pdn_disconnect_reject->presencemask |= PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdn_disconnect_reject, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDN_DISCONNECT_REJECT_MINIMUM_LENGTH, len); - - if ((encode_result = encode_esm_cause(&pdn_disconnect_reject->esmcause, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error - return encode_result; - else - encoded += encode_result; - - if ((pdn_disconnect_reject->presencemask & PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&pdn_disconnect_reject->protocolconfigurationoptions, - PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI, buffer + - encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.h deleted file mode 100644 index 3d6508a8695ab1e5db5c6202745441916e8aa8d7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectReject.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "EsmCause.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef PDN_DISCONNECT_REJECT_H_ -#define PDN_DISCONNECT_REJECT_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define PDN_DISCONNECT_REJECT_MINIMUM_LENGTH ( \ - ESM_CAUSE_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define PDN_DISCONNECT_REJECT_MAXIMUM_LENGTH ( \ - ESM_CAUSE_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum pdn_disconnect_reject_iei_tag { - PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} pdn_disconnect_reject_iei; - -/* - * Message name: PDN disconnect reject - * Description: This message is sent by the network to the UE to reject release of a PDN connection. See table 8.3.21.1. - * Significance: dual - * Direction: network to UE - */ - -typedef struct pdn_disconnect_reject_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - EsmCause esmcause; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} pdn_disconnect_reject_msg; - -int decode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdndisconnectreject, uint8_t *buffer, uint32_t len); - -int encode_pdn_disconnect_reject(pdn_disconnect_reject_msg *pdndisconnectreject, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(PDN_DISCONNECT_REJECT_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.c deleted file mode 100644 index 21273840066190a3305dae585a039004dfbb1820..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PdnDisconnectRequest.h" - -int decode_pdn_disconnect_request(pdn_disconnect_request_msg *pdn_disconnect_request, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - int decoded_result = 0; - - // Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message. - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, PDN_DISCONNECT_REQUEST_MINIMUM_LENGTH, len); - - /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_linked_eps_bearer_identity(&pdn_disconnect_request->linkedepsbeareridentity, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) - return decoded_result; - - decoded++; - - /* Decoding optional fields */ - while(len - decoded > 0) { - uint8_t ieiDecoded = *(buffer + decoded); - - /* Type | value iei are below 0x80 so just return the first 4 bits */ - if (ieiDecoded >= 0x80) - ieiDecoded = ieiDecoded & 0xf0; - - switch(ieiDecoded) { - case PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI: - if ((decoded_result = - decode_protocol_configuration_options(&pdn_disconnect_request->protocolconfigurationoptions, - PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, - buffer + decoded, len - decoded)) <= 0) - return decoded_result; - - decoded += decoded_result; - /* Set corresponding mask to 1 in presencemask */ - pdn_disconnect_request->presencemask |= PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - break; - - default: - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; - return TLV_DECODE_UNEXPECTED_IEI; - } - } - - return decoded; -} - -int encode_pdn_disconnect_request(pdn_disconnect_request_msg *pdn_disconnect_request, uint8_t *buffer, uint32_t len) -{ - int encoded = 0; - int encode_result = 0; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDN_DISCONNECT_REQUEST_MINIMUM_LENGTH, len); - - *(buffer + encoded) = (encode_u8_linked_eps_bearer_identity(&pdn_disconnect_request->linkedepsbeareridentity) & 0x0f); - encoded++; - - if ((pdn_disconnect_request->presencemask & PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) - == PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - if ((encode_result = - encode_protocol_configuration_options(&pdn_disconnect_request->protocolconfigurationoptions, - PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI, buffer - + encoded, len - encoded)) < 0) - // Return in case of error - return encode_result; - else - encoded += encode_result; - } - - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.h deleted file mode 100644 index 449a088c6a58d4e2546bc45ceb9ca9bb32ba9d9a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/PdnDisconnectRequest.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "ProtocolDiscriminator.h" -#include "EpsBearerIdentity.h" -#include "ProcedureTransactionIdentity.h" -#include "MessageType.h" -#include "LinkedEpsBearerIdentity.h" -#include "ProtocolConfigurationOptions.h" - -#ifndef PDN_DISCONNECT_REQUEST_H_ -#define PDN_DISCONNECT_REQUEST_H_ - -/* Minimum length macro. Formed by minimum length of each mandatory field */ -#define PDN_DISCONNECT_REQUEST_MINIMUM_LENGTH ( \ - LINKED_EPS_BEARER_IDENTITY_MINIMUM_LENGTH ) - -/* Maximum length macro. Formed by maximum length of each field */ -#define PDN_DISCONNECT_REQUEST_MAXIMUM_LENGTH ( \ - LINKED_EPS_BEARER_IDENTITY_MAXIMUM_LENGTH + \ - PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH ) - -/* If an optional value is present and should be encoded, the corresponding - * Bit mask should be set to 1. - */ -# define PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT (1<<0) - -typedef enum pdn_disconnect_request_iei_tag { - PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_IEI = 0x27, /* 0x27 = 39 */ -} pdn_disconnect_request_iei; - -/* - * Message name: PDN disconnect request - * Description: This message is sent by the UE to the network to initiate release of a PDN connection. See table 8.3.22.1. - * Significance: dual - * Direction: UE to network - */ - -typedef struct pdn_disconnect_request_msg_tag { - /* Mandatory fields */ - ProtocolDiscriminator protocoldiscriminator:4; - EpsBearerIdentity epsbeareridentity:4; - ProcedureTransactionIdentity proceduretransactionidentity; - MessageType messagetype; - LinkedEpsBearerIdentity linkedepsbeareridentity; - /* Optional fields */ - uint32_t presencemask; - ProtocolConfigurationOptions protocolconfigurationoptions; -} pdn_disconnect_request_msg; - -int decode_pdn_disconnect_request(pdn_disconnect_request_msg *pdndisconnectrequest, uint8_t *buffer, uint32_t len); - -int encode_pdn_disconnect_request(pdn_disconnect_request_msg *pdndisconnectrequest, uint8_t *buffer, uint32_t len); - -#endif /* ! defined(PDN_DISCONNECT_REQUEST_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_cause.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_cause.h deleted file mode 100644 index 65063a8ddaba18fd3e37f13b46938beb0ac3766e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_cause.h +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_cause.h - -Version 0.1 - -Date 2013/02/06 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines error cause code returned upon receiving unknown, - unforeseen, and erroneous EPS session management protocol - data. - -*****************************************************************************/ -#ifndef __ESM_CAUSE_H__ -#define __ESM_CAUSE_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Cause code used to notify that the EPS session management procedure - * has been successfully processed - */ -#define ESM_CAUSE_SUCCESS (-1) - -/* - * Causes related to nature of request (TS 24.301 - Annex B1) - */ -#define ESM_CAUSE_OPERATOR_DETERMINED_BARRING 8 -#define ESM_CAUSE_INSUFFICIENT_RESOURCES 26 -#define ESM_CAUSE_UNKNOWN_ACCESS_POINT_NAME 27 -#define ESM_CAUSE_UNKNOWN_PDN_TYPE 28 -#define ESM_CAUSE_USER_AUTHENTICATION_FAILED 29 -#define ESM_CAUSE_REQUEST_REJECTED_BY_GW 30 -#define ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED 31 -#define ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED 32 -#define ESM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33 -#define ESM_CAUSE_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34 -#define ESM_CAUSE_PTI_ALREADY_IN_USE 35 -#define ESM_CAUSE_REGULAR_DEACTIVATION 36 -#define ESM_CAUSE_EPS_QOS_NOT_ACCEPTED 37 -#define ESM_CAUSE_NETWORK_FAILURE 38 -#define ESM_CAUSE_REACTIVATION_REQUESTED 39 -#define ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION 41 -#define ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION 42 -#define ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY 43 -#define ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER 44 -#define ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER 45 -#define ESM_CAUSE_PTI_MISMATCH 47 -#define ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED 49 -#define ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED 50 -#define ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED 51 -#define ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED 52 -#define ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED 53 -#define ESM_CAUSE_PDN_CONNECTION_DOES_NOT_EXIST 54 -#define ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_NOT_ALLOWED 55 -#define ESM_CAUSE_COLLISION_WITH_NETWORK_INITIATED_REQUEST 56 -#define ESM_CAUSE_UNSUPPORTED_QCI_VALUE 59 -#define ESM_CAUSE_BEARER_HANDLING_NOT_SUPPORTED 60 -#define ESM_CAUSE_INVALID_PTI_VALUE 81 -#define ESM_CAUSE_APN_RESTRICTION_VALUE_NOT_COMPATIBLE 112 - -/* - * Protocol errors (e.g., unknown message) class (TS 24.301 - Annex B2) - */ -#define ESM_CAUSE_SEMANTICALLY_INCORRECT 95 -#define ESM_CAUSE_INVALID_MANDATORY_INFO 96 -#define ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED 97 -#define ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE 98 -#define ESM_CAUSE_IE_NOT_IMPLEMENTED 99 -#define ESM_CAUSE_CONDITIONAL_IE_ERROR 100 -#define ESM_CAUSE_MESSAGE_NOT_COMPATIBLE 101 -#define ESM_CAUSE_PROTOCOL_ERROR 111 - -/* - * TS 24.301 - Table 9.9.4.4.1 - * Any other value received by the UE shall be treated as cause code #34, - * "service option temporarily out of order". - * Any other value received by the network shall be treated as cause code #111 - * "protocol error, unspecified". - */ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __ESM_CAUSE_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.c b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.c deleted file mode 100644 index 2f5dbc87274964ac7091b2c9a9e05f9320f85e6e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.c +++ /dev/null @@ -1,484 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_msg.c - -Version 0.1 - -Date 2012/09/27 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel, Sebastien Roux - -Description Defines EPS Session Management messages - -*****************************************************************************/ - -#include "esm_msg.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "TLVDecoder.h" -#include "TLVEncoder.h" - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) -# include "nas_itti_messaging.h" -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -static int _esm_msg_decode_header(esm_msg_header_t *header, const uint8_t *buffer, uint32_t len); -static int _esm_msg_encode_header(const esm_msg_header_t *header, uint8_t *buffer, uint32_t len); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: esm_msg_decode() ** - ** ** - ** Description: Decode EPS Session Management messages ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the ESM ** - ** message ** - ** len: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message structure to be filled ** - ** Return: The number of bytes in the buffer if data ** - ** have been successfully decoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len) -{ - int header_result; - int decode_result; - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - uint32_t len_log = len; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 0; -# else - down_link = 1; -# endif -#endif - - LOG_FUNC_IN; - - /* First decode the ESM message header */ - header_result = _esm_msg_decode_header(&msg->header, buffer, len); - - if (header_result < 0) { - LOG_TRACE(ERROR, "ESM-MSG - Failed to decode ESM message header " - "(%d)", header_result); - LOG_FUNC_RETURN(header_result); - } - - buffer += header_result; - len -= header_result; - - switch(msg->header.message_type) { - case PDN_DISCONNECT_REQUEST: - decode_result = decode_pdn_disconnect_request(&msg->pdn_disconnect_request, buffer, len); - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - decode_result = decode_deactivate_eps_bearer_context_accept(&msg->deactivate_eps_bearer_context_accept, buffer, len); - break; - - case BEARER_RESOURCE_ALLOCATION_REQUEST: - decode_result = decode_bearer_resource_allocation_request(&msg->bearer_resource_allocation_request, buffer, len); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - decode_result = decode_activate_default_eps_bearer_context_accept(&msg->activate_default_eps_bearer_context_accept, buffer, len); - break; - - case PDN_CONNECTIVITY_REJECT: - decode_result = decode_pdn_connectivity_reject(&msg->pdn_connectivity_reject, buffer, len); - break; - - case MODIFY_EPS_BEARER_CONTEXT_REJECT: - decode_result = decode_modify_eps_bearer_context_reject(&msg->modify_eps_bearer_context_reject, buffer, len); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT: - decode_result = decode_activate_dedicated_eps_bearer_context_reject(&msg->activate_dedicated_eps_bearer_context_reject, buffer, len); - break; - - case MODIFY_EPS_BEARER_CONTEXT_ACCEPT: - decode_result = decode_modify_eps_bearer_context_accept(&msg->modify_eps_bearer_context_accept, buffer, len); - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST: - decode_result = decode_deactivate_eps_bearer_context_request(&msg->deactivate_eps_bearer_context_request, buffer, len); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: - decode_result = decode_activate_dedicated_eps_bearer_context_accept(&msg->activate_dedicated_eps_bearer_context_accept, buffer, len); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: - decode_result = decode_activate_default_eps_bearer_context_reject(&msg->activate_default_eps_bearer_context_reject, buffer, len); - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST: - decode_result = decode_modify_eps_bearer_context_request(&msg->modify_eps_bearer_context_request, buffer, len); - break; - - case PDN_DISCONNECT_REJECT: - decode_result = decode_pdn_disconnect_reject(&msg->pdn_disconnect_reject, buffer, len); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST: - decode_result = decode_activate_dedicated_eps_bearer_context_request(&msg->activate_dedicated_eps_bearer_context_request, buffer, len); - break; - - case BEARER_RESOURCE_MODIFICATION_REJECT: - decode_result = decode_bearer_resource_modification_reject(&msg->bearer_resource_modification_reject, buffer, len); - break; - - case BEARER_RESOURCE_ALLOCATION_REJECT: - decode_result = decode_bearer_resource_allocation_reject(&msg->bearer_resource_allocation_reject, buffer, len); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: - decode_result = decode_activate_default_eps_bearer_context_request(&msg->activate_default_eps_bearer_context_request, buffer, len); - break; - - case PDN_CONNECTIVITY_REQUEST: - decode_result = decode_pdn_connectivity_request(&msg->pdn_connectivity_request, buffer, len); - break; - - case ESM_INFORMATION_RESPONSE: - decode_result = decode_esm_information_response(&msg->esm_information_response, buffer, len); - break; - - case BEARER_RESOURCE_MODIFICATION_REQUEST: - decode_result = decode_bearer_resource_modification_request(&msg->bearer_resource_modification_request, buffer, len); - break; - - case ESM_INFORMATION_REQUEST: - decode_result = decode_esm_information_request(&msg->esm_information_request, buffer, len); - break; - - case ESM_STATUS: - decode_result = decode_esm_status(&msg->esm_status, buffer, len); - break; - - default: - LOG_TRACE(ERROR, "ESM-MSG - Unexpected message type: 0x%x", - msg->header.message_type); - decode_result = TLV_DECODE_WRONG_MESSAGE_TYPE; - break; - } - - if (decode_result < 0) { - LOG_TRACE(ERROR, "ESM-MSG - Failed to decode L3 ESM message 0x%x " - "(%u)", msg->header.message_type, decode_result); - LOG_FUNC_RETURN (decode_result); - } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Message has been decoded and security header removed, handle it has a plain message */ - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link); -#endif - } - - LOG_FUNC_RETURN (header_result + decode_result); -} - -/**************************************************************************** - ** ** - ** Name: esm_msg_encode() ** - ** ** - ** Description: Encode EPS Session Management messages ** - ** ** - ** Inputs: msg: The ESM message structure to encode ** - ** length: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if data ** - ** have been successfully encoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len) -{ - LOG_FUNC_IN; - - int header_result; - int encode_result; - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 1; -# else - down_link = 0; -# endif -#endif - - /* First encode the ESM message header */ - header_result = _esm_msg_encode_header(&msg->header, buffer, len); - - if (header_result < 0) { - LOG_TRACE(ERROR, "ESM-MSG - Failed to encode ESM message header " - "(%d)", header_result); - LOG_FUNC_RETURN(header_result); - } - - LOG_TRACE(INFO, "ESM-MSG - Encoded ESM message header " - "(%d)", header_result); - - buffer += header_result; - len -= header_result; - - switch(msg->header.message_type) { - case PDN_DISCONNECT_REQUEST: - encode_result = encode_pdn_disconnect_request(&msg->pdn_disconnect_request, buffer, len); - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - encode_result = encode_deactivate_eps_bearer_context_accept(&msg->deactivate_eps_bearer_context_accept, buffer, len); - break; - - case BEARER_RESOURCE_ALLOCATION_REQUEST: - encode_result = encode_bearer_resource_allocation_request(&msg->bearer_resource_allocation_request, buffer, len); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - encode_result = encode_activate_default_eps_bearer_context_accept(&msg->activate_default_eps_bearer_context_accept, buffer, len); - break; - - case PDN_CONNECTIVITY_REJECT: - encode_result = encode_pdn_connectivity_reject(&msg->pdn_connectivity_reject, buffer, len); - break; - - case MODIFY_EPS_BEARER_CONTEXT_REJECT: - encode_result = encode_modify_eps_bearer_context_reject(&msg->modify_eps_bearer_context_reject, buffer, len); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT: - encode_result = encode_activate_dedicated_eps_bearer_context_reject(&msg->activate_dedicated_eps_bearer_context_reject, buffer, len); - break; - - case MODIFY_EPS_BEARER_CONTEXT_ACCEPT: - encode_result = encode_modify_eps_bearer_context_accept(&msg->modify_eps_bearer_context_accept, buffer, len); - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST: - encode_result = encode_deactivate_eps_bearer_context_request(&msg->deactivate_eps_bearer_context_request, buffer, len); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: - encode_result = encode_activate_dedicated_eps_bearer_context_accept(&msg->activate_dedicated_eps_bearer_context_accept, buffer, len); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: - encode_result = encode_activate_default_eps_bearer_context_reject(&msg->activate_default_eps_bearer_context_reject, buffer, len); - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST: - encode_result = encode_modify_eps_bearer_context_request(&msg->modify_eps_bearer_context_request, buffer, len); - break; - - case PDN_DISCONNECT_REJECT: - encode_result = encode_pdn_disconnect_reject(&msg->pdn_disconnect_reject, buffer, len); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST: - encode_result = encode_activate_dedicated_eps_bearer_context_request(&msg->activate_dedicated_eps_bearer_context_request, buffer, len); - break; - - case BEARER_RESOURCE_MODIFICATION_REJECT: - encode_result = encode_bearer_resource_modification_reject(&msg->bearer_resource_modification_reject, buffer, len); - break; - - case BEARER_RESOURCE_ALLOCATION_REJECT: - encode_result = encode_bearer_resource_allocation_reject(&msg->bearer_resource_allocation_reject, buffer, len); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: - encode_result = encode_activate_default_eps_bearer_context_request(&msg->activate_default_eps_bearer_context_request, buffer, len); - break; - - case PDN_CONNECTIVITY_REQUEST: - encode_result = encode_pdn_connectivity_request(&msg->pdn_connectivity_request, buffer, len); - break; - - case ESM_INFORMATION_RESPONSE: - encode_result = encode_esm_information_response(&msg->esm_information_response, buffer, len); - break; - - case BEARER_RESOURCE_MODIFICATION_REQUEST: - encode_result = encode_bearer_resource_modification_request(&msg->bearer_resource_modification_request, buffer, len); - break; - - case ESM_INFORMATION_REQUEST: - encode_result = encode_esm_information_request(&msg->esm_information_request, buffer, len); - break; - - case ESM_STATUS: - encode_result = encode_esm_status(&msg->esm_status, buffer, len); - break; - - default: - LOG_TRACE(ERROR, "ESM-MSG - Unexpected message type: 0x%x", - msg->header.message_type); - encode_result = TLV_ENCODE_WRONG_MESSAGE_TYPE; - break; - } - - if (encode_result < 0) { - LOG_TRACE(ERROR, "ESM-MSG - Failed to encode L3 ESM message 0x%x " - "(%d)", msg->header.message_type, encode_result); - } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link); -#endif - } - - LOG_FUNC_RETURN (header_result + encode_result); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _esm_msg_decode_header() ** - ** ** - ** Description: Decode header of EPS Mobility Management message. ** - ** The protocol discriminator and the security header type ** - ** have already been decoded. ** - ** ** - ** Inputs: buffer: Pointer to the buffer containing the ESM ** - ** message ** - ** len: Number of bytes that should be decoded ** - ** Others: None ** - ** ** - ** Outputs: header: The ESM message header to be filled ** - ** Return: The size of the header if data have been ** - ** successfully decoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _esm_msg_decode_header(esm_msg_header_t *header, - const uint8_t *buffer, uint32_t len) -{ - int size = 0; - - /* Check the buffer length */ - if (len < sizeof(esm_msg_header_t)) { - return (TLV_DECODE_BUFFER_TOO_SHORT); - } - - /* Decode the EPS bearer identity and the protocol discriminator */ - DECODE_U8(buffer + size, *(uint8_t*)(header), size); - /* Decode the procedure transaction identity */ - DECODE_U8(buffer + size, header->procedure_transaction_identity, size); - /* Decode the message type */ - DECODE_U8(buffer + size, header->message_type, size); - - /* Check the protocol discriminator */ - if (header->protocol_discriminator != EPS_SESSION_MANAGEMENT_MESSAGE) { - LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x", - header->protocol_discriminator); - return (TLV_DECODE_PROTOCOL_NOT_SUPPORTED); - } - - return (size); -} - -/**************************************************************************** - ** ** - ** Name: _esm_msg_encode_header() ** - ** ** - ** The protocol discriminator and the security header type ** - ** have already been encoded. ** - ** ** - ** Inputs: header: The ESM message header to encode ** - ** len: Maximal capacity of the output buffer ** - ** Others: None ** - ** ** - ** Outputs: buffer: Pointer to the encoded data buffer ** - ** Return: The number of bytes in the buffer if data ** - ** have been successfully encoded; ** - ** A negative error code otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _esm_msg_encode_header(const esm_msg_header_t *header, - uint8_t *buffer, uint32_t len) -{ - int size = 0; - - /* Check the buffer length */ - if (len < sizeof(esm_msg_header_t)) { - LOG_TRACE(ERROR, "ESM-MSG - buffer too short"); - return (TLV_ENCODE_BUFFER_TOO_SHORT); - } - /* Check the protocol discriminator */ - else if (header->protocol_discriminator != EPS_SESSION_MANAGEMENT_MESSAGE) { - LOG_TRACE(ERROR, "ESM-MSG - Unexpected protocol discriminator: 0x%x", - header->protocol_discriminator); - return (TLV_ENCODE_PROTOCOL_NOT_SUPPORTED); - } - - /* Encode the EPS bearer identity and the protocol discriminator */ - ENCODE_U8(buffer + size, *(uint8_t*)(header), size); - /* Encode the procedure transaction identity */ - ENCODE_U8(buffer + size, header->procedure_transaction_identity, size); - /* Encode the message type */ - ENCODE_U8(buffer + size, header->message_type, size); - - return (size); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.h deleted file mode 100644 index 4c932969892ac7c4e1669978b75ee46bbf849548..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msg.h +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_msg.h - -Version 0.1 - -Date 2012/09/27 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines EPS Session Management messages and functions used - to encode and decode - -*****************************************************************************/ -#ifndef __ESM_MSG_H__ -#define __ESM_MSG_H__ - -#include "esm_msgDef.h" - -#include "ActivateDedicatedEpsBearerContextRequest.h" -#include "ActivateDedicatedEpsBearerContextAccept.h" -#include "ActivateDedicatedEpsBearerContextReject.h" -#include "ActivateDefaultEpsBearerContextRequest.h" -#include "ActivateDefaultEpsBearerContextAccept.h" -#include "ActivateDefaultEpsBearerContextReject.h" -#include "ModifyEpsBearerContextRequest.h" -#include "ModifyEpsBearerContextAccept.h" -#include "ModifyEpsBearerContextReject.h" -#include "DeactivateEpsBearerContextRequest.h" -#include "DeactivateEpsBearerContextAccept.h" -#include "PdnDisconnectRequest.h" -#include "PdnDisconnectReject.h" -#include "PdnConnectivityRequest.h" -#include "PdnConnectivityReject.h" -#include "BearerResourceAllocationRequest.h" -#include "BearerResourceAllocationReject.h" -#include "BearerResourceModificationRequest.h" -#include "BearerResourceModificationReject.h" -#include "EsmInformationRequest.h" -#include "EsmInformationResponse.h" -#include "EsmStatus.h" - -#include <stdint.h> - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Structure of ESM plain NAS message - * ---------------------------------- - */ -typedef union { - esm_msg_header_t header; - activate_default_eps_bearer_context_request_msg activate_default_eps_bearer_context_request; - activate_default_eps_bearer_context_accept_msg activate_default_eps_bearer_context_accept; - activate_default_eps_bearer_context_reject_msg activate_default_eps_bearer_context_reject; - activate_dedicated_eps_bearer_context_request_msg activate_dedicated_eps_bearer_context_request; - activate_dedicated_eps_bearer_context_accept_msg activate_dedicated_eps_bearer_context_accept; - activate_dedicated_eps_bearer_context_reject_msg activate_dedicated_eps_bearer_context_reject; - modify_eps_bearer_context_request_msg modify_eps_bearer_context_request; - modify_eps_bearer_context_accept_msg modify_eps_bearer_context_accept; - modify_eps_bearer_context_reject_msg modify_eps_bearer_context_reject; - deactivate_eps_bearer_context_request_msg deactivate_eps_bearer_context_request; - deactivate_eps_bearer_context_accept_msg deactivate_eps_bearer_context_accept; - pdn_connectivity_request_msg pdn_connectivity_request; - pdn_connectivity_reject_msg pdn_connectivity_reject; - pdn_disconnect_request_msg pdn_disconnect_request; - pdn_disconnect_reject_msg pdn_disconnect_reject; - bearer_resource_allocation_request_msg bearer_resource_allocation_request; - bearer_resource_allocation_reject_msg bearer_resource_allocation_reject; - bearer_resource_modification_request_msg bearer_resource_modification_request; - bearer_resource_modification_reject_msg bearer_resource_modification_reject; - esm_information_request_msg esm_information_request; - esm_information_response_msg esm_information_response; - esm_status_msg esm_status; -} ESM_msg; - - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len); - -int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len); - -#endif /* __ESM_MSG_H__ */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msgDef.h b/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msgDef.h deleted file mode 100644 index 71a76a8f362be07f5f9645fd546ad7298b2e8ad0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/msg/esm_msgDef.h +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - -Version 0.1 - -Date 2012/09/27 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel, Sebastien Roux - -Description Defines identifiers of the EPS Session Management messages - -*****************************************************************************/ -#ifndef __ESM_MSGDEF_H__ -#define __ESM_MSGDEF_H__ - -#include <stdint.h> -#include <asm/byteorder.h> - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Header length boundaries of EPS Session Management messages */ -#define ESM_HEADER_LENGTH sizeof(esm_msg_header_t) -#define ESM_HEADER_MINIMUM_LENGTH ESM_HEADER_LENGTH -#define ESM_HEADER_MAXIMUM_LENGTH ESM_HEADER_LENGTH - -/* Message identifiers for EPS Session Management */ -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST 0b11000001 /* 193 = 0xc1 */ -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT 0b11000010 /* 194 = 0xc2 */ -# define ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT 0b11000011 /* 195 = 0xc3 */ -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST 0b11000101 /* 197 = 0xc5 */ -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT 0b11000110 /* 198 = 0xc6 */ -# define ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT 0b11000111 /* 199 = 0xc7 */ -# define MODIFY_EPS_BEARER_CONTEXT_REQUEST 0b11001001 /* 201 = 0xc9 */ -# define MODIFY_EPS_BEARER_CONTEXT_ACCEPT 0b11001010 /* 202 = 0xca */ -# define MODIFY_EPS_BEARER_CONTEXT_REJECT 0b11001011 /* 203 = 0xcb */ -# define DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST 0b11001101 /* 205 = 0xcd */ -# define DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT 0b11001110 /* 206 = 0xce */ -# define PDN_CONNECTIVITY_REQUEST 0b11010000 /* 208 = 0xd0 */ -# define PDN_CONNECTIVITY_REJECT 0b11010001 /* 209 = 0xd1 */ -# define PDN_DISCONNECT_REQUEST 0b11010010 /* 210 = 0xd2 */ -# define PDN_DISCONNECT_REJECT 0b11010011 /* 211 = 0xd3 */ -# define BEARER_RESOURCE_ALLOCATION_REQUEST 0b11010100 /* 212 = 0xd4 */ -# define BEARER_RESOURCE_ALLOCATION_REJECT 0b11010101 /* 213 = 0xd5 */ -# define BEARER_RESOURCE_MODIFICATION_REQUEST 0b11010110 /* 214 = 0xd6 */ -# define BEARER_RESOURCE_MODIFICATION_REJECT 0b11010111 /* 215 = 0xd7 */ -# define ESM_INFORMATION_REQUEST 0b11011001 /* 217 = 0xd9 */ -# define ESM_INFORMATION_RESPONSE 0b11011010 /* 218 = 0xda */ -# define ESM_STATUS 0b11101000 /* 232 = 0xe8 */ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Header of EPS Session Management plain NAS message - * -------------------------------------------------- - * 8 7 6 5 4 3 2 1 - * +-----------------------+------------------------+ - * | EPS bearer identity | Protocol discriminator | - * +-----------------------+------------------------+ - * | Procedure transaction identity | - * +-----------------------+------------------------+ - * | Message type | - * +-----------------------+------------------------+ - */ -typedef struct { -#ifdef __LITTLE_ENDIAN_BITFIELD - uint8_t protocol_discriminator:4; - uint8_t eps_bearer_identity:4; -#endif -#ifdef __BIG_ENDIAN_BITFIELD - uint8_t eps_bearer_identity:4; - uint8_t protocol_discriminator:4; -#endif - uint8_t procedure_transaction_identity; - uint8_t message_type; -} __attribute__((__packed__)) esm_msg_header_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __ESM_MSGDEF_H__ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/COPYING b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/Makefile b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/Makefile deleted file mode 100644 index 18bae2492767dad24c2f608da296f776e5d78c9b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(ESMDIR) \ - -I$(IESDIR) -I$(ESMMSGDIR) -I$(EMMDIR) -I$(MMEAPIDIR) -I$(EMMSAPDIR) - -TARGET = $(LIBESMSAP) -TARGETS = $(TARGET).a $(TARGET).so - -all: $(TARGETS) - -%.o: %.c Makefile $(PROJDIR)/Makerules $(PROJDIR)/Makefile.inc - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET).a: $(OBJS) - @$(RM) $@ - @$(AR) $(ARFLAGS) $@ $(OBJS) - @echo Replacing $@ to $(LIBPROCESS) - @$(RM) $(LIBPROCESS)/$@ - @$(CP) $@ $(LIBPROCESS) - -$(TARGET).so: $(OBJS) - @$(LD) -G -o $@ $(OBJS) - @echo Replacing $@ to $(LIBPROCESS) - @$(RM) $(LIBPROCESS)/$@ - @$(CP) $@ $(LIBPROCESS) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGETS) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.c b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.c deleted file mode 100644 index ab584aa4f30fc3dd8a8553528fc4c4a3a5745085..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.c +++ /dev/null @@ -1,1299 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_recv.c - -Version 0.1 - -Date 2013/02/06 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions executed at the ESM Service Access - Point upon receiving EPS Session Management messages - from the EPS Mobility Management sublayer. - -*****************************************************************************/ - -#include "esm_recv.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "esm_pt.h" -#include "esm_ebr.h" -#include "esm_proc.h" - -#include "esm_cause.h" -#ifdef NAS_MME -#include "nas_itti_messaging.h" -#endif -#ifdef NAS_UE -#include <stdlib.h> // malloc, free -#include <string.h> // memset -#endif - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME upon receiving ESM messages - * -------------------------------------------------------------------------- - */ -/**************************************************************************** - ** ** - ** Name: esm_recv_status() ** - ** ** - ** Description: Processes ESM status message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -#ifdef NAS_UE -int esm_recv_status(int pti, int ebi, const esm_status_msg *msg) -#endif -#ifdef NAS_MME -int esm_recv_status(emm_data_context_t *ctx, int pti, int ebi, - const esm_status_msg *msg) -#endif -{ - int esm_cause; - int rc; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-SAP - Received ESM status message (pti=%d, ebi=%d)", - pti, ebi); - - /* - * Message processing - */ - /* Get the ESM cause */ - esm_cause = msg->esmcause; - - /* Execute the ESM status procedure */ -#ifdef NAS_UE - rc = esm_proc_status_ind(pti, ebi, &esm_cause); -#endif -#ifdef NAS_MME - rc = esm_proc_status_ind(ctx, pti, ebi, &esm_cause); -#endif - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE upon receiving ESM message from the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_recv_pdn_connectivity_reject() ** - ** ** - ** Description: Processes PDN Connectivity Reject message ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_pdn_connectivity_reject(int pti, int ebi, - const pdn_connectivity_reject_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause; - - LOG_TRACE(INFO, "ESM-SAP - Received PDN Connectivity Reject message " - "(pti=%d, ebi=%d, cause=%d)", pti, ebi, msg->esmcause); - - /* - * Procedure transaction identity checking - */ - if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case a - * Reserved or unassigned PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } else if ( esm_pt_is_not_in_use(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case a - * Assigned value that does not match any PTI in use - */ - LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH); - } - /* - * EPS bearer identity checking - */ - else if ( (ebi != ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case a - * Assigned or reserved EPS bearer identity value */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Get the ESM cause */ - esm_cause = msg->esmcause; - - /* Execute the PDN connectivity procedure not accepted by the network */ - int rc = esm_proc_pdn_connectivity_reject(pti, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_pdn_disconnect_reject() ** - ** ** - ** Description: Processes PDN Disconnect Reject message ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_pdn_disconnect_reject(int pti, int ebi, - const pdn_disconnect_reject_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause; - - LOG_TRACE(INFO, "ESM-SAP - Received PDN Disconnect Reject message " - "(pti=%d, ebi=%d, cause=%d)", pti, ebi, msg->esmcause); - - /* - * Procedure transaction identity checking - */ - if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case b - * Reserved or unassigned PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } else if ( esm_pt_is_not_in_use(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case b - * Assigned value that does not match any PTI in use - */ - LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH); - } - /* - * EPS bearer identity checking - */ - else if ( (ebi != ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case b - * Assigned or reserved EPS bearer identity value */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Get the ESM cause */ - esm_cause = msg->esmcause; - - /* Execute the PDN disconnect procedure not accepted by the network */ - int rc = esm_proc_pdn_disconnect_reject(pti, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_activate_default_eps_bearer_context_request() ** - ** ** - ** Description: Processes Activate Default EPS Bearer Context Request ** - ** message ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi, - const activate_default_eps_bearer_context_request_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - - LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context " - "Request message (pti=%d, ebi=%d)", pti, ebi); - - /* - * Procedure transaction identity checking - */ - if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case h - * Reserved or unassigned PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } else if ( esm_pt_is_not_in_use(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case g - * Assigned value that does not match any PTI in use - */ - LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH); - } - /* - * EPS bearer identity checking - */ - else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case g - * Reserved or unassigned EPS bearer identity value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - esm_proc_qos_t qos = {-1, -1, -1, -1, -1}; - - /* Get the maximum bit rate for uplink and downlink */ - if (msg->epsqos.bitRatesExtPresent) { - qos.mbrUL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForUL); - qos.mbrDL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForDL); - } else if (msg->epsqos.bitRatesPresent) { - qos.mbrUL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForUL); - qos.mbrDL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForDL); - } - - /* Get the guaranteed bit rate for uplink and downlink */ - if (msg->epsqos.bitRatesExtPresent) { - qos.gbrUL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForUL); - qos.gbrDL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForDL); - } else if (msg->epsqos.bitRatesPresent) { - qos.gbrUL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForUL); - qos.gbrDL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForDL); - } - - /* Get the QoS Class Identifier */ - qos.qci = msg->epsqos.qci; - /* Get the value of the PDN type indicator */ - int pdn_type = -1; - - if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV4) { - pdn_type = ESM_PDN_TYPE_IPV4; - } else if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV6) { - pdn_type = ESM_PDN_TYPE_IPV6; - } else if (msg->pdnaddress.pdntypevalue == PDN_VALUE_TYPE_IPV4V6) { - pdn_type = ESM_PDN_TYPE_IPV4V6; - } - - /* Get the ESM cause */ - if (msg->presencemask & - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT) { - /* The network allocated a PDN address of a PDN type which is different - * from the requested PDN type */ - esm_cause = msg->esmcause; - } - - /* Execute the PDN connectivity procedure accepted by the network */ - int pid = esm_proc_pdn_connectivity_accept(pti, pdn_type, - &msg->pdnaddress.pdnaddressinformation, - &msg->accesspointname.accesspointnamevalue, - &esm_cause); - - if (pid != RETURNerror) { - /* Create local default EPS bearer context */ - int rc = esm_proc_default_eps_bearer_context_request(pid, ebi, &qos, - &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_activate_dedicated_eps_bearer_context_request() ** - ** ** - ** Description: Processes Activate Dedicated EPS Bearer Context Request ** - ** message ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi, - const activate_dedicated_eps_bearer_context_request_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - int i; - int j; - - LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer " - "Context Request message (pti=%d, ebi=%d)", pti, ebi); - - /* - * Procedure transaction identity checking - */ - if ( esm_pt_is_reserved(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case j - * Reserved PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } else if ( (pti != ESM_PT_UNASSIGNED) && esm_pt_is_not_in_use(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case i - * Assigned value that does not match any PTI in use - */ - LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH); - } - /* - * EPS bearer identity checking - */ - else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case h - * Reserved or unassigned EPS bearer identity value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - /* - * TFT checking - */ - else if (msg->tft.tftoperationcode != TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE) { - /* 3GPP TS 24.301, section 6.4.2.4, case a1 - * Semantic errors in TFT operations - */ - LOG_FUNC_RETURN (ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION); - } else if (msg->tft.numberofpacketfilters == 0) { - /* 3GPP TS 24.301, section 6.4.2.4, case b1 - * Syntactical errors in TFT operations - */ - LOG_FUNC_RETURN (ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION); - } - - /* - * Message processing - */ - /* Processing of the EPS bearer level QoS parameters */ - esm_proc_qos_t qos = {-1, -1, -1, -1, -1}; - - /* Get the maximum bit rate for uplink and downlink */ - if (msg->epsqos.bitRatesExtPresent) { - qos.mbrUL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForUL); - qos.mbrDL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.maxBitRateForDL); - } else if (msg->epsqos.bitRatesPresent) { - qos.mbrUL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForUL); - qos.mbrDL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.maxBitRateForDL); - } - - /* Get the guaranteed bit rate for uplink and downlink */ - if (msg->epsqos.bitRatesExtPresent) { - qos.gbrUL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForUL); - qos.gbrDL = - eps_qos_bit_rate_ext_value(msg->epsqos.bitRatesExt.guarBitRateForDL); - } else if (msg->epsqos.bitRatesPresent) { - qos.gbrUL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForUL); - qos.gbrDL = - eps_qos_bit_rate_value(msg->epsqos.bitRates.guarBitRateForDL); - } - - /* Get the QoS Class Identifier */ - qos.qci = msg->epsqos.qci; - - /* Processing of the traffic flow template parameters */ - esm_proc_tft_t tft = {0, {NULL}}; - /* Get the list of packet filters */ - const PacketFilters *pkfs = &(msg->tft.packetfilterlist.createtft); - - for (i = 0; i < msg->tft.numberofpacketfilters; i++) { - /* Create new temporary packet filter */ - tft.pkf[i] = (network_pkf_t *)malloc(sizeof(network_pkf_t)); - - if (tft.pkf[i] != NULL) { - /* Initialize the temporary packet filter */ - memset(tft.pkf[i], 0, sizeof(network_pkf_t)); - /* Increment the number of packet filters contained in the TFT */ - tft.n_pkfs += 1; - /* Packet filter identifier */ - tft.pkf[i]->id = pkfs[i]->identifier; - /* Packet filter direction */ - tft.pkf[i]->dir = pkfs[i]->direction; - /* Evaluation precedence */ - tft.pkf[i]->precedence = pkfs[i]->eval_precedence; - - /* Get the packet filter components */ - const PacketFilter *pkf = &(pkfs[i]->packetfilter); - - if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG) { - /* IPv4 remote address component */ - for (j = 0; - (j < TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE) - && (j < NET_PACKET_FILTER_IPV4_ADDR_SIZE); j++) { - tft.pkf[i]->data.ipv4.addr[j] = pkf->ipv4remoteaddr[j].addr; - tft.pkf[i]->data.ipv4.mask[j] = pkf->ipv4remoteaddr[j].mask; - } - } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG) { - /* IPv6 remote address component */ - for (j = 0; - (j < TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE) - && (j < NET_PACKET_FILTER_IPV6_ADDR_SIZE); j++) { - tft.pkf[i]->data.ipv6.addr[j] = pkf->ipv6remoteaddr[j].addr; - tft.pkf[i]->data.ipv6.mask[j] = pkf->ipv6remoteaddr[j].mask; - } - } - - if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG) { - /* Protocol identifier/Next header component */ - tft.pkf[i]->data.ipv4.protocol = - pkf->protocolidentifier_nextheader; - } - - if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG) { - /* Single local port component */ - tft.pkf[i]->lport = pkf->singlelocalport; - } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG) { - /* Local port range component */ - /* TODO: Add port range type to network_pkf_t in networkDef.h */ - tft.pkf[i]->lport = pkf->localportrange.lowlimit; - } - - if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG) { - /* Single remote port component */ - tft.pkf[i]->rport = pkf->singleremoteport; - } else if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG) { - /* Remote port range component */ - /* TODO: Add port range type to network_pkf_t in networkDef.h */ - tft.pkf[i]->rport = pkf->remoteportrange.lowlimit; - } - - if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX) { - /* Security parameter index component */ - tft.pkf[i]->data.ipv6.ipsec = pkf->securityparameterindex; - } - - if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS) { - /* Type of service/Traffic class component */ - tft.pkf[i]->data.ipv4.tos = - pkf->typdeofservice_trafficclass.value; - } - - if (pkf->flags & TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL) { - /* Flow label component */ - tft.pkf[i]->data.ipv6.fl = pkf->flowlabel; - } - } - } - - /* Execute the dedicated EPS bearer context activation procedure */ - int rc = esm_proc_dedicated_eps_bearer_context_request(ebi, - msg->linkedepsbeareridentity, - &qos, &tft, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Release temporary traffic flow template data */ - for (i = 0; i < tft.n_pkfs; i++) { - free(tft.pkf[i]); - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_deactivate_eps_bearer_context_request() ** - ** ** - ** Description: Processes Deactivate EPS Bearer Context Request message ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi, - const deactivate_eps_bearer_context_request_msg *msg) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - int esm_cause; - - LOG_TRACE(INFO, "ESM-SAP - Received Deactivate EPS Bearer Context " - "Request message (pti=%d, ebi=%d)", pti, ebi); - - /* - * Procedure transaction identity checking - */ - if ( esm_pt_is_reserved(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case m - * Reserved PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } else if ( esm_pt_is_not_in_use(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case m - * Assigned value does not match any PTI in use - */ - LOG_TRACE(WARNING, "ESM-SAP - PTI mismatch (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_PTI_MISMATCH); - } - /* - * EPS bearer identity checking - */ - else if ( (ebi == ESM_EBI_UNASSIGNED) || esm_ebr_is_reserved(ebi) || - esm_ebr_is_not_in_use(ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case j - * Reserved or unassigned EPS bearer identity value or, - * assigned value that does not match an existing EPS bearer context - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - /* Respond with a DEACTIVATE EPS BEARER CONTEXT ACCEPT message with - * the EPS bearer identity set to the received EPS bearer identity */ - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Get the ESM cause */ - esm_cause = msg->esmcause; - - /* Execute the PDN disconnect procedure accepted by the network */ - if (pti != ESM_PT_UNASSIGNED) { - rc = esm_proc_pdn_disconnect_accept(pti, &esm_cause); - } - - if (rc != RETURNerror) { - /* Execute the EPS bearer context deactivation procedure */ - rc = esm_proc_eps_bearer_context_deactivate_request(ebi, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME upon receiving ESM message from the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_recv_pdn_connectivity_request() ** - ** ** - ** Description: Processes PDN connectivity request message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: new_ebi: New assigned EPS bearer identity ** - ** data: PDN connection and EPS bearer context data ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_pdn_connectivity_request(emm_data_context_t *ctx, int pti, int ebi, - const pdn_connectivity_request_msg *msg, - unsigned int *new_ebi, void *data) -{ - int esm_cause = ESM_CAUSE_SUCCESS; - uint8_t i; - - LOG_FUNC_IN; - - LOG_TRACE(INFO, "ESM-SAP - Received PDN Connectivity Request message " - "(ueid=%u, pti=%d, ebi=%d)", ctx->ueid, pti, ebi); - - /* - * Procedure transaction identity checking - */ - if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case a - * Reserved or unassigned PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } - /* - * EPS bearer identity checking - */ - else if ( ebi != ESM_EBI_UNASSIGNED ) { - /* 3GPP TS 24.301, section 7.3.2, case a - * Reserved or assigned EPS bearer identity value */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Get PDN connection and EPS bearer context data structure to setup */ - esm_proc_data_t *esm_data = (esm_proc_data_t *)(data); - - if (data == NULL) { - LOG_TRACE(ERROR, "ESM-SAP - Invalid ESM data structure"); - LOG_FUNC_RETURN (ESM_CAUSE_PROTOCOL_ERROR); - } - - /* Get the PDN connectivity request type */ - int request_type = -1; - - if (msg->requesttype == REQUEST_TYPE_INITIAL_REQUEST) { - request_type = ESM_PDN_REQUEST_INITIAL; - } else if (msg->requesttype == REQUEST_TYPE_HANDOVER) { - request_type = ESM_PDN_REQUEST_HANDOVER; - } else if (msg->requesttype == REQUEST_TYPE_EMERGENCY) { - request_type = ESM_PDN_REQUEST_EMERGENCY; - } else { - /* Unkown PDN request type */ - LOG_TRACE(ERROR, "ESM-SAP - Invalid PDN request type"); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_MANDATORY_INFO); - } - - /* Get the value of the PDN type indicator */ - if (msg->pdntype == PDN_TYPE_IPV4) { - esm_data->pdn_type = ESM_PDN_TYPE_IPV4; - } else if (msg->pdntype == PDN_TYPE_IPV6) { - esm_data->pdn_type = ESM_PDN_TYPE_IPV6; - } else if (msg->pdntype == PDN_TYPE_IPV4V6) { - esm_data->pdn_type = ESM_PDN_TYPE_IPV4V6; - } else { - /* Unkown PDN type */ - LOG_TRACE(ERROR, "ESM-SAP - Invalid PDN type"); - LOG_FUNC_RETURN (ESM_CAUSE_UNKNOWN_PDN_TYPE); - } - - /* Get the Access Point Name, if provided */ - if (msg->presencemask & PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) { - esm_data->apn = msg->accesspointname.accesspointnamevalue; - } - - /* Get the ESM information transfer flag */ - if (msg->presencemask & - PDN_CONNECTIVITY_REQUEST_ESM_INFORMATION_TRANSFER_FLAG_PRESENT) { - /* 3GPP TS 24.301, sections 6.5.1.2, 6.5.1.3 - * ESM information, i.e. protocol configuration options, APN, or both, - * has to be sent after the NAS signalling security has been activated - * between the UE and the MME. - * - * The MME then at a later stage in the PDN connectivity procedure - * initiates the ESM information request procedure in which the UE - * can provide the MME with protocol configuration options or APN - * or both. - * The MME waits for completion of the ESM information request - * procedure before proceeding with the PDN connectivity procedure. - */ - //TODO: rc = esm_proc_information_request(); - } - esm_data->pco = msg->protocolconfigurationoptions; - for (i = 0; i < msg->protocolconfigurationoptions.num_protocol_id_or_container_id; i++) { - DUP_OCTET_STRING(msg->protocolconfigurationoptions.protocolidcontents[i], esm_data->pco.protocolidcontents[i]); - esm_data->pco.protocolid[i] = msg->protocolconfigurationoptions.protocolid[i]; - esm_data->pco.lengthofprotocolid[i] = msg->protocolconfigurationoptions.lengthofprotocolid[i]; - } - - -#if defined(ORIGINAL_CODE) - /* Execute the PDN connectivity procedure requested by the UE */ - int pid = esm_proc_pdn_connectivity_request(ctx, pti, request_type, - &esm_data->apn, - esm_data->pdn_type, - &esm_data->pdn_addr, - &esm_data->qos, - &esm_cause); - - if (pid != RETURNerror) { - /* Create local default EPS bearer context */ - int rc = esm_proc_default_eps_bearer_context(ctx, pid, new_ebi, - &esm_data->qos, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - } - -#else - int is_emergency = (request_type == ESM_PDN_REQUEST_EMERGENCY); - - nas_itti_pdn_connectivity_req( - pti, - ctx->ueid, - ctx->imsi, - esm_data, - request_type); - esm_cause = ESM_CAUSE_SUCCESS; -#endif - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_pdn_disconnect_request() ** - ** ** - ** Description: Processes PDN disconnect request message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: linked_ebi: Linked EPS bearer identity of the default ** - ** bearer associated with the PDN to discon- ** - ** nect from ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_pdn_disconnect_request(emm_data_context_t *ctx, int pti, int ebi, - const pdn_disconnect_request_msg *msg, - unsigned int *linked_ebi) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - - LOG_TRACE(INFO, "ESM-SAP - Received PDN Disconnect Request message " - "(ueid=%d, pti=%d, ebi=%d)", ctx->ueid, pti, ebi); - - /* - * Procedure transaction identity checking - */ - if ( (pti == ESM_PT_UNASSIGNED) || esm_pt_is_reserved(pti) ) { - /* 3GPP TS 24.301, section 7.3.1, case b - * Reserved or unassigned PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } - /* - * EPS bearer identity checking - */ - else if ( ebi != ESM_EBI_UNASSIGNED ) { - /* 3GPP TS 24.301, section 7.3.2, case b - * Reserved or assigned EPS bearer identity value */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Execute the PDN disconnect procedure requested by the UE */ - int pid = esm_proc_pdn_disconnect_request(ctx, pti, &esm_cause); - - if (pid != RETURNerror) { - /* Get the identity of the default EPS bearer context assigned to - * the PDN connection to disconnect from */ - *linked_ebi = msg->linkedepsbeareridentity; - /* Release the associated default EPS bearer context */ - int bid = 0; - int rc = esm_proc_eps_bearer_context_deactivate(ctx, FALSE, - *linked_ebi, - &pid, &bid, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_activate_default_eps_bearer_context_accept() ** - ** ** - ** Description: Processes Activate Default EPS Bearer Context Accept ** - ** message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_activate_default_eps_bearer_context_accept(emm_data_context_t *ctx, - int pti, int ebi, - const activate_default_eps_bearer_context_accept_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - - LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context " - "Accept message (ueid=%d, pti=%d, ebi=%d)", ctx->ueid, pti, ebi); - - /* - * Procedure transaction identity checking - */ - if (esm_pt_is_reserved(pti)) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Reserved PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } - /* - * EPS bearer identity checking - */ - else if ( esm_ebr_is_reserved(ebi) || esm_ebr_is_not_in_use(ctx, ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case f - * Reserved or assigned value that does not match an existing EPS - * bearer context - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Execute the default EPS bearer context activation procedure accepted - * by the UE */ - int rc = esm_proc_default_eps_bearer_context_accept(ctx, ebi, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_activate_default_eps_bearer_context_reject() ** - ** ** - ** Description: Processes Activate Default EPS Bearer Context Reject ** - ** message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fail ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_activate_default_eps_bearer_context_reject(emm_data_context_t *ctx, - int pti, int ebi, - const activate_default_eps_bearer_context_reject_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - - LOG_TRACE(INFO, "ESM-SAP - Received Activate Default EPS Bearer Context " - "Reject message (ueid=%d, pti=%d, ebi=%d)", ctx->ueid, pti, ebi); - - /* - * Procedure transaction identity checking - */ - if (esm_pt_is_reserved(pti)) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Reserved PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } - /* - * EPS bearer identity checking - */ - else if ( esm_ebr_is_reserved(ebi) || esm_ebr_is_not_in_use(ctx, ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case f - * Reserved or assigned value that does not match an existing EPS - * bearer context - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Execute the default EPS bearer context activation procedure not accepted - * by the UE */ - int rc = esm_proc_default_eps_bearer_context_reject(ctx, ebi, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_activate_dedicated_eps_bearer_context_accept() ** - ** ** - ** Description: Processes Activate Dedicated EPS Bearer Context Accept ** - ** message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_activate_dedicated_eps_bearer_context_accept(emm_data_context_t *ctx, - int pti, int ebi, - const activate_dedicated_eps_bearer_context_accept_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - - LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer " - "Context Accept message (ueid=%d, pti=%d, ebi=%d)", - ctx->ueid, pti, ebi); - - /* - * Procedure transaction identity checking - */ - if (esm_pt_is_reserved(pti)) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Reserved PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } - /* - * EPS bearer identity checking - */ - else if ( esm_ebr_is_reserved(ebi) || esm_ebr_is_not_in_use(ctx, ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case f - * Reserved or assigned value that does not match an existing EPS - * bearer context - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Execute the dedicated EPS bearer context activation procedure accepted - * by the UE */ - int rc = esm_proc_dedicated_eps_bearer_context_accept(ctx, ebi, - &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_activate_dedicated_eps_bearer_context_reject() ** - ** ** - ** Description: Processes Activate Dedicated EPS Bearer Context Reject ** - ** message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fail ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_activate_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, - int pti, int ebi, - const activate_dedicated_eps_bearer_context_reject_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - - LOG_TRACE(INFO, "ESM-SAP - Received Activate Dedicated EPS Bearer " - "Context Reject message (ueid=%d, pti=%d, ebi=%d)", - ctx->ueid, pti, ebi); - - /* - * Procedure transaction identity checking - */ - if (esm_pt_is_reserved(pti)) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Reserved PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } - /* - * EPS bearer identity checking - */ - else if ( esm_ebr_is_reserved(ebi) || esm_ebr_is_not_in_use(ctx, ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case f - * Reserved or assigned value that does not match an existing EPS - * bearer context - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Execute the dedicated EPS bearer context activation procedure not - * accepted by the UE */ - int rc = esm_proc_dedicated_eps_bearer_context_reject(ctx, ebi, - &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -/**************************************************************************** - ** ** - ** Name: esm_recv_deactivate_eps_bearer_context_accept() ** - ** ** - ** Description: Processes Deactivate EPS Bearer Context Accept message ** - ** ** - ** Inputs: ueid: UE local identifier ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** msg: The received ESM message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: ESM cause code whenever the processing of ** - ** the ESM message fails ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_recv_deactivate_eps_bearer_context_accept(emm_data_context_t *ctx, - int pti, int ebi, - const deactivate_eps_bearer_context_accept_msg *msg) -{ - LOG_FUNC_IN; - - int esm_cause = ESM_CAUSE_SUCCESS; - - LOG_TRACE(INFO, "ESM-SAP - Received Deactivate EPS Bearer Context " - "Accept message (ueid=%d, pti=%d, ebi=%d)", ctx->ueid, pti, ebi); - - /* - * Procedure transaction identity checking - */ - if (esm_pt_is_reserved(pti)) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Reserved PTI value - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid PTI value (pti=%d)", pti); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_PTI_VALUE); - } - /* - * EPS bearer identity checking - */ - else if ( esm_ebr_is_reserved(ebi) || esm_ebr_is_not_in_use(ctx, ebi) ) { - /* 3GPP TS 24.301, section 7.3.2, case f - * Reserved or assigned value that does not match an existing EPS - * bearer context - */ - LOG_TRACE(WARNING, "ESM-SAP - Invalid EPS bearer identity (ebi=%d)", - ebi); - LOG_FUNC_RETURN (ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); - } - - /* - * Message processing - */ - /* Execute the default EPS bearer context activation procedure accepted - * by the UE */ - int pid = esm_proc_eps_bearer_context_deactivate_accept(ctx, ebi, - &esm_cause); - - if (pid != RETURNerror) { - /* Release all the resources reserved for the PDN */ - int rc = esm_proc_pdn_disconnect_accept(ctx, pid, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } - } - - /* Return the ESM cause value */ - LOG_FUNC_RETURN (esm_cause); -} - -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.h b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.h deleted file mode 100644 index f7da2b773b2470fb4e0d766f93cb688ced3e3211..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_recv.h +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_recv.h - -Version 0.1 - -Date 2013/02/06 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions executed at the ESM Service Access - Point upon receiving EPS Session Management messages - from the EPS Mobility Management sublayer. - -*****************************************************************************/ -#ifndef __ESM_RECV_H__ -#define __ESM_RECV_H__ - -#include "EsmStatus.h" -#include "emmData.h" - -#ifdef NAS_UE -#include "PdnConnectivityReject.h" -#include "PdnDisconnectReject.h" -#include "BearerResourceAllocationReject.h" -#include "BearerResourceModificationReject.h" - -#include "ActivateDefaultEpsBearerContextRequest.h" -#include "ActivateDedicatedEpsBearerContextRequest.h" -#include "ModifyEpsBearerContextRequest.h" -#include "DeactivateEpsBearerContextRequest.h" - -#include "EsmInformationRequest.h" -#endif - -#ifdef NAS_MME -#include "PdnConnectivityRequest.h" -#include "PdnDisconnectRequest.h" -#include "BearerResourceAllocationRequest.h" -#include "BearerResourceModificationRequest.h" - -#include "ActivateDefaultEpsBearerContextAccept.h" -#include "ActivateDefaultEpsBearerContextReject.h" -#include "ActivateDedicatedEpsBearerContextAccept.h" -#include "ActivateDedicatedEpsBearerContextReject.h" -#include "ModifyEpsBearerContextAccept.h" -#include "ModifyEpsBearerContextReject.h" -#include "DeactivateEpsBearerContextAccept.h" - -#include "EsmInformationResponse.h" -#endif - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME upon receiving ESM messages - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -int esm_recv_status(int pti, int ebi, const esm_status_msg *msg); -#endif -#ifdef NAS_MME -int esm_recv_status(emm_data_context_t *ctx, int pti, int ebi, - const esm_status_msg *msg); -#endif - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE upon receiving ESM message from the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Transaction related messages - * ---------------------------- - */ -int esm_recv_pdn_connectivity_reject(int pti, int ebi, - const pdn_connectivity_reject_msg *msg); - -int esm_recv_pdn_disconnect_reject(int pti, int ebi, - const pdn_disconnect_reject_msg *msg); - -/* - * Messages related to EPS bearer contexts - * --------------------------------------- - */ -int esm_recv_activate_default_eps_bearer_context_request(int pti, int ebi, - const activate_default_eps_bearer_context_request_msg *msg); - -int esm_recv_activate_dedicated_eps_bearer_context_request(int pti, int ebi, - const activate_dedicated_eps_bearer_context_request_msg *msg); - -int esm_recv_deactivate_eps_bearer_context_request(int pti, int ebi, - const deactivate_eps_bearer_context_request_msg *msg); -#endif - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME upon receiving ESM message from the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Transaction related messages - * ---------------------------- - */ -int esm_recv_pdn_connectivity_request(emm_data_context_t *ctx, int pti, int ebi, - const pdn_connectivity_request_msg *msg, unsigned int *new_ebi, void *data); - -int esm_recv_pdn_disconnect_request(emm_data_context_t *ctx, int pti, int ebi, - const pdn_disconnect_request_msg *msg, - unsigned int *linked_ebi); - -/* - * Messages related to EPS bearer contexts - * --------------------------------------- - */ -int esm_recv_activate_default_eps_bearer_context_accept(emm_data_context_t *ctx, - int pti, int ebi, const activate_default_eps_bearer_context_accept_msg *msg); - -int esm_recv_activate_default_eps_bearer_context_reject(emm_data_context_t *ctx, - int pti, int ebi, const activate_default_eps_bearer_context_reject_msg *msg); - -int esm_recv_activate_dedicated_eps_bearer_context_accept(emm_data_context_t *ctx, - int pti, int ebi, const activate_dedicated_eps_bearer_context_accept_msg *msg); - -int esm_recv_activate_dedicated_eps_bearer_context_reject(emm_data_context_t *ctx, - int pti, int ebi, const activate_dedicated_eps_bearer_context_reject_msg *msg); - -int esm_recv_deactivate_eps_bearer_context_accept(emm_data_context_t *ctx, int pti, - int ebi, const deactivate_eps_bearer_context_accept_msg *msg); -#endif - -#endif /* __ESM_RECV_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.c b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.c deleted file mode 100644 index 5220aba605e5a0476f3acc557ec0d943af449fbe..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.c +++ /dev/null @@ -1,1190 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_sap.c - -Version 0.1 - -Date 2012/11/22 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the ESM Service Access Points at which the EPS - Session Management sublayer provides procedures for the - EPS bearer context handling and resources allocation. - -*****************************************************************************/ - -#include "esm_sap.h" -#include "esm_recv.h" -#include "esm_send.h" -#include "commonDef.h" -#include "nas_log.h" - -#include "OctetString.h" -#include "TLVDecoder.h" -#include "esm_msgDef.h" -#include "esm_msg.h" - -#include "esm_cause.h" -#include "esm_proc.h" - -#include <string.h> // memset, strlen -#include <assert.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -static int _esm_sap_recv(int msg_type, int is_standalone, - const OctetString *req, OctetString *rsp, esm_sap_error_t *err); -static int _esm_sap_send(int msg_type, int is_standalone, int pti, int ebi, - const esm_sap_data_t *data, OctetString *rsp); -#endif - -#ifdef NAS_MME -static int _esm_sap_recv(int msg_type, int is_standalone, emm_data_context_t *ctx, - const OctetString *req, OctetString *rsp, esm_sap_error_t *err); -static int _esm_sap_send(int msg_type, int is_standalone, emm_data_context_t *ctx, - int pti, int ebi, const esm_sap_data_t *data, OctetString *rsp); -#endif - -/* - * String representation of ESM-SAP primitives - */ -static const char *_esm_sap_primitive_str[] = { - "ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ", - "ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF", - "ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ", - "ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REQ", - "ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_CNF", - "ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REJ", - "ESM_EPS_BEARER_CONTEXT_MODIFY_REQ", - "ESM_EPS_BEARER_CONTEXT_MODIFY_CNF", - "ESM_EPS_BEARER_CONTEXT_MODIFY_REJ", - "ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ", - "ESM_EPS_BEARER_CONTEXT_DEACTIVATE_CNF", - "ESM_PDN_CONNECTIVITY_REQ", - "ESM_PDN_CONNECTIVITY_REJ", - "ESM_PDN_DISCONNECT_REQ", - "ESM_PDN_DISCONNECT_REJ", - "ESM_BEARER_RESOURCE_ALLOCATE_REQ", - "ESM_BEARER_RESOURCE_ALLOCATE_REJ", - "ESM_BEARER_RESOURCE_MODIFY_REQ", - "ESM_BEARER_RESOURCE_MODIFY_REJ", - "ESM_UNITDATA_IND", -}; - -/* - * Buffer used to encode ESM messages before being returned to the EPS - * Mobility Management sublayer in order to be sent onto the network - */ -#define ESM_SAP_BUFFER_SIZE 4096 -static char _esm_sap_buffer[ESM_SAP_BUFFER_SIZE]; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: esm_sap_initialize() ** - ** ** - ** Description: Initializes the ESM Service Access Point state machine ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: NONE ** - ** ** - ***************************************************************************/ -void esm_sap_initialize(void) -{ - LOG_FUNC_IN; - - /* Initialize ESM state machine */ - //esm_fsm_initialize(); - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: esm_sap_send() ** - ** ** - ** Description: Processes the ESM Service Access Point primitive ** - ** ** - ** Inputs: msg: The ESM-SAP primitive to process ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_sap_send(esm_sap_t *msg) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - int pid; - - /* Check the ESM-SAP primitive */ - esm_primitive_t primitive = msg->primitive; - assert( (primitive > ESM_START) && (primitive < ESM_END)); - - LOG_TRACE(INFO, "ESM-SAP - Received primitive %s (%d)", - _esm_sap_primitive_str[primitive - ESM_START - 1], primitive); - - switch (primitive) { - case ESM_PDN_CONNECTIVITY_REQ: -#ifdef NAS_UE - { - esm_pdn_connectivity_t *pdn_connect = &msg->data.pdn_connect; - - if ( !msg->is_standalone || !pdn_connect->is_defined ) { - OctetString apn = {0, NULL}; - - if (pdn_connect->apn) { - apn.length = strlen(pdn_connect->apn); - apn.value = (uint8_t *)pdn_connect->apn; - } - - /* Define new PDN context */ - rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE, - pdn_connect->pdn_type, &apn, - pdn_connect->is_emergency, NULL); - - if ( msg->is_standalone || (rc != RETURNok) ) { - break; - } - } - - if (pdn_connect->is_defined) { - unsigned int pti; - /* Assign new procedure transaction identity */ - rc = esm_proc_pdn_connectivity(pdn_connect->cid, TRUE, - pdn_connect->pdn_type, NULL, - pdn_connect->is_emergency, &pti); - - if (rc != RETURNerror) { - /* Send PDN connectivity request */ - rc = _esm_sap_send(PDN_CONNECTIVITY_REQUEST, - msg->is_standalone, - pti, EPS_BEARER_IDENTITY_UNASSIGNED, - &msg->data, &msg->send); - } - } - } - -#endif -#ifdef NAS_MME - /* The MME received a PDN connectivity request message */ - rc = _esm_sap_recv(PDN_CONNECTIVITY_REQUEST, msg->is_standalone, - msg->ctx, msg->recv, &msg->send, &msg->err); -#endif - break; - - case ESM_PDN_CONNECTIVITY_REJ: -#ifdef NAS_MME - /* PDN connectivity locally failed */ - pid = esm_proc_default_eps_bearer_context_failure(msg->ctx); - - if (pid != RETURNerror) { - rc = esm_proc_pdn_connectivity_failure(msg->ctx, pid); - } - -#endif -#ifdef NAS_UE - { - esm_pdn_connectivity_t *pdn_connect = &msg->data.pdn_connect; - - if ( msg->is_standalone && pdn_connect->is_defined ) { - /* Undefine the specified PDN context */ - rc = esm_proc_pdn_connectivity(pdn_connect->cid, FALSE, - pdn_connect->pdn_type, NULL, - pdn_connect->is_emergency, NULL); - } else if (msg->recv != NULL) { - /* The UE received a PDN connectivity reject message */ - rc = _esm_sap_recv(PDN_CONNECTIVITY_REJECT, msg->is_standalone, - msg->recv, &msg->send, &msg->err); - } else { - /* The PDN connectivity procedure locally failed */ - rc = esm_proc_pdn_connectivity_failure(TRUE); - } - } -#endif - break; - - case ESM_PDN_DISCONNECT_REQ: -#ifdef NAS_UE - { - unsigned int pti, ebi; - /* Get the procedure transaction identity and the EPS bearer - * identity of the default bearer assigned to the PDN to - * disconnect from */ - rc = esm_proc_pdn_disconnect(msg->data.pdn_disconnect.cid, - &pti, &ebi); - - if (rc != RETURNerror) { - /* Send PDN disconnect request */ - rc = _esm_sap_send(PDN_DISCONNECT_REQUEST, TRUE, pti, ebi, - &msg->data, &msg->send); - } - } - -#endif - break; - - case ESM_PDN_DISCONNECT_REJ: - break; - - case ESM_BEARER_RESOURCE_ALLOCATE_REQ: - break; - - case ESM_BEARER_RESOURCE_ALLOCATE_REJ: - break; - - case ESM_BEARER_RESOURCE_MODIFY_REQ: - break; - - case ESM_BEARER_RESOURCE_MODIFY_REJ: - break; - - case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ: -#ifdef NAS_UE - /* The UE received activate default ESP bearer context request */ - rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST, - msg->is_standalone, - msg->recv, &msg->send, &msg->err); -#endif - break; - - case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF: -#ifdef NAS_MME - /* The MME received activate default ESP bearer context accept */ - rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT, - msg->is_standalone, msg->ctx, - msg->recv, &msg->send, &msg->err); -#endif -#ifdef NAS_UE - /* - * The activate default ESP bearer context accept message - * has been successfully delivered to the other side - */ - rc = esm_proc_default_eps_bearer_context_complete(); - - if (rc != RETURNerror) { - rc = esm_proc_pdn_connectivity_complete(); - } - -#endif - break; - - case ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ: -#ifdef NAS_MME - /* The MME received activate default ESP bearer context reject */ - rc = _esm_sap_recv(ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT, - msg->is_standalone, msg->ctx, - msg->recv, &msg->send, &msg->err); -#endif -#ifdef NAS_UE - /* - * Default ESP bearer context activation procedure locally failed - */ - rc = esm_proc_default_eps_bearer_context_failure(); - - if (rc != RETURNerror) { - rc = esm_proc_pdn_connectivity_failure(FALSE); - } - -#endif - break; - - case ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REQ: - break; - - case ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_CNF: - break; - - case ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REJ: - break; - - case ESM_EPS_BEARER_CONTEXT_MODIFY_REQ: - break; - - case ESM_EPS_BEARER_CONTEXT_MODIFY_CNF: - break; - - case ESM_EPS_BEARER_CONTEXT_MODIFY_REJ: - break; - - case ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ: { - int bid; - /* - * Locally deactivate EPS bearer context - */ -#ifdef NAS_UE - rc = esm_proc_eps_bearer_context_deactivate(TRUE, - msg->data.eps_bearer_context_deactivate.ebi, &pid, &bid); -#endif -#ifdef NAS_MME - rc = esm_proc_eps_bearer_context_deactivate(msg->ctx, TRUE, - msg->data.eps_bearer_context_deactivate.ebi, - &pid, &bid, NULL); -#endif - } - break; - - case ESM_EPS_BEARER_CONTEXT_DEACTIVATE_CNF: - break; - - case ESM_UNITDATA_IND: -#ifdef NAS_UE - rc = _esm_sap_recv(-1, msg->is_standalone, msg->recv, - &msg->send, &msg->err); -#endif -#ifdef NAS_MME - rc = _esm_sap_recv(-1, msg->is_standalone, msg->ctx, - msg->recv, &msg->send, &msg->err); -#endif - break; - - default: - break; - } - -#ifdef NAS_MME - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "ESM-SAP - Failed to process primitive %s (%d)", - _esm_sap_primitive_str[primitive - ESM_START - 1], primitive); - } - -#endif - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _esm_sap_recv() ** - ** ** - ** Description: Processes ESM messages received from the network: Decodes ** - ** the message and checks whether it is of the expected ty- ** - ** pe, checks the validity of the procedure transaction iden-** - ** tity, checks the validity of the EPS bearer identity, and ** - ** parses the message content. ** - ** If no protocol error is found the ESM response message is ** - ** returned in order to be sent back onto the network upon ** - ** the relevant ESM procedure completion. ** - ** If a protocol error is found the ESM status message is ** - ** returned including the value of the ESM cause code. ** - ** ** - ** Inputs: msg_type: Expected type of the received ESM message ** - ** is_standalone: Indicates whether the ESM message has been ** - ** received standalone or together within EMM ** - ** attach related message ** - ** ueid: UE identifier within the MME ** - ** req: The encoded ESM request message to process ** - ** Others: None ** - ** ** - ** Outputs: rsp: The encoded ESM response message to be re- ** - ** turned upon ESM procedure completion ** - ** err: Error code of the ESM procedure ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_sap_buffer ** - ** ** - ***************************************************************************/ -static int _esm_sap_recv(int msg_type, int is_standalone, -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - const OctetString *req, OctetString *rsp, - esm_sap_error_t *err) -{ - esm_proc_procedure_t esm_procedure = NULL; - int esm_cause = ESM_CAUSE_SUCCESS; - int rc = RETURNerror; - int decoder_rc; - - ESM_msg esm_msg; - - LOG_FUNC_IN; - - memset(&esm_msg, 0 , sizeof(ESM_msg)); - - /* Decode the received ESM message */ - decoder_rc = esm_msg_decode(&esm_msg, req->value, req->length); - - /* Process decoding errors */ - if (decoder_rc < 0) { - /* 3GPP TS 24.301, section 7.2 - * Ignore received message that is too short to contain a complete - * message type information element */ - if (decoder_rc == TLV_DECODE_BUFFER_TOO_SHORT) { - LOG_TRACE(WARNING, "ESM-SAP - Discard message too short to " - "contain a complete message type IE"); - /* Return indication that received message has been discarded */ - *err = ESM_SAP_DISCARDED; - LOG_FUNC_RETURN (RETURNok); - } - /* 3GPP TS 24.301, section 7.2 - * Unknown or unforeseen message type */ - else if (decoder_rc == TLV_DECODE_WRONG_MESSAGE_TYPE) { - esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED; - } - /* 3GPP TS 24.301, section 7.7.2 - * Conditional IE errors */ - else if (decoder_rc == TLV_DECODE_UNEXPECTED_IEI) { - esm_cause = ESM_CAUSE_CONDITIONAL_IE_ERROR; - } else { - esm_cause = ESM_CAUSE_PROTOCOL_ERROR; - } - } - /* Check the type of the ESM message actually received */ - else if ( (msg_type > 0) && (msg_type != esm_msg.header.message_type) ) { - if (esm_msg.header.message_type != ESM_STATUS) { - /* Semantically incorrect ESM message */ - LOG_TRACE(ERROR, "ESM-SAP - Received ESM message 0x%x is not " - "of the expected type (0x%x)", - esm_msg.header.message_type, msg_type); - esm_cause = ESM_CAUSE_SEMANTICALLY_INCORRECT; - } - } - - /* Get the procedure transaction identity */ - unsigned int pti = esm_msg.header.procedure_transaction_identity; - /* Get the EPS bearer identity */ - unsigned int ebi = esm_msg.header.eps_bearer_identity; - /* Indicate whether the ESM bearer context related procedure was triggered - * by the receipt of a transaction related request message from the UE or - * was triggered network-internally */ - int triggered_by_ue = (pti != PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED); - /* Indicate whether the received message shall be ignored */ - int is_discarded = FALSE; - - if (esm_cause != ESM_CAUSE_SUCCESS) { - LOG_TRACE(ERROR, "ESM-SAP - Failed to decode expected ESM message " - "0x%x", msg_type); - } - /* Process the received ESM message */ - else switch (esm_msg.header.message_type) { -#ifdef NAS_UE - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: - /* - * Process activate default EPS bearer context request message - * received from the MME - */ - esm_cause = esm_recv_activate_default_eps_bearer_context_request( - pti, ebi, - &esm_msg.activate_default_eps_bearer_context_request); - - if ( (esm_cause == ESM_CAUSE_SUCCESS) || - (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) ) { - /* Return accept message */ - rc = esm_send_activate_default_eps_bearer_context_accept(ebi, - &esm_msg.activate_default_eps_bearer_context_accept); - /* Setup the callback function used to send activate default - * EPS bearer context accept message onto the network */ - esm_procedure = esm_proc_default_eps_bearer_context_accept; - - if (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) { - /* 3GPP TS 24.301, section 7.3.1, case g - * Return accept message, even to network retransmission - * of already accepted activate default EPS bearer context - * request message - */ - is_discarded = TRUE; - } - } else { - /* Return reject message */ - rc = esm_send_activate_default_eps_bearer_context_reject(ebi, - &esm_msg.activate_default_eps_bearer_context_reject, - esm_cause); - /* Setup the callback function used to send activate default - * EPS bearer context reject message onto the network */ - esm_procedure = esm_proc_default_eps_bearer_context_reject; - } - - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST: - /* - * Process activate dedicated EPS bearer context request message - * received from the MME - */ - esm_cause = esm_recv_activate_dedicated_eps_bearer_context_request( - pti, ebi, - &esm_msg.activate_dedicated_eps_bearer_context_request); - - if ( (esm_cause == ESM_CAUSE_SUCCESS) || - (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) ) { - /* Return accept message */ - rc = esm_send_activate_dedicated_eps_bearer_context_accept(ebi, - &esm_msg.activate_dedicated_eps_bearer_context_accept); - /* Setup the callback function used to send activate dedicated - * EPS bearer context accept message onto the network */ - esm_procedure = esm_proc_dedicated_eps_bearer_context_accept; - - if (esm_cause == ESM_CAUSE_PTI_ALREADY_IN_USE) { - /* 3GPP TS 24.301, section 7.3.1, case i - * Return accept message, even to network retransmission - * of already accepted activate dedicated EPS bearer context - * request message - */ - is_discarded = TRUE; - } - } else { - /* Return reject message */ - rc = esm_send_activate_dedicated_eps_bearer_context_reject(ebi, - &esm_msg.activate_dedicated_eps_bearer_context_reject, - esm_cause); - /* Setup the callback function used to send activate dedicated - * EPS bearer context reject message onto the network */ - esm_procedure = esm_proc_dedicated_eps_bearer_context_reject; - } - - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST: - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST: - /* - * Process deactivate EPS bearer context request message - * received from the MME - */ - esm_cause = esm_recv_deactivate_eps_bearer_context_request(pti, ebi, - &esm_msg.deactivate_eps_bearer_context_request); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_PTI_MISMATCH) ) { - /* 3GPP TS 24.301, section 7.3.1, case m - * Ignore deactivate EPS bearer context request message - * received with PTI reserved value, or assigned value - * that does not match any PTI in use - */ - is_discarded = TRUE; - } else if ( (esm_cause == ESM_CAUSE_SUCCESS) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* Return accept message */ - rc = esm_send_deactivate_eps_bearer_context_accept(ebi, - &esm_msg.deactivate_eps_bearer_context_accept); - /* Setup the callback function used to send deactivate - * EPS bearer context accept message onto the network */ - esm_procedure = esm_proc_eps_bearer_context_deactivate_accept; - - if (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) { - /* 3GPP TS 24.301, section 7.3.2, case j - * Respond with a deactivate EPS bearer context accept - * message with the EPS bearer identity set to the received - * EPS bearer identity - */ - is_discarded = TRUE; - } - } - - break; - - case PDN_CONNECTIVITY_REJECT: - /* - * Process PDN connectivity reject message received from the MME - */ - esm_cause = esm_recv_pdn_connectivity_reject(pti, ebi, - &esm_msg.pdn_connectivity_reject); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_PTI_MISMATCH) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* 3GPP TS 24.301, section 7.3.1, case a - * Ignore PDN connectivity reject message received with - * reserved or unassigned PTI value, or assigned value that - * does not match any PTI in use - * 3GPP TS 24.301, section 7.3.2, case a - * Ignore PDN connectivity reject message received with - * reserved or unassigned EPS bearer identity value - */ - is_discarded = TRUE; - } - - break; - - case PDN_DISCONNECT_REJECT: - /* - * Process PDN disconnect reject message received from the MME - */ - esm_cause = esm_recv_pdn_disconnect_reject(pti, ebi, - &esm_msg.pdn_disconnect_reject); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_PTI_MISMATCH) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* 3GPP TS 24.301, section 7.3.1, case b - * Ignore PDN disconnect reject message received with - * reserved or unassigned PTI value, or assigned value that - * does not match any PTI in use - * 3GPP TS 24.301, section 7.3.2, case b - * Ignore PDN disconnect reject message received with - * reserved or unassigned EPS bearer identity value - */ - is_discarded = TRUE; - } - - break; - - case BEARER_RESOURCE_ALLOCATION_REJECT: - break; - - case BEARER_RESOURCE_MODIFICATION_REJECT: - break; - - case ESM_INFORMATION_REQUEST: - break; - - case ESM_STATUS: - /* - * Process received ESM status message - */ - esm_cause = esm_recv_status(pti, ebi, &esm_msg.esm_status); - break; -#endif - -#ifdef NAS_MME - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - /* - * Process activate default EPS bearer context accept message - * received from the UE - */ - esm_cause = esm_recv_activate_default_eps_bearer_context_accept( - ctx, pti, ebi, - &esm_msg.activate_default_eps_bearer_context_accept); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Ignore ESM message received with reserved PTI value - * 3GPP TS 24.301, section 7.3.2, case f - * Ignore ESM message received with reserved or assigned - * value that does not match an existing EPS bearer context - */ - is_discarded = TRUE; - } - - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: - /* - * Process activate default EPS bearer context reject message - * received from the UE - */ - esm_cause = esm_recv_activate_default_eps_bearer_context_reject( - ctx, pti, ebi, - &esm_msg.activate_default_eps_bearer_context_reject); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Ignore ESM message received with reserved PTI value - * 3GPP TS 24.301, section 7.3.2, case f - * Ignore ESM message received with reserved or assigned - * value that does not match an existing EPS bearer context - */ - is_discarded = TRUE; - } - - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - /* - * Process deactivate EPS bearer context accept message - * received from the UE - */ - esm_cause = esm_recv_deactivate_eps_bearer_context_accept( - ctx, pti, ebi, - &esm_msg.deactivate_eps_bearer_context_accept); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Ignore ESM message received with reserved PTI value - * 3GPP TS 24.301, section 7.3.2, case f - * Ignore ESM message received with reserved or assigned - * value that does not match an existing EPS bearer context - */ - is_discarded = TRUE; - } - - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: - /* - * Process activate dedicated EPS bearer context accept message - * received from the UE - */ - esm_cause = esm_recv_activate_dedicated_eps_bearer_context_accept( - ctx, pti, ebi, - &esm_msg.activate_dedicated_eps_bearer_context_accept); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Ignore ESM message received with reserved PTI value - * 3GPP TS 24.301, section 7.3.2, case f - * Ignore ESM message received with reserved or assigned - * value that does not match an existing EPS bearer context - */ - is_discarded = TRUE; - } - - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT: - /* - * Process activate dedicated EPS bearer context reject message - * received from the UE - */ - esm_cause = esm_recv_activate_dedicated_eps_bearer_context_reject( - ctx, pti, ebi, - &esm_msg.activate_dedicated_eps_bearer_context_reject); - - if ( (esm_cause == ESM_CAUSE_INVALID_PTI_VALUE) || - (esm_cause == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) ) { - /* 3GPP TS 24.301, section 7.3.1, case f - * Ignore ESM message received with reserved PTI value - * 3GPP TS 24.301, section 7.3.2, case f - * Ignore ESM message received with reserved or assigned - * value that does not match an existing EPS bearer context - */ - is_discarded = TRUE; - } - - break; - - case MODIFY_EPS_BEARER_CONTEXT_ACCEPT: - break; - - case MODIFY_EPS_BEARER_CONTEXT_REJECT: - break; - - case PDN_CONNECTIVITY_REQUEST: { - esm_proc_data_t data; - memset(&data, 0, sizeof(esm_proc_data_t)); - - LOG_TRACE(DEBUG, "ESM-SAP - PDN_CONNECTIVITY_REQUEST pti %u ebi %u", pti, ebi); - - /* - * Process PDN connectivity request message received from the UE - */ - esm_cause = esm_recv_pdn_connectivity_request(ctx, pti, ebi, - &esm_msg.pdn_connectivity_request, - &ebi, &data); - - if (esm_cause != ESM_CAUSE_SUCCESS) { - /* Return reject message */ - rc = esm_send_pdn_connectivity_reject(pti, - &esm_msg.pdn_connectivity_reject, esm_cause); - /* Setup the callback function used to send PDN connectivity - * reject message onto the network */ - esm_procedure = esm_proc_pdn_connectivity_reject; - /* No ESM status message should be returned */ - esm_cause = ESM_CAUSE_SUCCESS; - } else { -#if defined(ORIGINAL_CODE) - /* Setup PDN type */ - int pdn_type = -1; - - if (data.pdn_type == ESM_PDN_TYPE_IPV4) { - pdn_type = PDN_VALUE_TYPE_IPV4; - } else if (data.pdn_type == ESM_PDN_TYPE_IPV6) { - pdn_type = PDN_VALUE_TYPE_IPV6; - } else if (data.pdn_type == ESM_PDN_TYPE_IPV4V6) { - pdn_type = PDN_VALUE_TYPE_IPV4V6; - } - - /* Setup EPS bearer level Quality of Service */ - EpsQualityOfService qos; - qos.bitRatesPresent = 1; - qos.bitRatesExtPresent = 0; - qos.qci = data.qos.qci; - qos.bitRates.maxBitRateForUL = data.qos.mbrUL; - qos.bitRates.maxBitRateForDL = data.qos.mbrDL; - qos.bitRates.guarBitRateForUL = data.qos.gbrUL; - qos.bitRates.guarBitRateForDL = data.qos.gbrDL; - - /* Return default EPS bearer context request message */ - rc = esm_send_activate_default_eps_bearer_context_request( - pti, ebi, - &esm_msg.activate_default_eps_bearer_context_request, - &data.apn, pdn_type, &data.pdn_addr, &qos, esm_cause); -#if 0 - PacketFilters pkfs; - pkfs[0].identifier = 1; - pkfs[0].direction = TRAFFIC_FLOW_TEMPLATE_DOWNLINK_ONLY; - pkfs[0].eval_precedence = 2; - pkfs[0].packetfilter.flags = - (TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG | - TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG | - TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG | - TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG); - pkfs[0].packetfilter.ipv4remoteaddr[0].addr = 192; - pkfs[0].packetfilter.ipv4remoteaddr[1].addr = 168; - pkfs[0].packetfilter.ipv4remoteaddr[2].addr = 12; - pkfs[0].packetfilter.ipv4remoteaddr[3].addr = 1; - pkfs[0].packetfilter.ipv4remoteaddr[0].mask = 255; - pkfs[0].packetfilter.ipv4remoteaddr[1].mask = 255; - pkfs[0].packetfilter.ipv4remoteaddr[2].mask = 255; - pkfs[0].packetfilter.ipv4remoteaddr[3].mask = 0; - pkfs[0].packetfilter.protocolidentifier_nextheader = 17; - pkfs[0].packetfilter.singlelocalport = 10001; - pkfs[0].packetfilter.singleremoteport = 12001; - pkfs[1].identifier = 2; - pkfs[1].direction = TRAFFIC_FLOW_TEMPLATE_UPLINK_ONLY; - pkfs[1].eval_precedence = 3; - pkfs[1].packetfilter.flags = - (TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG | - TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG | - TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG | - TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG); - pkfs[1].packetfilter.ipv4remoteaddr[0].addr = 192; - pkfs[1].packetfilter.ipv4remoteaddr[1].addr = 168; - pkfs[1].packetfilter.ipv4remoteaddr[2].addr = 12; - pkfs[1].packetfilter.ipv4remoteaddr[3].addr = 1; - pkfs[1].packetfilter.ipv4remoteaddr[0].mask = 255; - pkfs[1].packetfilter.ipv4remoteaddr[1].mask = 255; - pkfs[1].packetfilter.ipv4remoteaddr[2].mask = 255; - pkfs[1].packetfilter.ipv4remoteaddr[3].mask = 0; - pkfs[1].packetfilter.protocolidentifier_nextheader = 17; - pkfs[1].packetfilter.singlelocalport = 10002; - pkfs[1].packetfilter.singleremoteport = 12002; - /* Return dedicated EPS bearer context request message */ - rc = esm_send_activate_dedicated_eps_bearer_context_request( - pti, ebi, - &esm_msg.activate_dedicated_eps_bearer_context_request, - ebi, &qos, &pkfs, 2); -#endif - esm_procedure = esm_proc_default_eps_bearer_context_request; -#else - esm_cause = ESM_CAUSE_SUCCESS; -#endif - /* Setup the callback function used to send default EPS bearer - * context request message onto the network */ - //esm_procedure = esm_proc_default_eps_bearer_context_request; - } - - break; - } - - - case PDN_DISCONNECT_REQUEST: - /* - * Process PDN disconnect request message received from the UE - */ - esm_cause = esm_recv_pdn_disconnect_request(ctx, pti, ebi, - &esm_msg.pdn_disconnect_request, &ebi); - - if (esm_cause != ESM_CAUSE_SUCCESS) { - /* Return reject message */ - rc = esm_send_pdn_disconnect_reject(pti, - &esm_msg.pdn_disconnect_reject, esm_cause); - /* Setup the callback function used to send PDN connectivity - * reject message onto the network */ - esm_procedure = esm_proc_pdn_disconnect_reject; - /* No ESM status message should be returned */ - esm_cause = ESM_CAUSE_SUCCESS; - } else { - /* Return deactivate EPS bearer context request message */ - rc = esm_send_deactivate_eps_bearer_context_request(pti, ebi, - &esm_msg.deactivate_eps_bearer_context_request, - ESM_CAUSE_REGULAR_DEACTIVATION); - /* Setup the callback function used to send deactivate EPS - * bearer context request message onto the network */ - esm_procedure = esm_proc_eps_bearer_context_deactivate_request; - } - - break; - - case BEARER_RESOURCE_ALLOCATION_REQUEST: - break; - - case BEARER_RESOURCE_MODIFICATION_REQUEST: - break; - - case ESM_INFORMATION_RESPONSE: - break; - - case ESM_STATUS: - /* - * Process received ESM status message - */ - esm_cause = esm_recv_status(ctx, pti, ebi, &esm_msg.esm_status); - break; -#endif - - default: - LOG_TRACE(WARNING, "ESM-SAP - Received unexpected ESM message " - "0x%x", esm_msg.header.message_type); - esm_cause = ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED; - break; - } - - if ( (esm_cause != ESM_CAUSE_SUCCESS) && (esm_procedure == NULL) ) { - /* ESM message processing failed */ - if (!is_discarded) { - /* 3GPP TS 24.301, section 7.1 - * Handling of unknown, unforeseen, and erroneous protocol data */ - LOG_TRACE(WARNING, "ESM-SAP - Received ESM message is not valid " - "(cause=%d)", esm_cause); - /* Return an ESM status message */ - rc = esm_send_status(pti, ebi, &esm_msg.esm_status, esm_cause); - /* Setup the callback function used to send ESM status message - * onto the network */ - esm_procedure = esm_proc_status; - /* Discard received ESM message */ - is_discarded = TRUE; - } - } else { - /* ESM message processing succeed */ - *err = ESM_SAP_SUCCESS; - rc = RETURNok; - } - - if ( (rc != RETURNerror) && (esm_procedure != NULL) ) { - /* Encode the returned ESM response message */ - int size = esm_msg_encode(&esm_msg, (uint8_t *)_esm_sap_buffer, - ESM_SAP_BUFFER_SIZE); - - if (size > 0) { - rsp->length = size; - rsp->value = (uint8_t *)(_esm_sap_buffer); - } - - /* Complete the relevant ESM procedure */ -#ifdef NAS_UE - rc = (*esm_procedure)(is_standalone, ebi, rsp, triggered_by_ue); -#endif -#ifdef NAS_MME - rc = (*esm_procedure)(is_standalone, ctx, ebi, rsp, triggered_by_ue); -#endif - - if (is_discarded) { - /* Return indication that received message has been discarded */ - *err = ESM_SAP_DISCARDED; - } else if (rc != RETURNok) { - /* Return indication that ESM procedure failed */ - *err = ESM_SAP_FAILED; - } - } else if (is_discarded) { - LOG_TRACE(WARNING, "ESM-SAP - Silently discard message type 0x%x", - esm_msg.header.message_type); - /* Return indication that received message has been discarded */ - *err = ESM_SAP_DISCARDED; - rc = RETURNok; - } - - LOG_FUNC_RETURN(rc); -} - -/**************************************************************************** - ** ** - ** Name: _esm_sap_send() ** - ** ** - ** Description: Processes ESM messages to send onto the network: Encoded ** - ** the message and execute the relevant ESM procedure. ** - ** ** - ** Inputs: msg_type: Type of the ESM message to be sent ** - ** is_standalone: Indicates whether the ESM message has to ** - ** be sent standalone or together within EMM ** - ** attach related message ** - ** ueid: UE identifier within the MME ** - ** pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** data: Data required to build the message ** - ** Others: None ** - ** ** - ** Outputs: rsp: The encoded ESM response message to be re- ** - ** turned upon ESM procedure completion ** - ** Return: RETURNok, RETURNerror ** - ** Others: _esm_sap_buffer ** - ** ** - ***************************************************************************/ -static int _esm_sap_send(int msg_type, int is_standalone, -#ifdef NAS_MME - emm_data_context_t *ctx, -#endif - int pti, int ebi, const esm_sap_data_t *data, - OctetString *rsp) -{ - LOG_FUNC_IN; - - esm_proc_procedure_t esm_procedure = NULL; - int rc = RETURNok; - - /* Indicate whether the message is sent by the UE or the MME */ -#ifdef NAS_UE - int sent_by_ue = TRUE; -#endif -#ifdef NAS_MME - int sent_by_ue = FALSE; -#endif - - ESM_msg esm_msg; - memset(&esm_msg, 0 , sizeof(ESM_msg)); - - /* Process the ESM message to send */ - switch (msg_type) { -#ifdef NAS_UE - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT: - break; - - case MODIFY_EPS_BEARER_CONTEXT_ACCEPT: - break; - - case MODIFY_EPS_BEARER_CONTEXT_REJECT: - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - break; - - case PDN_CONNECTIVITY_REQUEST: { - /* - * Process PDN connectivity request message to send to the MME - */ - const esm_pdn_connectivity_t *msg = &data->pdn_connect; - rc = esm_send_pdn_connectivity_request(pti, msg->is_emergency, - msg->pdn_type, msg->apn, - &esm_msg.pdn_connectivity_request); - /* Setup callback function used to send PDN connectivity request - * message onto the network */ - esm_procedure = esm_proc_pdn_connectivity_request; - break; - } - - case PDN_DISCONNECT_REQUEST: - /* - * Process PDN disconnect request message to send to the MME - */ - rc = esm_send_pdn_disconnect_request(pti, ebi, - &esm_msg.pdn_disconnect_request); - /* Setup callback function used to send PDN disconnect request - * message onto the network */ - esm_procedure = esm_proc_pdn_disconnect_request; - break; - - case BEARER_RESOURCE_ALLOCATION_REQUEST: - break; - - case BEARER_RESOURCE_MODIFICATION_REQUEST: - break; -#endif - -#ifdef NAS_MME - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST: - break; - - case MODIFY_EPS_BEARER_CONTEXT_REQUEST: - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST: - break; - - case PDN_CONNECTIVITY_REJECT: - break; - - case PDN_DISCONNECT_REJECT: - break; - - case BEARER_RESOURCE_ALLOCATION_REJECT: - break; - - case BEARER_RESOURCE_MODIFICATION_REJECT: - break; -#endif - - default: - LOG_TRACE(WARNING, "ESM-SAP - Send unexpected ESM message 0x%x", - msg_type); - break; - } - - if (rc != RETURNerror) { - /* Encode the returned ESM response message */ - int size = esm_msg_encode(&esm_msg, (uint8_t *)_esm_sap_buffer, - ESM_SAP_BUFFER_SIZE); - - if (size > 0) { - rsp->length = size; - rsp->value = (uint8_t *)(_esm_sap_buffer); - } - - /* Execute the relevant ESM procedure */ - if (esm_procedure) { -#ifdef NAS_UE - rc = (*esm_procedure)(is_standalone, pti, rsp, sent_by_ue); -#endif -#ifdef NAS_MME - rc = (*esm_procedure)(is_standalone, ctx, pti, rsp, sent_by_ue); -#endif - } - } - - LOG_FUNC_RETURN(rc); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.h b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.h deleted file mode 100644 index c2d900a4ae3a239dac0f2f3ff1fe9546752d612c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sap.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_sap.h - -Version 0.1 - -Date 2012/11/22 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the ESM Service Access Points at which the EPS - Session Management sublayer provides procedures for the - EPS bearer context handling and resources allocation. - -*****************************************************************************/ -#ifndef __ESM_SAP_H__ -#define __ESM_SAP_H__ - -#include "esm_sapDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void esm_sap_initialize(void); - -int esm_sap_send(esm_sap_t *msg); - -#endif /* __ESM_SAP_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sapDef.h b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sapDef.h deleted file mode 100644 index 46017a96fc77f93096f3845239d33480af8eafe1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_sapDef.h +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_sapDef.h - -Version 0.1 - -Date 2012/11/21 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines the ESM Service Access Point that provides EPS - bearer context handling and resources allocation procedures. - -*****************************************************************************/ - -#include "emmData.h" - -#ifndef __ESM_SAPDEF_H__ -#define __ESM_SAPDEF_H__ - -#include "OctetString.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * EPS Session Management primitives - * --------------------------------- - */ -typedef enum esm_primitive_s { - ESM_START = 0, - /* Procedures related to EPS bearer contexts (initiated by the network) */ - ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ, - ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF, - ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REJ, - ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REQ, - ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_CNF, - ESM_DEDICATED_EPS_BEARER_CONTEXT_ACTIVATE_REJ, - ESM_EPS_BEARER_CONTEXT_MODIFY_REQ, - ESM_EPS_BEARER_CONTEXT_MODIFY_CNF, - ESM_EPS_BEARER_CONTEXT_MODIFY_REJ, - ESM_EPS_BEARER_CONTEXT_DEACTIVATE_REQ, - ESM_EPS_BEARER_CONTEXT_DEACTIVATE_CNF, - /* Transaction related procedures (initiated by the UE) */ - ESM_PDN_CONNECTIVITY_REQ, - ESM_PDN_CONNECTIVITY_REJ, - ESM_PDN_DISCONNECT_REQ, - ESM_PDN_DISCONNECT_REJ, - ESM_BEARER_RESOURCE_ALLOCATE_REQ, - ESM_BEARER_RESOURCE_ALLOCATE_REJ, - ESM_BEARER_RESOURCE_MODIFY_REQ, - ESM_BEARER_RESOURCE_MODIFY_REJ, - /* ESM data indication ("raw" ESM message) */ - ESM_UNITDATA_IND, - ESM_END -} esm_primitive_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * Error code returned upon processing ESM-SAP primitive - */ -typedef enum { - ESM_SAP_SUCCESS = 1, /* ESM-SAP primitive succeed */ - ESM_SAP_DISCARDED, /* ESM-SAP primitive failed, the caller should - * ignore the error */ - ESM_SAP_FAILED /* ESM-SAP primitive failed, the caller should - * take specific action and state transition may - * occurs */ -} esm_sap_error_t; - -/* - * ESM primitive for activate EPS default bearer context procedure - * --------------------------------------------------------------- - */ -typedef struct esm_activate_eps_default_bearer_context_s { -} esm_activate_eps_default_bearer_context_t; - -/* - * ESM primitive for PDN connectivity procedure - * -------------------------------------------- - */ -typedef struct esm_pdn_connectivity_s { - int cid; /* PDN connection local identifier */ - int is_defined; /* Indicates whether a PDN context has been defined - * for the specified APN */ - int pdn_type; /* PDN address type (IPv4, IPv6, IPv4v6) */ - const char *apn; /* PDN's Access Point Name */ - int is_emergency; /* Indicates whether the PDN context has been - * defined to establish connection for emergency - * bearer services */ -} esm_pdn_connectivity_t; - -/* - * ESM primitive for PDN disconnect procedure - * ------------------------------------------ - */ -typedef struct esm_pdn_disconnect_s { - int cid; /* PDN connection local identifier */ -} esm_pdn_disconnect_t; - -/* - * ESM primitive for deactivate EPS bearer context procedure - * --------------------------------------------------------- - */ -typedef struct esm_eps_bearer_context_deactivate_s { -#define ESM_SAP_ALL_EBI 0xff - unsigned int ebi; /* EPS bearer identity of the EPS bearer context - * to be deactivated */ -} esm_eps_bearer_context_deactivate_t; - -/* - * ------------------------------ - * Structure of ESM-SAP primitive - * ------------------------------ - */ -typedef union { - esm_pdn_connectivity_t pdn_connect; - esm_pdn_disconnect_t pdn_disconnect; - esm_eps_bearer_context_deactivate_t eps_bearer_context_deactivate; -} esm_sap_data_t; - -typedef struct esm_sap_s { - esm_primitive_t primitive; /* ESM-SAP primitive to process */ - int is_standalone; /* Indicates whether the ESM message handled - * within this primitive has to be sent/received - * standalone or together within an EMM related - * message */ -#if defined(NAS_MME) - emm_data_context_t *ctx; /* UE context */ -#endif - unsigned int ueid; /* Local UE identifier */ - esm_sap_error_t err; /* ESM-SAP error code */ - const OctetString *recv; /* Encoded ESM message received */ - OctetString send; /* Encoded ESM message to be sent */ - esm_sap_data_t data; /* ESM message data parameters */ -} esm_sap_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __ESM_SAPDEF_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.c b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.c deleted file mode 100644 index 485b3e19e0e3c121a8e245cb0fa1499564809df5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.c +++ /dev/null @@ -1,755 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_send.c - -Version 0.1 - -Date 2013/02/11 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions executed at the ESM Service Access - Point to send EPS Session Management messages to the - EPS Mobility Management sublayer. - -*****************************************************************************/ - -#include "esm_send.h" -#include "commonDef.h" -#include "nas_log.h" - -#ifdef NAS_UE -#include "networkDef.h" -#endif - -#include "esm_msgDef.h" -#include "esm_cause.h" - -#include <string.h> // strlen - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME to send ESM messages - * -------------------------------------------------------------------------- - */ -/**************************************************************************** - ** ** - ** Name: esm_send_status() ** - ** ** - ** Description: Builds ESM status message ** - ** ** - ** The ESM status message is sent by the network or the UE ** - ** to pass information on the status of the indicated EPS ** - ** bearer context and report certain error conditions. ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = ESM_STATUS; - msg->proceduretransactionidentity = pti; - - /* Mandatory - ESM cause code */ - msg->esmcause = esm_cause; - - LOG_TRACE(WARNING, "ESM-SAP - Send ESM Status message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE to send ESM message to the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: esm_send_pdn_connectivity_request() ** - ** ** - ** Description: Builds PDN Connectivity Request message ** - ** ** - ** The PDN connectivity request message is sent by the UE to ** - ** the network to initiate establishment of a PDN connection.** - ** ** - ** Inputs: pti: Procedure transaction identity assigned to ** - ** the PDN connection ** - ** is_emergency: Indicates whether the PDN connectivity is ** - ** requested for emergency bearer services ** - ** pdn_type: PDN address type ** - ** apn: Access Point Name of the PDN to connect to ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type, - const char *apn, - pdn_connectivity_request_msg *msg) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED; - msg->messagetype = PDN_CONNECTIVITY_REQUEST; - msg->proceduretransactionidentity = pti; - - /* Mandatory - PDN connectivity request type */ - if (is_emergency) { - msg->requesttype = REQUEST_TYPE_EMERGENCY; - } else { - msg->requesttype = REQUEST_TYPE_INITIAL_REQUEST; - } - - /* Mandatory - PDN type */ - if (pdn_type == NET_PDN_TYPE_IPV4) { - msg->pdntype = PDN_TYPE_IPV4; - } else if (pdn_type == NET_PDN_TYPE_IPV6) { - msg->pdntype = PDN_TYPE_IPV6; - } else if (pdn_type == NET_PDN_TYPE_IPV4V6) { - msg->pdntype = PDN_TYPE_IPV4V6; - } - - /* Optional - Access Point Name */ - msg->presencemask = 0; - - if (apn) { - size_t len = strlen(apn); - - if (len > 0) { - msg->presencemask |= - PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT; - msg->accesspointname.accesspointnamevalue.length = len; - msg->accesspointname.accesspointnamevalue.value = (uint8_t *)apn; - } - } - - LOG_TRACE(INFO, "ESM-SAP - Send PDN Connectivity Request message " - "(pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_pdn_disconnect_request() ** - ** ** - ** Description: Builds PDN Disconnect Request message ** - ** ** - ** The PDN disconnect request message is sent by the UE to ** - ** the network to initiate release of a PDN connection. ** - ** ** - ** Inputs: pti: Procedure transaction identity assigned to ** - ** the PDN connection ** - ** ebi: EPS bearer identity of the default bearer ** - ** associated with the PDN to disconnect from ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_pdn_disconnect_request(int pti, int ebi, - pdn_disconnect_request_msg *msg) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED; - msg->messagetype = PDN_DISCONNECT_REQUEST; - msg->proceduretransactionidentity = pti; - - /* Mandatory - Linked EPS bearer identity */ - msg->linkedepsbeareridentity = ebi; - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send PDN Disconnect Request message " - "(pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_activate_default_eps_bearer_context_accept() ** - ** ** - ** Description: Builds Activate Default EPS Bearer Context Accept message ** - ** ** - ** The activate default EPS bearer context accept message is ** - ** sent by the UE to the network to acknowledge activation ** - ** of a default EPS bearer context. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_activate_default_eps_bearer_context_accept(int ebi, - activate_default_eps_bearer_context_accept_msg *msg) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT; - msg->proceduretransactionidentity = PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; - /* Mandatory IEs */ - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context " - "Accept message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_activate_default_eps_bearer_context_reject() ** - ** ** - ** Description: Builds Activate Default EPS Bearer Context Reject message ** - ** ** - ** The activate default EPS bearer context reject message is ** - ** sent by UE to the network to reject activation of a de- ** - ** fault EPS bearer context. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_activate_default_eps_bearer_context_reject(int ebi, - activate_default_eps_bearer_context_reject_msg *msg, int esm_cause) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT; - msg->proceduretransactionidentity = PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; - /* Mandatory - ESM cause code */ - msg->esmcause = esm_cause; - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context " - "Reject message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_activate_dedicated_eps_bearer_context_accept() ** - ** ** - ** Description: Builds Activate Dedicated EPS Bearer Context Accept ** - ** message ** - ** ** - ** The activate dedicated EPS bearer context accept message ** - ** is sent by the UE to the network to acknowledge activa- ** - ** tion of a dedicated EPS bearer context associated with ** - ** the same PDN address(es) and APN as an already active EPS ** - ** bearer context. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_activate_dedicated_eps_bearer_context_accept(int ebi, - activate_dedicated_eps_bearer_context_accept_msg *msg) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT; - msg->proceduretransactionidentity = PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; - /* Mandatory IEs */ - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context " - "Accept message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_activate_dedicated_eps_bearer_context_reject() ** - ** ** - ** Description: Builds Activate Dedicated EPS Bearer Context Reject ** - ** message ** - ** ** - ** The activate dedicated EPS bearer context reject message ** - ** is sent by UE to the network to reject activation of a ** - ** dedicated EPS bearer context. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi, - activate_dedicated_eps_bearer_context_reject_msg *msg, int esm_cause) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT; - msg->proceduretransactionidentity = PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; - /* Mandatory - ESM cause code */ - msg->esmcause = esm_cause; - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context " - "Reject message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_deactivate_eps_bearer_context_accept() ** - ** ** - ** Description: Builds Deactivate EPS Bearer Context Accept message ** - ** ** - ** The deactivate EPS bearer context accept message is sent ** - ** by the UE to acknowledge deactivation of an EPS bearer ** - ** context. ** - ** ** - ** Inputs: ebi: EPS bearer identity ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_deactivate_eps_bearer_context_accept(int ebi, - deactivate_eps_bearer_context_accept_msg *msg) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT; - msg->proceduretransactionidentity = PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED; - /* Mandatory IEs */ - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send Deactivate EPS Bearer Context Accept" - " message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} -#endif // NAS_UE - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME to send ESM message to the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: esm_send_pdn_connectivity_reject() ** - ** ** - ** Description: Builds PDN Connectivity Reject message ** - ** ** - ** The PDN connectivity reject message is sent by the net- ** - ** work to the UE to reject establishment of a PDN connec- ** - ** tion. ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg, - int esm_cause) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED; - msg->messagetype = PDN_CONNECTIVITY_REJECT; - msg->proceduretransactionidentity = pti; - - /* Mandatory - ESM cause code */ - msg->esmcause = esm_cause; - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send PDN Connectivity Reject message " - "(pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_pdn_disconnect_reject() ** - ** ** - ** Description: Builds PDN Disconnect Reject message ** - ** ** - ** The PDN disconnect reject message is sent by the network ** - ** to the UE to reject release of a PDN connection. ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg, - int esm_cause) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED; - msg->messagetype = PDN_DISCONNECT_REJECT; - msg->proceduretransactionidentity = pti; - - /* Mandatory - ESM cause code */ - msg->esmcause = esm_cause; - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send PDN Disconnect Reject message " - "(pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_activate_default_eps_bearer_context_request() ** - ** ** - ** Description: Builds Activate Default EPS Bearer Context Request ** - ** message ** - ** ** - ** The activate default EPS bearer context request message ** - ** is sent by the network to the UE to request activation of ** - ** a default EPS bearer context. ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** qos: Subscribed EPS quality of service ** - ** apn: Access Point Name in used ** - ** pdn_addr: PDN IPv4 address and/or IPv6 suffix ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_activate_default_eps_bearer_context_request(int pti, - int ebi, - activate_default_eps_bearer_context_request_msg *msg, - const OctetString *apn, - const ProtocolConfigurationOptions *pco, - int pdn_type, - const OctetString *pdn_addr, - const EpsQualityOfService *qos, - int esm_cause) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST; - msg->proceduretransactionidentity = pti; - - /* Mandatory - EPS QoS */ - msg->epsqos = *qos; - LOG_TRACE(INFO, "ESM-SAP - epsqos qci: %u", qos->qci); - - if (qos->bitRatesPresent) { - LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForUL: %u", qos->bitRates.maxBitRateForUL); - LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForDL: %u", qos->bitRates.maxBitRateForDL); - LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForUL: %u", qos->bitRates.guarBitRateForUL); - LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForDL: %u", qos->bitRates.guarBitRateForDL); - } else { - LOG_TRACE(INFO, "ESM-SAP - epsqos no bit rates defined"); - } - - if (qos->bitRatesExtPresent) { - LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForUL Ext: %u", qos->bitRatesExt.maxBitRateForUL); - LOG_TRACE(INFO, "ESM-SAP - epsqos maxBitRateForDL Ext: %u", qos->bitRatesExt.maxBitRateForDL); - LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForUL Ext: %u", qos->bitRatesExt.guarBitRateForUL); - LOG_TRACE(INFO, "ESM-SAP - epsqos guarBitRateForDL Ext: %u", qos->bitRatesExt.guarBitRateForDL); - } else { - LOG_TRACE(INFO, "ESM-SAP - epsqos no bit rates ext defined"); - } - - - if ((apn == NULL) || ((apn != NULL) && (apn->value == NULL))) { - LOG_TRACE(WARNING, "ESM-SAP - apn is NULL!"); - } - - LOG_TRACE(INFO, "ESM-SAP - apn is %s", apn->value); - - /* Mandatory - Access Point Name */ - msg->accesspointname.accesspointnamevalue = *apn; - - /* Mandatory - PDN address */ - LOG_TRACE(INFO, "ESM-SAP - pdn_type is %u", pdn_type); - msg->pdnaddress.pdntypevalue = pdn_type; - LOG_TRACE(INFO, "ESM-SAP - pdn_addr is %u", dump_octet_string(pdn_addr)); - msg->pdnaddress.pdnaddressinformation = *pdn_addr; - - /* Optional - ESM cause code */ - msg->presencemask = 0; - - if (esm_cause != ESM_CAUSE_SUCCESS) { - msg->presencemask |= - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; - msg->esmcause = esm_cause; - } - - if (pco != NULL) { - msg->presencemask |= - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - msg->protocolconfigurationoptions = *pco; - } - -#warning "TEST LG FORCE APN-AMBR" - LOG_TRACE(INFO, "ESM-SAP - FORCE APN-AMBR"); - msg->presencemask |= - ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_APNAMBR_PRESENT; - msg->apnambr.apnambrfordownlink = 0xfe; // (8640kbps) - msg->apnambr.apnambrforuplink = 0xfe; // (8640kbps) - msg->apnambr.apnambrfordownlink_extended = 0xde; // (200Mbps) - msg->apnambr.apnambrforuplink_extended = 0x9e; // (100Mbps) - msg->apnambr.apnambrfordownlink_extended2 = 0; - msg->apnambr.apnambrforuplink_extended2 = 0; - msg->apnambr.extensions = 0 | APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION_PRESENT; - - LOG_TRACE(INFO, "ESM-SAP - Send Activate Default EPS Bearer Context " - "Request message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_activate_dedicated_eps_bearer_context_request() ** - ** ** - ** Description: Builds Activate Dedicated EPS Bearer Context Request ** - ** message ** - ** ** - ** The activate dedicated EPS bearer context request message ** - ** is sent by the network to the UE to request activation of ** - ** a dedicated EPS bearer context associated with the same ** - ** PDN address(es) and APN as an already active default EPS ** - ** bearer context. ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** linked_ebi: EPS bearer identity of the default bearer ** - ** associated with the EPS dedicated bearer ** - ** to be activated ** - ** qos: EPS quality of service ** - ** tft: Traffic flow template ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi, - activate_dedicated_eps_bearer_context_request_msg *msg, - int linked_ebi, const EpsQualityOfService *qos, - PacketFilters *pkfs, int n_pkfs) -{ - int i; - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST; - msg->proceduretransactionidentity = pti; - - /* Mandatory - EPS QoS */ - msg->epsqos = *qos; - - /* Mandatory - traffic flow template */ - msg->tft.tftoperationcode = TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE; - msg->tft.ebit = TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_NOT_INCLUDED; - msg->tft.numberofpacketfilters = n_pkfs; - - for (i = 0; i < msg->tft.numberofpacketfilters; i++) { - msg->tft.packetfilterlist.createtft[i] = (*pkfs)[i]; - } - - /* Optional */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send Activate Dedicated EPS Bearer Context " - "Request message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: esm_send_deactivate_eps_bearer_context_request() ** - ** ** - ** Description: Builds Deactivate EPS Bearer Context Request message ** - ** ** - ** The deactivate EPS bearer context request message is sent ** - ** by the network to request deactivation of an active EPS ** - ** bearer context. ** - ** ** - ** Inputs: pti: Procedure transaction identity ** - ** ebi: EPS bearer identity ** - ** esm_cause: ESM cause code ** - ** Others: None ** - ** ** - ** Outputs: msg: The ESM message to be sent ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi, - deactivate_eps_bearer_context_request_msg *msg, - int esm_cause) -{ - LOG_FUNC_IN; - - /* Mandatory - ESM message header */ - msg->protocoldiscriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - msg->epsbeareridentity = ebi; - msg->messagetype = DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST; - msg->proceduretransactionidentity = pti; - - /* Mandatory - ESM cause code */ - msg->esmcause = esm_cause; - /* Optional IEs */ - msg->presencemask = 0; - - LOG_TRACE(INFO, "ESM-SAP - Send Deactivate EPS Bearer Context Request " - "message (pti=%d, ebi=%d)", - msg->proceduretransactionidentity, msg->epsbeareridentity); - - LOG_FUNC_RETURN(RETURNok); -} -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.h b/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.h deleted file mode 100644 index 552227a2c6a78ff172a1737f7447b1bc4c259672..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/esm/sap/esm_send.h +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source esm_send.h - -Version 0.1 - -Date 2013/02/11 - -Product NAS stack - -Subsystem EPS Session Management - -Author Frederic Maurel - -Description Defines functions executed at the ESM Service Access - Point to send EPS Session Management messages to the - EPS Mobility Management sublayer. - -*****************************************************************************/ -#ifndef __ESM_SEND_H__ -#define __ESM_SEND_H__ - -#include "EsmStatus.h" - -#ifdef NAS_MME -#include "PdnConnectivityReject.h" -#include "PdnDisconnectReject.h" -#include "BearerResourceAllocationReject.h" -#include "BearerResourceModificationReject.h" - -#include "ActivateDefaultEpsBearerContextRequest.h" -#include "ActivateDedicatedEpsBearerContextRequest.h" -#include "ModifyEpsBearerContextRequest.h" -#include "DeactivateEpsBearerContextRequest.h" - -#include "EsmInformationRequest.h" -#endif - -#ifdef NAS_UE -#include "PdnConnectivityRequest.h" -#include "PdnDisconnectRequest.h" -#include "BearerResourceAllocationRequest.h" -#include "BearerResourceModificationRequest.h" - -#include "ActivateDefaultEpsBearerContextAccept.h" -#include "ActivateDefaultEpsBearerContextReject.h" -#include "ActivateDedicatedEpsBearerContextAccept.h" -#include "ActivateDedicatedEpsBearerContextReject.h" -#include "ModifyEpsBearerContextAccept.h" -#include "ModifyEpsBearerContextReject.h" -#include "DeactivateEpsBearerContextAccept.h" - -#include "EsmInformationResponse.h" -#endif - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * -------------------------------------------------------------------------- - * Functions executed by both the UE and the MME to send ESM messages - * -------------------------------------------------------------------------- - */ -int esm_send_status(int pti, int ebi, esm_status_msg *msg, int esm_cause); - -/* - * -------------------------------------------------------------------------- - * Functions executed by the UE to send ESM message to the network - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/* - * Transaction related messages - * ---------------------------- - */ -int esm_send_pdn_connectivity_request(int pti, int is_emergency, int pdn_type, - const char *apn, pdn_connectivity_request_msg *msg); -int esm_send_pdn_disconnect_request(int pti, int ebi, - pdn_disconnect_request_msg *msg); - -/* - * Messages related to EPS bearer contexts - * --------------------------------------- - */ -int esm_send_activate_default_eps_bearer_context_accept(int ebi, - activate_default_eps_bearer_context_accept_msg *msg); -int esm_send_activate_default_eps_bearer_context_reject(int ebi, - activate_default_eps_bearer_context_reject_msg *msg, int esm_cause); - -int esm_send_activate_dedicated_eps_bearer_context_accept(int ebi, - activate_dedicated_eps_bearer_context_accept_msg *msg); -int esm_send_activate_dedicated_eps_bearer_context_reject(int ebi, - activate_dedicated_eps_bearer_context_reject_msg *msg, int esm_cause); - -int esm_send_deactivate_eps_bearer_context_accept(int ebi, - deactivate_eps_bearer_context_accept_msg *msg); - -#endif - -/* - * -------------------------------------------------------------------------- - * Functions executed by the MME to send ESM message to the UE - * -------------------------------------------------------------------------- - */ -#ifdef NAS_MME -/* - * Transaction related messages - * ---------------------------- - */ -int esm_send_pdn_connectivity_reject(int pti, pdn_connectivity_reject_msg *msg, - int esm_cause); - -int esm_send_pdn_disconnect_reject(int pti, pdn_disconnect_reject_msg *msg, - int esm_cause); - -/* - * Messages related to EPS bearer contexts - * --------------------------------------- - */ -int esm_send_activate_default_eps_bearer_context_request(int pti, int ebi, - activate_default_eps_bearer_context_request_msg *msg, const OctetString *apn, - const ProtocolConfigurationOptions *pco, int pdn_type, const OctetString *pdn_addr, - const EpsQualityOfService *qos, int esm_cause); - -int esm_send_activate_dedicated_eps_bearer_context_request(int pti, int ebi, - activate_dedicated_eps_bearer_context_request_msg *msg, int linked_ebi, - const EpsQualityOfService *qos, PacketFilters *pkfs, int n_pkfs); - -int esm_send_deactivate_eps_bearer_context_request(int pti, int ebi, - deactivate_eps_bearer_context_request_msg *msg, int esm_cause); - -#endif - -#endif /* __ESM_SEND_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.c b/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.c deleted file mode 100644 index 286b0afd7f202700f86f13f5ba35e04912e8b798..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.c +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AccessPointName.h" - -int decode_access_point_name(AccessPointName *accesspointname, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&accesspointname->accesspointnamevalue, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_access_point_name_xml(accesspointname, iei); -#endif - return decoded; -} -int encode_access_point_name(AccessPointName *accesspointname, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - OctetString apn_encoded; - uint32_t length_index; - uint32_t index; - uint32_t index_copy; - - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ACCESS_POINT_NAME_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_access_point_name_xml(accesspointname, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - apn_encoded.length = 0; - apn_encoded.value = calloc(1, ACCESS_POINT_NAME_MAXIMUM_LENGTH); - index = 0; // index on original APN string - length_index = 0; // marker where to write partial length - index_copy = 1; - - while ((accesspointname->accesspointnamevalue.value[index] != 0) && (index < accesspointname->accesspointnamevalue.length)) { - if (accesspointname->accesspointnamevalue.value[index] == '.') { - apn_encoded.value[length_index] = index_copy - length_index - 1; - length_index = index_copy; - index_copy = length_index + 1; - } else { - apn_encoded.value[index_copy] = accesspointname->accesspointnamevalue.value[index]; - index_copy++; - } - - index++; - } - - apn_encoded.value[length_index] = index_copy - length_index - 1; - apn_encoded.length = index_copy; - - if ((encode_result = encode_octet_string(&apn_encoded, buffer + encoded, len - encoded)) < 0) { - free(apn_encoded.value); - return encode_result; - } else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - - free(apn_encoded.value); - return encoded; -} - -void dump_access_point_name_xml(AccessPointName *accesspointname, uint8_t iei) -{ - printf("<Access Point Name>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s</Access Point Name>\n", - dump_octet_string_xml(&accesspointname->accesspointnamevalue)); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.h b/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.h deleted file mode 100644 index f121d8833dd03dc81179fdb133c1ac14b726d791..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AccessPointName.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef ACCESS_POINT_NAME_H_ -#define ACCESS_POINT_NAME_H_ - -#define ACCESS_POINT_NAME_MINIMUM_LENGTH 3 -#define ACCESS_POINT_NAME_MAXIMUM_LENGTH 102 - -typedef struct AccessPointName_tag { - OctetString accesspointnamevalue; -} AccessPointName; - -int encode_access_point_name(AccessPointName *accesspointname, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_access_point_name(AccessPointName *accesspointname, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_access_point_name_xml(AccessPointName *accesspointname, uint8_t iei); - -#endif /* ACCESS POINT NAME_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.c b/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.c deleted file mode 100644 index d8c306ba439eeffd02b540338d1bd936afd5a1d0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AdditionalUpdateResult.h" - -int decode_additional_update_result(AdditionalUpdateResult *additionalupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ADDITIONAL_UPDATE_RESULT_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *additionalupdateresult = *buffer & 0x3; - decoded++; -#if defined (NAS_DEBUG) - dump_additional_update_result_xml(additionalupdateresult, iei); -#endif - return decoded; -} - -int decode_u8_additional_update_result(AdditionalUpdateResult *additionalupdateresult, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *additionalupdateresult = *buffer & 0x3; - decoded++; -#if defined (NAS_DEBUG) - dump_additional_update_result_xml(additionalupdateresult, iei); -#endif - return decoded; -} - -int encode_additional_update_result(AdditionalUpdateResult *additionalupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ADDITIONAL_UPDATE_RESULT_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_additional_update_result_xml(additionalupdateresult, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*additionalupdateresult & 0x3); - encoded++; - return encoded; -} - -uint8_t encode_u8_additional_update_result(AdditionalUpdateResult *additionalupdateresult) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_additional_update_result_xml(additionalupdateresult, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*additionalupdateresult & 0x3); - encoded++; - - return bufferReturn; -} - -void dump_additional_update_result_xml(AdditionalUpdateResult *additionalupdateresult, uint8_t iei) -{ - printf("<Additional Update Result>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Additional update result value>%u</Additional update result value>\n", *additionalupdateresult); - printf("</Additional Update Result>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.h b/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.h deleted file mode 100644 index 70edbc2634ee6f6b00cdb274e7a509cddd37dc8b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateResult.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef ADDITIONAL_UPDATE_RESULT_H_ -#define ADDITIONAL_UPDATE_RESULT_H_ - -#define ADDITIONAL_UPDATE_RESULT_MINIMUM_LENGTH 1 -#define ADDITIONAL_UPDATE_RESULT_MAXIMUM_LENGTH 1 - -typedef uint8_t AdditionalUpdateResult; - -int encode_additional_update_result(AdditionalUpdateResult *additionalupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_additional_update_result_xml(AdditionalUpdateResult *additionalupdateresult, uint8_t iei); - -uint8_t encode_u8_additional_update_result(AdditionalUpdateResult *additionalupdateresult); - -int decode_additional_update_result(AdditionalUpdateResult *additionalupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_additional_update_result(AdditionalUpdateResult *additionalupdateresult, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* ADDITIONAL UPDATE RESULT_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.c deleted file mode 100644 index f253c43a82096f1310c20a80ace04590212b4094..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.c +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AdditionalUpdateType.h" - -int decode_additional_update_type(AdditionalUpdateType *additionalupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - *additionalupdatetype = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_additional_update_type_xml(additionalupdatetype, iei); -#endif - return decoded; -} - -int encode_additional_update_type(AdditionalUpdateType *additionalupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} -void dump_additional_update_type_xml(AdditionalUpdateType *additionalupdatetype, uint8_t iei) -{ - printf("<Additional Update Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <AUTV>%u</AUTV>\n", *additionalupdatetype); - printf("</Additional Update Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.h deleted file mode 100644 index dd7bc36643d2557407a7f35abf86ebf0da5386e1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AdditionalUpdateType.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef ADDITIONAL_UPDATE_TYPE_H_ -#define ADDITIONAL_UPDATE_TYPE_H_ - -#define ADDITIONAL_UPDATE_TYPE_MINIMUM_LENGTH 1 -#define ADDITIONAL_UPDATE_TYPE_MAXIMUM_LENGTH 1 - -typedef uint8_t AdditionalUpdateType; - -int encode_additional_update_type(AdditionalUpdateType *additionalupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_additional_update_type(AdditionalUpdateType *additionalupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_additional_update_type_xml(AdditionalUpdateType *additionalupdatetype, uint8_t iei); - -#endif /* ADDITIONAL UPDATE TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.c b/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.c deleted file mode 100644 index b92ed3732edfad788e17ac6e7885ed11a30e21ed..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.c +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ApnAggregateMaximumBitRate.h" - -int decode_apn_aggregate_maximum_bit_rate(ApnAggregateMaximumBitRate *apnaggregatemaximumbitrate, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - apnaggregatemaximumbitrate->apnambrfordownlink = *(buffer + decoded); - decoded++; - apnaggregatemaximumbitrate->apnambrforuplink = *(buffer + decoded); - decoded++; - - if (ielen >= 4) { - apnaggregatemaximumbitrate->apnambrfordownlink_extended = *(buffer + decoded); - decoded++; - apnaggregatemaximumbitrate->apnambrforuplink_extended = *(buffer + decoded); - decoded++; - - if (ielen >= 6) { - apnaggregatemaximumbitrate->apnambrfordownlink_extended2 = *(buffer + decoded); - decoded++; - apnaggregatemaximumbitrate->apnambrforuplink_extended2 = *(buffer + decoded); - decoded++; - } - } - -#if defined (NAS_DEBUG) - dump_apn_aggregate_maximum_bit_rate_xml(apnaggregatemaximumbitrate, iei); -#endif - return decoded; -} -int encode_apn_aggregate_maximum_bit_rate(ApnAggregateMaximumBitRate *apnaggregatemaximumbitrate, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, APN_AGGREGATE_MAXIMUM_BIT_RATE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_apn_aggregate_maximum_bit_rate_xml(apnaggregatemaximumbitrate, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = apnaggregatemaximumbitrate->apnambrfordownlink; - encoded++; - *(buffer + encoded) = apnaggregatemaximumbitrate->apnambrforuplink; - encoded++; - - if (apnaggregatemaximumbitrate->extensions & APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION_PRESENT) { - *(buffer + encoded) = apnaggregatemaximumbitrate->apnambrfordownlink_extended; - encoded++; - *(buffer + encoded) = apnaggregatemaximumbitrate->apnambrforuplink_extended; - encoded++; - - if (apnaggregatemaximumbitrate->extensions & APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION2_PRESENT) { - *(buffer + encoded) = apnaggregatemaximumbitrate->apnambrfordownlink_extended2; - encoded++; - *(buffer + encoded) = apnaggregatemaximumbitrate->apnambrforuplink_extended2; - encoded++; - } - } - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_apn_aggregate_maximum_bit_rate_xml(ApnAggregateMaximumBitRate *apnaggregatemaximumbitrate, uint8_t iei) -{ - printf("<Apn Aggregate Maximum Bit Rate>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <APN AMBR for downlink>%u</APN AMBR for downlink>\n", apnaggregatemaximumbitrate->apnambrfordownlink); - printf(" <APN AMBR for uplink>%u</APN AMBR for uplink>\n", apnaggregatemaximumbitrate->apnambrforuplink); - - if (apnaggregatemaximumbitrate->extensions & APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION_PRESENT) { - printf(" <APN AMBR extended for downlink>%u</APN AMBR for downlink>\n", apnaggregatemaximumbitrate->apnambrfordownlink_extended); - printf(" <APN AMBR extended for uplink>%u</APN AMBR for uplink>\n", apnaggregatemaximumbitrate->apnambrforuplink_extended); - - if (apnaggregatemaximumbitrate->extensions & APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION2_PRESENT) { - printf(" <APN AMBR extended2 for downlink>%u</APN AMBR for downlink>\n", apnaggregatemaximumbitrate->apnambrfordownlink_extended); - printf(" <APN AMBR extended2 for uplink>%u</APN AMBR for uplink>\n", apnaggregatemaximumbitrate->apnambrforuplink_extended); - } - } - - printf("</Apn Aggregate Maximum Bit Rate>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.h b/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.h deleted file mode 100644 index b7666084d2c33e68b478d8f1b69e1ab80b3c55dd..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ApnAggregateMaximumBitRate.h +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef APN_AGGREGATE_MAXIMUM_BIT_RATE_H_ -#define APN_AGGREGATE_MAXIMUM_BIT_RATE_H_ - -#define APN_AGGREGATE_MAXIMUM_BIT_RATE_MINIMUM_LENGTH 4 -#define APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_LENGTH 8 - -#define APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION_PRESENT (1<<0) -#define APN_AGGREGATE_MAXIMUM_BIT_RATE_MAXIMUM_EXTENSION2_PRESENT (1<<1) - -typedef struct ApnAggregateMaximumBitRate_tag { - uint8_t apnambrfordownlink; - uint8_t apnambrforuplink; - uint8_t apnambrfordownlink_extended; - uint8_t apnambrforuplink_extended; - uint8_t apnambrfordownlink_extended2; - uint8_t apnambrforuplink_extended2; - uint8_t extensions; -} ApnAggregateMaximumBitRate; - -int encode_apn_aggregate_maximum_bit_rate(ApnAggregateMaximumBitRate *apnaggregatemaximumbitrate, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_apn_aggregate_maximum_bit_rate(ApnAggregateMaximumBitRate *apnaggregatemaximumbitrate, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_apn_aggregate_maximum_bit_rate_xml(ApnAggregateMaximumBitRate *apnaggregatemaximumbitrate, uint8_t iei); - -#endif /* APN AGGREGATE MAXIMUM BIT RATE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.c b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.c deleted file mode 100644 index 68b642430723b5b4bbf677ad6103e7dafbe5906f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationFailureParameter.h" - -int decode_authentication_failure_parameter(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&authenticationfailureparameter->auts, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_authentication_failure_parameter_xml(authenticationfailureparameter, iei); -#endif - return decoded; -} -int encode_authentication_failure_parameter(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_FAILURE_PARAMETER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_authentication_failure_parameter_xml(authenticationfailureparameter, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if ((encode_result = encode_octet_string(&authenticationfailureparameter->auts, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_authentication_failure_parameter_xml(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei) -{ - printf("<Authentication Failure Parameter>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s",dump_octet_string_xml(&authenticationfailureparameter->auts)); - printf("</Authentication Failure Parameter>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.h b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.h deleted file mode 100644 index c8384685f18cfc1ccd327ed575b88dcf1e32a08e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationFailureParameter.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef AUTHENTICATION_FAILURE_PARAMETER_H_ -#define AUTHENTICATION_FAILURE_PARAMETER_H_ - -#define AUTHENTICATION_FAILURE_PARAMETER_MINIMUM_LENGTH 16 -#define AUTHENTICATION_FAILURE_PARAMETER_MAXIMUM_LENGTH 16 - -typedef struct AuthenticationFailureParameter_tag { - OctetString auts; -} AuthenticationFailureParameter; - -int encode_authentication_failure_parameter(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_authentication_failure_parameter(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_authentication_failure_parameter_xml(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei); - -#endif /* AUTHENTICATION FAILURE PARAMETER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.c b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.c deleted file mode 100644 index f338b11f48f97d39d33fb1059bc5ec7b25754dc8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationParameterAutn.h" - -int decode_authentication_parameter_autn(AuthenticationParameterAutn *authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&authenticationparameterautn->autn, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_authentication_parameter_autn_xml(authenticationparameterautn, iei); -#endif - return decoded; -} -int encode_authentication_parameter_autn(AuthenticationParameterAutn *authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - int encode_result; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_authentication_parameter_autn_xml(authenticationparameterautn, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if ((encode_result = encode_octet_string(&authenticationparameterautn->autn, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_authentication_parameter_autn_xml(AuthenticationParameterAutn *authenticationparameterautn, uint8_t iei) -{ - printf("<Authentication Parameter Autn>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s", dump_octet_string_xml(&authenticationparameterautn->autn)); - printf("</Authentication Parameter Autn>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.h b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.h deleted file mode 100644 index f4246ca5da6c80c4664a0d93f364e788a650e074..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterAutn.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef AUTHENTICATION_PARAMETER_AUTN_H_ -#define AUTHENTICATION_PARAMETER_AUTN_H_ - -#define AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH 17 -#define AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH 17 - -typedef struct AuthenticationParameterAutn_tag { - OctetString autn; -} AuthenticationParameterAutn; - -int encode_authentication_parameter_autn(AuthenticationParameterAutn *authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_authentication_parameter_autn(AuthenticationParameterAutn *authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_authentication_parameter_autn_xml(AuthenticationParameterAutn *authenticationparameterautn, uint8_t iei); - -#endif /* AUTHENTICATION PARAMETER AUTN_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.c b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.c deleted file mode 100644 index ebc44a5d7c85fc534bb5d7aa1db26bdd372d81f2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.c +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationParameterRand.h" - -int decode_authentication_parameter_rand(AuthenticationParameterRand *authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 16; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - if ((decode_result = decode_octet_string(&authenticationparameterrand->rand, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_authentication_parameter_rand_xml(authenticationparameterrand, iei); -#endif - return decoded; -} - -int encode_authentication_parameter_rand(AuthenticationParameterRand *authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encode_result; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_authentication_parameter_rand_xml(authenticationparameterrand, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - if ((encode_result = encode_octet_string(&authenticationparameterrand->rand, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - return encoded; -} - -void dump_authentication_parameter_rand_xml(AuthenticationParameterRand *authenticationparameterrand, uint8_t iei) -{ - printf("<Authentication Parameter Rand>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s",dump_octet_string_xml(&authenticationparameterrand->rand)); - printf("</Authentication Parameter Rand>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.h b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.h deleted file mode 100644 index 6690aceb5fe7996974e8697c82e6848c096e6b20..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationParameterRand.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef AUTHENTICATION_PARAMETER_RAND_H_ -#define AUTHENTICATION_PARAMETER_RAND_H_ - -#define AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH 16 -#define AUTHENTICATION_PARAMETER_RAND_MAXIMUM_LENGTH 16 - -typedef struct AuthenticationParameterRand_tag { - OctetString rand; -} AuthenticationParameterRand; - -int encode_authentication_parameter_rand(AuthenticationParameterRand *authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_authentication_parameter_rand_xml(AuthenticationParameterRand *authenticationparameterrand, uint8_t iei); - -int decode_authentication_parameter_rand(AuthenticationParameterRand *authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* AUTHENTICATION PARAMETER RAND_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.c b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.c deleted file mode 100644 index 94dd1c0dd4b9d7f61450f6491c2a492b660e9938..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.c +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "AuthenticationResponseParameter.h" - -int decode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&authenticationresponseparameter->res, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_authentication_response_parameter_xml(authenticationresponseparameter, iei); -#endif - return decoded; -} -int encode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_authentication_response_parameter_xml(authenticationresponseparameter, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if ((encode_result = encode_octet_string(&authenticationresponseparameter->res, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_authentication_response_parameter_xml(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei) -{ - printf("<Authentication Response Parameter>\n"); - dump_octet_string_xml(&authenticationresponseparameter->res); - printf("</Authentication Response Parameter>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.h b/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.h deleted file mode 100644 index 9b4c72bfad178cd9554637da8f8c93268a9f05ef..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/AuthenticationResponseParameter.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef AUTHENTICATION_RESPONSE_PARAMETER_H_ -#define AUTHENTICATION_RESPONSE_PARAMETER_H_ - -#define AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH 6 -#define AUTHENTICATION_RESPONSE_PARAMETER_MAXIMUM_LENGTH 18 - -typedef struct AuthenticationResponseParameter_tag { - OctetString res; -} AuthenticationResponseParameter; - -int encode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_authentication_response_parameter_xml(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei); - -#endif /* AUTHENTICATION RESPONSE PARAMETER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/COPYING b/openair-cn/NAS/EURECOM-NAS/src/ies/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.c b/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.c deleted file mode 100644 index 16f039627eb47ddcb3468eae44938de8e1fc721d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "CipheringKeySequenceNumber.h" - -int decode_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, CIPHERING_KEY_SEQUENCE_NUMBER_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *cipheringkeysequencenumber = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_ciphering_key_sequence_number_xml(cipheringkeysequencenumber, iei); -#endif - return decoded; -} - -int decode_u8_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *cipheringkeysequencenumber = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_ciphering_key_sequence_number_xml(cipheringkeysequencenumber, iei); -#endif - return decoded; -} - -int encode_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, CIPHERING_KEY_SEQUENCE_NUMBER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_ciphering_key_sequence_number_xml(cipheringkeysequencenumber, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*cipheringkeysequencenumber & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_ciphering_key_sequence_number_xml(cipheringkeysequencenumber, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*cipheringkeysequencenumber & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_ciphering_key_sequence_number_xml(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei) -{ - printf("<Ciphering Key Sequence Number>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Key sequence>%u</Key sequence>\n", *cipheringkeysequencenumber); - printf("</Ciphering Key Sequence Number>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.h b/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.h deleted file mode 100644 index d75b686ab454c0807f21fbe13312919c14a9a53e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/CipheringKeySequenceNumber.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef CIPHERING_KEY_SEQUENCE_NUMBER_H_ -#define CIPHERING_KEY_SEQUENCE_NUMBER_H_ - -#define CIPHERING_KEY_SEQUENCE_NUMBER_MINIMUM_LENGTH 1 -#define CIPHERING_KEY_SEQUENCE_NUMBER_MAXIMUM_LENGTH 1 - -typedef uint8_t CipheringKeySequenceNumber; - -int encode_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_ciphering_key_sequence_number_xml(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei); - -uint8_t encode_u8_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber); - -int decode_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_ciphering_key_sequence_number(CipheringKeySequenceNumber *cipheringkeysequencenumber, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* CIPHERING KEY SEQUENCE NUMBER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.c b/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.c deleted file mode 100644 index 7a534dee111e7e655aa2ad107206bad39ffa9e03..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "Cli.h" - -int decode_cli(Cli *cli, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&cli->clivalue, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_cli_xml(cli, iei); -#endif - return decoded; -} -int encode_cli(Cli *cli, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, CLI_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_cli_xml(cli, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if ((encode_result = encode_octet_string(&cli->clivalue, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_cli_xml(Cli *cli, uint8_t iei) -{ - printf("<Cli>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s", dump_octet_string_xml(&cli->clivalue)); - printf("</Cli>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.h b/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.h deleted file mode 100644 index 998289359b414240fc4592396965e0220b4c29d0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/Cli.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef CLI_H_ -#define CLI_H_ - -#define CLI_MINIMUM_LENGTH 3 -#define CLI_MAXIMUM_LENGTH 14 - -typedef struct Cli_tag { - OctetString clivalue; -} Cli; - -int encode_cli(Cli *cli, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_cli(Cli *cli, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_cli_xml(Cli *cli, uint8_t iei); - -#endif /* CLI_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.c b/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.c deleted file mode 100644 index 84ce13a3226ee0aaeb8c112f9cfb086fff203c65..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "CsfbResponse.h" - -int decode_csfb_response(CsfbResponse *csfbresponse, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, CSFB_RESPONSE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *csfbresponse = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_csfb_response_xml(csfbresponse, iei); -#endif - return decoded; -} - -int decode_u8_csfb_response(CsfbResponse *csfbresponse, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *csfbresponse = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_csfb_response_xml(csfbresponse, iei); -#endif - return decoded; -} - -int encode_csfb_response(CsfbResponse *csfbresponse, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, CSFB_RESPONSE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_csfb_response_xml(csfbresponse, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*csfbresponse & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_csfb_response(CsfbResponse *csfbresponse) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_csfb_response_xml(csfbresponse, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*csfbresponse & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_csfb_response_xml(CsfbResponse *csfbresponse, uint8_t iei) -{ - printf("<Csfb Response>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <CSFB response value>%u</CSFB response value>\n", *csfbresponse); - printf("</Csfb Response>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.h b/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.h deleted file mode 100644 index 20172a0be84faf721e40ae9830ab461979e70fe6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/CsfbResponse.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef CSFB_RESPONSE_H_ -#define CSFB_RESPONSE_H_ - -#define CSFB_RESPONSE_MINIMUM_LENGTH 1 -#define CSFB_RESPONSE_MAXIMUM_LENGTH 1 - -typedef uint8_t CsfbResponse; - -int encode_csfb_response(CsfbResponse *csfbresponse, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_csfb_response_xml(CsfbResponse *csfbresponse, uint8_t iei); - -uint8_t encode_u8_csfb_response(CsfbResponse *csfbresponse); - -int decode_csfb_response(CsfbResponse *csfbresponse, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_csfb_response(CsfbResponse *csfbresponse, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* CSFB RESPONSE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.c b/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.c deleted file mode 100644 index 07791bfc4d6ea67ac2088608cfd6f9196b49e6dc..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.c +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DaylightSavingTime.h" - -int decode_daylight_saving_time(DaylightSavingTime *daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - *daylightsavingtime = *buffer & 0x3; - decoded++; -#if defined (NAS_DEBUG) - dump_daylight_saving_time_xml(daylightsavingtime, iei); -#endif - return decoded; -} -int encode_daylight_saving_time(DaylightSavingTime *daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DAYLIGHT_SAVING_TIME_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_daylight_saving_time_xml(daylightsavingtime, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - (*daylightsavingtime & 0x3); - encoded++; - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_daylight_saving_time_xml(DaylightSavingTime *daylightsavingtime, uint8_t iei) -{ - printf("<Daylight Saving Time>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Value>%u</Value>\n", *daylightsavingtime); - printf("</Daylight Saving Time>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.h b/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.h deleted file mode 100644 index c8397132f4ae2613a7e35c09360efd517ad0bd29..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/DaylightSavingTime.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef DAYLIGHT_SAVING_TIME_H_ -#define DAYLIGHT_SAVING_TIME_H_ - -#define DAYLIGHT_SAVING_TIME_MINIMUM_LENGTH 3 -#define DAYLIGHT_SAVING_TIME_MAXIMUM_LENGTH 3 - -typedef uint8_t DaylightSavingTime; - -int encode_daylight_saving_time(DaylightSavingTime *daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_daylight_saving_time(DaylightSavingTime *daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_daylight_saving_time_xml(DaylightSavingTime *daylightsavingtime, uint8_t iei); - -#endif /* DAYLIGHT SAVING TIME_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.c deleted file mode 100644 index 7a92ffebcac22a1472aaa8b74bca5bd9f0911bc4..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.c +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DetachType.h" - -int decode_detach_type(DetachType *detachtype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, DETACH_TYPE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - detachtype->switchoff = (*(buffer + decoded) >> 3) & 0x1; - detachtype->typeofdetach = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_detach_type_xml(detachtype, iei); -#endif - return decoded; -} - -int decode_u8_detach_type(DetachType *detachtype, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - detachtype->switchoff = (*(buffer + decoded) >> 3) & 0x1; - detachtype->typeofdetach = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_detach_type_xml(detachtype, iei); -#endif - return decoded; -} - -int encode_detach_type(DetachType *detachtype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DETACH_TYPE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_detach_type_xml(detachtype, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - ((detachtype->switchoff & 0x1) << 3) | - (detachtype->typeofdetach & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_detach_type(DetachType *detachtype) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_detach_type_xml(detachtype, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - ((detachtype->switchoff & 0x1) << 3) | - (detachtype->typeofdetach & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_detach_type_xml(DetachType *detachtype, uint8_t iei) -{ - printf("<Detach Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Switch off>%u</Switch off>\n", detachtype->switchoff); - printf(" <Type of detach>%u</Type of detach>\n", detachtype->typeofdetach); - printf("</Detach Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.h deleted file mode 100644 index 52da84e4743e8987c4558bc1d4f04437c09011a3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/DetachType.h +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef DETACH_TYPE_H_ -#define DETACH_TYPE_H_ - -#define DETACH_TYPE_MINIMUM_LENGTH 1 -#define DETACH_TYPE_MAXIMUM_LENGTH 1 - -typedef struct DetachType_tag { -#define DETACH_TYPE_NORMAL_DETACH 0 -#define DETACH_TYPE_SWITCH_OFF 1 - uint8_t switchoff:1; -#define DETACH_TYPE_EPS 0b001 -#define DETACH_TYPE_IMSI 0b010 -#define DETACH_TYPE_EPS_IMSI 0b011 -#define DETACH_TYPE_RESERVED_1 0b110 -#define DETACH_TYPE_RESERVED_2 0b111 - uint8_t typeofdetach:3; -} DetachType; - -int encode_detach_type(DetachType *detachtype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_detach_type_xml(DetachType *detachtype, uint8_t iei); - -uint8_t encode_u8_detach_type(DetachType *detachtype); - -int decode_detach_type(DetachType *detachtype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_detach_type(DetachType *detachtype, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* DETACH TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.c b/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.c deleted file mode 100644 index c9528e1cae500f162d168ee778e083675d426e3c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.c +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "DrxParameter.h" - -int decode_drx_parameter(DrxParameter *drxparameter, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - drxparameter->splitpgcyclecode = *(buffer + decoded); - decoded++; - drxparameter->cnspecificdrxcyclelengthcoefficientanddrxvaluefors1mode = (*(buffer + decoded) >> 4) & 0xf; - drxparameter->splitonccch = (*(buffer + decoded) >> 3) & 0x1; - drxparameter->nondrxtimer = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_drx_parameter_xml(drxparameter, iei); -#endif - return decoded; -} - -int encode_drx_parameter(DrxParameter *drxparameter, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DRX_PARAMETER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_drx_parameter_xml(drxparameter, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = drxparameter->splitpgcyclecode; - encoded++; - *(buffer + encoded) = 0x00 | ((drxparameter->cnspecificdrxcyclelengthcoefficientanddrxvaluefors1mode & 0xf) << 4) | - ((drxparameter->splitonccch & 0x1) << 3) | - (drxparameter->nondrxtimer & 0x7); - encoded++; - return encoded; -} - -void dump_drx_parameter_xml(DrxParameter *drxparameter, uint8_t iei) -{ - printf("<Drx Parameter>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <SPLIT PG CYCLE CODE>%u</SPLIT PG CYCLE CODE>\n", drxparameter->splitpgcyclecode); - printf(" <CN specific DRX cycle length coefficient and DRX value for S1 mode>%u</CN specific DRX cycle length coefficient and DRX value for S1 mode>\n", - drxparameter->cnspecificdrxcyclelengthcoefficientanddrxvaluefors1mode); - printf(" <SPLIT on CCCH>%u</SPLIT on CCCH>\n", drxparameter->splitonccch); - printf(" <non DRX timer>%u</non DRX timer>\n", drxparameter->nondrxtimer); - printf("</Drx Parameter>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.h b/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.h deleted file mode 100644 index 49452c12152277b3aa8dbc72b1e1c36276e12803..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/DrxParameter.h +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef DRX_PARAMETER_H_ -#define DRX_PARAMETER_H_ - -#define DRX_PARAMETER_MINIMUM_LENGTH 3 -#define DRX_PARAMETER_MAXIMUM_LENGTH 3 - -typedef struct DrxParameter_tag { - uint8_t splitpgcyclecode; - uint8_t cnspecificdrxcyclelengthcoefficientanddrxvaluefors1mode:4; - uint8_t splitonccch:1; - uint8_t nondrxtimer:3; -} DrxParameter; - -int encode_drx_parameter(DrxParameter *drxparameter, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_drx_parameter_xml(DrxParameter *drxparameter, uint8_t iei); - -int decode_drx_parameter(DrxParameter *drxparameter, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* DRX PARAMETER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.c deleted file mode 100644 index 3939acd6f83a771e9c33870f817f8811063eaac9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.c +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EmergencyNumberList.h" - -int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - emergencynumberlist->lengthofemergency = *(buffer + decoded); - decoded++; - emergencynumberlist->emergencyservicecategoryvalue = *(buffer + decoded) & 0x1f; - decoded++; -#if defined (NAS_DEBUG) - dump_emergency_number_list_xml(emergencynumberlist, iei); -#endif - return decoded; -} -int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EMERGENCY_NUMBER_LIST_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_emergency_number_list_xml(emergencynumberlist, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = emergencynumberlist->lengthofemergency; - encoded++; - *(buffer + encoded) = 0x00 | - (emergencynumberlist->emergencyservicecategoryvalue & 0x1f); - encoded++; - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_emergency_number_list_xml(EmergencyNumberList *emergencynumberlist, uint8_t iei) -{ - printf("<Emergency Number List>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Length of emergency>%u</Length of emergency>\n", emergencynumberlist->lengthofemergency); - printf(" <Emergency service category value>%u</Emergency service category value>\n", emergencynumberlist->emergencyservicecategoryvalue); - printf("</Emergency Number List>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.h deleted file mode 100644 index 0ac2d8cace2ef40a4fbd7c3f1b9bf1dfcfcea0da..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EmergencyNumberList.h +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EMERGENCY_NUMBER_LIST_H_ -#define EMERGENCY_NUMBER_LIST_H_ - -#define EMERGENCY_NUMBER_LIST_MINIMUM_LENGTH 5 -#define EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH 50 - -typedef struct EmergencyNumberList_tag { - uint8_t lengthofemergency; - uint8_t emergencyservicecategoryvalue:5; -} EmergencyNumberList; - -int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_emergency_number_list_xml(EmergencyNumberList *emergencynumberlist, uint8_t iei); - -#endif /* EMERGENCY NUMBER LIST_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.c deleted file mode 100644 index a6734b71223325b0ec54e0ac6aee820e32b707ea..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.c +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EmmCause.h" - -int decode_emm_cause(EmmCause *emmcause, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - *emmcause = *(buffer + decoded); - decoded++; -#if defined (NAS_DEBUG) - dump_emm_cause_xml(emmcause, iei); -#endif - return decoded; -} - -int encode_emm_cause(EmmCause *emmcause, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EMM_CAUSE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_emm_cause_xml(emmcause, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = *emmcause; - encoded++; - return encoded; -} - -void dump_emm_cause_xml(EmmCause *emmcause, uint8_t iei) -{ - printf("<Emm Cause>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Cause value>%u</Cause value>\n", *emmcause); - printf("</Emm Cause>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.h deleted file mode 100644 index 1aa2e7b9616b8f5b876667cbbd1af4be4bf7f5d8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EmmCause.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EMM_CAUSE_H_ -#define EMM_CAUSE_H_ - -#define EMM_CAUSE_MINIMUM_LENGTH 1 -#define EMM_CAUSE_MAXIMUM_LENGTH 1 - -typedef uint8_t EmmCause; - -int encode_emm_cause(EmmCause *emmcause, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_emm_cause_xml(EmmCause *emmcause, uint8_t iei); - -int decode_emm_cause(EmmCause *emmcause, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* EMM CAUSE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.c deleted file mode 100644 index dff7004ff6fb9853362735805dbd69e1c75284f9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsAttachResult.h" - -int decode_eps_attach_result(EpsAttachResult *epsattachresult, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EPS_ATTACH_RESULT_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *epsattachresult = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_attach_result_xml(epsattachresult, iei); -#endif - return decoded; -} - -int decode_u8_eps_attach_result(EpsAttachResult *epsattachresult, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *epsattachresult = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_attach_result_xml(epsattachresult, iei); -#endif - return decoded; -} - -int encode_eps_attach_result(EpsAttachResult *epsattachresult, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_ATTACH_RESULT_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_attach_result_xml(epsattachresult, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*epsattachresult & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_eps_attach_result(EpsAttachResult *epsattachresult) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_eps_attach_result_xml(epsattachresult, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*epsattachresult & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_eps_attach_result_xml(EpsAttachResult *epsattachresult, uint8_t iei) -{ - printf("<Eps Attach Result>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <EPS attach result value>%u</EPS attach result value>\n", *epsattachresult); - printf("</Eps Attach Result>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.h deleted file mode 100644 index 56192c7034451ea052170192db39bebc670bd30f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachResult.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_ATTACH_RESULT_H_ -#define EPS_ATTACH_RESULT_H_ - -#define EPS_ATTACH_RESULT_MINIMUM_LENGTH 1 -#define EPS_ATTACH_RESULT_MAXIMUM_LENGTH 1 - -#define EPS_ATTACH_RESULT_EPS 0b001 -#define EPS_ATTACH_RESULT_EPS_IMSI 0b010 -typedef uint8_t EpsAttachResult; - -int encode_eps_attach_result(EpsAttachResult *epsattachresult, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_attach_result_xml(EpsAttachResult *epsattachresult, uint8_t iei); - -uint8_t encode_u8_eps_attach_result(EpsAttachResult *epsattachresult); - -int decode_eps_attach_result(EpsAttachResult *epsattachresult, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_eps_attach_result(EpsAttachResult *epsattachresult, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* EPS ATTACH RESULT_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.c deleted file mode 100644 index b7946edb0e7649d5546dec817a7a950b44447a17..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsAttachType.h" - -int decode_eps_attach_type(EpsAttachType *epsattachtype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EPS_ATTACH_TYPE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *epsattachtype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_attach_type_xml(epsattachtype, iei); -#endif - return decoded; -} - -int decode_u8_eps_attach_type(EpsAttachType *epsattachtype, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *epsattachtype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_attach_type_xml(epsattachtype, iei); -#endif - return decoded; -} - -int encode_eps_attach_type(EpsAttachType *epsattachtype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_ATTACH_TYPE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_attach_type_xml(epsattachtype, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*epsattachtype & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_eps_attach_type(EpsAttachType *epsattachtype) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_eps_attach_type_xml(epsattachtype, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*epsattachtype & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_eps_attach_type_xml(EpsAttachType *epsattachtype, uint8_t iei) -{ - printf("<Eps Attach Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <EPS attach type value>%u</EPS attach type value>\n", *epsattachtype); - printf("</Eps Attach Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.h deleted file mode 100644 index fd2676b760d9f0770c2250aa5a01abb3233f1bf2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsAttachType.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_ATTACH_TYPE_H_ -#define EPS_ATTACH_TYPE_H_ - -#define EPS_ATTACH_TYPE_MINIMUM_LENGTH 1 -#define EPS_ATTACH_TYPE_MAXIMUM_LENGTH 1 - -#define EPS_ATTACH_TYPE_EPS 0b0001 -#define EPS_ATTACH_TYPE_IMSI 0b0010 -#define EPS_ATTACH_TYPE_EMERGENCY 0b0110 -#define EPS_ATTACH_TYPE_RESERVED 0b0111 -typedef uint8_t EpsAttachType; - -int encode_eps_attach_type(EpsAttachType *epsattachtype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_attach_type_xml(EpsAttachType *epsattachtype, uint8_t iei); - -uint8_t encode_u8_eps_attach_type(EpsAttachType *epsattachtype); - -int decode_eps_attach_type(EpsAttachType *epsattachtype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_eps_attach_type(EpsAttachType *epsattachtype, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* EPS ATTACH TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.c deleted file mode 100644 index 9ef3a4e8f55b2c35837d83c661755a3590aa9971..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.c +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsBearerContextStatus.h" - -int decode_eps_bearer_context_status(EpsBearerContextStatus *epsbearercontextstatus, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - //IES_DECODE_U16(*epsbearercontextstatus, *(buffer + decoded)); - IES_DECODE_U16(buffer, decoded, *epsbearercontextstatus); -#if defined (NAS_DEBUG) - dump_eps_bearer_context_status_xml(epsbearercontextstatus, iei); -#endif - return decoded; -} -int encode_eps_bearer_context_status(EpsBearerContextStatus *epsbearercontextstatus, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_BEARER_CONTEXT_STATUS_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_bearer_context_status_xml(epsbearercontextstatus, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - IES_ENCODE_U16(buffer, encoded, *epsbearercontextstatus); - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_eps_bearer_context_status_xml(EpsBearerContextStatus *epsbearercontextstatus, uint8_t iei) -{ - printf("<Eps Bearer Context Status>\n"); - printf(" <EBI>%u</EBI>\n", *epsbearercontextstatus); - printf("</Eps Bearer Context Status>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.h deleted file mode 100644 index 7c2e1a040383dce51993237793d690f1ffe1a41f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerContextStatus.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_BEARER_CONTEXT_STATUS_H_ -#define EPS_BEARER_CONTEXT_STATUS_H_ - -#define EPS_BEARER_CONTEXT_STATUS_MINIMUM_LENGTH 4 -#define EPS_BEARER_CONTEXT_STATUS_MAXIMUM_LENGTH 4 - -typedef uint16_t EpsBearerContextStatus; - -int encode_eps_bearer_context_status(EpsBearerContextStatus *epsbearercontextstatus, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_eps_bearer_context_status(EpsBearerContextStatus *epsbearercontextstatus, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_bearer_context_status_xml(EpsBearerContextStatus *epsbearercontextstatus, uint8_t iei); - -#endif /* EPS BEARER CONTEXT STATUS_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.c deleted file mode 100644 index 2a49a67d1513ae3086e66695be043c88a38d8724..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsBearerIdentity.h" - -int decode_eps_bearer_identity(EpsBearerIdentity *epsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_eps_bearer_identity(EpsBearerIdentity *epsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.h deleted file mode 100644 index e9c368ec6962c85d81cbdbf13a2e3b01572f1be2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsBearerIdentity.h +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_BEARER_IDENTITY_H_ -#define EPS_BEARER_IDENTITY_H_ - -#define EPS_BEARER_IDENTITY_MINIMUM_LENGTH 1 -#define EPS_BEARER_IDENTITY_MAXIMUM_LENGTH 1 - -#define EPS_BEARER_IDENTITY_UNASSIGNED 0 -#define EPS_BEARER_IDENTITY_FIRST 5 -#define EPS_BEARER_IDENTITY_LAST 15 -typedef uint8_t EpsBearerIdentity; - -int encode_eps_bearer_identity(EpsBearerIdentity *epsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_bearer_identity_xml(EpsBearerIdentity *epsbeareridentity, uint8_t iei); - -int decode_eps_bearer_identity(EpsBearerIdentity *epsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* EPS BEARER IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.c deleted file mode 100644 index 4d154a3b66d4f8a5303d976c53d31e02845e91cd..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.c +++ /dev/null @@ -1,381 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsMobileIdentity.h" - -static int decode_guti_eps_mobile_identity(GutiEpsMobileIdentity_t *guti, uint8_t *buffer); -static int decode_imsi_eps_mobile_identity(ImsiEpsMobileIdentity_t *imsi, uint8_t *buffer); -static int decode_imei_eps_mobile_identity(ImeiEpsMobileIdentity_t *imei, uint8_t *buffer); - -static int encode_guti_eps_mobile_identity(GutiEpsMobileIdentity_t *guti, uint8_t *buffer); -static int encode_imsi_eps_mobile_identity(ImsiEpsMobileIdentity_t *imsi, uint8_t *buffer); -static int encode_imei_eps_mobile_identity(ImeiEpsMobileIdentity_t *imei, uint8_t *buffer); - -int decode_eps_mobile_identity(EpsMobileIdentity *epsmobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded_rc = TLV_DECODE_VALUE_DOESNT_MATCH; - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - uint8_t typeofidentity = *(buffer + decoded) & 0x7; - - if (typeofidentity == EPS_MOBILE_IDENTITY_IMSI) { - decoded_rc = decode_imsi_eps_mobile_identity(&epsmobileidentity->imsi, - buffer + decoded); - } else if (typeofidentity == EPS_MOBILE_IDENTITY_GUTI) { - decoded_rc = decode_guti_eps_mobile_identity(&epsmobileidentity->guti, - buffer + decoded); - } else if (typeofidentity == EPS_MOBILE_IDENTITY_IMEI) { - decoded_rc = decode_imei_eps_mobile_identity(&epsmobileidentity->imei, - buffer + decoded); - } - - if (decoded_rc < 0) { - return decoded_rc; - } - -#if defined (NAS_DEBUG) - dump_eps_mobile_identity_xml(epsmobileidentity, iei); -#endif - return (decoded + decoded_rc); -} - -int encode_eps_mobile_identity(EpsMobileIdentity *epsmobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - int encoded_rc = TLV_ENCODE_VALUE_DOESNT_MATCH; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_MOBILE_IDENTITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_mobile_identity_xml(epsmobileidentity, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if (epsmobileidentity->imsi.typeofidentity == EPS_MOBILE_IDENTITY_IMSI) { - encoded_rc = encode_imsi_eps_mobile_identity(&epsmobileidentity->imsi, - buffer + encoded); - } else if (epsmobileidentity->guti.typeofidentity == EPS_MOBILE_IDENTITY_GUTI) { - encoded_rc = encode_guti_eps_mobile_identity(&epsmobileidentity->guti, - buffer + encoded); - } else if (epsmobileidentity->imei.typeofidentity == EPS_MOBILE_IDENTITY_IMEI) { - encoded_rc = encode_imei_eps_mobile_identity(&epsmobileidentity->imei, - buffer + encoded); - } - - if (encoded_rc < 0) { - return encoded_rc; - } - - *lenPtr = encoded + encoded_rc - 1 - ((iei > 0) ? 1 : 0); - return (encoded + encoded_rc); -} - -void dump_eps_mobile_identity_xml(EpsMobileIdentity *epsmobileidentity, uint8_t iei) -{ - printf("<Eps Mobile Identity>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - if (epsmobileidentity->imsi.typeofidentity == EPS_MOBILE_IDENTITY_IMSI) { - ImsiEpsMobileIdentity_t* imsi = &epsmobileidentity->imsi; - printf(" <odd even>%u</odd even>\n", imsi->oddeven); - printf(" <Type of identity>IMSI</Type of identity>\n"); - printf(" <digit1>%u</digit1>\n", imsi->digit1); - printf(" <digit2>%u</digit2>\n", imsi->digit2); - printf(" <digit3>%u</digit3>\n", imsi->digit3); - printf(" <digit4>%u</digit4>\n", imsi->digit4); - printf(" <digit5>%u</digit5>\n", imsi->digit5); - printf(" <digit6>%u</digit6>\n", imsi->digit6); - printf(" <digit7>%u</digit7>\n", imsi->digit7); - printf(" <digit8>%u</digit8>\n", imsi->digit8); - printf(" <digit9>%u</digit9>\n", imsi->digit9); - printf(" <digit10>%u</digit10>\n", imsi->digit10); - printf(" <digit11>%u</digit11>\n", imsi->digit11); - printf(" <digit12>%u</digit12>\n", imsi->digit12); - printf(" <digit13>%u</digit13>\n", imsi->digit13); - printf(" <digit14>%u</digit14>\n", imsi->digit14); - printf(" <digit15>%u</digit15>\n", imsi->digit15); - } else if (epsmobileidentity->guti.typeofidentity == EPS_MOBILE_IDENTITY_GUTI) { - GutiEpsMobileIdentity_t* guti = &epsmobileidentity->guti; - printf(" <odd even>%u</odd even>\n", guti->oddeven); - printf(" <Type of identity>GUTI</Type of identity>\n"); - printf(" <MCC digit 1>%u</MCC digit 1>\n", guti->mccdigit1); - printf(" <MCC digit 2>%u</MCC digit 2>\n", guti->mccdigit2); - printf(" <MCC digit 3>%u</MCC digit 3>\n", guti->mccdigit3); - printf(" <MNC digit 1>%u</MNC digit 1>\n", guti->mncdigit1); - printf(" <MNC digit 2>%u</MNC digit 2>\n", guti->mncdigit2); - printf(" <MNC digit 3>%u</MNC digit 3>\n", guti->mncdigit3); - printf(" <MME group id>%u</MME group id>\n", guti->mmegroupid); - printf(" <MME code>%u</MME code>\n", guti->mmecode); - printf(" <M TMSI>%u</M TMSI>\n", guti->mtmsi); - } else if (epsmobileidentity->imei.typeofidentity == EPS_MOBILE_IDENTITY_IMEI) { - ImeiEpsMobileIdentity_t* imei = &epsmobileidentity->imei; - printf(" <odd even>%u</odd even>\n", imei->oddeven); - printf(" <Type of identity>IMEI</Type of identity>\n"); - printf(" <digit1>%u</digit1>\n", imei->digit1); - printf(" <digit2>%u</digit2>\n", imei->digit2); - printf(" <digit3>%u</digit3>\n", imei->digit3); - printf(" <digit4>%u</digit4>\n", imei->digit4); - printf(" <digit5>%u</digit5>\n", imei->digit5); - printf(" <digit6>%u</digit6>\n", imei->digit6); - printf(" <digit7>%u</digit7>\n", imei->digit7); - printf(" <digit8>%u</digit8>\n", imei->digit8); - printf(" <digit9>%u</digit9>\n", imei->digit9); - printf(" <digit10>%u</digit10>\n", imei->digit10); - printf(" <digit11>%u</digit11>\n", imei->digit11); - printf(" <digit12>%u</digit12>\n", imei->digit12); - printf(" <digit13>%u</digit13>\n", imei->digit13); - printf(" <digit14>%u</digit14>\n", imei->digit14); - printf(" <digit15>%u</digit15>\n", imei->digit15); - } else { - printf(" Wrong type of EPS mobile identity (%u)\n", epsmobileidentity->guti.typeofidentity); - } - - printf("</Eps Mobile Identity>\n"); -} - -static int decode_guti_eps_mobile_identity(GutiEpsMobileIdentity_t *guti, uint8_t *buffer) -{ - int decoded = 0; - guti->spare = (*(buffer + decoded) >> 4) & 0xf; - - /* - * For the GUTI, bits 5 to 8 of octet 3 are coded as "1111" - */ - if (guti->spare != 0xf) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - guti->oddeven = (*(buffer + decoded) >> 3) & 0x1; - guti->typeofidentity = *(buffer + decoded) & 0x7; - - if (guti->typeofidentity != EPS_MOBILE_IDENTITY_GUTI) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - decoded++; - guti->mccdigit2 = (*(buffer + decoded) >> 4) & 0xf; - guti->mccdigit1 = *(buffer + decoded) & 0xf; - decoded++; - guti->mncdigit3 = (*(buffer + decoded) >> 4) & 0xf; - guti->mccdigit3 = *(buffer + decoded) & 0xf; - decoded++; - guti->mncdigit2 = (*(buffer + decoded) >> 4) & 0xf; - guti->mncdigit1 = *(buffer + decoded) & 0xf; - decoded++; - //IES_DECODE_U16(guti->mmegroupid, *(buffer + decoded)); - IES_DECODE_U16(buffer, decoded, guti->mmegroupid); - guti->mmecode = *(buffer + decoded); - decoded++; - //IES_DECODE_U32(guti->mtmsi, *(buffer + decoded)); - IES_DECODE_U32(buffer, decoded, guti->mtmsi); - return decoded; -} - -static int decode_imsi_eps_mobile_identity(ImsiEpsMobileIdentity_t *imsi, uint8_t *buffer) -{ - int decoded = 0; - imsi->typeofidentity = *(buffer + decoded) & 0x7; - - if (imsi->typeofidentity != EPS_MOBILE_IDENTITY_IMSI) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - imsi->oddeven = (*(buffer + decoded) >> 3) & 0x1; - imsi->digit1 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit2 = *(buffer + decoded) & 0xf; - imsi->digit3 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit4 = *(buffer + decoded) & 0xf; - imsi->digit5 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit6 = *(buffer + decoded) & 0xf; - imsi->digit7 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit8 = *(buffer + decoded) & 0xf; - imsi->digit9 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit10 = *(buffer + decoded) & 0xf; - imsi->digit11 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit12 = *(buffer + decoded) & 0xf; - imsi->digit13 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit14 = *(buffer + decoded) & 0xf; - imsi->digit15 = (*(buffer + decoded) >> 4) & 0xf; - - /* - * IMSI is coded using BCD coding. If the number of identity digits is - * even then bits 5 to 8 of the last octet shall be filled with an end - * mark coded as "1111". - */ - if ((imsi->oddeven == EPS_MOBILE_IDENTITY_EVEN) && (imsi->digit15 != 0x0f)) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - decoded++; - return decoded; -} - -static int decode_imei_eps_mobile_identity(ImeiEpsMobileIdentity_t *imei, uint8_t *buffer) -{ - int decoded = 0; - imei->typeofidentity = *(buffer + decoded) & 0x7; - - if (imei->typeofidentity != EPS_MOBILE_IDENTITY_IMEI) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - imei->oddeven = (*(buffer + decoded) >> 3) & 0x1; - imei->digit1 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit2 = *(buffer + decoded) & 0xf; - imei->digit3 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit4 = *(buffer + decoded) & 0xf; - imei->digit5 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit6 = *(buffer + decoded) & 0xf; - imei->digit7 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit8 = *(buffer + decoded) & 0xf; - imei->digit9 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit10 = *(buffer + decoded) & 0xf; - imei->digit11 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit12 = *(buffer + decoded) & 0xf; - imei->digit13 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit14 = *(buffer + decoded) & 0xf; - imei->digit15 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - return decoded; -} - -static int encode_guti_eps_mobile_identity(GutiEpsMobileIdentity_t *guti, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0xf0 | ((guti->oddeven & 0x1) << 3) | - (guti->typeofidentity & 0x7); - encoded++; - *(buffer + encoded) = 0x00 | ((guti->mccdigit2 & 0xf) << 4) | - (guti->mccdigit1 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((guti->mncdigit3 & 0xf) << 4) | - (guti->mccdigit3 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((guti->mncdigit2 & 0xf) << 4) | - (guti->mncdigit1 & 0xf); - encoded++; - IES_ENCODE_U16(buffer, encoded, guti->mmegroupid); - *(buffer + encoded) = guti->mmecode; - encoded++; - IES_ENCODE_U32(buffer, encoded, guti->mtmsi); - return encoded; -} - -static int encode_imsi_eps_mobile_identity(ImsiEpsMobileIdentity_t *imsi, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0x00 | (imsi->digit1 << 4) | (imsi->oddeven << 3) | - (imsi->typeofidentity); - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit3 << 4) | imsi->digit2; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit5 << 4) | imsi->digit4; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit7 << 4) | imsi->digit6; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit9 << 4) | imsi->digit8; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit11 << 4) | imsi->digit10; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit13 << 4) | imsi->digit12; - encoded++; - - if (imsi->oddeven != EPS_MOBILE_IDENTITY_EVEN) { - *(buffer + encoded) = 0x00 | (imsi->digit15 << 4) | imsi->digit14; - } else { - *(buffer + encoded) = 0xf0 | imsi->digit14; - } - - encoded++; - return encoded; -} - -static int encode_imei_eps_mobile_identity(ImeiEpsMobileIdentity_t *imei, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0x00 | (imei->digit1 << 4) | (imei->oddeven << 3) | - (imei->typeofidentity); - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit3 << 4) | imei->digit2; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit5 << 4) | imei->digit4; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit7 << 4) | imei->digit6; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit9 << 4) | imei->digit8; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit11 << 4) | imei->digit10; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit13 << 4) | imei->digit12; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit15 << 4) | imei->digit14; - encoded++; - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.h deleted file mode 100644 index 6f2360c56de016b672c64154ff004a2e0e21122c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsMobileIdentity.h +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_MOBILE_IDENTITY_H_ -#define EPS_MOBILE_IDENTITY_H_ - -#define EPS_MOBILE_IDENTITY_MINIMUM_LENGTH 3 -#define EPS_MOBILE_IDENTITY_MAXIMUM_LENGTH 13 - -typedef struct { - uint8_t spare:4; -#define EPS_MOBILE_IDENTITY_EVEN 0 -#define EPS_MOBILE_IDENTITY_ODD 1 - uint8_t oddeven:1; - uint8_t typeofidentity:3; - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; - uint16_t mmegroupid; - uint8_t mmecode; - uint32_t mtmsi; -} GutiEpsMobileIdentity_t; - -typedef struct { - uint8_t digit1:4; - uint8_t oddeven:1; - uint8_t typeofidentity:3; - uint8_t digit2:4; - uint8_t digit3:4; - uint8_t digit4:4; - uint8_t digit5:4; - uint8_t digit6:4; - uint8_t digit7:4; - uint8_t digit8:4; - uint8_t digit9:4; - uint8_t digit10:4; - uint8_t digit11:4; - uint8_t digit12:4; - uint8_t digit13:4; - uint8_t digit14:4; - uint8_t digit15:4; -} ImsiEpsMobileIdentity_t; - -typedef ImsiEpsMobileIdentity_t ImeiEpsMobileIdentity_t; - -typedef union EpsMobileIdentity_tag { -#define EPS_MOBILE_IDENTITY_IMSI 0b001 -#define EPS_MOBILE_IDENTITY_GUTI 0b110 -#define EPS_MOBILE_IDENTITY_IMEI 0b011 - ImsiEpsMobileIdentity_t imsi; - GutiEpsMobileIdentity_t guti; - ImeiEpsMobileIdentity_t imei; -} EpsMobileIdentity; - -int encode_eps_mobile_identity(EpsMobileIdentity *epsmobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_eps_mobile_identity(EpsMobileIdentity *epsmobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_mobile_identity_xml(EpsMobileIdentity *epsmobileidentity, uint8_t iei); - -#endif /* EPS MOBILE IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.c deleted file mode 100644 index 0063fb5339ad26be538dbc134f3b2ed8957284e3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.c +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsNetworkFeatureSupport.h" - -int decode_eps_network_feature_support(EpsNetworkFeatureSupport *epsnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - *epsnetworkfeaturesupport = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_network_feature_support_xml(epsnetworkfeaturesupport, iei); -#endif - return decoded; -} -int encode_eps_network_feature_support(EpsNetworkFeatureSupport *epsnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_NETWORK_FEATURE_SUPPORT_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_network_feature_support_xml(epsnetworkfeaturesupport, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - (*epsnetworkfeaturesupport & 0x1); - encoded++; - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_eps_network_feature_support_xml(EpsNetworkFeatureSupport *epsnetworkfeaturesupport, uint8_t iei) -{ - printf("<Eps Network Feature Support>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <IMS VoPS>%u</IMS VoPS>\n", *epsnetworkfeaturesupport); - printf("</Eps Network Feature Support>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.h deleted file mode 100644 index d9e0423aec0462a0808256fd1ab0da6ceb1e83e1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsNetworkFeatureSupport.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_NETWORK_FEATURE_SUPPORT_H_ -#define EPS_NETWORK_FEATURE_SUPPORT_H_ - -#define EPS_NETWORK_FEATURE_SUPPORT_MINIMUM_LENGTH 3 -#define EPS_NETWORK_FEATURE_SUPPORT_MAXIMUM_LENGTH 3 - -typedef uint8_t EpsNetworkFeatureSupport; - -int encode_eps_network_feature_support(EpsNetworkFeatureSupport *epsnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_eps_network_feature_support(EpsNetworkFeatureSupport *epsnetworkfeaturesupport, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_network_feature_support_xml(EpsNetworkFeatureSupport *epsnetworkfeaturesupport, uint8_t iei); - -#endif /* EPS NETWORK FEATURE SUPPORT_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.c deleted file mode 100644 index ade4ca8ed2a2e4c35d614f99032a8ad80104b89e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.c +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsQualityOfService.h" - -static int decode_eps_qos_bit_rates(EpsQoSBitRates* epsqosbitrates, const uint8_t *buffer) -{ - int decoded = 0; - epsqosbitrates->maxBitRateForUL = *(buffer + decoded); - decoded++; - epsqosbitrates->maxBitRateForDL = *(buffer + decoded); - decoded++; - epsqosbitrates->guarBitRateForUL = *(buffer + decoded); - decoded++; - epsqosbitrates->guarBitRateForDL = *(buffer + decoded); - decoded++; - return decoded; -} - -int decode_eps_quality_of_service(EpsQualityOfService *epsqualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - epsqualityofservice->qci = *(buffer + decoded); - decoded++; - - if ( ielen > 2 + (iei > 0) ? 1 : 0 ) { - /* bitRates is present */ - epsqualityofservice->bitRatesPresent = 1; - decoded += decode_eps_qos_bit_rates(&epsqualityofservice->bitRates, - buffer + decoded); - } else { - /* bitRates is not present */ - epsqualityofservice->bitRatesPresent = 0; - } - - if ( ielen > 6 + (iei > 0) ? 1 : 0 ) { - /* bitRatesExt is present */ - epsqualityofservice->bitRatesExtPresent = 1; - decoded += decode_eps_qos_bit_rates(&epsqualityofservice->bitRatesExt, - buffer + decoded); - } else { - /* bitRatesExt is not present */ - epsqualityofservice->bitRatesExtPresent = 0; - } - -#if defined (NAS_DEBUG) - dump_eps_quality_of_service_xml(epsqualityofservice, iei); -#endif - return decoded; -} - -static int encode_eps_qos_bit_rates(const EpsQoSBitRates* epsqosbitrates, uint8_t *buffer) -{ - int encoded = 0; - *(buffer + encoded) = epsqosbitrates->maxBitRateForUL; - encoded ++; - *(buffer + encoded) = epsqosbitrates->maxBitRateForDL; - encoded ++; - *(buffer + encoded) = epsqosbitrates->guarBitRateForUL; - encoded ++; - *(buffer + encoded) = epsqosbitrates->guarBitRateForDL; - encoded ++; - return encoded; -} - -int encode_eps_quality_of_service(EpsQualityOfService *epsqualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_quality_of_service_xml(epsqualityofservice, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = epsqualityofservice->qci; - encoded++; - - if (epsqualityofservice->bitRatesPresent) { - encoded += encode_eps_qos_bit_rates(&epsqualityofservice->bitRates, - buffer + encoded); - } - - if (epsqualityofservice->bitRatesExtPresent) { - encoded += encode_eps_qos_bit_rates(&epsqualityofservice->bitRatesExt, - buffer + encoded); - } - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_eps_quality_of_service_xml(EpsQualityOfService *epsqualityofservice, uint8_t iei) -{ - printf("<Eps Quality Of Service>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <QCI>%u</QCI>\n", epsqualityofservice->qci); - - if (epsqualityofservice->bitRatesPresent) { - printf(" <bitRates>\n"); - printf(" <maxBitRateForUL>%u</maxBitRateForUL>\n", - epsqualityofservice->bitRates.maxBitRateForUL); - printf(" <maxBitRateForDL>%u</maxBitRateForDL>\n", - epsqualityofservice->bitRates.maxBitRateForDL); - printf(" <guarBitRateForUL>%u</guarBitRateForUL>\n", - epsqualityofservice->bitRates.guarBitRateForUL); - printf(" <guarBitRateForDL>%u</guarBitRateForDL>\n", - epsqualityofservice->bitRates.guarBitRateForDL); - printf(" </bitRates>\n"); - } - - if (epsqualityofservice->bitRatesExtPresent) { - printf(" <bitRatesExt>\n"); - printf(" <maxBitRateForUL>%u</maxBitRateForUL>\n", - epsqualityofservice->bitRatesExt.maxBitRateForUL); - printf(" <maxBitRateForDL>%u</maxBitRateForDL>\n", - epsqualityofservice->bitRatesExt.maxBitRateForDL); - printf(" <guarBitRateForUL>%u</guarBitRateForUL>\n", - epsqualityofservice->bitRatesExt.guarBitRateForUL); - printf(" <guarBitRateForDL>%u</guarBitRateForDL>\n", - epsqualityofservice->bitRatesExt.guarBitRateForDL); - printf(" </bitRatesExt>\n"); - } - - printf("</Eps Quality Of Service>\n"); -} - -#define EPS_QOS_BIT_RATE_MAX 262144 // 256 Mbps -int eps_qos_bit_rate_value(uint8_t br) -{ - if (br < 0b00000001) { - return (EPS_QOS_BIT_RATE_MAX); - } else if ( (br > 0b00000000) && (br < 0b01000000) ) { - return (br); - } else if ( (br > 0b00111111) && (br < 0b10000000) ) { - return (64 + (br - 0b01000000) * 8); - } else if ( (br > 0b01111111) && (br < 0b11111111) ) { - return (576 + (br - 0b10000000) * 64); - } else { - return (0); - } -} - -int eps_qos_bit_rate_ext_value(uint8_t br) -{ - if ( (br > 0b00000000) && (br < 0b01001011) ) { - return (8600 + br * 100); - } else if ( (br > 0b01001010) && (br < 0b10111011) ) { - return (16384 + (br - 0b01001010) * 1024); - } else if ( (br > 0b10111010) && (br < 0b11111011) ) { - return (131072 + (br - 0b10111010) * 2048); - } else { - return (-1); - } -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.h deleted file mode 100644 index e8af0fc4d61a0aa1a9ba8035b3ba771cfb1d11f3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsQualityOfService.h +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#ifndef EPS_QUALITY_OF_SERVICE_H_ -#define EPS_QUALITY_OF_SERVICE_H_ - -#define EPS_QUALITY_OF_SERVICE_MINIMUM_LENGTH 2 -#define EPS_QUALITY_OF_SERVICE_MAXIMUM_LENGTH 10 - -typedef struct { - uint8_t maxBitRateForUL; - uint8_t maxBitRateForDL; - uint8_t guarBitRateForUL; - uint8_t guarBitRateForDL; -} EpsQoSBitRates; - -typedef struct { - uint8_t bitRatesPresent:1; - uint8_t bitRatesExtPresent:1; - uint8_t qci; - EpsQoSBitRates bitRates; - EpsQoSBitRates bitRatesExt; -} EpsQualityOfService; - -//typedef uint8_t EpsQualityOfService; - -int encode_eps_quality_of_service(EpsQualityOfService *epsqualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_eps_quality_of_service(EpsQualityOfService *epsqualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_quality_of_service_xml(EpsQualityOfService *epsqualityofservice, uint8_t iei); - -int eps_qos_bit_rate_value(uint8_t br); -int eps_qos_bit_rate_ext_value(uint8_t br); - -#endif /* EPS QUALITY OF SERVICE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.c deleted file mode 100644 index 5f1822d4abb72479372dc2d1d6b097448a52b884..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsUpdateResult.h" - -int decode_eps_update_result(EpsUpdateResult *epsupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EPS_UPDATE_RESULT_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *epsupdateresult = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_update_result_xml(epsupdateresult, iei); -#endif - return decoded; -} - -int decode_u8_eps_update_result(EpsUpdateResult *epsupdateresult, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *epsupdateresult = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_update_result_xml(epsupdateresult, iei); -#endif - return decoded; -} - -int encode_eps_update_result(EpsUpdateResult *epsupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_UPDATE_RESULT_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_update_result_xml(epsupdateresult, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*epsupdateresult & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_eps_update_result(EpsUpdateResult *epsupdateresult) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_eps_update_result_xml(epsupdateresult, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*epsupdateresult & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_eps_update_result_xml(EpsUpdateResult *epsupdateresult, uint8_t iei) -{ - printf("<Eps Update Result>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <EPS update result value>%u</EPS update result value>\n", *epsupdateresult); - printf("</Eps Update Result>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.h deleted file mode 100644 index 7d91f83dcb53d6f4585bfec31c305669fda86dc9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateResult.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_UPDATE_RESULT_H_ -#define EPS_UPDATE_RESULT_H_ - -#define EPS_UPDATE_RESULT_MINIMUM_LENGTH 1 -#define EPS_UPDATE_RESULT_MAXIMUM_LENGTH 1 - -typedef uint8_t EpsUpdateResult; - -int encode_eps_update_result(EpsUpdateResult *epsupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_update_result_xml(EpsUpdateResult *epsupdateresult, uint8_t iei); - -uint8_t encode_u8_eps_update_result(EpsUpdateResult *epsupdateresult); - -int decode_eps_update_result(EpsUpdateResult *epsupdateresult, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_eps_update_result(EpsUpdateResult *epsupdateresult, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* EPS UPDATE RESULT_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.c deleted file mode 100644 index 39dd4461d9e7ddb81c9756c7c60c24c296ca40be..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.c +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EpsUpdateType.h" - -int decode_eps_update_type(EpsUpdateType *epsupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, EPS_UPDATE_TYPE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - epsupdatetype->activeflag = (*(buffer + decoded) >> 3) & 0x1; - epsupdatetype->epsupdatetypevalue = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_update_type_xml(epsupdatetype, iei); -#endif - return decoded; -} - -int decode_u8_eps_update_type(EpsUpdateType *epsupdatetype, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - epsupdatetype->activeflag = (*(buffer + decoded) >> 3) & 0x1; - epsupdatetype->epsupdatetypevalue = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_eps_update_type_xml(epsupdatetype, iei); -#endif - return decoded; -} - -int encode_eps_update_type(EpsUpdateType *epsupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPS_UPDATE_TYPE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_eps_update_type_xml(epsupdatetype, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - ((epsupdatetype->activeflag & 0x1) << 3) | - (epsupdatetype->epsupdatetypevalue & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_eps_update_type(EpsUpdateType *epsupdatetype) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_eps_update_type_xml(epsupdatetype, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - ((epsupdatetype->activeflag & 0x1) << 3) | - (epsupdatetype->epsupdatetypevalue & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_eps_update_type_xml(EpsUpdateType *epsupdatetype, uint8_t iei) -{ - printf("<Eps Update Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <active flag>%u</active flag>\n", epsupdatetype->activeflag); - printf(" <EPS update type value>%u</EPS update type value>\n", epsupdatetype->epsupdatetypevalue); - printf("</Eps Update Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.h deleted file mode 100644 index 80bfc2e76b4aaea6b946d1a865ed811117d79ceb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EpsUpdateType.h +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef EPS_UPDATE_TYPE_H_ -#define EPS_UPDATE_TYPE_H_ - -#define EPS_UPDATE_TYPE_MINIMUM_LENGTH 1 -#define EPS_UPDATE_TYPE_MAXIMUM_LENGTH 1 - -typedef struct EpsUpdateType_tag { - uint8_t activeflag:1; - uint8_t epsupdatetypevalue:3; -} EpsUpdateType; - -int encode_eps_update_type(EpsUpdateType *epsupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_eps_update_type_xml(EpsUpdateType *epsupdatetype, uint8_t iei); - -uint8_t encode_u8_eps_update_type(EpsUpdateType *epsupdatetype); - -int decode_eps_update_type(EpsUpdateType *epsupdatetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_eps_update_type(EpsUpdateType *epsupdatetype, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* EPS UPDATE TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.c deleted file mode 100644 index e20ece8ee51143908a323e959e3f7d7920d3586b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.c +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EsmCause.h" - -int decode_esm_cause(EsmCause *esmcause, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - *esmcause = *(buffer + decoded); - decoded++; -#if defined (NAS_DEBUG) - dump_esm_cause_xml(esmcause, iei); -#endif - return decoded; -} - -int encode_esm_cause(EsmCause *esmcause, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ESM_CAUSE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_esm_cause_xml(esmcause, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = *esmcause; - encoded++; - return encoded; -} - -void dump_esm_cause_xml(EsmCause *esmcause, uint8_t iei) -{ - printf("<Esm Cause>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Cause value>%u</Cause value>\n", *esmcause); - printf("</Esm Cause>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.h deleted file mode 100644 index 7be75c4a7fd19af62995fc39d0a48e8a5b357e82..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmCause.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef ESM_CAUSE_H_ -#define ESM_CAUSE_H_ - -#define ESM_CAUSE_MINIMUM_LENGTH 1 -#define ESM_CAUSE_MAXIMUM_LENGTH 1 - -typedef uint8_t EsmCause; - -int encode_esm_cause(EsmCause *esmcause, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_esm_cause_xml(EsmCause *esmcause, uint8_t iei); - -int decode_esm_cause(EsmCause *esmcause, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* ESM CAUSE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.c deleted file mode 100644 index 1c42a93058534de0ba24c72404dba245af74d9cb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EsmInformationTransferFlag.h" - -int decode_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, ESM_INFORMATION_TRANSFER_FLAG_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *esminformationtransferflag = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_esm_information_transfer_flag_xml(esminformationtransferflag, iei); -#endif - return decoded; -} - -int decode_u8_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *esminformationtransferflag = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_esm_information_transfer_flag_xml(esminformationtransferflag, iei); -#endif - return decoded; -} - -int encode_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ESM_INFORMATION_TRANSFER_FLAG_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_esm_information_transfer_flag_xml(esminformationtransferflag, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*esminformationtransferflag & 0x1); - encoded++; - return encoded; -} - -uint8_t encode_u8_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_esm_information_transfer_flag_xml(esminformationtransferflag, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*esminformationtransferflag & 0x1); - encoded++; - - return bufferReturn; -} - -void dump_esm_information_transfer_flag_xml(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei) -{ - printf("<Esm Information Transfer Flag>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <EIT value>%u</EIT value>\n", *esminformationtransferflag); - printf("</Esm Information Transfer Flag>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.h deleted file mode 100644 index 3a201d7baf03df8e1541ec60a1029f89c6ed6474..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmInformationTransferFlag.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef ESM_INFORMATION_TRANSFER_FLAG_H_ -#define ESM_INFORMATION_TRANSFER_FLAG_H_ - -#define ESM_INFORMATION_TRANSFER_FLAG_MINIMUM_LENGTH 1 -#define ESM_INFORMATION_TRANSFER_FLAG_MAXIMUM_LENGTH 1 - -typedef uint8_t EsmInformationTransferFlag; - -int encode_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_esm_information_transfer_flag_xml(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei); - -uint8_t encode_u8_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag); - -int decode_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_esm_information_transfer_flag(EsmInformationTransferFlag *esminformationtransferflag, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* ESM INFORMATION TRANSFER FLAG_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.c b/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.c deleted file mode 100644 index edb4cef9d89071e971bc36620f6e7974e50599d6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.c +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "EsmMessageContainer.h" -#include "nas_log.h" - -#define NAS_DEBUG 1 - -int decode_esm_message_container(EsmMessageContainer *esmmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - int decode_result; - uint16_t ielen; - - LOG_FUNC_IN; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - DECODE_LENGTH_U16(buffer + decoded, ielen, decoded); - - CHECK_LENGTH_DECODER(len - decoded, ielen); - - - if ((decode_result = decode_octet_string(&esmmessagecontainer->esmmessagecontainercontents, ielen, buffer + decoded, len - decoded)) < 0) { - LOG_FUNC_RETURN(decode_result); - } else { - decoded += decode_result; - } - -#if defined (NAS_DEBUG) - dump_esm_message_container_xml(esmmessagecontainer, iei); -#endif - LOG_FUNC_RETURN(decoded); -} - -int encode_esm_message_container(EsmMessageContainer *esmmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int32_t encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_esm_message_container_xml(esmmessagecontainer, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - - //encoded += 2; - //if ((encode_result = encode_octet_string(&esmmessagecontainer->esmmessagecontainercontents, buffer + sizeof(uint16_t), len - sizeof(uint16_t))) < 0) - if ((encode_result = encode_octet_string(&esmmessagecontainer->esmmessagecontainercontents, lenPtr + sizeof(uint16_t), len - sizeof(uint16_t))) < 0) - return encode_result; - else - encoded += encode_result; - - ENCODE_U16(lenPtr, encode_result, encoded); -#if 0 - lenPtr[1] = (((encoded - 2 - ((iei > 0) ? 1: 0))) & 0x0000ff00) >> 8; - lenPtr[0] = ((encoded - 2 - ((iei > 0) ? 1: 0))) & 0x000000ff; -#endif - return encoded; -} - -void dump_esm_message_container_xml(EsmMessageContainer *esmmessagecontainer, uint8_t iei) -{ - printf("<Esm Message Container>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s", dump_octet_string_xml(&esmmessagecontainer->esmmessagecontainercontents)); - printf("</Esm Message Container>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.h b/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.h deleted file mode 100644 index 4d8664ecaf68a9bc78c42df3f0439febc8cdc9c5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/EsmMessageContainer.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef ESM_MESSAGE_CONTAINER_H_ -#define ESM_MESSAGE_CONTAINER_H_ - -#define ESM_MESSAGE_CONTAINER_MINIMUM_LENGTH 2 // [length]+[length] -#define ESM_MESSAGE_CONTAINER_MAXIMUM_LENGTH 65538 // [IEI]+[length]+[length]+[ESM msg] - -typedef struct EsmMessageContainer_tag { - OctetString esmmessagecontainercontents; -} EsmMessageContainer; - -int encode_esm_message_container(EsmMessageContainer *esmmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_esm_message_container(EsmMessageContainer *esmmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_esm_message_container_xml(EsmMessageContainer *esmmessagecontainer, uint8_t iei); - -#endif /* ESM MESSAGE CONTAINER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.c b/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.c deleted file mode 100644 index 056355d34f888528de76ca33bdb0629215d7027e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.c +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "GprsTimer.h" - -static const long _gprs_timer_unit[] = {2, 60, 360, 60, 60, 60, 60, 0}; - -int decode_gprs_timer(GprsTimer *gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - gprstimer->unit = (*(buffer + decoded) >> 5) & 0x7; - gprstimer->timervalue = *(buffer + decoded) & 0x1f; - decoded++; -#if defined (NAS_DEBUG) - dump_gprs_timer_xml(gprstimer, iei); -#endif - return decoded; -} - -int encode_gprs_timer(GprsTimer *gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, GPRS_TIMER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_gprs_timer_xml(gprstimer, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = 0x00 | ((gprstimer->unit & 0x7) << 5) | - (gprstimer->timervalue & 0x1f); - encoded++; - return encoded; -} - -void dump_gprs_timer_xml(GprsTimer *gprstimer, uint8_t iei) -{ - printf("<Gprs Timer>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Unit>%u</Unit>\n", gprstimer->unit); - printf(" <Timer value>%u</Timer value>\n", gprstimer->timervalue); - printf("</Gprs Timer>\n"); -} - -long gprs_timer_value(GprsTimer *gprstimer) -{ - return (gprstimer->timervalue * _gprs_timer_unit[gprstimer->unit]); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.h b/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.h deleted file mode 100644 index 57547842f2fcde59bf58f1d8db9cc0d750e3cc65..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/GprsTimer.h +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef GPRS_TIMER_H_ -#define GPRS_TIMER_H_ - -#define GPRS_TIMER_MINIMUM_LENGTH 2 -#define GPRS_TIMER_MAXIMUM_LENGTH 2 - -typedef struct GprsTimer_tag { -#define GPRS_TIMER_UNIT_2S 0b000 /* 2 seconds */ -#define GPRS_TIMER_UNIT_60S 0b001 /* 1 minute */ -#define GPRS_TIMER_UNIT_360S 0b010 /* decihours */ -#define GPRS_TIMER_UNIT_0S 0b111 /* deactivated */ - uint8_t unit:3; - uint8_t timervalue:5; -} GprsTimer; - -int encode_gprs_timer(GprsTimer *gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_gprs_timer_xml(GprsTimer *gprstimer, uint8_t iei); - -int decode_gprs_timer(GprsTimer *gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len); - -long gprs_timer_value(GprsTimer *gprstimer); - -#endif /* GPRS TIMER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.c deleted file mode 100644 index 8edf37dbe7a8e8e0167550be05f74351398c8038..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "GutiType.h" - -int decode_guti_type(GutiType *gutitype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, GUTI_TYPE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *gutitype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_guti_type_xml(gutitype, iei); -#endif - return decoded; -} - -int decode_u8_guti_type(GutiType *gutitype, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *gutitype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_guti_type_xml(gutitype, iei); -#endif - return decoded; -} - -int encode_guti_type(GutiType *gutitype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, GUTI_TYPE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_guti_type_xml(gutitype, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*gutitype & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_guti_type(GutiType *gutitype) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_guti_type_xml(gutitype, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*gutitype & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_guti_type_xml(GutiType *gutitype, uint8_t iei) -{ - printf("<Guti Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Guti type value>%u</Guti type value>\n", *gutitype); - printf("</Guti Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.h deleted file mode 100644 index 8f96fc75eee2737b29c2223ca2018d57162ef49b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/GutiType.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef GUTI_TYPE_H_ -#define GUTI_TYPE_H_ - -#define GUTI_TYPE_MINIMUM_LENGTH 1 -#define GUTI_TYPE_MAXIMUM_LENGTH 1 - -#define GUTI_NATIVE 0 -#define GUTI_MAPPED 1 -typedef uint8_t GutiType; - -int encode_guti_type(GutiType *gutitype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_guti_type_xml(GutiType *gutitype, uint8_t iei); - -uint8_t encode_u8_guti_type(GutiType *gutitype); - -int decode_guti_type(GutiType *gutitype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_guti_type(GutiType *gutitype, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* GUTI_TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.c b/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.c deleted file mode 100644 index ddcfb54c2dd66b656433be84218ae851b8927d51..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "IdentityType2.h" - -int decode_identity_type_2(IdentityType2 *identitytype2, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, IDENTITY_TYPE_2_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *identitytype2 = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_identity_type_2_xml(identitytype2, iei); -#endif - return decoded; -} - -int decode_u8_identity_type_2(IdentityType2 *identitytype2, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *identitytype2 = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_identity_type_2_xml(identitytype2, iei); -#endif - return decoded; -} - -int encode_identity_type_2(IdentityType2 *identitytype2, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IDENTITY_TYPE_2_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_identity_type_2_xml(identitytype2, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*identitytype2 & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_identity_type_2(IdentityType2 *identitytype2) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_identity_type_2_xml(identitytype2, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*identitytype2 & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_identity_type_2_xml(IdentityType2 *identitytype2, uint8_t iei) -{ - printf("<Identity Type 2>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Type of identity>%u</Type of identity>\n", *identitytype2); - printf("</Identity Type 2>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.h b/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.h deleted file mode 100644 index be342ffe0429b5f8813fa7d2cda41a65f157bdf0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/IdentityType2.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef IDENTITY_TYPE_2_H_ -#define IDENTITY_TYPE_2_H_ - -#define IDENTITY_TYPE_2_MINIMUM_LENGTH 1 -#define IDENTITY_TYPE_2_MAXIMUM_LENGTH 1 - -#define IDENTITY_TYPE_2_IMSI 0b001 -#define IDENTITY_TYPE_2_IMEI 0b010 -#define IDENTITY_TYPE_2_IMEISV 0b011 -#define IDENTITY_TYPE_2_TMSI 0b100 -typedef uint8_t IdentityType2; - -int encode_identity_type_2(IdentityType2 *identitytype2, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_identity_type_2_xml(IdentityType2 *identitytype2, uint8_t iei); - -uint8_t encode_u8_identity_type_2(IdentityType2 *identitytype2); - -int decode_identity_type_2(IdentityType2 *identitytype2, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_identity_type_2(IdentityType2 *identitytype2, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* IDENTITY TYPE 2_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.c b/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.c deleted file mode 100644 index c6dfbe5f72410d2b844c407a0eb7a223eebf0eb9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ImeisvRequest.h" - -int decode_imeisv_request(ImeisvRequest *imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, IMEISV_REQUEST_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *imeisvrequest = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_imeisv_request_xml(imeisvrequest, iei); -#endif - return decoded; -} - -int decode_u8_imeisv_request(ImeisvRequest *imeisvrequest, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *imeisvrequest = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_imeisv_request_xml(imeisvrequest, iei); -#endif - return decoded; -} - -int encode_imeisv_request(ImeisvRequest *imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IMEISV_REQUEST_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_imeisv_request_xml(imeisvrequest, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*imeisvrequest & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_imeisv_request(ImeisvRequest *imeisvrequest) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_imeisv_request_xml(imeisvrequest, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*imeisvrequest & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_imeisv_request_xml(ImeisvRequest *imeisvrequest, uint8_t iei) -{ - printf("<Imeisv Request>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <IMEISV request value>%u</IMEISV request value>\n", *imeisvrequest); - printf("</Imeisv Request>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.h b/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.h deleted file mode 100644 index 6f8e9f87bfad1f281869662490b049425a3fd995..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ImeisvRequest.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef IMEISV_REQUEST_H_ -#define IMEISV_REQUEST_H_ - -#define IMEISV_REQUEST_MINIMUM_LENGTH 1 -#define IMEISV_REQUEST_MAXIMUM_LENGTH 1 - -typedef uint8_t ImeisvRequest; - -int encode_imeisv_request(ImeisvRequest *imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_imeisv_request_xml(ImeisvRequest *imeisvrequest, uint8_t iei); - -uint8_t encode_u8_imeisv_request(ImeisvRequest *imeisvrequest); - -int decode_imeisv_request(ImeisvRequest *imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_imeisv_request(ImeisvRequest *imeisvrequest, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* IMEISV REQUEST_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.c b/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.c deleted file mode 100644 index 4be3a1d7293660d5c5f081d0400347edcf50000f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.c +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "KsiAndSequenceNumber.h" - -int decode_ksi_and_sequence_number(KsiAndSequenceNumber *ksiandsequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ksiandsequencenumber->ksi = (*(buffer + decoded) >> 5) & 0x7; - ksiandsequencenumber->sequencenumber = *(buffer + decoded) & 0x1f; - decoded++; -#if defined (NAS_DEBUG) - dump_ksi_and_sequence_number_xml(ksiandsequencenumber, iei); -#endif - return decoded; -} - -int encode_ksi_and_sequence_number(KsiAndSequenceNumber *ksiandsequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, KSI_AND_SEQUENCE_NUMBER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_ksi_and_sequence_number_xml(ksiandsequencenumber, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = 0x00 | ((ksiandsequencenumber->ksi & 0x7) << 5) | - (ksiandsequencenumber->sequencenumber & 0x1f); - encoded++; - return encoded; -} - -void dump_ksi_and_sequence_number_xml(KsiAndSequenceNumber *ksiandsequencenumber, uint8_t iei) -{ - printf("<Ksi And Sequence Number>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <KSI>%u</KSI>\n", ksiandsequencenumber->ksi); - printf(" <Sequence number>%u</Sequence number>\n", ksiandsequencenumber->sequencenumber); - printf("</Ksi And Sequence Number>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.h b/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.h deleted file mode 100644 index 524309bf89b58dd74b19a9b26cfdc5707d7027c7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/KsiAndSequenceNumber.h +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef KSI_AND_SEQUENCE_NUMBER_H_ -#define KSI_AND_SEQUENCE_NUMBER_H_ - -#define KSI_AND_SEQUENCE_NUMBER_MINIMUM_LENGTH 2 -#define KSI_AND_SEQUENCE_NUMBER_MAXIMUM_LENGTH 2 - -typedef struct KsiAndSequenceNumber_tag { - uint8_t ksi:3; - uint8_t sequencenumber:5; -} KsiAndSequenceNumber; - -int encode_ksi_and_sequence_number(KsiAndSequenceNumber *ksiandsequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_ksi_and_sequence_number_xml(KsiAndSequenceNumber *ksiandsequencenumber, uint8_t iei); - -int decode_ksi_and_sequence_number(KsiAndSequenceNumber *ksiandsequencenumber, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* KSI AND SEQUENCE NUMBER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.c deleted file mode 100644 index 5c59acb7816e134722ce2e6a8863dcb032e08a34..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "LcsClientIdentity.h" - -int decode_lcs_client_identity(LcsClientIdentity *lcsclientidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&lcsclientidentity->lcsclientidentityvalue, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_lcs_client_identity_xml(lcsclientidentity, iei); -#endif - return decoded; -} -int encode_lcs_client_identity(LcsClientIdentity *lcsclientidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, LCS_CLIENT_IDENTITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_lcs_client_identity_xml(lcsclientidentity, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if ((encode_result = encode_octet_string(&lcsclientidentity->lcsclientidentityvalue, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_lcs_client_identity_xml(LcsClientIdentity *lcsclientidentity, uint8_t iei) -{ - printf("<Lcs Client Identity>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s",dump_octet_string_xml(&lcsclientidentity->lcsclientidentityvalue)); - printf("</Lcs Client Identity>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.h deleted file mode 100644 index 690914741ef581af8065a4d1040325ff3a532f9b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsClientIdentity.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef LCS_CLIENT_IDENTITY_H_ -#define LCS_CLIENT_IDENTITY_H_ - -#define LCS_CLIENT_IDENTITY_MINIMUM_LENGTH 3 -#define LCS_CLIENT_IDENTITY_MAXIMUM_LENGTH 257 - -typedef struct LcsClientIdentity_tag { - OctetString lcsclientidentityvalue; -} LcsClientIdentity; - -int encode_lcs_client_identity(LcsClientIdentity *lcsclientidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_lcs_client_identity(LcsClientIdentity *lcsclientidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_lcs_client_identity_xml(LcsClientIdentity *lcsclientidentity, uint8_t iei); - -#endif /* LCS CLIENT IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.c b/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.c deleted file mode 100644 index 371e195da1b12e4a3d7fe6823ee69d0a01acaa77..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.c +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "LcsIndicator.h" - -int decode_lcs_indicator(LcsIndicator *lcsindicator, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - *lcsindicator = *(buffer + decoded); - decoded++; -#if defined (NAS_DEBUG) - dump_lcs_indicator_xml(lcsindicator, iei); -#endif - return decoded; -} - -int encode_lcs_indicator(LcsIndicator *lcsindicator, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, LCS_INDICATOR_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_lcs_indicator_xml(lcsindicator, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = *lcsindicator; - encoded++; - return encoded; -} - -void dump_lcs_indicator_xml(LcsIndicator *lcsindicator, uint8_t iei) -{ - printf("<Lcs Indicator>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <LCS indicator value>%u</LCS indicator value>\n", *lcsindicator); - printf("</Lcs Indicator>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.h b/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.h deleted file mode 100644 index d4ad52e11dd70a1eee2f6221d59c3b6ec2211dcb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LcsIndicator.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef LCS_INDICATOR_H_ -#define LCS_INDICATOR_H_ - -#define LCS_INDICATOR_MINIMUM_LENGTH 2 -#define LCS_INDICATOR_MAXIMUM_LENGTH 2 - -typedef uint8_t LcsIndicator; - -int encode_lcs_indicator(LcsIndicator *lcsindicator, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_lcs_indicator_xml(LcsIndicator *lcsindicator, uint8_t iei); - -int decode_lcs_indicator(LcsIndicator *lcsindicator, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* LCS INDICATOR_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.c deleted file mode 100644 index 47a55b50fc143b145d92c01eae89321e66caf126..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "LinkedEpsBearerIdentity.h" - -int decode_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, LINKED_EPS_BEARER_IDENTITY_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *linkedepsbeareridentity = *buffer & 0xf; - decoded++; -#if defined (NAS_DEBUG) - dump_linked_eps_bearer_identity_xml(linkedepsbeareridentity, iei); -#endif - return decoded; -} - -int decode_u8_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *linkedepsbeareridentity = *buffer & 0xf; - decoded++; -#if defined (NAS_DEBUG) - dump_linked_eps_bearer_identity_xml(linkedepsbeareridentity, iei); -#endif - return decoded; -} - -int encode_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, LINKED_EPS_BEARER_IDENTITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_linked_eps_bearer_identity_xml(linkedepsbeareridentity, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*linkedepsbeareridentity & 0xf); - encoded++; - return encoded; -} - -uint8_t encode_u8_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_linked_eps_bearer_identity_xml(linkedepsbeareridentity, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*linkedepsbeareridentity & 0xf); - encoded++; - - return bufferReturn; -} - -void dump_linked_eps_bearer_identity_xml(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei) -{ - printf("<Linked Eps Bearer Identity>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Linked EPS bearer identity value>%u</Linked EPS bearer identity value>\n", *linkedepsbeareridentity); - printf("</Linked Eps Bearer Identity>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.h deleted file mode 100644 index 5fa07834f49649b70ea6f9dad08bf42a2a513966..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LinkedEpsBearerIdentity.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef LINKED_EPS_BEARER_IDENTITY_H_ -#define LINKED_EPS_BEARER_IDENTITY_H_ - -#define LINKED_EPS_BEARER_IDENTITY_MINIMUM_LENGTH 1 -#define LINKED_EPS_BEARER_IDENTITY_MAXIMUM_LENGTH 1 - -typedef uint8_t LinkedEpsBearerIdentity; - -int encode_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_linked_eps_bearer_identity_xml(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei); - -uint8_t encode_u8_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity); - -int decode_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_linked_eps_bearer_identity(LinkedEpsBearerIdentity *linkedepsbeareridentity, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* LINKED EPS BEARER IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.c b/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.c deleted file mode 100644 index 231676ba9ec811898573d571dab0d0ca61899116..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.c +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "LlcServiceAccessPointIdentifier.h" - -int decode_llc_service_access_point_identifier(LlcServiceAccessPointIdentifier *llcserviceaccesspointidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - *llcserviceaccesspointidentifier = *buffer & 0xf; - decoded++; -#if defined (NAS_DEBUG) - dump_llc_service_access_point_identifier_xml(llcserviceaccesspointidentifier, iei); -#endif - return decoded; -} - -int encode_llc_service_access_point_identifier(LlcServiceAccessPointIdentifier *llcserviceaccesspointidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_llc_service_access_point_identifier_xml(llcserviceaccesspointidentifier, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = 0x00 | - (*llcserviceaccesspointidentifier & 0xf); - encoded++; - return encoded; -} - -void dump_llc_service_access_point_identifier_xml(LlcServiceAccessPointIdentifier *llcserviceaccesspointidentifier, uint8_t iei) -{ - printf("<Llc Service Access Point Identifier>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <LLC SAPI value>%u</LLC SAPI value>\n", *llcserviceaccesspointidentifier); - printf("</Llc Service Access Point Identifier>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.h b/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.h deleted file mode 100644 index b699ded1b4895442dff8cc60bcf20cb5bf20bfbb..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LlcServiceAccessPointIdentifier.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef LLC_SERVICE_ACCESS_POINT_IDENTIFIER_H_ -#define LLC_SERVICE_ACCESS_POINT_IDENTIFIER_H_ - -#define LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MINIMUM_LENGTH 2 -#define LLC_SERVICE_ACCESS_POINT_IDENTIFIER_MAXIMUM_LENGTH 2 - -typedef uint8_t LlcServiceAccessPointIdentifier; - -int encode_llc_service_access_point_identifier(LlcServiceAccessPointIdentifier *llcserviceaccesspointidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_llc_service_access_point_identifier_xml(LlcServiceAccessPointIdentifier *llcserviceaccesspointidentifier, uint8_t iei); - -int decode_llc_service_access_point_identifier(LlcServiceAccessPointIdentifier *llcserviceaccesspointidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* LLC SERVICE ACCESS POINT IDENTIFIER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.c b/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.c deleted file mode 100644 index 43b9868a9919b6d49e3b8f42a1d02d1f846138f6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "LocationAreaIdentification.h" - -int decode_location_area_identification(LocationAreaIdentification *locationareaidentification, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - locationareaidentification->mccdigit2 = (*(buffer + decoded) >> 4) & 0xf; - locationareaidentification->mccdigit1 = *(buffer + decoded) & 0xf; - decoded++; - locationareaidentification->mncdigit3 = (*(buffer + decoded) >> 4) & 0xf; - locationareaidentification->mccdigit3 = *(buffer + decoded) & 0xf; - decoded++; - locationareaidentification->mncdigit2 = (*(buffer + decoded) >> 4) & 0xf; - locationareaidentification->mncdigit1 = *(buffer + decoded) & 0xf; - decoded++; - //IES_DECODE_U16(locationareaidentification->lac, *(buffer + decoded)); - IES_DECODE_U16(buffer, decoded, locationareaidentification->lac); -#if defined (NAS_DEBUG) - dump_location_area_identification_xml(locationareaidentification, iei); -#endif - return decoded; -} - -int encode_location_area_identification(LocationAreaIdentification *locationareaidentification, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, LOCATION_AREA_IDENTIFICATION_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_location_area_identification_xml(locationareaidentification, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = 0x00 | ((locationareaidentification->mccdigit2 & 0xf) << 4) | - (locationareaidentification->mccdigit1 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((locationareaidentification->mncdigit3 & 0xf) << 4) | - (locationareaidentification->mccdigit3 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((locationareaidentification->mncdigit2 & 0xf) << 4) | - (locationareaidentification->mncdigit1 & 0xf); - encoded++; - IES_ENCODE_U16(buffer, encoded, locationareaidentification->lac); - return encoded; -} - -void dump_location_area_identification_xml(LocationAreaIdentification *locationareaidentification, uint8_t iei) -{ - printf("<Location Area Identification>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <MCC digit 2>%u</MCC digit 2>\n", locationareaidentification->mccdigit2); - printf(" <MCC digit 1>%u</MCC digit 1>\n", locationareaidentification->mccdigit1); - printf(" <MNC digit 3>%u</MNC digit 3>\n", locationareaidentification->mncdigit3); - printf(" <MCC digit 3>%u</MCC digit 3>\n", locationareaidentification->mccdigit3); - printf(" <MNC digit 2>%u</MNC digit 2>\n", locationareaidentification->mncdigit2); - printf(" <MNC digit 1>%u</MNC digit 1>\n", locationareaidentification->mncdigit1); - printf(" <LAC>%u</LAC>\n", locationareaidentification->lac); - printf("</Location Area Identification>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.h b/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.h deleted file mode 100644 index d2b6880779f9fbebf528da99659621787454350d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/LocationAreaIdentification.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef LOCATION_AREA_IDENTIFICATION_H_ -#define LOCATION_AREA_IDENTIFICATION_H_ - -#define LOCATION_AREA_IDENTIFICATION_MINIMUM_LENGTH 6 -#define LOCATION_AREA_IDENTIFICATION_MAXIMUM_LENGTH 6 - -typedef struct LocationAreaIdentification_tag { - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; - uint16_t lac; -} LocationAreaIdentification; - -int encode_location_area_identification(LocationAreaIdentification *locationareaidentification, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_location_area_identification_xml(LocationAreaIdentification *locationareaidentification, uint8_t iei); - -int decode_location_area_identification(LocationAreaIdentification *locationareaidentification, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* LOCATION AREA IDENTIFICATION_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Makefile b/openair-cn/NAS/EURECOM-NAS/src/ies/Makefile deleted file mode 100644 index 8cc286e671c929cc3b878ba0984e87bca11326b4..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. -I$(UTILDIR) - -#DEFINES += -DNAS_DEBUG - -TARGET = $(LIBIES) -TARGETS = $(TARGET).a $(TARGET).so - -all: $(TARGETS) - -%.o: %.c %.h Makefile - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET).a: $(OBJS) - @$(RM) $@ - @$(AR) $(ARFLAGS) $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -$(TARGET).so: $(OBJS) - @$(LD) -G -o $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGETS) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.c deleted file mode 100644 index d66bd9b66227c533c5ddc7e340e9bec587fb717c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "MessageType.h" - -int decode_message_type(MessageType *messagetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_message_type(MessageType *messagetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.h deleted file mode 100644 index 810efb60cad297725bab55e156554e844bb713d3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MessageType.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef MESSAGE_TYPE_H_ -#define MESSAGE_TYPE_H_ - -#define MESSAGE_TYPE_MINIMUM_LENGTH 1 -#define MESSAGE_TYPE_MAXIMUM_LENGTH 1 - -typedef uint8_t MessageType; - -int encode_message_type(MessageType *messagetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_message_type_xml(MessageType *messagetype, uint8_t iei); - -int decode_message_type(MessageType *messagetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* MESSAGE TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.c deleted file mode 100644 index 14d9902142f70b1edd89d8d70b085a9059980a9c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.c +++ /dev/null @@ -1,678 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "MobileIdentity.h" - -static int decode_imsi_mobile_identity(ImsiMobileIdentity_t *imsi, uint8_t *buffer); -static int decode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buffer); -static int decode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer); -static int decode_tmsi_mobile_identity(TmsiMobileIdentity_t *tmsi, uint8_t *buffer); -static int decode_tmgi_mobile_identity(TmgiMobileIdentity_t *tmgi, uint8_t *buffer); -static int decode_no_mobile_identity(NoMobileIdentity_t *no_id, uint8_t *buffer); - -static int encode_imsi_mobile_identity(ImsiMobileIdentity_t *imsi, uint8_t *buffer); -static int encode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buffer); -static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer); -static int encode_tmsi_mobile_identity(TmsiMobileIdentity_t *tmsi, uint8_t *buffer); -static int encode_tmgi_mobile_identity(TmgiMobileIdentity_t *tmgi, uint8_t *buffer); -static int encode_no_mobile_identity(NoMobileIdentity_t *no_id, uint8_t *buffer); - -int decode_mobile_identity(MobileIdentity *mobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded_rc = TLV_DECODE_VALUE_DOESNT_MATCH; - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - - uint8_t typeofidentity = *(buffer + decoded) & 0x7; - - if (typeofidentity != MOBILE_IDENTITY_NOT_AVAILABLE) { - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if (typeofidentity == MOBILE_IDENTITY_IMSI) { - decoded_rc = decode_imsi_mobile_identity(&mobileidentity->imsi, - buffer + decoded); - } else if (typeofidentity == MOBILE_IDENTITY_IMEI) { - decoded_rc = decode_imei_mobile_identity(&mobileidentity->imei, - buffer + decoded); - } else if (typeofidentity == MOBILE_IDENTITY_IMEISV) { - decoded_rc = decode_imeisv_mobile_identity(&mobileidentity->imeisv, - buffer + decoded); - } else if (typeofidentity == MOBILE_IDENTITY_TMSI) { - decoded_rc = decode_tmsi_mobile_identity(&mobileidentity->tmsi, - buffer + decoded); - } else if (typeofidentity == MOBILE_IDENTITY_TMGI) { - decoded_rc = decode_tmgi_mobile_identity(&mobileidentity->tmgi, - buffer + decoded); - } - } else if (ielen == MOBILE_IDENTITY_NOT_AVAILABLE_LTE_LENGTH) { - decoded_rc = decode_no_mobile_identity(&mobileidentity->no_id, - buffer + decoded); - } - - if (decoded_rc < 0) { - return decoded_rc; - } - -#if defined (NAS_DEBUG) - dump_mobile_identity_xml(mobileidentity, iei); -#endif - return (decoded + decoded_rc); -} - -int encode_mobile_identity(MobileIdentity *mobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - int encoded_rc = TLV_ENCODE_VALUE_DOESNT_MATCH; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MOBILE_IDENTITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_mobile_identity_xml(mobileidentity, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if (mobileidentity->no_id.typeofidentity != MOBILE_IDENTITY_NOT_AVAILABLE) { - if (mobileidentity->imsi.typeofidentity == MOBILE_IDENTITY_IMSI) { - encoded_rc = encode_imsi_mobile_identity(&mobileidentity->imsi, - buffer + encoded); - } else if (mobileidentity->imei.typeofidentity == MOBILE_IDENTITY_IMEI) { - encoded_rc = encode_imei_mobile_identity(&mobileidentity->imei, - buffer + encoded); - } else if (mobileidentity->imeisv.typeofidentity == MOBILE_IDENTITY_IMEISV) { - encoded_rc = encode_imeisv_mobile_identity(&mobileidentity->imeisv, - buffer + encoded); - } else if (mobileidentity->tmsi.typeofidentity == MOBILE_IDENTITY_TMSI) { - encoded_rc = encode_tmsi_mobile_identity(&mobileidentity->tmsi, - buffer + encoded); - } else if (mobileidentity->tmgi.typeofidentity == MOBILE_IDENTITY_TMGI) { - encoded_rc = encode_tmgi_mobile_identity(&mobileidentity->tmgi, - buffer + encoded); - } - - if (encoded_rc > 0) { - *lenPtr = encoded + encoded_rc - 1 - ((iei > 0) ? 1 : 0); - } - } else { - encoded_rc = encode_no_mobile_identity(&mobileidentity->no_id, - buffer + encoded); - - if (encoded_rc > 0) { - *lenPtr = MOBILE_IDENTITY_NOT_AVAILABLE_LTE_LENGTH; - } - } - - if (encoded_rc < 0) { - return encoded_rc; - } - - return (encoded + encoded_rc); -} - -void dump_mobile_identity_xml(MobileIdentity *mobileidentity, uint8_t iei) -{ - printf("<Mobile Identity>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - if (mobileidentity->imsi.typeofidentity == MOBILE_IDENTITY_IMSI) { - ImsiMobileIdentity_t* imsi = &mobileidentity->imsi; - printf(" <odd even>%u</odd even>\n", imsi->oddeven); - printf(" <Type of identity>IMSI</Type of identity>\n"); - printf(" <digit1>%u</digit1>\n", imsi->digit1); - printf(" <digit2>%u</digit2>\n", imsi->digit2); - printf(" <digit3>%u</digit3>\n", imsi->digit3); - printf(" <digit4>%u</digit4>\n", imsi->digit4); - printf(" <digit5>%u</digit5>\n", imsi->digit5); - printf(" <digit6>%u</digit6>\n", imsi->digit6); - printf(" <digit7>%u</digit7>\n", imsi->digit7); - printf(" <digit8>%u</digit8>\n", imsi->digit8); - printf(" <digit9>%u</digit9>\n", imsi->digit9); - printf(" <digit10>%u</digit10>\n", imsi->digit10); - printf(" <digit11>%u</digit11>\n", imsi->digit11); - printf(" <digit12>%u</digit12>\n", imsi->digit12); - printf(" <digit13>%u</digit13>\n", imsi->digit13); - printf(" <digit14>%u</digit14>\n", imsi->digit14); - printf(" <digit15>%u</digit15>\n", imsi->digit15); - } else if (mobileidentity->imei.typeofidentity == MOBILE_IDENTITY_IMEI) { - ImeiMobileIdentity_t* imei = &mobileidentity->imei; - printf(" <odd even>%u</odd even>\n", imei->oddeven); - printf(" <Type of identity>IMEI</Type of identity>\n"); - printf(" <digit1>%u</digit1>\n", imei->digit1); - printf(" <digit2>%u</digit2>\n", imei->digit2); - printf(" <digit3>%u</digit3>\n", imei->digit3); - printf(" <digit4>%u</digit4>\n", imei->digit4); - printf(" <digit5>%u</digit5>\n", imei->digit5); - printf(" <digit6>%u</digit6>\n", imei->digit6); - printf(" <digit7>%u</digit7>\n", imei->digit7); - printf(" <digit8>%u</digit8>\n", imei->digit8); - printf(" <digit9>%u</digit9>\n", imei->digit9); - printf(" <digit10>%u</digit10>\n", imei->digit10); - printf(" <digit11>%u</digit11>\n", imei->digit11); - printf(" <digit12>%u</digit12>\n", imei->digit12); - printf(" <digit13>%u</digit13>\n", imei->digit13); - printf(" <digit14>%u</digit14>\n", imei->digit14); - printf(" <digit15>%u</digit15>\n", imei->digit15); - } else if (mobileidentity->imeisv.typeofidentity == MOBILE_IDENTITY_IMEISV) { - ImeisvMobileIdentity_t* imeisv = &mobileidentity->imeisv; - printf(" <odd even>%u</odd even>\n", imeisv->oddeven); - printf(" <Type of identity>IMEISV</Type of identity>\n"); - printf(" <digit1>%u</digit1>\n", imeisv->digit1); - printf(" <digit2>%u</digit2>\n", imeisv->digit2); - printf(" <digit3>%u</digit3>\n", imeisv->digit3); - printf(" <digit4>%u</digit4>\n", imeisv->digit4); - printf(" <digit5>%u</digit5>\n", imeisv->digit5); - printf(" <digit6>%u</digit6>\n", imeisv->digit6); - printf(" <digit7>%u</digit7>\n", imeisv->digit7); - printf(" <digit8>%u</digit8>\n", imeisv->digit8); - printf(" <digit9>%u</digit9>\n", imeisv->digit9); - printf(" <digit10>%u</digit10>\n", imeisv->digit10); - printf(" <digit11>%u</digit11>\n", imeisv->digit11); - printf(" <digit12>%u</digit12>\n", imeisv->digit12); - printf(" <digit13>%u</digit13>\n", imeisv->digit13); - printf(" <digit14>%u</digit14>\n", imeisv->digit14); - printf(" <digit15>%u</digit15>\n", imeisv->digit15); - } else if (mobileidentity->tmsi.typeofidentity == MOBILE_IDENTITY_TMSI) { - TmsiMobileIdentity_t* tmsi = &mobileidentity->tmsi; - printf(" <odd even>%u</odd even>\n", tmsi->oddeven); - printf(" <Type of identity>TMSI</Type of identity>\n"); - printf(" <digit1>%u</digit1>\n", tmsi->digit1); - printf(" <digit2>%u</digit2>\n", tmsi->digit2); - printf(" <digit3>%u</digit3>\n", tmsi->digit3); - printf(" <digit4>%u</digit4>\n", tmsi->digit4); - printf(" <digit5>%u</digit5>\n", tmsi->digit5); - printf(" <digit6>%u</digit6>\n", tmsi->digit6); - printf(" <digit7>%u</digit7>\n", tmsi->digit7); - printf(" <digit8>%u</digit8>\n", tmsi->digit8); - printf(" <digit9>%u</digit9>\n", tmsi->digit9); - printf(" <digit10>%u</digit10>\n", tmsi->digit10); - printf(" <digit11>%u</digit11>\n", tmsi->digit11); - printf(" <digit12>%u</digit12>\n", tmsi->digit12); - printf(" <digit13>%u</digit13>\n", tmsi->digit13); - printf(" <digit14>%u</digit14>\n", tmsi->digit14); - printf(" <digit15>%u</digit15>\n", tmsi->digit15); - } else if (mobileidentity->tmgi.typeofidentity == MOBILE_IDENTITY_TMGI) { - TmgiMobileIdentity_t* tmgi = &mobileidentity->tmgi; - printf(" <MBMS session ID indication>%u</MBMS session ID indication>\n", tmgi->mbmssessionidindication); - printf(" <MCC MNC indication>%u</MCC MNC indication>\n", - tmgi->mccmncindication); - printf(" <Odd even>%u</Odd even>\n", - tmgi->oddeven); - printf(" <Type of identity>TMGI</Type of identity>\n"); - printf(" <MBMS service ID>%u</MBMS service ID>\n", - tmgi->mbmsserviceid); - printf(" <MCC digit 2>%u</MCC digit 2>\n", tmgi->mccdigit2); - printf(" <MCC digit 1>%u</MCC digit 1>\n", tmgi->mccdigit1); - printf(" <MNC digit 3>%u</MNC digit 3>\n", tmgi->mncdigit3); - printf(" <MCC digit 3>%u</MCC digit 3>\n", tmgi->mccdigit3); - printf(" <MNC digit 2>%u</MNC digit 2>\n", tmgi->mncdigit2); - printf(" <MNC digit 1>%u</MNC digit 1>\n", tmgi->mncdigit1); - printf(" <MBMS session ID>%u</MBMS session ID>\n", - tmgi->mbmssessionid); - } else { - printf(" Wrong type of mobile identity (%u)\n", mobileidentity->imsi.typeofidentity); - } - - printf("</Mobile Identity>\n"); -} - -static int decode_imsi_mobile_identity(ImsiMobileIdentity_t *imsi, uint8_t *buffer) -{ - int decoded = 0; - imsi->typeofidentity = *(buffer + decoded) & 0x7; - - if (imsi->typeofidentity != MOBILE_IDENTITY_IMSI) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - imsi->oddeven = (*(buffer + decoded) >> 3) & 0x1; - imsi->digit1 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit2 = *(buffer + decoded) & 0xf; - imsi->digit3 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit4 = *(buffer + decoded) & 0xf; - imsi->digit5 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit6 = *(buffer + decoded) & 0xf; - imsi->digit7 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit8 = *(buffer + decoded) & 0xf; - imsi->digit9 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit10 = *(buffer + decoded) & 0xf; - imsi->digit11 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit12 = *(buffer + decoded) & 0xf; - imsi->digit13 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imsi->digit14 = *(buffer + decoded) & 0xf; - imsi->digit15 = (*(buffer + decoded) >> 4) & 0xf; - - /* - * IMSI is coded using BCD coding. If the number of identity digits is - * even then bits 5 to 8 of the last octet shall be filled with an end - * mark coded as "1111". - */ - if ((imsi->oddeven == MOBILE_IDENTITY_EVEN) && (imsi->digit15 != 0x0f)) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - decoded++; - return decoded; -} - -static int decode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buffer) -{ - int decoded = 0; - imei->typeofidentity = *(buffer + decoded) & 0x7; - - if (imei->typeofidentity != MOBILE_IDENTITY_IMEI) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - imei->oddeven = (*(buffer + decoded) >> 3) & 0x1; - imei->digit1 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit2 = *(buffer + decoded) & 0xf; - imei->digit3 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit4 = *(buffer + decoded) & 0xf; - imei->digit5 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit6 = *(buffer + decoded) & 0xf; - imei->digit7 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit8 = *(buffer + decoded) & 0xf; - imei->digit9 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit10 = *(buffer + decoded) & 0xf; - imei->digit11 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit12 = *(buffer + decoded) & 0xf; - imei->digit13 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imei->digit14 = *(buffer + decoded) & 0xf; - imei->digit15 = (*(buffer + decoded) >> 4) & 0xf; - - /* - * IMEI is coded using BCD coding. If the number of identity digits is - * even then bits 5 to 8 of the last octet shall be filled with an end - * mark coded as "1111". - */ - if ((imei->oddeven == MOBILE_IDENTITY_EVEN) && (imei->digit15 != 0x0f)) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - decoded++; - return decoded; -} - -static int decode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer) -{ - int decoded = 0; - imeisv->typeofidentity = *(buffer + decoded) & 0x7; - - if (imeisv->typeofidentity != MOBILE_IDENTITY_IMEISV) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - imeisv->oddeven = (*(buffer + decoded) >> 3) & 0x1; - imeisv->digit1 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imeisv->digit2 = *(buffer + decoded) & 0xf; - imeisv->digit3 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imeisv->digit4 = *(buffer + decoded) & 0xf; - imeisv->digit5 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imeisv->digit6 = *(buffer + decoded) & 0xf; - imeisv->digit7 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imeisv->digit8 = *(buffer + decoded) & 0xf; - imeisv->digit9 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imeisv->digit10 = *(buffer + decoded) & 0xf; - imeisv->digit11 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imeisv->digit12 = *(buffer + decoded) & 0xf; - imeisv->digit13 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - imeisv->digit14 = *(buffer + decoded) & 0xf; - imeisv->digit15 = (*(buffer + decoded) >> 4) & 0xf; - - /* - * IMEISV is coded using BCD coding. If the number of identity digits is - * even then bits 5 to 8 of the last octet shall be filled with an end - * mark coded as "1111". - */ - if ((imeisv->oddeven == MOBILE_IDENTITY_EVEN) && (imeisv->digit15 != 0x0f)) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - decoded++; - return decoded; -} - -static int decode_tmsi_mobile_identity(TmsiMobileIdentity_t *tmsi, uint8_t *buffer) -{ - int decoded = 0; - tmsi->typeofidentity = *(buffer + decoded) & 0x7; - - if (tmsi->typeofidentity != MOBILE_IDENTITY_TMSI) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - tmsi->oddeven = (*(buffer + decoded) >> 3) & 0x1; - tmsi->digit1 = (*(buffer + decoded) >> 4) & 0xf; - - /* - * If the mobile identity is the TMSI/P-TMSI/M-TMSI then bits 5 to 8 - * of octet 3 are coded as "1111". - */ - if (tmsi->digit1 != 0xf) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - decoded++; - tmsi->digit2 = *(buffer + decoded) & 0xf; - tmsi->digit3 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - tmsi->digit4 = *(buffer + decoded) & 0xf; - tmsi->digit5 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - tmsi->digit6 = *(buffer + decoded) & 0xf; - tmsi->digit7 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - tmsi->digit8 = *(buffer + decoded) & 0xf; - tmsi->digit9 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - tmsi->digit10 = *(buffer + decoded) & 0xf; - tmsi->digit11 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - tmsi->digit12 = *(buffer + decoded) & 0xf; - tmsi->digit13 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - tmsi->digit14 = *(buffer + decoded) & 0xf; - tmsi->digit15 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - return decoded; -} - -static int decode_tmgi_mobile_identity(TmgiMobileIdentity_t *tmgi, uint8_t *buffer) -{ - int decoded = 0; - tmgi->spare = (*(buffer + decoded) >> 6) & 0x2; - - /* - * Spare bits are coded with 0s - */ - if (tmgi->spare != 0) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - tmgi->mbmssessionidindication = (*(buffer + decoded) >> 5) & 0x1; - tmgi->mccmncindication = (*(buffer + decoded) >> 4) & 0x1; - tmgi->oddeven = (*(buffer + decoded) >> 3) & 0x1; - tmgi->typeofidentity = *(buffer + decoded) & 0x7; - - if (tmgi->typeofidentity != MOBILE_IDENTITY_TMGI) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - decoded++; - //IES_DECODE_U24(tmgi->mbmsserviceid, *(buffer + decoded)); - IES_DECODE_U24(buffer, decoded, tmgi->mbmsserviceid); - tmgi->mccdigit2 = (*(buffer + decoded) >> 4) & 0xf; - tmgi->mccdigit1 = *(buffer + decoded) & 0xf; - decoded++; - tmgi->mncdigit3 = (*(buffer + decoded) >> 4) & 0xf; - tmgi->mccdigit3 = *(buffer + decoded) & 0xf; - decoded++; - tmgi->mncdigit2 = (*(buffer + decoded) >> 4) & 0xf; - tmgi->mncdigit1 = *(buffer + decoded) & 0xf; - decoded++; - tmgi->mbmssessionid = *(buffer + decoded); - decoded++; - return decoded; -} - -static int decode_no_mobile_identity(NoMobileIdentity_t *no_id, uint8_t *buffer) -{ - int decoded = 0; - no_id->typeofidentity = *(buffer + decoded) & 0x7; - - if (no_id->typeofidentity != MOBILE_IDENTITY_NOT_AVAILABLE) { - return (TLV_ENCODE_VALUE_DOESNT_MATCH); - } - - no_id->oddeven = (*(buffer + decoded) >> 3) & 0x1; - no_id->digit1 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - no_id->digit2 = *(buffer + decoded) & 0xf; - no_id->digit3 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - no_id->digit4 = *(buffer + decoded) & 0xf; - no_id->digit5 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - no_id->digit6 = *(buffer + decoded) & 0xf; - no_id->digit7 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - no_id->digit8 = *(buffer + decoded) & 0xf; - no_id->digit9 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - no_id->digit10 = *(buffer + decoded) & 0xf; - no_id->digit11 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - no_id->digit12 = *(buffer + decoded) & 0xf; - no_id->digit13 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - no_id->digit14 = *(buffer + decoded) & 0xf; - no_id->digit15 = (*(buffer + decoded) >> 4) & 0xf; - decoded++; - return decoded; -} - -static int encode_imsi_mobile_identity(ImsiMobileIdentity_t *imsi, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0x00 | (imsi->digit1 << 4) | (imsi->oddeven << 3) | - (imsi->typeofidentity); - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit3 << 4) | imsi->digit2; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit5 << 4) | imsi->digit4; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit7 << 4) | imsi->digit6; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit9 << 4) | imsi->digit8; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit11 << 4) | imsi->digit10; - encoded++; - *(buffer + encoded) = 0x00 | (imsi->digit13 << 4) | imsi->digit12; - encoded++; - - if (imsi->oddeven != MOBILE_IDENTITY_EVEN) { - *(buffer + encoded) = 0x00 | (imsi->digit15 << 4) | imsi->digit14; - } else { - *(buffer + encoded) = 0xf0 | imsi->digit14; - } - - encoded++; - return encoded; -} - -static int encode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0x00 | (imei->digit1 << 4) | (imei->oddeven << 3) | - (imei->typeofidentity); - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit3 << 4) | imei->digit2; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit5 << 4) | imei->digit4; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit7 << 4) | imei->digit6; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit9 << 4) | imei->digit8; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit11 << 4) | imei->digit10; - encoded++; - *(buffer + encoded) = 0x00 | (imei->digit13 << 4) | imei->digit12; - encoded++; - - if (imei->oddeven != MOBILE_IDENTITY_EVEN) { - *(buffer + encoded) = 0x00 | (imei->digit15 << 4) | imei->digit14; - } else { - *(buffer + encoded) = 0xf0 | imei->digit14; - } - - encoded++; - return encoded; -} - -static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0x00 | (imeisv->digit1 << 4) | (imeisv->oddeven << 3) | - (imeisv->typeofidentity); - encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit3 << 4) | imeisv->digit2; - encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit5 << 4) | imeisv->digit4; - encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit7 << 4) | imeisv->digit6; - encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit9 << 4) | imeisv->digit8; - encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit11 << 4) | imeisv->digit10; - encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit13 << 4) | imeisv->digit12; - encoded++; - - if (imeisv->oddeven != MOBILE_IDENTITY_EVEN) { - *(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14; - } else { - *(buffer + encoded) = 0xf0 | imeisv->digit14; - } - - encoded++; - return encoded; -} - -static int encode_tmsi_mobile_identity(TmsiMobileIdentity_t *tmsi, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0xf0 | (tmsi->oddeven << 3) | (tmsi->typeofidentity); - encoded++; - *(buffer + encoded) = 0x00 | (tmsi->digit3 << 4) | tmsi->digit2; - encoded++; - *(buffer + encoded) = 0x00 | (tmsi->digit5 << 4) | tmsi->digit4; - encoded++; - *(buffer + encoded) = 0x00 | (tmsi->digit7 << 4) | tmsi->digit6; - encoded++; - *(buffer + encoded) = 0x00 | (tmsi->digit9 << 4) | tmsi->digit8; - encoded++; - *(buffer + encoded) = 0x00 | (tmsi->digit11 << 4) | tmsi->digit10; - encoded++; - *(buffer + encoded) = 0x00 | (tmsi->digit13 << 4) | tmsi->digit12; - encoded++; - *(buffer + encoded) = 0x00 | (tmsi->digit15 << 4) | tmsi->digit14; - encoded++; - return encoded; -} - -static int encode_tmgi_mobile_identity(TmgiMobileIdentity_t *tmgi, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = 0x00 | - ((tmgi->mbmssessionidindication & 0x1) << 5) | - ((tmgi->mccmncindication & 0x1) << 4) | - ((tmgi->oddeven & 0x1) << 3) | - (tmgi->typeofidentity & 0x7); - encoded++; - IES_ENCODE_U24(buffer, encoded, tmgi->mbmsserviceid); - *(buffer + encoded) = 0x00 | ((tmgi->mccdigit2 & 0xf) << 4) | - (tmgi->mccdigit1 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((tmgi->mncdigit3 & 0xf) << 4) | - (tmgi->mccdigit3 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((tmgi->mncdigit2 & 0xf) << 4) | - (tmgi->mncdigit1 & 0xf); - encoded++; - *(buffer + encoded) = tmgi->mbmssessionid; - encoded++; - return encoded; -} - -static int encode_no_mobile_identity(NoMobileIdentity_t *no_id, uint8_t *buffer) -{ - uint32_t encoded = 0; - *(buffer + encoded) = no_id->typeofidentity; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - return encoded; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.h deleted file mode 100644 index 206685c7f3bb6fa28ff4d3c7818253a191ed1b4e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileIdentity.h +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef MOBILE_IDENTITY_H_ -#define MOBILE_IDENTITY_H_ - -#define MOBILE_IDENTITY_MINIMUM_LENGTH 3 -#define MOBILE_IDENTITY_MAXIMUM_LENGTH 11 - -#define MOBILE_IDENTITY_NOT_AVAILABLE_GSM_LENGTH 1 -#define MOBILE_IDENTITY_NOT_AVAILABLE_GPRS_LENGTH 3 -#define MOBILE_IDENTITY_NOT_AVAILABLE_LTE_LENGTH 3 - -typedef struct { - uint8_t digit1:4; - uint8_t oddeven:1; - uint8_t typeofidentity:3; - uint8_t digit2:4; - uint8_t digit3:4; - uint8_t digit4:4; - uint8_t digit5:4; - uint8_t digit6:4; - uint8_t digit7:4; - uint8_t digit8:4; - uint8_t digit9:4; - uint8_t digit10:4; - uint8_t digit11:4; - uint8_t digit12:4; - uint8_t digit13:4; - uint8_t digit14:4; - uint8_t digit15:4; -} ImsiMobileIdentity_t; - -typedef struct { - uint8_t spare:2; - uint8_t mbmssessionidindication:1; - uint8_t mccmncindication:1; -#define MOBILE_IDENTITY_EVEN 0 -#define MOBILE_IDENTITY_ODD 1 - uint8_t oddeven:1; - uint8_t typeofidentity:3; - uint32_t mbmsserviceid; - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; - uint8_t mbmssessionid; -} TmgiMobileIdentity_t; - -typedef ImsiMobileIdentity_t ImeiMobileIdentity_t; -typedef ImsiMobileIdentity_t ImeisvMobileIdentity_t; -typedef ImsiMobileIdentity_t TmsiMobileIdentity_t; -typedef ImsiMobileIdentity_t NoMobileIdentity_t; - -typedef union MobileIdentity_tag { -#define MOBILE_IDENTITY_IMSI 0b001 -#define MOBILE_IDENTITY_IMEI 0b010 -#define MOBILE_IDENTITY_IMEISV 0b011 -#define MOBILE_IDENTITY_TMSI 0b100 -#define MOBILE_IDENTITY_TMGI 0b101 -#define MOBILE_IDENTITY_NOT_AVAILABLE 0b000 - ImsiMobileIdentity_t imsi; - ImeiMobileIdentity_t imei; - ImeisvMobileIdentity_t imeisv; - TmsiMobileIdentity_t tmsi; - TmgiMobileIdentity_t tmgi; - NoMobileIdentity_t no_id; -} MobileIdentity; - -int encode_mobile_identity(MobileIdentity *mobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_mobile_identity(MobileIdentity *mobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_mobile_identity_xml(MobileIdentity *mobileidentity, uint8_t iei); - -#endif /* MOBILE IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.c b/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.c deleted file mode 100644 index 3e97e164ad2a274da2f1745bc1badb425b3be9d0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.c +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "MobileStationClassmark2.h" - -int decode_mobile_station_classmark_2(MobileStationClassmark2 *mobilestationclassmark2, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - mobilestationclassmark2->revisionlevel = (*(buffer + decoded) >> 5) & 0x3; - mobilestationclassmark2->esind = (*(buffer + decoded) >> 4) & 0x1; - mobilestationclassmark2->a51 = (*(buffer + decoded) >> 3) & 0x1; - mobilestationclassmark2->rfpowercapability = *(buffer + decoded) & 0x7; - decoded++; - mobilestationclassmark2->pscapability = (*(buffer + decoded) >> 6) & 0x1; - mobilestationclassmark2->ssscreenindicator = (*(buffer + decoded) >> 4) & 0x3; - mobilestationclassmark2->smcapability = (*(buffer + decoded) >> 3) & 0x1; - mobilestationclassmark2->vbs = (*(buffer + decoded) >> 2) & 0x1; - mobilestationclassmark2->vgcs = (*(buffer + decoded) >> 1) & 0x1; - mobilestationclassmark2->fc = *(buffer + decoded) & 0x1; - decoded++; - mobilestationclassmark2->cm3 = (*(buffer + decoded) >> 7) & 0x1; - mobilestationclassmark2->lcsvacap = (*(buffer + decoded) >> 5) & 0x1; - mobilestationclassmark2->ucs2 = (*(buffer + decoded) >> 4) & 0x1; - mobilestationclassmark2->solsa = (*(buffer + decoded) >> 3) & 0x1; - mobilestationclassmark2->cmsp = (*(buffer + decoded) >> 2) & 0x1; - mobilestationclassmark2->a53 = (*(buffer + decoded) >> 1) & 0x1; - mobilestationclassmark2->a52 = *(buffer + decoded) & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_mobile_station_classmark_2_xml(mobilestationclassmark2, iei); -#endif - return decoded; -} -int encode_mobile_station_classmark_2(MobileStationClassmark2 *mobilestationclassmark2, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MOBILE_STATION_CLASSMARK_2_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_mobile_station_classmark_2_xml(mobilestationclassmark2, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - ((mobilestationclassmark2->revisionlevel & 0x3) << 5) | - ((mobilestationclassmark2->esind & 0x1) << 4) | - ((mobilestationclassmark2->a51 & 0x1) << 3) | - (mobilestationclassmark2->rfpowercapability & 0x7); - encoded++; - *(buffer + encoded) = 0x00 | - ((mobilestationclassmark2->pscapability & 0x1) << 6) | - ((mobilestationclassmark2->ssscreenindicator & 0x3) << 4) | - ((mobilestationclassmark2->smcapability & 0x1) << 3) | - ((mobilestationclassmark2->vbs & 0x1) << 2) | - ((mobilestationclassmark2->vgcs & 0x1) << 1) | - (mobilestationclassmark2->fc & 0x1); - encoded++; - *(buffer + encoded) = 0x00 | ((mobilestationclassmark2->cm3 & 0x1) << 7) | - ((mobilestationclassmark2->lcsvacap & 0x1) << 5) | - ((mobilestationclassmark2->ucs2 & 0x1) << 4) | - ((mobilestationclassmark2->solsa & 0x1) << 3) | - ((mobilestationclassmark2->cmsp & 0x1) << 2) | - ((mobilestationclassmark2->a53 & 0x1) << 1) | - (mobilestationclassmark2->a52 & 0x1); - encoded++; - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_mobile_station_classmark_2_xml(MobileStationClassmark2 *mobilestationclassmark2, uint8_t iei) -{ - printf("<Mobile Station Classmark 2>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Revision level>%u</Revision level>\n", mobilestationclassmark2->revisionlevel); - printf(" <ES IND>%u</ES IND>\n", mobilestationclassmark2->esind); - printf(" <A51>%u</A51>\n", mobilestationclassmark2->a51); - printf(" <RF power capability>%u</RF power capability>\n", mobilestationclassmark2->rfpowercapability); - printf(" <PS capability>%u</PS capability>\n", mobilestationclassmark2->pscapability); - printf(" <SS Screen indicator>%u</SS Screen indicator>\n", mobilestationclassmark2->ssscreenindicator); - printf(" <SM capability>%u</SM capability>\n", mobilestationclassmark2->smcapability); - printf(" <VBS>%u</VBS>\n", mobilestationclassmark2->vbs); - printf(" <VGCS>%u</VGCS>\n", mobilestationclassmark2->vgcs); - printf(" <FC>%u</FC>\n", mobilestationclassmark2->fc); - printf(" <CM3>%u</CM3>\n", mobilestationclassmark2->cm3); - printf(" <LCSVA CAP>%u</LCSVA CAP>\n", mobilestationclassmark2->lcsvacap); - printf(" <UCS2>%u</UCS2>\n", mobilestationclassmark2->ucs2); - printf(" <SoLSA>%u</SoLSA>\n", mobilestationclassmark2->solsa); - printf(" <CMSP>%u</CMSP>\n", mobilestationclassmark2->cmsp); - printf(" <A53>%u</A53>\n", mobilestationclassmark2->a53); - printf(" <A52>%u</A52>\n", mobilestationclassmark2->a52); - printf("</Mobile Station Classmark 2>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.h b/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.h deleted file mode 100644 index d8a9c596a45024063c01bfb9ce68879afb008433..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark2.h +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef MOBILE_STATION_CLASSMARK_2_H_ -#define MOBILE_STATION_CLASSMARK_2_H_ - -#define MOBILE_STATION_CLASSMARK_2_MINIMUM_LENGTH 5 -#define MOBILE_STATION_CLASSMARK_2_MAXIMUM_LENGTH 5 - -typedef struct MobileStationClassmark2_tag { - uint8_t revisionlevel:2; - uint8_t esind:1; - uint8_t a51:1; - uint8_t rfpowercapability:3; - uint8_t pscapability:1; - uint8_t ssscreenindicator:2; - uint8_t smcapability:1; - uint8_t vbs:1; - uint8_t vgcs:1; - uint8_t fc:1; - uint8_t cm3:1; - uint8_t lcsvacap:1; - uint8_t ucs2:1; - uint8_t solsa:1; - uint8_t cmsp:1; - uint8_t a53:1; - uint8_t a52:1; -} MobileStationClassmark2; - -int encode_mobile_station_classmark_2(MobileStationClassmark2 *mobilestationclassmark2, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_mobile_station_classmark_2(MobileStationClassmark2 *mobilestationclassmark2, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_mobile_station_classmark_2_xml(MobileStationClassmark2 *mobilestationclassmark2, uint8_t iei); - -#endif /* MOBILE STATION CLASSMARK 2_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.c b/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.c deleted file mode 100644 index 84bf06c3c186383c87fbb3994e58f3f37610f73b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "MobileStationClassmark3.h" - -int decode_mobile_station_classmark_3(MobileStationClassmark3 *mobilestationclassmark3, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_mobile_station_classmark_3(MobileStationClassmark3 *mobilestationclassmark3, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.h b/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.h deleted file mode 100644 index 504678bbdf875efabad05ef120cdb0c063beb7ad..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MobileStationClassmark3.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef MOBILE_STATION_CLASSMARK_3_H_ -#define MOBILE_STATION_CLASSMARK_3_H_ - -#define MOBILE_STATION_CLASSMARK_3_MINIMUM_LENGTH 1 -#define MOBILE_STATION_CLASSMARK_3_MAXIMUM_LENGTH 1 - -typedef struct { - uint8_t field; -} MobileStationClassmark3; - -int encode_mobile_station_classmark_3(MobileStationClassmark3 *mobilestationclassmark3, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_mobile_station_classmark_3_xml(MobileStationClassmark3 *mobilestationclassmark3, uint8_t iei); - -int decode_mobile_station_classmark_3(MobileStationClassmark3 *mobilestationclassmark3, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* MOBILE STATION CLASSMARK 3_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.c b/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.c deleted file mode 100644 index 2fc8a72c8778dfcad2d37477bee7576b0eb81305..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "MsNetworkCapability.h" - -int decode_ms_network_capability(MsNetworkCapability *msnetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&msnetworkcapability->msnetworkcapabilityvalue, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_ms_network_capability_xml(msnetworkcapability, iei); -#endif - return decoded; -} -int encode_ms_network_capability(MsNetworkCapability *msnetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MS_NETWORK_CAPABILITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_ms_network_capability_xml(msnetworkcapability, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if ((encode_result = encode_octet_string(&msnetworkcapability->msnetworkcapabilityvalue, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_ms_network_capability_xml(MsNetworkCapability *msnetworkcapability, uint8_t iei) -{ - printf("<Ms Network Capability>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s",dump_octet_string_xml(&msnetworkcapability->msnetworkcapabilityvalue)); - printf("</Ms Network Capability>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.h b/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.h deleted file mode 100644 index 7f6d1699da03f14ad4f7e7729a9006852576fc47..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/MsNetworkCapability.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef MS_NETWORK_CAPABILITY_H_ -#define MS_NETWORK_CAPABILITY_H_ - -#define MS_NETWORK_CAPABILITY_MINIMUM_LENGTH 3 -#define MS_NETWORK_CAPABILITY_MAXIMUM_LENGTH 10 - -typedef struct MsNetworkCapability_tag { - OctetString msnetworkcapabilityvalue; -} MsNetworkCapability; - -int encode_ms_network_capability(MsNetworkCapability *msnetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_ms_network_capability(MsNetworkCapability *msnetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_ms_network_capability_xml(MsNetworkCapability *msnetworkcapability, uint8_t iei); - -#endif /* MS NETWORK CAPABILITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.c b/openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.c deleted file mode 100644 index 2ab41a17e860da9a7713a6969403d424dd416071..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.c +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "NasKeySetIdentifier.h" - -int decode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1; - naskeysetidentifier->naskeysetidentifier = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_nas_key_set_identifier_xml(naskeysetidentifier, iei); -#endif - return decoded; -} - -int decode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1; - naskeysetidentifier->naskeysetidentifier = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_nas_key_set_identifier_xml(naskeysetidentifier, iei); -#endif - return decoded; -} - -int encode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_nas_key_set_identifier_xml(naskeysetidentifier, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - ((naskeysetidentifier->tsc & 0x1) << 3) | - (naskeysetidentifier->naskeysetidentifier & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_nas_key_set_identifier_xml(naskeysetidentifier, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - ((naskeysetidentifier->tsc & 0x1) << 3) | - (naskeysetidentifier->naskeysetidentifier & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_nas_key_set_identifier_xml(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei) -{ - printf("<Nas Key Set Identifier>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <TSC>%u</TSC>\n", naskeysetidentifier->tsc); - printf(" <NAS key set identifier>%u</NAS key set identifier>\n", naskeysetidentifier->naskeysetidentifier); - printf("</Nas Key Set Identifier>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.h b/openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.h deleted file mode 100644 index f2a09c6864430e5b20dbf683e031a6e00a0b503b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasKeySetIdentifier.h +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef NAS_KEY_SET_IDENTIFIER_H_ -#define NAS_KEY_SET_IDENTIFIER_H_ - -#define NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH 1 -#define NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH 1 - -typedef struct NasKeySetIdentifier_tag { -#define NAS_KEY_SET_IDENTIFIER_NATIVE 0 -#define NAS_KEY_SET_IDENTIFIER_MAPPED 1 - uint8_t tsc:1; -#define NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE 0b111 - uint8_t naskeysetidentifier:3; -} NasKeySetIdentifier; - -int encode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_nas_key_set_identifier_xml(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei); - -uint8_t encode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier); - -int decode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* NAS KEY SET IDENTIFIER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.c b/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.c deleted file mode 100644 index 248d14c890dc0b4157dd2864155164ec6dbf47ef..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.c +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "NasMessageContainer.h" - -int decode_nas_message_container(NasMessageContainer *nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_nas_message_container_xml(nasmessagecontainer, iei); -#endif - return decoded; -} -int encode_nas_message_container(NasMessageContainer *nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_nas_message_container_xml(nasmessagecontainer, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - - if ((encode_result = encode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_nas_message_container_xml(NasMessageContainer *nasmessagecontainer, uint8_t iei) -{ - printf("<Nas Message Container>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s", dump_octet_string_xml(&nasmessagecontainer->nasmessagecontainercontents)); - printf("</Nas Message Container>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.h b/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.h deleted file mode 100644 index 35d3d4d58d517b14caa275be5ca9d3432c569771..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasMessageContainer.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef NAS_MESSAGE_CONTAINER_H_ -#define NAS_MESSAGE_CONTAINER_H_ - -#define NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH 4 -#define NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH 253 - -typedef struct NasMessageContainer_tag { - OctetString nasmessagecontainercontents; -} NasMessageContainer; - -int encode_nas_message_container(NasMessageContainer *nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_nas_message_container(NasMessageContainer *nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_nas_message_container_xml(NasMessageContainer *nasmessagecontainer, uint8_t iei); - -#endif /* NAS MESSAGE CONTAINER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.c deleted file mode 100644 index d2afc7f0f8c4726f7aacf87d0f93e8b37e877f85..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "NasRequestType.h" - -int decode_request_type(RequestType *requesttype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, REQUEST_TYPE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *requesttype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_request_type_xml(requesttype, iei); -#endif - return decoded; -} - -int decode_u8_request_type(RequestType *requesttype, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *requesttype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_request_type_xml(requesttype, iei); -#endif - return decoded; -} - -int encode_request_type(RequestType *requesttype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, REQUEST_TYPE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_request_type_xml(requesttype, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*requesttype & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_request_type(RequestType *requesttype) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_request_type_xml(requesttype, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*requesttype & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_request_type_xml(RequestType *requesttype, uint8_t iei) -{ - printf("<Request Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Request type value>%u</Request type value>\n", *requesttype); - printf("</Request Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.h deleted file mode 100644 index 42d262779945131b065847504a41ceafd1252349..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasRequestType.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef NAS_REQUEST_TYPE_H_ -#define NAS_REQUEST_TYPE_H_ - -#define REQUEST_TYPE_MINIMUM_LENGTH 1 -#define REQUEST_TYPE_MAXIMUM_LENGTH 1 - -#define REQUEST_TYPE_INITIAL_REQUEST 0b001 -#define REQUEST_TYPE_HANDOVER 0b010 -#define REQUEST_TYPE_UNUSED 0b011 -#define REQUEST_TYPE_EMERGENCY 0b100 -typedef uint8_t RequestType; - -int encode_request_type(RequestType *requesttype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_request_type_xml(RequestType *requesttype, uint8_t iei); - -uint8_t encode_u8_request_type(RequestType *requesttype); - -int decode_request_type(RequestType *requesttype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_request_type(RequestType *requesttype, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* NAS_REQUEST_TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.c b/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.c deleted file mode 100644 index b1713b74f9fb265d57de9466d69f2fe002f16369..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.c +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "NasSecurityAlgorithms.h" - -int decode_nas_security_algorithms(NasSecurityAlgorithms *nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - nassecurityalgorithms->typeofcipheringalgorithm = (*(buffer + decoded) >> 4) & 0x7; - nassecurityalgorithms->typeofintegrityalgorithm = *(buffer + decoded) & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_nas_security_algorithms_xml(nassecurityalgorithms, iei); -#endif - return decoded; -} - -int encode_nas_security_algorithms(NasSecurityAlgorithms *nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_nas_security_algorithms_xml(nassecurityalgorithms, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = 0x00 | - ((nassecurityalgorithms->typeofcipheringalgorithm & 0x7) << 4) | - (nassecurityalgorithms->typeofintegrityalgorithm & 0x7); - encoded++; - return encoded; -} - -void dump_nas_security_algorithms_xml(NasSecurityAlgorithms *nassecurityalgorithms, uint8_t iei) -{ - printf("<Nas Security Algorithms>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Type of ciphering algorithm>%u</Type of ciphering algorithm>\n", nassecurityalgorithms->typeofcipheringalgorithm); - printf(" <Type of integrity algorithm>%u</Type of integrity algorithm>\n", nassecurityalgorithms->typeofintegrityalgorithm); - printf("</Nas Security Algorithms>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.h b/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.h deleted file mode 100644 index 8125e0adf8a5a4418c2d4b7dffb3777f0ed69f33..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NasSecurityAlgorithms.h +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef NAS_SECURITY_ALGORITHMS_H_ -#define NAS_SECURITY_ALGORITHMS_H_ - -#define NAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH 1 -#define NAS_SECURITY_ALGORITHMS_MAXIMUM_LENGTH 2 - -typedef struct NasSecurityAlgorithms_tag { -#define NAS_SECURITY_ALGORITHMS_EEA0 0b000 -#define NAS_SECURITY_ALGORITHMS_EEA1 0b001 -#define NAS_SECURITY_ALGORITHMS_EEA2 0b010 -#define NAS_SECURITY_ALGORITHMS_EEA3 0b011 -#define NAS_SECURITY_ALGORITHMS_EEA4 0b100 -#define NAS_SECURITY_ALGORITHMS_EEA5 0b101 -#define NAS_SECURITY_ALGORITHMS_EEA6 0b110 -#define NAS_SECURITY_ALGORITHMS_EEA7 0b111 - uint8_t typeofcipheringalgorithm:3; -#define NAS_SECURITY_ALGORITHMS_EIA0 0b000 -#define NAS_SECURITY_ALGORITHMS_EIA1 0b001 -#define NAS_SECURITY_ALGORITHMS_EIA2 0b010 -#define NAS_SECURITY_ALGORITHMS_EIA3 0b011 -#define NAS_SECURITY_ALGORITHMS_EIA4 0b100 -#define NAS_SECURITY_ALGORITHMS_EIA5 0b101 -#define NAS_SECURITY_ALGORITHMS_EIA6 0b110 -#define NAS_SECURITY_ALGORITHMS_EIA7 0b111 - uint8_t typeofintegrityalgorithm:3; -} NasSecurityAlgorithms; - -int encode_nas_security_algorithms(NasSecurityAlgorithms *nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_nas_security_algorithms_xml(NasSecurityAlgorithms *nassecurityalgorithms, uint8_t iei); - -int decode_nas_security_algorithms(NasSecurityAlgorithms *nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* NAS SECURITY ALGORITHMS_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.c b/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.c deleted file mode 100644 index 284b451ce5d263f3e7995878389124784d012a42..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.c +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "NetworkName.h" - -int decode_network_name(NetworkName *networkname, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if (((*buffer >> 7) & 0x1) != 1) { - errorCodeDecoder = TLV_DECODE_VALUE_DOESNT_MATCH; - return TLV_DECODE_VALUE_DOESNT_MATCH; - } - - networkname->codingscheme = (*(buffer + decoded) >> 5) & 0x7; - networkname->addci = (*(buffer + decoded) >> 4) & 0x1; - networkname->numberofsparebitsinlastoctet = (*(buffer + decoded) >> 1) & 0x7; - - if ((decode_result = decode_octet_string(&networkname->textstring, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_network_name_xml(networkname, iei); -#endif - return decoded; -} -int encode_network_name(NetworkName *networkname, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NETWORK_NAME_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_network_name_xml(networkname, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | (1 << 7) | - ((networkname->codingscheme & 0x7) << 4) | - ((networkname->addci & 0x1) << 3) | - (networkname->numberofsparebitsinlastoctet & 0x7); - encoded++; - - if ((encode_result = encode_octet_string(&networkname->textstring, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_network_name_xml(NetworkName *networkname, uint8_t iei) -{ - printf("<Network Name>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Coding scheme>%u</Coding scheme>\n", networkname->codingscheme); - printf(" <Add CI>%u</Add CI>\n", networkname->addci); - printf(" <Number of spare bits in last octet>%u</Number of spare bits in last octet>\n", networkname->numberofsparebitsinlastoctet); - printf("%s", dump_octet_string_xml(&networkname->textstring)); - printf("</Network Name>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.h b/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.h deleted file mode 100644 index d627605f61e3d96570c83f3c4ebc3e7e1744108f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/NetworkName.h +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef NETWORK_NAME_H_ -#define NETWORK_NAME_H_ - -#define NETWORK_NAME_MINIMUM_LENGTH 3 -#define NETWORK_NAME_MAXIMUM_LENGTH 255 - -typedef struct NetworkName_tag { - uint8_t codingscheme:3; - uint8_t addci:1; - uint8_t numberofsparebitsinlastoctet:3; - OctetString textstring; -} NetworkName; - -int encode_network_name(NetworkName *networkname, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_network_name(NetworkName *networkname, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_network_name_xml(NetworkName *networkname, uint8_t iei); - -#endif /* NETWORK NAME_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.c b/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.c deleted file mode 100644 index a274c2b8d97dea7d169454dc0338c9375c243495..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.c +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "Nonce.h" - -int decode_nonce(Nonce *nonce, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - //IES_DECODE_U32(*nonce, *(buffer + decoded)); - IES_DECODE_U32(buffer, decoded, *nonce); -#if defined (NAS_DEBUG) - dump_nonce_xml(nonce, iei); -#endif - return decoded; -} - -int encode_nonce(Nonce *nonce, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NONCE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_nonce_xml(nonce, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - IES_ENCODE_U32(buffer, encoded, *nonce); - return encoded; -} - -void dump_nonce_xml(Nonce *nonce, uint8_t iei) -{ - printf("<Nonce>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Nonce value>%u</Nonce value>\n", *nonce); - printf("</Nonce>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.h b/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.h deleted file mode 100644 index b37b35a7f35db266335b43dfd794f0918f2e21da..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/Nonce.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef NONCE_H_ -#define NONCE_H_ - -#define NONCE_MINIMUM_LENGTH 5 -#define NONCE_MAXIMUM_LENGTH 5 - -typedef uint32_t Nonce; - -int encode_nonce(Nonce *nonce, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_nonce_xml(Nonce *nonce, uint8_t iei); - -int decode_nonce(Nonce *nonce, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* NONCE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.c b/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.c deleted file mode 100644 index 21738a02dbc4e3070792b652c1d0223be0a0a0d7..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.c +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PTmsiSignature.h" - -int decode_p_tmsi_signature(PTmsiSignature *ptmsisignature, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - int decode_result; - uint8_t ielen = 3; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - if ((decode_result = decode_octet_string(&ptmsisignature->ptmsisignaturevalue, ielen, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_p_tmsi_signature_xml(ptmsisignature, iei); -#endif - return decoded; -} - -int encode_p_tmsi_signature(PTmsiSignature *ptmsisignature, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encode_result; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, P_TMSI_SIGNATURE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_p_tmsi_signature_xml(ptmsisignature, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - if ((encode_result = encode_octet_string(&ptmsisignature->ptmsisignaturevalue, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - return encoded; -} - -void dump_p_tmsi_signature_xml(PTmsiSignature *ptmsisignature, uint8_t iei) -{ - printf("<P Tmsi Signature>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf("%s",dump_octet_string_xml(&ptmsisignature->ptmsisignaturevalue)); - printf("</P Tmsi Signature>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.h b/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.h deleted file mode 100644 index 9f063dd46161cdde55d293714e943a58b8ba5b05..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PTmsiSignature.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef P_TMSI_SIGNATURE_H_ -#define P_TMSI_SIGNATURE_H_ - -#define P_TMSI_SIGNATURE_MINIMUM_LENGTH 4 -#define P_TMSI_SIGNATURE_MAXIMUM_LENGTH 4 - -typedef struct PTmsiSignature_tag { - OctetString ptmsisignaturevalue; -} PTmsiSignature; - -int encode_p_tmsi_signature(PTmsiSignature *ptmsisignature, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_p_tmsi_signature_xml(PTmsiSignature *ptmsisignature, uint8_t iei); - -int decode_p_tmsi_signature(PTmsiSignature *ptmsisignature, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* P TMSI SIGNATURE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.c b/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.c deleted file mode 100644 index 2e694ae8b016d0a9b517461f3cc95a4da0993c80..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.c +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PacketFlowIdentifier.h" - -int decode_packet_flow_identifier(PacketFlowIdentifier *packetflowidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - *packetflowidentifier = *buffer & 0x7f; - decoded++; -#if defined (NAS_DEBUG) - dump_packet_flow_identifier_xml(packetflowidentifier, iei); -#endif - return decoded; -} -int encode_packet_flow_identifier(PacketFlowIdentifier *packetflowidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PACKET_FLOW_IDENTIFIER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_packet_flow_identifier_xml(packetflowidentifier, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - (*packetflowidentifier & 0x7f); - encoded++; - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_packet_flow_identifier_xml(PacketFlowIdentifier *packetflowidentifier, uint8_t iei) -{ - printf("<Packet Flow Identifier>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Packet flow identifier value>%u</Packet flow identifier value>\n", *packetflowidentifier); - printf("</Packet Flow Identifier>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.h b/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.h deleted file mode 100644 index 26c0e6467c2b74a1717c78216a4e543f9d5b9eae..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PacketFlowIdentifier.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PACKET_FLOW_IDENTIFIER_H_ -#define PACKET_FLOW_IDENTIFIER_H_ - -#define PACKET_FLOW_IDENTIFIER_MINIMUM_LENGTH 3 -#define PACKET_FLOW_IDENTIFIER_MAXIMUM_LENGTH 3 - -typedef uint8_t PacketFlowIdentifier; - -int encode_packet_flow_identifier(PacketFlowIdentifier *packetflowidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_packet_flow_identifier(PacketFlowIdentifier *packetflowidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_packet_flow_identifier_xml(PacketFlowIdentifier *packetflowidentifier, uint8_t iei); - -#endif /* PACKET FLOW IDENTIFIER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.c deleted file mode 100644 index 2c5a05a45a8c8414c476e2a005661105ba9bc19c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.c +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PagingIdentity.h" - -int decode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - *pagingidentity = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_paging_identity_xml(pagingidentity, iei); -#endif - return decoded; -} - -int encode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PAGING_IDENTITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_paging_identity_xml(pagingidentity, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = 0x00 | - (*pagingidentity & 0x1); - encoded++; - return encoded; -} - -void dump_paging_identity_xml(PagingIdentity *pagingidentity, uint8_t iei) -{ - printf("<Paging Identity>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Paging identity value>%u</Paging identity value>\n", *pagingidentity); - printf("</Paging Identity>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.h deleted file mode 100644 index a817ae116f872c3909da44c999123f4398f2bc1f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PagingIdentity.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PAGING_IDENTITY_H_ -#define PAGING_IDENTITY_H_ - -#define PAGING_IDENTITY_MINIMUM_LENGTH 2 -#define PAGING_IDENTITY_MAXIMUM_LENGTH 2 - -typedef uint8_t PagingIdentity; - -int encode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_paging_identity_xml(PagingIdentity *pagingidentity, uint8_t iei); - -int decode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* PAGING IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.c b/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.c deleted file mode 100644 index c95cb1528f1c588b4622e3b49ef0b77ac76eba39..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PdnAddress.h" - -int decode_pdn_address(PdnAddress *pdnaddress, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - pdnaddress->pdntypevalue = *(buffer + decoded) & 0x7; - decoded++; - - if ((decode_result = decode_octet_string(&pdnaddress->pdnaddressinformation, ielen - 1, buffer + decoded, len - decoded)) < 0) - return decode_result; - else - decoded += decode_result; - -#if defined (NAS_DEBUG) - dump_pdn_address_xml(pdnaddress, iei); -#endif - return decoded; -} -int encode_pdn_address(PdnAddress *pdnaddress, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDN_ADDRESS_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_pdn_address_xml(pdnaddress, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - (pdnaddress->pdntypevalue & 0x7); - encoded++; - - if ((encode_result = encode_octet_string(&pdnaddress->pdnaddressinformation, buffer + encoded, len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_pdn_address_xml(PdnAddress *pdnaddress, uint8_t iei) -{ - printf("<Pdn Address>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <PDN type value>%u</PDN type value>\n", pdnaddress->pdntypevalue); - printf("%s", dump_octet_string_xml(&pdnaddress->pdnaddressinformation)); - printf("</Pdn Address>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.h b/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.h deleted file mode 100644 index 5b923b2310f2e9af1f95c6e29642341fa8188d67..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnAddress.h +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PDN_ADDRESS_H_ -#define PDN_ADDRESS_H_ - -#define PDN_ADDRESS_MINIMUM_LENGTH 7 -#define PDN_ADDRESS_MAXIMUM_LENGTH 15 - -typedef struct PdnAddress_tag { -#define PDN_VALUE_TYPE_IPV4 0b001 -#define PDN_VALUE_TYPE_IPV6 0b010 -#define PDN_VALUE_TYPE_IPV4V6 0b011 - uint8_t pdntypevalue:3; - OctetString pdnaddressinformation; -} PdnAddress; - -int encode_pdn_address(PdnAddress *pdnaddress, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_pdn_address(PdnAddress *pdnaddress, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_pdn_address_xml(PdnAddress *pdnaddress, uint8_t iei); - -#endif /* PDN ADDRESS_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.c deleted file mode 100644 index e4a39d1f1c5d56bf8fe85f732d53b7ed71c149fe..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PdnType.h" - -int decode_pdn_type(PdnType *pdntype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, PDN_TYPE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *pdntype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_pdn_type_xml(pdntype, iei); -#endif - return decoded; -} - -int decode_u8_pdn_type(PdnType *pdntype, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *pdntype = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_pdn_type_xml(pdntype, iei); -#endif - return decoded; -} - -int encode_pdn_type(PdnType *pdntype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDN_TYPE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_pdn_type_xml(pdntype, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*pdntype & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_pdn_type(PdnType *pdntype) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; -#if defined (NAS_DEBUG) - dump_pdn_type_xml(pdntype, 0); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*pdntype & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_pdn_type_xml(PdnType *pdntype, uint8_t iei) -{ - printf("<Pdn Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <PDN type value>%u</PDN type value>\n", *pdntype); - printf("</Pdn Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.h deleted file mode 100644 index c3a3ac9133fd0343b4dea8cc27f7e7c64321bb9d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PdnType.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PDN_TYPE_H_ -#define PDN_TYPE_H_ - -#define PDN_TYPE_MINIMUM_LENGTH 1 -#define PDN_TYPE_MAXIMUM_LENGTH 1 - -#define PDN_TYPE_IPV4 0b001 -#define PDN_TYPE_IPV6 0b010 -#define PDN_TYPE_IPV4V6 0b011 -#define PDN_TYPE_UNUSED 0b100 -typedef uint8_t PdnType; - -int encode_pdn_type(PdnType *pdntype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_pdn_type_xml(PdnType *pdntype, uint8_t iei); - -uint8_t encode_u8_pdn_type(PdnType *pdntype); - -int decode_pdn_type(PdnType *pdntype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_pdn_type(PdnType *pdntype, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* PDN TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.c b/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.c deleted file mode 100644 index 226a26c6612a4e14e37666170b147da49eb8395b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.c +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "PlmnList.h" - -int decode_plmn_list(PlmnList *plmnlist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - plmnlist->mccdigit2 = (*(buffer + decoded) >> 4) & 0xf; - plmnlist->mccdigit1 = *(buffer + decoded) & 0xf; - decoded++; - plmnlist->mncdigit3 = (*(buffer + decoded) >> 4) & 0xf; - plmnlist->mccdigit3 = *(buffer + decoded) & 0xf; - decoded++; - plmnlist->mncdigit2 = (*(buffer + decoded) >> 4) & 0xf; - plmnlist->mncdigit1 = *(buffer + decoded) & 0xf; - decoded++; -#if defined (NAS_DEBUG) - dump_plmn_list_xml(plmnlist, iei); -#endif - return decoded; -} -int encode_plmn_list(PlmnList *plmnlist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PLMN_LIST_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_plmn_list_xml(plmnlist, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | ((plmnlist->mccdigit2 & 0xf) << 4) | - (plmnlist->mccdigit1 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((plmnlist->mncdigit3 & 0xf) << 4) | - (plmnlist->mccdigit3 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((plmnlist->mncdigit2 & 0xf) << 4) | - (plmnlist->mncdigit1 & 0xf); - encoded++; - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_plmn_list_xml(PlmnList *plmnlist, uint8_t iei) -{ - printf("<Plmn List>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <MCC digit 2>%u</MCC digit 2>\n", plmnlist->mccdigit2); - printf(" <MCC digit 1>%u</MCC digit 1>\n", plmnlist->mccdigit1); - printf(" <MNC digit 3>%u</MNC digit 3>\n", plmnlist->mncdigit3); - printf(" <MCC digit 3>%u</MCC digit 3>\n", plmnlist->mccdigit3); - printf(" <MNC digit 2>%u</MNC digit 2>\n", plmnlist->mncdigit2); - printf(" <MNC digit 1>%u</MNC digit 1>\n", plmnlist->mncdigit1); - printf("</Plmn List>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.h b/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.h deleted file mode 100644 index 7c2247381f1822d78ce8ca7fa14e3186ef9b357d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/PlmnList.h +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PLMN_LIST_H_ -#define PLMN_LIST_H_ - -#define PLMN_LIST_MINIMUM_LENGTH 5 -#define PLMN_LIST_MAXIMUM_LENGTH 47 - -typedef struct PlmnList_tag { - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; -} PlmnList; - -int encode_plmn_list(PlmnList *plmnlist, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_plmn_list(PlmnList *plmnlist, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_plmn_list_xml(PlmnList *plmnlist, uint8_t iei); - -#endif /* PLMN LIST_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.c deleted file mode 100644 index 92a0f3e502fed91a5cad3cabb791b88b6245cd06..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ProcedureTransactionIdentity.h" - -int decode_procedure_transaction_identity(ProcedureTransactionIdentity *proceduretransactionidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_procedure_transaction_identity(ProcedureTransactionIdentity *proceduretransactionidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.h deleted file mode 100644 index 28eabb6a1520ad5ccf4f7e2183925ffab3cd68d1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProcedureTransactionIdentity.h +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PROCEDURE_TRANSACTION_IDENTITY_H_ -#define PROCEDURE_TRANSACTION_IDENTITY_H_ - -#define PROCEDURE_TRANSACTION_IDENTITY_MINIMUM_LENGTH 1 -#define PROCEDURE_TRANSACTION_IDENTITY_MAXIMUM_LENGTH 1 - -#define PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0 -#define PROCEDURE_TRANSACTION_IDENTITY_FIRST 1 -#define PROCEDURE_TRANSACTION_IDENTITY_LAST 254 -typedef uint8_t ProcedureTransactionIdentity; - -int encode_procedure_transaction_identity(ProcedureTransactionIdentity *proceduretransactionidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_procedure_transaction_identity_xml(ProcedureTransactionIdentity *proceduretransactionidentity, uint8_t iei); - -int decode_procedure_transaction_identity(ProcedureTransactionIdentity *proceduretransactionidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* PROCEDURE TRANSACTION IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.c b/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.c deleted file mode 100644 index dc17201da0dc79f782253d0769bb404ed6c3c75f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.c +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ProtocolConfigurationOptions.h" - -int decode_protocol_configuration_options(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t decoded = 0; - uint8_t ielen = 0; - int decode_result; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - if (((*(buffer + decoded) >> 7) & 0x1) != 1) { - errorCodeDecoder = TLV_DECODE_VALUE_DOESNT_MATCH; - return TLV_DECODE_VALUE_DOESNT_MATCH; - } - - /* Bits 7 to 4 of octet 3 are spare, read as 0 */ - if (((*(buffer + decoded) & 0x78) >> 3) != 0) { - errorCodeDecoder = TLV_DECODE_VALUE_DOESNT_MATCH; - return TLV_DECODE_VALUE_DOESNT_MATCH; - } - - protocolconfigurationoptions->configurationprotol = (*(buffer + decoded) >> 1) & 0x7; - decoded++; - - //IES_DECODE_U16(protocolconfigurationoptions->protocolid, *(buffer + decoded)); - protocolconfigurationoptions->num_protocol_id_or_container_id = 0; - while ((len - decoded) > 0) { - IES_DECODE_U16(buffer, decoded, protocolconfigurationoptions->protocolid[protocolconfigurationoptions->num_protocol_id_or_container_id]); - DECODE_U8(buffer + decoded, protocolconfigurationoptions->lengthofprotocolid[protocolconfigurationoptions->num_protocol_id_or_container_id], decoded); - - if (protocolconfigurationoptions->lengthofprotocolid[protocolconfigurationoptions->num_protocol_id_or_container_id] > 0) { - if ((decode_result = decode_octet_string(&protocolconfigurationoptions->protocolidcontents[protocolconfigurationoptions->num_protocol_id_or_container_id], - protocolconfigurationoptions->lengthofprotocolid[protocolconfigurationoptions->num_protocol_id_or_container_id], buffer + decoded, len - decoded)) < 0) { - return decode_result; - } else { - decoded += decode_result; - } - } else { - protocolconfigurationoptions->protocolidcontents[protocolconfigurationoptions->num_protocol_id_or_container_id].length = 0; - protocolconfigurationoptions->protocolidcontents[protocolconfigurationoptions->num_protocol_id_or_container_id].value = NULL; - } - protocolconfigurationoptions->num_protocol_id_or_container_id += 1; - } - -#if defined (NAS_DEBUG) - dump_protocol_configuration_options_xml(protocolconfigurationoptions, iei); -#endif - return decoded; -} -int encode_protocol_configuration_options(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint8_t num_protocol_id_or_container_id = 0; - uint32_t encoded = 0; - int encode_result; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_protocol_configuration_options_xml(protocolconfigurationoptions, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | (1 << 7) | - (protocolconfigurationoptions->configurationprotol & 0x7); - encoded++; - - while (num_protocol_id_or_container_id < protocolconfigurationoptions->num_protocol_id_or_container_id) { - - IES_ENCODE_U16(buffer, encoded, protocolconfigurationoptions->protocolid[num_protocol_id_or_container_id]); - *(buffer + encoded) = protocolconfigurationoptions->lengthofprotocolid[num_protocol_id_or_container_id]; - encoded++; - - if ((encode_result = encode_octet_string(&protocolconfigurationoptions->protocolidcontents[num_protocol_id_or_container_id], - buffer + encoded, - len - encoded)) < 0) - return encode_result; - else - encoded += encode_result; - - num_protocol_id_or_container_id += 1; - } - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_protocol_configuration_options_xml(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei) -{ - int i; - printf("<Protocol Configuration Options>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Configuration protol>%u</Configuration protol>\n", protocolconfigurationoptions->configurationprotol); - i = 0; - while (i < protocolconfigurationoptions->num_protocol_id_or_container_id) { - printf(" <Protocol ID>%u</Protocol ID>\n", protocolconfigurationoptions->protocolid[i]); - printf(" <Length of protocol ID>%u</Length of protocol ID>\n", protocolconfigurationoptions->lengthofprotocolid[i]); - printf(" %s",dump_octet_string_xml(&protocolconfigurationoptions->protocolidcontents[i])); - i++; - } - printf("</Protocol Configuration Options>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.h b/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.h deleted file mode 100644 index bd59d2c4accc7c42780d2890593a7a09afd57465..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolConfigurationOptions.h +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PROTOCOL_CONFIGURATION_OPTIONS_H_ -#define PROTOCOL_CONFIGURATION_OPTIONS_H_ - -#define PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH 3 -#define PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH 253 - -// arbitrary value, theoricaly can be greater than defined (250/3) -#define PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID 16 - - -/* 3GPP TS 24.008 Table 10.5.154 - * MS to network table - */ -typedef enum ProtocolConfigurationOptionsList_ids_tag { - PCO_UNKNOWN = 0, - PCO_P_CSCF_IPV6_ADDRESS_REQ = 1, - PCO_IM_CN_SUBSYSTEM_SIGNALING_FLAG = 2, - PCO_DNS_SERVER_IPV6_ADDRESS_REQ = 3, - PCO_NOT_SUPPORTED = 4, - PCO_MS_SUPPORTED_OF_NETWORK_REQUESTED_BEARER_CONTROL_INDICATOR = 5, - PCO_RESERVED = 6, - /* TODO: complete me */ -} ProtocolConfigurationOptionsList_ids; - -/* 3GPP TS 24.008 Table 10.5.154 - * network to MS table - * TODO - */ - -typedef struct ProtocolConfigurationOptions_tag { - uint8_t configurationprotol:3; - uint8_t num_protocol_id_or_container_id; - uint16_t protocolid[PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID]; - uint8_t lengthofprotocolid[PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID]; - OctetString protocolidcontents[PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID]; -} ProtocolConfigurationOptions; - -int encode_protocol_configuration_options(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_protocol_configuration_options(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_protocol_configuration_options_xml(ProtocolConfigurationOptions *protocolconfigurationoptions, uint8_t iei); - -#endif /* PROTOCOL CONFIGURATION OPTIONS_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.c b/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.c deleted file mode 100644 index b87ddb490a22fe9912a9f43c62e5197c5c50ad15..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ProtocolDiscriminator.h" - -int decode_protocol_discriminator(ProtocolDiscriminator *protocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_protocol_discriminator(ProtocolDiscriminator *protocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.h b/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.h deleted file mode 100644 index 3945556a747c0e0cf97e28fb9086fa5c812b5b5a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ProtocolDiscriminator.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef PROTOCOL_DISCRIMINATOR_H_ -#define PROTOCOL_DISCRIMINATOR_H_ - -#define PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH 1 -#define PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH 1 - -typedef uint8_t ProtocolDiscriminator; - -int encode_protocol_discriminator(ProtocolDiscriminator *protocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_protocol_discriminator_xml(ProtocolDiscriminator *protocoldiscriminator, uint8_t iei); - -int decode_protocol_discriminator(ProtocolDiscriminator *protocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* PROTOCOL DISCRIMINATOR_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.c b/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.c deleted file mode 100644 index 2d5ea1c5ea3ba9c59a45eaa147bbf5c14943492f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.c +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "QualityOfService.h" - -int decode_quality_of_service(QualityOfService *qualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - qualityofservice->delayclass = (*(buffer + decoded) >> 3) & 0x7; - qualityofservice->reliabilityclass = *(buffer + decoded) & 0x7; - decoded++; - qualityofservice->peakthroughput = (*(buffer + decoded) >> 4) & 0xf; - qualityofservice->precedenceclass = *(buffer + decoded) & 0x7; - decoded++; - qualityofservice->meanthroughput = *(buffer + decoded) & 0x1f; - decoded++; - qualityofservice->trafficclass = (*(buffer + decoded) >> 5) & 0x7; - qualityofservice->deliveryorder = (*(buffer + decoded) >> 3) & 0x3; - qualityofservice->deliveryoferroneoussdu = *(buffer + decoded) & 0x7; - decoded++; - qualityofservice->maximumsdusize = *(buffer + decoded); - decoded++; - qualityofservice->maximumbitrateuplink = *(buffer + decoded); - decoded++; - qualityofservice->maximumbitratedownlink = *(buffer + decoded); - decoded++; - qualityofservice->residualber = (*(buffer + decoded) >> 4) & 0xf; - qualityofservice->sduratioerror = *(buffer + decoded) & 0xf; - decoded++; - qualityofservice->transferdelay = (*(buffer + decoded) >> 2) & 0x3f; - qualityofservice->traffichandlingpriority = *(buffer + decoded) & 0x3; - decoded++; - qualityofservice->guaranteedbitrateuplink = *(buffer + decoded); - decoded++; - qualityofservice->guaranteedbitratedownlink = *(buffer + decoded); - decoded++; - qualityofservice->signalingindication = (*(buffer + decoded) >> 4) & 0x1; - qualityofservice->sourcestatisticsdescriptor = *(buffer + decoded) & 0xf; - decoded++; -#if defined (NAS_DEBUG) - dump_quality_of_service_xml(qualityofservice, iei); -#endif - return decoded; -} -int encode_quality_of_service(QualityOfService *qualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, QUALITY_OF_SERVICE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_quality_of_service_xml(qualityofservice, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - ((qualityofservice->delayclass & 0x7) << 3) | - (qualityofservice->reliabilityclass & 0x7); - encoded++; - *(buffer + encoded) = 0x00 | ((qualityofservice->peakthroughput & 0xf) << 4) | - (qualityofservice->precedenceclass & 0x7); - encoded++; - *(buffer + encoded) = 0x00 | - (qualityofservice->meanthroughput & 0x1f); - encoded++; - *(buffer + encoded) = 0x00 | ((qualityofservice->trafficclass & 0x7) << 5) | - ((qualityofservice->deliveryorder & 0x3) << 3) | - (qualityofservice->deliveryoferroneoussdu & 0x7); - encoded++; - *(buffer + encoded) = qualityofservice->maximumsdusize; - encoded++; - *(buffer + encoded) = qualityofservice->maximumbitrateuplink; - encoded++; - *(buffer + encoded) = qualityofservice->maximumbitratedownlink; - encoded++; - *(buffer + encoded) = 0x00 | ((qualityofservice->residualber & 0xf) << 4) | - (qualityofservice->sduratioerror & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((qualityofservice->transferdelay & 0x3f) << 2) | - (qualityofservice->traffichandlingpriority & 0x3); - encoded++; - *(buffer + encoded) = qualityofservice->guaranteedbitrateuplink; - encoded++; - *(buffer + encoded) = qualityofservice->guaranteedbitratedownlink; - encoded++; - *(buffer + encoded) = 0x00 | - ((qualityofservice->signalingindication & 0x1) << 4) | - (qualityofservice->sourcestatisticsdescriptor & 0xf); - encoded++; - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_quality_of_service_xml(QualityOfService *qualityofservice, uint8_t iei) -{ - printf("<Quality Of Service>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Delay class>%u</Delay class>\n", qualityofservice->delayclass); - printf(" <Reliability class>%u</Reliability class>\n", qualityofservice->reliabilityclass); - printf(" <Peak throughput>%u</Peak throughput>\n", qualityofservice->peakthroughput); - printf(" <Precedence class>%u</Precedence class>\n", qualityofservice->precedenceclass); - printf(" <Mean throughput>%u</Mean throughput>\n", qualityofservice->meanthroughput); - printf(" <Traffic class>%u</Traffic class>\n", qualityofservice->trafficclass); - printf(" <Delivery order>%u</Delivery order>\n", qualityofservice->deliveryorder); - printf(" <Delivery of erroneous SDU>%u</Delivery of erroneous SDU>\n", qualityofservice->deliveryoferroneoussdu); - printf(" <Maximum SDU size>%u</Maximum SDU size>\n", qualityofservice->maximumsdusize); - printf(" <Maximum bit rate uplink>%u</Maximum bit rate uplink>\n", qualityofservice->maximumbitrateuplink); - printf(" <Maximum bit rate downlink>%u</Maximum bit rate downlink>\n", qualityofservice->maximumbitratedownlink); - printf(" <Residual BER>%u</Residual BER>\n", qualityofservice->residualber); - printf(" <SDU ratio error>%u</SDU ratio error>\n", qualityofservice->sduratioerror); - printf(" <Transfer delay>%u</Transfer delay>\n", qualityofservice->transferdelay); - printf(" <Traffic handling priority>%u</Traffic handling priority>\n", qualityofservice->traffichandlingpriority); - printf(" <Guaranteed bit rate uplink>%u</Guaranteed bit rate uplink>\n", qualityofservice->guaranteedbitrateuplink); - printf(" <Guaranteed bit rate downlink>%u</Guaranteed bit rate downlink>\n", qualityofservice->guaranteedbitratedownlink); - printf(" <Signaling indication>%u</Signaling indication>\n", qualityofservice->signalingindication); - printf(" <Source statistics descriptor>%u</Source statistics descriptor>\n", qualityofservice->sourcestatisticsdescriptor); - printf("</Quality Of Service>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.h b/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.h deleted file mode 100644 index 193eb6c4e279a20ca92f9bdaab0b7690a3246aa4..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/QualityOfService.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef QUALITY_OF_SERVICE_H_ -#define QUALITY_OF_SERVICE_H_ - -#define QUALITY_OF_SERVICE_MINIMUM_LENGTH 14 -#define QUALITY_OF_SERVICE_MAXIMUM_LENGTH 14 - -typedef struct QualityOfService_tag { - uint8_t delayclass:3; - uint8_t reliabilityclass:3; - uint8_t peakthroughput:4; - uint8_t precedenceclass:3; - uint8_t meanthroughput:5; - uint8_t trafficclass:3; - uint8_t deliveryorder:2; - uint8_t deliveryoferroneoussdu:3; - uint8_t maximumsdusize; - uint8_t maximumbitrateuplink; - uint8_t maximumbitratedownlink; - uint8_t residualber:4; - uint8_t sduratioerror:4; - uint8_t transferdelay:6; - uint8_t traffichandlingpriority:2; - uint8_t guaranteedbitrateuplink; - uint8_t guaranteedbitratedownlink; - uint8_t signalingindication:1; - uint8_t sourcestatisticsdescriptor:4; -} QualityOfService; - -int encode_quality_of_service(QualityOfService *qualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_quality_of_service(QualityOfService *qualityofservice, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_quality_of_service_xml(QualityOfService *qualityofservice, uint8_t iei); - -#endif /* QUALITY OF SERVICE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.c b/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.c deleted file mode 100644 index 1350cb0ba1f81b9d1d2e16cd646ad86456ccf39c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "RadioPriority.h" - -int decode_radio_priority(RadioPriority *radiopriority, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, RADIO_PRIORITY_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *radiopriority = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_radio_priority_xml(radiopriority, iei); -#endif - return decoded; -} - -int decode_u8_radio_priority(RadioPriority *radiopriority, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *radiopriority = *buffer & 0x7; - decoded++; -#if defined (NAS_DEBUG) - dump_radio_priority_xml(radiopriority, iei); -#endif - return decoded; -} - -int encode_radio_priority(RadioPriority *radiopriority, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, RADIO_PRIORITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_radio_priority_xml(radiopriority, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*radiopriority & 0x7); - encoded++; - return encoded; -} - -uint8_t encode_u8_radio_priority(RadioPriority *radiopriority) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_radio_priority_xml(radiopriority, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*radiopriority & 0x7); - encoded++; - - return bufferReturn; -} - -void dump_radio_priority_xml(RadioPriority *radiopriority, uint8_t iei) -{ - printf("<Radio Priority>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Radio priority level value>%u</Radio priority level value>\n", *radiopriority); - printf("</Radio Priority>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.h b/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.h deleted file mode 100644 index e079247598061dda3c0d00cf8ddb15556f2a7f6d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/RadioPriority.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef RADIO_PRIORITY_H_ -#define RADIO_PRIORITY_H_ - -#define RADIO_PRIORITY_MINIMUM_LENGTH 1 -#define RADIO_PRIORITY_MAXIMUM_LENGTH 1 - -typedef uint8_t RadioPriority; - -int encode_radio_priority(RadioPriority *radiopriority, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_radio_priority_xml(RadioPriority *radiopriority, uint8_t iei); - -uint8_t encode_u8_radio_priority(RadioPriority *radiopriority); - -int decode_radio_priority(RadioPriority *radiopriority, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_radio_priority(RadioPriority *radiopriority, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* RADIO PRIORITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.c deleted file mode 100644 index 5d80c562f3aef73e078186c8551f4805f7929a9a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "SecurityHeaderType.h" - -int decode_security_header_type(SecurityHeaderType *securityheadertype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_security_header_type(SecurityHeaderType *securityheadertype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.h deleted file mode 100644 index 0447e857db13d95f2730c619392daa091448d138..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/SecurityHeaderType.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef SECURITY_HEADER_TYPE_H_ -#define SECURITY_HEADER_TYPE_H_ - -#define SECURITY_HEADER_TYPE_MINIMUM_LENGTH 1 -#define SECURITY_HEADER_TYPE_MAXIMUM_LENGTH 1 - -typedef uint8_t SecurityHeaderType; - -int encode_security_header_type(SecurityHeaderType *securityheadertype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_security_header_type_xml(SecurityHeaderType *securityheadertype, uint8_t iei); - -int decode_security_header_type(SecurityHeaderType *securityheadertype, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* SECURITY HEADER TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.c b/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.c deleted file mode 100644 index bab2e96bb02ff7931892dec1f4183041be2d79a3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ServiceType.h" - -int decode_service_type(ServiceType *servicetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, SERVICE_TYPE_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *servicetype = *buffer & 0xf; - decoded++; -#if defined (NAS_DEBUG) - dump_service_type_xml(servicetype, iei); -#endif - return decoded; -} - -int decode_u8_service_type(ServiceType *servicetype, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *servicetype = *buffer & 0xf; - decoded++; -#if defined (NAS_DEBUG) - dump_service_type_xml(servicetype, iei); -#endif - return decoded; -} - -int encode_service_type(ServiceType *servicetype, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SERVICE_TYPE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_service_type_xml(servicetype, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*servicetype & 0xf); - encoded++; - return encoded; -} - -uint8_t encode_u8_service_type(ServiceType *servicetype) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_service_type_xml(servicetype, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*servicetype & 0xf); - encoded++; - - return bufferReturn; -} - -void dump_service_type_xml(ServiceType *servicetype, uint8_t iei) -{ - printf("<Service Type>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Service type value>%u</Service type value>\n", *servicetype); - printf("</Service Type>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.h b/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.h deleted file mode 100644 index 44e908414049546b30414726926d7c718fb21e47..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ServiceType.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef SERVICE_TYPE_H_ -#define SERVICE_TYPE_H_ - -#define SERVICE_TYPE_MINIMUM_LENGTH 1 -#define SERVICE_TYPE_MAXIMUM_LENGTH 1 - -typedef uint8_t ServiceType; - -int encode_service_type(ServiceType *servicetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_service_type_xml(ServiceType *servicetype, uint8_t iei); - -uint8_t encode_u8_service_type(ServiceType *servicetype); - -int decode_service_type(ServiceType *servicetype, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_service_type(ServiceType *servicetype, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* SERVICE TYPE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.c b/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.c deleted file mode 100644 index 9cebc07ca82a4c8b9c70f53e6b5b322f6a487d28..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.c +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ShortMac.h" - -int decode_short_mac(ShortMac *shortmac, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - //IES_DECODE_U16(*shortmac, *(buffer + decoded)); - IES_DECODE_U16(buffer, decoded, *shortmac); -#if defined (NAS_DEBUG) - dump_short_mac_xml(shortmac, iei); -#endif - return decoded; -} - -int encode_short_mac(ShortMac *shortmac, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SHORT_MAC_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_short_mac_xml(shortmac, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - IES_ENCODE_U16(buffer, encoded, *shortmac); - return encoded; -} - -void dump_short_mac_xml(ShortMac *shortmac, uint8_t iei) -{ - printf("<Short Mac>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Short MAC value>%u</Short MAC value>\n", *shortmac); - printf("</Short Mac>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.h b/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.h deleted file mode 100644 index b6152bd027e8f24b416eb48975037ced696f3d7d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/ShortMac.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef SHORT_MAC_H_ -#define SHORT_MAC_H_ - -#define SHORT_MAC_MINIMUM_LENGTH 3 -#define SHORT_MAC_MAXIMUM_LENGTH 3 - -typedef uint16_t ShortMac; - -int encode_short_mac(ShortMac *shortmac, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_short_mac_xml(ShortMac *shortmac, uint8_t iei); - -int decode_short_mac(ShortMac *shortmac, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* SHORT MAC_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.c b/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.c deleted file mode 100644 index 256a67e0fcf414a89711083cfdf19749cb1686db..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.c +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "SsCode.h" - -int decode_ss_code(SsCode *sscode, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - *sscode = *(buffer + decoded); - decoded++; -#if defined (NAS_DEBUG) - dump_ss_code_xml(sscode, iei); -#endif - return decoded; -} - -int encode_ss_code(SsCode *sscode, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SS_CODE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_ss_code_xml(sscode, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = *sscode; - encoded++; - return encoded; -} - -void dump_ss_code_xml(SsCode *sscode, uint8_t iei) -{ - printf("<Ss Code>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <SS code value>%u</SS code value>\n", *sscode); - printf("</Ss Code>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.h b/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.h deleted file mode 100644 index f53e5e2dc0a9336f5891c2735d0d9670d0101e36..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/SsCode.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef SS_CODE_H_ -#define SS_CODE_H_ - -#define SS_CODE_MINIMUM_LENGTH 2 -#define SS_CODE_MAXIMUM_LENGTH 2 - -typedef uint8_t SsCode; - -int encode_ss_code(SsCode *sscode, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_ss_code_xml(SsCode *sscode, uint8_t iei); - -int decode_ss_code(SsCode *sscode, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* SS CODE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.c b/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.c deleted file mode 100644 index 284ee27dc964ecba055e5ebdb575f437f9d82896..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.c +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "SupportedCodecList.h" - -int decode_supported_codec_list(SupportedCodecList *supportedcodeclist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - supportedcodeclist->systemidentification = *(buffer + decoded); - decoded++; - supportedcodeclist->lengthofbitmap = *(buffer + decoded); - decoded++; - //IES_DECODE_U16(supportedcodeclist->codecbitmap, *(buffer + decoded)); - IES_DECODE_U16(buffer, decoded, supportedcodeclist->codecbitmap); -#if defined (NAS_DEBUG) - dump_supported_codec_list_xml(supportedcodeclist, iei); -#endif - return decoded; -} -int encode_supported_codec_list(SupportedCodecList *supportedcodeclist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SUPPORTED_CODEC_LIST_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_supported_codec_list_xml(supportedcodeclist, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = supportedcodeclist->systemidentification; - encoded++; - *(buffer + encoded) = supportedcodeclist->lengthofbitmap; - encoded++; - IES_ENCODE_U16(buffer, encoded, supportedcodeclist->codecbitmap); - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_supported_codec_list_xml(SupportedCodecList *supportedcodeclist, uint8_t iei) -{ - printf("<Supported Codec List>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <System identification>%u</System identification>\n", supportedcodeclist->systemidentification); - printf(" <Length of bitmap>%u</Length of bitmap>\n", supportedcodeclist->lengthofbitmap); - printf(" <Codec bitmap>%u</Codec bitmap>\n", supportedcodeclist->codecbitmap); - printf("</Supported Codec List>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.h b/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.h deleted file mode 100644 index a9be6640ff272beab2b133b6768d633eff024202..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/SupportedCodecList.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef SUPPORTED_CODEC_LIST_H_ -#define SUPPORTED_CODEC_LIST_H_ - -#define SUPPORTED_CODEC_LIST_MINIMUM_LENGTH 5 -#define SUPPORTED_CODEC_LIST_MAXIMUM_LENGTH 5 - -typedef struct SupportedCodecList_tag { - uint8_t systemidentification; - uint8_t lengthofbitmap; - uint16_t codecbitmap; -} SupportedCodecList; - -int encode_supported_codec_list(SupportedCodecList *supportedcodeclist, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_supported_codec_list(SupportedCodecList *supportedcodeclist, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_supported_codec_list_xml(SupportedCodecList *supportedcodeclist, uint8_t iei); - -#endif /* SUPPORTED CODEC LIST_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.c deleted file mode 100644 index 332abb54bc3cdbf71941d85fa1c9118f79cfbdcd..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.c +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TimeZone.h" - -int decode_time_zone(TimeZone *timezone, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - *timezone = *(buffer + decoded); - decoded++; -#if defined (NAS_DEBUG) - dump_time_zone_xml(timezone, iei); -#endif - return decoded; -} - -int encode_time_zone(TimeZone *timezone, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TIME_ZONE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_time_zone_xml(timezone, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = *timezone; - encoded++; - return encoded; -} - -void dump_time_zone_xml(TimeZone *timezone, uint8_t iei) -{ - printf("<Time Zone>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Time zone>%u</Time zone>\n", *timezone); - printf("</Time Zone>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.h deleted file mode 100644 index 812477be4d1ff36c4913b261010ce1cf379b41db..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZone.h +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef TIME_ZONE_H_ -#define TIME_ZONE_H_ - -#define TIME_ZONE_MINIMUM_LENGTH 2 -#define TIME_ZONE_MAXIMUM_LENGTH 2 - -typedef uint8_t TimeZone; - -int encode_time_zone(TimeZone *timezone, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_time_zone_xml(TimeZone *timezone, uint8_t iei); - -int decode_time_zone(TimeZone *timezone, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* TIME ZONE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.c deleted file mode 100644 index dacfb2289600806efef58d571c2b8b992075252d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.c +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TimeZoneAndTime.h" - -int decode_time_zone_and_time(TimeZoneAndTime *timezoneandtime, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - timezoneandtime->year = *(buffer + decoded); - decoded++; - timezoneandtime->month = *(buffer + decoded); - decoded++; - timezoneandtime->day = *(buffer + decoded); - decoded++; - timezoneandtime->hour = *(buffer + decoded); - decoded++; - timezoneandtime->minute = *(buffer + decoded); - decoded++; - timezoneandtime->second = *(buffer + decoded); - decoded++; - timezoneandtime->timezone = *(buffer + decoded); - decoded++; -#if defined (NAS_DEBUG) - dump_time_zone_and_time_xml(timezoneandtime, iei); -#endif - return decoded; -} - -int encode_time_zone_and_time(TimeZoneAndTime *timezoneandtime, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TIME_ZONE_AND_TIME_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_time_zone_and_time_xml(timezoneandtime, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = timezoneandtime->year; - encoded++; - *(buffer + encoded) = timezoneandtime->month; - encoded++; - *(buffer + encoded) = timezoneandtime->day; - encoded++; - *(buffer + encoded) = timezoneandtime->hour; - encoded++; - *(buffer + encoded) = timezoneandtime->minute; - encoded++; - *(buffer + encoded) = timezoneandtime->second; - encoded++; - *(buffer + encoded) = timezoneandtime->timezone; - encoded++; - return encoded; -} - -void dump_time_zone_and_time_xml(TimeZoneAndTime *timezoneandtime, uint8_t iei) -{ - printf("<Time Zone And Time>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Year>%u</Year>\n", timezoneandtime->year); - printf(" <Month>%u</Month>\n", timezoneandtime->month); - printf(" <Day>%u</Day>\n", timezoneandtime->day); - printf(" <Hour>%u</Hour>\n", timezoneandtime->hour); - printf(" <Minute>%u</Minute>\n", timezoneandtime->minute); - printf(" <Second>%u</Second>\n", timezoneandtime->second); - printf(" <Time Zone>%u</Time Zone>\n", timezoneandtime->timezone); - printf("</Time Zone And Time>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.h deleted file mode 100644 index 4665b84316fb3eee3b4d02af6df2bab73211fcea..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TimeZoneAndTime.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef TIME_ZONE_AND_TIME_H_ -#define TIME_ZONE_AND_TIME_H_ - -#define TIME_ZONE_AND_TIME_MINIMUM_LENGTH 8 -#define TIME_ZONE_AND_TIME_MAXIMUM_LENGTH 8 - -typedef struct TimeZoneAndTime_tag { - uint8_t year; - uint8_t month; - uint8_t day; - uint8_t hour; - uint8_t minute; - uint8_t second; - uint8_t timezone; -} TimeZoneAndTime; - -int encode_time_zone_and_time(TimeZoneAndTime *timezoneandtime, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_time_zone_and_time_xml(TimeZoneAndTime *timezoneandtime, uint8_t iei); - -int decode_time_zone_and_time(TimeZoneAndTime *timezoneandtime, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* TIME ZONE AND TIME_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.c deleted file mode 100644 index 7d21e5f7580cf4f7129d6a0d251d78ea72de04a8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TmsiStatus.h" - -int decode_tmsi_status(TmsiStatus *tmsistatus, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, TMSI_STATUS_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *tmsistatus = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_tmsi_status_xml(tmsistatus, iei); -#endif - return decoded; -} - -int decode_u8_tmsi_status(TmsiStatus *tmsistatus, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *tmsistatus = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_tmsi_status_xml(tmsistatus, iei); -#endif - return decoded; -} - -int encode_tmsi_status(TmsiStatus *tmsistatus, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TMSI_STATUS_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_tmsi_status_xml(tmsistatus, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*tmsistatus & 0x1); - encoded++; - return encoded; -} - -uint8_t encode_u8_tmsi_status(TmsiStatus *tmsistatus) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_tmsi_status_xml(tmsistatus, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*tmsistatus & 0x1); - encoded++; - - return bufferReturn; -} - -void dump_tmsi_status_xml(TmsiStatus *tmsistatus, uint8_t iei) -{ - printf("<Tmsi Status>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <TMSI flag>%u</TMSI flag>\n", *tmsistatus); - printf("</Tmsi Status>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.h deleted file mode 100644 index c6c7e87a7d33442faf4ea3d72525292b1b2bb20c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TmsiStatus.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef TMSI_STATUS_H_ -#define TMSI_STATUS_H_ - -#define TMSI_STATUS_MINIMUM_LENGTH 1 -#define TMSI_STATUS_MAXIMUM_LENGTH 1 - -typedef uint8_t TmsiStatus; - -int encode_tmsi_status(TmsiStatus *tmsistatus, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_tmsi_status_xml(TmsiStatus *tmsistatus, uint8_t iei); - -uint8_t encode_u8_tmsi_status(TmsiStatus *tmsistatus); - -int decode_tmsi_status(TmsiStatus *tmsistatus, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_tmsi_status(TmsiStatus *tmsistatus, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* TMSI STATUS_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.c deleted file mode 100644 index dd50d9566f9718656da576b25a512b779970615b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.c +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrackingAreaIdentity.h" - -int decode_tracking_area_identity(TrackingAreaIdentity *trackingareaidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - trackingareaidentity->mccdigit2 = (*(buffer + decoded) >> 4) & 0xf; - trackingareaidentity->mccdigit1 = *(buffer + decoded) & 0xf; - decoded++; - trackingareaidentity->mncdigit3 = (*(buffer + decoded) >> 4) & 0xf; - trackingareaidentity->mccdigit3 = *(buffer + decoded) & 0xf; - decoded++; - trackingareaidentity->mncdigit2 = (*(buffer + decoded) >> 4) & 0xf; - trackingareaidentity->mncdigit1 = *(buffer + decoded) & 0xf; - decoded++; - //IES_DECODE_U16(trackingareaidentity->tac, *(buffer + decoded)); - IES_DECODE_U16(buffer, decoded, trackingareaidentity->tac); -#if defined (NAS_DEBUG) - dump_tracking_area_identity_xml(trackingareaidentity, iei); -#endif - return decoded; -} - -int encode_tracking_area_identity(TrackingAreaIdentity *trackingareaidentity, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_IDENTITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_tracking_area_identity_xml(trackingareaidentity, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - *(buffer + encoded) = 0x00 | ((trackingareaidentity->mccdigit2 & 0xf) << 4) | - (trackingareaidentity->mccdigit1 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((trackingareaidentity->mncdigit3 & 0xf) << 4) | - (trackingareaidentity->mccdigit3 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((trackingareaidentity->mncdigit2 & 0xf) << 4) | - (trackingareaidentity->mncdigit1 & 0xf); - encoded++; - IES_ENCODE_U16(buffer, encoded, trackingareaidentity->tac); - return encoded; -} - -void dump_tracking_area_identity_xml(TrackingAreaIdentity *trackingareaidentity, uint8_t iei) -{ - printf("<Tracking Area Identity>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <MCC digit 2>%u</MCC digit 2>\n", trackingareaidentity->mccdigit2); - printf(" <MCC digit 1>%u</MCC digit 1>\n", trackingareaidentity->mccdigit1); - printf(" <MNC digit 3>%u</MNC digit 3>\n", trackingareaidentity->mncdigit3); - printf(" <MCC digit 3>%u</MCC digit 3>\n", trackingareaidentity->mccdigit3); - printf(" <MNC digit 2>%u</MNC digit 2>\n", trackingareaidentity->mncdigit2); - printf(" <MNC digit 1>%u</MNC digit 1>\n", trackingareaidentity->mncdigit1); - printf(" <TAC>0x%.4x</TAC>\n", trackingareaidentity->tac); - printf("</Tracking Area Identity>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.h deleted file mode 100644 index eb3826cab19b70e7689e15654d24e9974a6ad010..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentity.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef TRACKING_AREA_IDENTITY_H_ -#define TRACKING_AREA_IDENTITY_H_ - -#define TRACKING_AREA_IDENTITY_MINIMUM_LENGTH 6 -#define TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH 6 - -typedef struct TrackingAreaIdentity_tag { - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; - uint16_t tac; -} TrackingAreaIdentity; - -int encode_tracking_area_identity(TrackingAreaIdentity *trackingareaidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_tracking_area_identity_xml(TrackingAreaIdentity *trackingareaidentity, uint8_t iei); - -int decode_tracking_area_identity(TrackingAreaIdentity *trackingareaidentity, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* TRACKING AREA IDENTITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.c deleted file mode 100644 index eb0e30d01c8078050f16d5a2ca22adec6aa7c41f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.c +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrackingAreaIdentityList.h" - -int decode_tracking_area_identity_list(TrackingAreaIdentityList *trackingareaidentitylist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - trackingareaidentitylist->typeoflist = (*(buffer + decoded) >> 5) & 0x3; - trackingareaidentitylist->numberofelements = *(buffer + decoded) & 0x1f; - decoded++; - trackingareaidentitylist->mccdigit2 = (*(buffer + decoded) >> 4) & 0xf; - trackingareaidentitylist->mccdigit1 = *(buffer + decoded) & 0xf; - decoded++; - trackingareaidentitylist->mncdigit3 = (*(buffer + decoded) >> 4) & 0xf; - trackingareaidentitylist->mccdigit3 = *(buffer + decoded) & 0xf; - decoded++; - trackingareaidentitylist->mncdigit2 = (*(buffer + decoded) >> 4) & 0xf; - trackingareaidentitylist->mncdigit1 = *(buffer + decoded) & 0xf; - decoded++; - //IES_DECODE_U16(trackingareaidentitylist->tac, *(buffer + decoded)); - IES_DECODE_U16(buffer, decoded, trackingareaidentitylist->tac); -#if defined (NAS_DEBUG) - dump_tracking_area_identity_list_xml(trackingareaidentitylist, iei); -#endif - return decoded; -} - -int encode_tracking_area_identity_list(TrackingAreaIdentityList *trackingareaidentitylist, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_tracking_area_identity_list_xml(trackingareaidentitylist, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - ((trackingareaidentitylist->typeoflist & 0x3) << 5) | - (trackingareaidentitylist->numberofelements & 0x1f); - encoded++; - *(buffer + encoded) = 0x00 | ((trackingareaidentitylist->mccdigit2 & 0xf) << 4) | - (trackingareaidentitylist->mccdigit1 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((trackingareaidentitylist->mncdigit3 & 0xf) << 4) | - (trackingareaidentitylist->mccdigit3 & 0xf); - encoded++; - *(buffer + encoded) = 0x00 | ((trackingareaidentitylist->mncdigit2 & 0xf) << 4) | - (trackingareaidentitylist->mncdigit1 & 0xf); - encoded++; - IES_ENCODE_U16(buffer, encoded, trackingareaidentitylist->tac); - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_tracking_area_identity_list_xml(TrackingAreaIdentityList *trackingareaidentitylist, uint8_t iei) -{ - printf("<Tracking Area Identity List>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <Type of list>%u</Type of list>\n", trackingareaidentitylist->typeoflist); - /* LW: number of elements is coded as N-1 (0 -> 1 element, 1 -> 2 elements...), - * see 3GPP TS 24.301, section 9.9.3.33.1 */ - printf(" <Number of elements>%u</Number of elements>\n", trackingareaidentitylist->numberofelements + 1); - printf(" <MCC digit 2>%u</MCC digit 2>\n", trackingareaidentitylist->mccdigit2); - printf(" <MCC digit 1>%u</MCC digit 1>\n", trackingareaidentitylist->mccdigit1); - printf(" <MNC digit 3>%u</MNC digit 3>\n", trackingareaidentitylist->mncdigit3); - printf(" <MCC digit 3>%u</MCC digit 3>\n", trackingareaidentitylist->mccdigit3); - printf(" <MNC digit 2>%u</MNC digit 2>\n", trackingareaidentitylist->mncdigit2); - printf(" <MNC digit 1>%u</MNC digit 1>\n", trackingareaidentitylist->mncdigit1); - printf(" <TAC>0x%.4x</TAC>\n", trackingareaidentitylist->tac); - printf("</Tracking Area Identity List>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.h deleted file mode 100644 index a849fd04b0391eb8a9891c431fb576994666913b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrackingAreaIdentityList.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef TRACKING_AREA_IDENTITY_LIST_H_ -#define TRACKING_AREA_IDENTITY_LIST_H_ - -#define TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH 8 -#define TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH 98 - -typedef struct TrackingAreaIdentityList_tag { - /* XXX - The only supported type of list is a list of TACs - * belonging to one PLMN, with consecutive TAC values */ - //#define TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_NON_CONSECUTIVE_TACS 0b00 -#define TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS 0b01 - //#define TRACKING_AREA_IDENTITY_LIST_MANY_PLMNS 0b10 - uint8_t typeoflist:2; - uint8_t numberofelements:5; - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; - uint16_t tac; -} TrackingAreaIdentityList; - -int encode_tracking_area_identity_list(TrackingAreaIdentityList *trackingareaidentitylist, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_tracking_area_identity_list(TrackingAreaIdentityList *trackingareaidentitylist, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_tracking_area_identity_list_xml(TrackingAreaIdentityList *trackingareaidentitylist, uint8_t iei); - -#endif /* TRACKING AREA IDENTITY LIST_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.c deleted file mode 100644 index cb6aaff14f4943ad293a522f00348bca76edb776..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrafficFlowAggregateDescription.h" - -int decode_traffic_flow_aggregate_description(TrafficFlowAggregateDescription *trafficflowaggregatedescription, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_traffic_flow_aggregate_description(TrafficFlowAggregateDescription *trafficflowaggregatedescription, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.h deleted file mode 100644 index cda9369666cbd536d4d15926179f7a9123fc1e4e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowAggregateDescription.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_H_ -#define TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_H_ - -#define TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MINIMUM_LENGTH 1 -#define TRAFFIC_FLOW_AGGREGATE_DESCRIPTION_MAXIMUM_LENGTH 1 - -typedef struct { - uint8_t field; -} TrafficFlowAggregateDescription; - -int encode_traffic_flow_aggregate_description(TrafficFlowAggregateDescription *trafficflowaggregatedescription, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_traffic_flow_aggregate_description_xml(TrafficFlowAggregateDescription *trafficflowaggregatedescription, uint8_t iei); - -int decode_traffic_flow_aggregate_description(TrafficFlowAggregateDescription *trafficflowaggregatedescription, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* TRAFFIC FLOW AGGREGATE DESCRIPTION_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.c deleted file mode 100644 index 931e2326aa5c8c4a5fbdd25db95abea761ce5bd9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.c +++ /dev/null @@ -1,550 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TrafficFlowTemplate.h" - -static int decode_traffic_flow_template_delete_packet(DeletePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int decode_traffic_flow_template_create_tft(CreateNewTft* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int decode_traffic_flow_template_add_packet(AddPacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int decode_traffic_flow_template_replace_packet(ReplacePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); - -static int decode_traffic_flow_template_packet_filter_identifiers(PacketFilterIdentifiers* packetfilteridentifiers, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int decode_traffic_flow_template_packet_filters(PacketFilters* packetfilters, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); - -static int encode_traffic_flow_template_delete_packet(DeletePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int encode_traffic_flow_template_create_tft(CreateNewTft* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int encode_traffic_flow_template_add_packet(AddPacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int encode_traffic_flow_template_replace_packet(ReplacePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); - -static int encode_traffic_flow_template_packet_filter_identifiers(PacketFilterIdentifiers* packetfilteridentifiers, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); -static int encode_traffic_flow_template_packet_filters(PacketFilters* packetfilters, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len); - -static void dump_traffic_flow_template_packet_filter_identifiers(PacketFilterIdentifiers* packetfilteridentifiers, uint8_t nbpacketfilters); -static void dump_traffic_flow_template_packet_filters(PacketFilters* packetfilters, uint8_t nbpacketfilters); - -int decode_traffic_flow_template(TrafficFlowTemplate *trafficflowtemplate, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - int decoded_result = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - trafficflowtemplate->tftoperationcode = (*(buffer + decoded) >> 5) & 0x7; - trafficflowtemplate->ebit = (*(buffer + decoded) >> 4) & 0x1; - trafficflowtemplate->numberofpacketfilters = *(buffer + decoded) & 0xf; - decoded++; - - /* Decoding packet filter list */ - if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE_PACKET) { - decoded_result = decode_traffic_flow_template_delete_packet(&trafficflowtemplate->packetfilterlist.deletepacketfilter, trafficflowtemplate->numberofpacketfilters, (buffer + decoded), len - decoded); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE) { - decoded_result = decode_traffic_flow_template_create_tft(&trafficflowtemplate->packetfilterlist.createtft, trafficflowtemplate->numberofpacketfilters, (buffer + decoded), len - decoded); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_ADD_PACKET) { - decoded_result = decode_traffic_flow_template_add_packet(&trafficflowtemplate->packetfilterlist.addpacketfilter, trafficflowtemplate->numberofpacketfilters, (buffer + decoded), len - decoded); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_REPLACE_PACKET) { - decoded_result = decode_traffic_flow_template_replace_packet(&trafficflowtemplate->packetfilterlist.replacepacketfilter, trafficflowtemplate->numberofpacketfilters, (buffer + decoded), len - decoded); - } - -#if defined (NAS_DEBUG) - dump_traffic_flow_template_xml(trafficflowtemplate, iei); -#endif - - if (decoded_result < 0) { - return decoded_result; - } - - return (decoded + decoded_result); -} - -int encode_traffic_flow_template(TrafficFlowTemplate *trafficflowtemplate, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRAFFIC_FLOW_TEMPLATE_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_traffic_flow_template_xml(trafficflowtemplate, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | ((trafficflowtemplate->tftoperationcode & 0x7) << 5) | ((trafficflowtemplate->ebit & 0x1) << 4) | (trafficflowtemplate->numberofpacketfilters & 0xf); - encoded++; - - /* Encoding packet filter list */ - if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE_PACKET) { - encoded += encode_traffic_flow_template_delete_packet(&trafficflowtemplate->packetfilterlist.deletepacketfilter, trafficflowtemplate->numberofpacketfilters, (buffer + encoded), len - encoded); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE) { - encoded += encode_traffic_flow_template_create_tft(&trafficflowtemplate->packetfilterlist.createtft, trafficflowtemplate->numberofpacketfilters, (buffer + encoded), len - encoded); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_ADD_PACKET) { - encoded += encode_traffic_flow_template_add_packet(&trafficflowtemplate->packetfilterlist.addpacketfilter, trafficflowtemplate->numberofpacketfilters, (buffer + encoded), len - encoded); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_REPLACE_PACKET) { - encoded += encode_traffic_flow_template_replace_packet(&trafficflowtemplate->packetfilterlist.replacepacketfilter, trafficflowtemplate->numberofpacketfilters, (buffer + encoded), len - encoded); - } - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_traffic_flow_template_xml(TrafficFlowTemplate *trafficflowtemplate, uint8_t iei) -{ - printf("<Traffic Flow Template>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <TFT operation code>%u</TFT operation code>\n", trafficflowtemplate->tftoperationcode); - printf(" <E bit>%u</E bit>\n", trafficflowtemplate->ebit); - printf(" <Number of packet filters>%u</Number of packet filters>\n", trafficflowtemplate->numberofpacketfilters); - - if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE_PACKET) { - dump_traffic_flow_template_packet_filter_identifiers(&trafficflowtemplate->packetfilterlist.deletepacketfilter, trafficflowtemplate->numberofpacketfilters); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE) { - dump_traffic_flow_template_packet_filters(&trafficflowtemplate->packetfilterlist.createtft, trafficflowtemplate->numberofpacketfilters); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_ADD_PACKET) { - dump_traffic_flow_template_packet_filters(&trafficflowtemplate->packetfilterlist.addpacketfilter, trafficflowtemplate->numberofpacketfilters); - } else if (trafficflowtemplate->tftoperationcode == TRAFFIC_FLOW_TEMPLATE_OPCODE_REPLACE_PACKET) { - dump_traffic_flow_template_packet_filters(&trafficflowtemplate->packetfilterlist.replacepacketfilter, trafficflowtemplate->numberofpacketfilters); - } - - printf("</Traffic Flow Template>\n"); -} - -static int decode_traffic_flow_template_delete_packet(DeletePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return decode_traffic_flow_template_packet_filter_identifiers(packetfilter, nbpacketfilters, buffer, len); -} - -static int decode_traffic_flow_template_create_tft(CreateNewTft* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return decode_traffic_flow_template_packet_filters(packetfilter, nbpacketfilters, buffer, len); -} - -static int decode_traffic_flow_template_add_packet(AddPacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return decode_traffic_flow_template_packet_filters(packetfilter, nbpacketfilters, buffer, len); -} - -static int decode_traffic_flow_template_replace_packet(ReplacePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return decode_traffic_flow_template_packet_filters(packetfilter, nbpacketfilters, buffer, len); -} - -static int decode_traffic_flow_template_packet_filter_identifiers(PacketFilterIdentifiers* packetfilteridentifiers, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - int decoded = 0, i; - - for (i = 0; (i < nbpacketfilters) && (len - decoded > 0); i++) { - /* Packet filter identifier */ - IES_DECODE_U8(buffer, decoded, (*packetfilteridentifiers)[i].identifier); - } - - return decoded; -} - -static int decode_traffic_flow_template_packet_filters(PacketFilters* packetfilters, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - int decoded = 0, i, j; - - for (i = 0; (i < nbpacketfilters); i++) { - if (len - decoded <= 0) { - /* Mismatch between the number of packet filters subfield, - * and the number of packet filters in the packet filter list */ - return (TLV_DECODE_VALUE_DOESNT_MATCH); - } - - /* Initialize the packet filter presence flag indicator */ - (*packetfilters)[i].packetfilter.flags = 0; - /* Packet filter direction */ - (*packetfilters)[i].direction = *(buffer + decoded) >> 4; - /* Packet filter identifier */ - (*packetfilters)[i].identifier = *(buffer + decoded) & 0x0f; - decoded++; - /* Packet filter evaluation precedence */ - IES_DECODE_U8(buffer, decoded, (*packetfilters)[i].eval_precedence); - /* Length of the Packet filter contents field */ - uint8_t pkflen; - IES_DECODE_U8(buffer, decoded, pkflen); - /* Packet filter contents */ - int pkfstart = decoded; - - while (decoded - pkfstart < pkflen) { - /* Packet filter component type identifier */ - uint8_t component_type; - IES_DECODE_U8(buffer, decoded, component_type); - - switch (component_type) { - case TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR: - /* IPv4 remote address type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG; - - for (j = 0; j < TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE; j++) { - (*packetfilters)[i].packetfilter.ipv4remoteaddr[j].addr = *(buffer + decoded); - (*packetfilters)[i].packetfilter.ipv4remoteaddr[j].mask = *(buffer + decoded + TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE); - decoded++; - } - - decoded += TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE; - break; - - case TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR: - /* IPv6 remote address type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG; - - for (j = 0; j < TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE; j++) { - (*packetfilters)[i].packetfilter.ipv6remoteaddr[j].addr = *(buffer + decoded); - (*packetfilters)[i].packetfilter.ipv6remoteaddr[j].mask = *(buffer + decoded + TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE); - decoded++; - } - - decoded += TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE; - break; - - case TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER: - /* Protocol identifier/Next header type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG; - IES_DECODE_U8(buffer, decoded, (*packetfilters)[i].packetfilter.protocolidentifier_nextheader); - break; - - case TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT: - /* Single local port type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG; - IES_DECODE_U16(buffer, decoded, (*packetfilters)[i].packetfilter.singlelocalport); - break; - - case TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE: - /* Local port range type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG; - IES_DECODE_U16(buffer, decoded, (*packetfilters)[i].packetfilter.localportrange.lowlimit); - IES_DECODE_U16(buffer, decoded, (*packetfilters)[i].packetfilter.localportrange.highlimit); - break; - - case TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT: - /* Single remote port type */ - (*packetfilters)[i].packetfilter.flags |=TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG ; - IES_DECODE_U16(buffer, decoded, (*packetfilters)[i].packetfilter.singleremoteport); - break; - - case TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE: - /* Remote port range type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG; - IES_DECODE_U16(buffer, decoded, (*packetfilters)[i].packetfilter.remoteportrange.lowlimit); - IES_DECODE_U16(buffer, decoded, (*packetfilters)[i].packetfilter.remoteportrange.highlimit); - break; - - case TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX: - /* Security parameter index type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX_FLAG; - IES_DECODE_U32(buffer, decoded, (*packetfilters)[i].packetfilter.securityparameterindex); - break; - - case TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS: - /* Type of service/Traffic class type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS_FLAG; - IES_DECODE_U8(buffer, decoded, (*packetfilters)[i].packetfilter.typdeofservice_trafficclass.value); - IES_DECODE_U8(buffer, decoded, (*packetfilters)[i].packetfilter.typdeofservice_trafficclass.mask); - break; - - case TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL: - /* Flow label type */ - (*packetfilters)[i].packetfilter.flags |= TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL_FLAG; - IES_DECODE_U24(buffer, decoded, (*packetfilters)[i].packetfilter.flowlabel); - break; - - default: - /* Packet filter component type identifier is not valid */ - return (TLV_DECODE_UNEXPECTED_IEI); - break; - } - } - } - - if (len - decoded != 0) { - /* Mismatch between the number of packet filters subfield, - * and the number of packet filters in the packet filter list */ - return (TLV_DECODE_VALUE_DOESNT_MATCH); - } - - return decoded; -} - -static int encode_traffic_flow_template_delete_packet(DeletePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return encode_traffic_flow_template_packet_filter_identifiers(packetfilter, nbpacketfilters, buffer, len); -} - -static int encode_traffic_flow_template_create_tft(CreateNewTft* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return encode_traffic_flow_template_packet_filters(packetfilter, nbpacketfilters, buffer, len); -} - -static int encode_traffic_flow_template_add_packet(AddPacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return encode_traffic_flow_template_packet_filters(packetfilter, nbpacketfilters, buffer, len); -} - -static int encode_traffic_flow_template_replace_packet(ReplacePacketFilter* packetfilter, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - return encode_traffic_flow_template_packet_filters(packetfilter, nbpacketfilters, buffer, len); -} - -static int encode_traffic_flow_template_packet_filter_identifiers(PacketFilterIdentifiers* packetfilteridentifiers, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - int encoded = 0, i; - - for (i = 0; (i < nbpacketfilters) && (len - encoded > 0); i++) { - /* Packet filter identifier */ - IES_ENCODE_U8(buffer, encoded, (*packetfilteridentifiers)[i].identifier); - } - - return encoded; -} - -static int encode_traffic_flow_template_packet_filters(PacketFilters* packetfilters, uint8_t nbpacketfilters, uint8_t *buffer, uint32_t len) -{ - int encoded = 0, i, j; - - for (i = 0; (i < nbpacketfilters) && (len - encoded > 0); i++) { - if (len - encoded <= 0) { - /* Mismatch between the number of packet filters subfield, - * and the number of packet filters in the packet filter list */ - return (TLV_DECODE_VALUE_DOESNT_MATCH); - } - - /* Packet filter identifier and direction */ - IES_ENCODE_U8(buffer, encoded, (0x00 | ((*packetfilters)[i].direction << 4) | ((*packetfilters)[i].identifier))); - /* Packet filter evaluation precedence */ - IES_ENCODE_U8(buffer, encoded, (*packetfilters)[i].eval_precedence); - /* Save address of the Packet filter contents field length */ - uint8_t* pkflenPtr = buffer + encoded; - encoded++; - /* Packet filter contents */ - int pkfstart = encoded; - uint16_t flag = TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG; - - while (flag <= TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL_FLAG) { - switch ((*packetfilters)[i].packetfilter.flags & flag) { - case TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG: - /* IPv4 remote address type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR); - - for (j = 0; j < TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE; j++) { - *(buffer + encoded) = (*packetfilters)[i].packetfilter.ipv4remoteaddr[j].addr; - *(buffer + encoded + TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE) = (*packetfilters)[i].packetfilter.ipv4remoteaddr[j].mask; - encoded++; - } - - encoded += TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE; - break; - - case TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG: - /* IPv6 remote address type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR); - - for (j = 0; j < TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE; j++) { - *(buffer + encoded) = (*packetfilters)[i].packetfilter.ipv6remoteaddr[j].addr; - *(buffer + encoded + TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE) = (*packetfilters)[i].packetfilter.ipv6remoteaddr[j].mask; - encoded++; - } - - encoded += TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE; - break; - - case TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG: - /* Protocol identifier/Next header type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER); - IES_ENCODE_U8(buffer, encoded, (*packetfilters)[i].packetfilter.protocolidentifier_nextheader); - break; - - case TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG: - /* Single local port type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT); - IES_ENCODE_U16(buffer, encoded, (*packetfilters)[i].packetfilter.singlelocalport); - break; - - case TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG: - /* Local port range type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE); - IES_ENCODE_U16(buffer, encoded, (*packetfilters)[i].packetfilter.localportrange.lowlimit); - IES_ENCODE_U16(buffer, encoded, (*packetfilters)[i].packetfilter.localportrange.highlimit); - break; - - case TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG: - /* Single remote port type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT); - IES_ENCODE_U16(buffer, encoded, (*packetfilters)[i].packetfilter.singleremoteport); - break; - - case TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG: - /* Remote port range type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE); - IES_ENCODE_U16(buffer, encoded, (*packetfilters)[i].packetfilter.remoteportrange.lowlimit); - IES_ENCODE_U16(buffer, encoded, (*packetfilters)[i].packetfilter.remoteportrange.highlimit); - break; - - case TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX_FLAG: - /* Security parameter index type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX); - IES_ENCODE_U32(buffer, encoded, (*packetfilters)[i].packetfilter.securityparameterindex); - break; - - case TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS_FLAG: - /* Type of service/Traffic class type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS); - IES_ENCODE_U8(buffer, encoded, (*packetfilters)[i].packetfilter.typdeofservice_trafficclass.value); - IES_ENCODE_U8(buffer, encoded, (*packetfilters)[i].packetfilter.typdeofservice_trafficclass.mask); - break; - - case TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL_FLAG: - /* Flow label type */ - IES_ENCODE_U8(buffer, encoded, TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL); - IES_ENCODE_U24(buffer, encoded, (*packetfilters)[i].packetfilter.flowlabel & 0x000fffff); - break; - - default: - break; - } - - flag = flag << 1; - } - - /* Length of the Packet filter contents field */ - *pkflenPtr = encoded - pkfstart; - } - - return encoded; -} - -static void dump_traffic_flow_template_packet_filter_identifiers(PacketFilterIdentifiers* packetfilteridentifiers, uint8_t nbpacketfilters) -{ - int i; - printf(" <Packet filter list>\n"); - - for (i = 0; i < nbpacketfilters; i++) { - printf(" <Identifier>%u</Identifier>\n", (*packetfilteridentifiers)[i].identifier); - } - - printf(" </Packet filter list>\n"); -} - -static void dump_traffic_flow_template_packet_filters(PacketFilters* packetfilters, uint8_t nbpacketfilters) -{ - int i; - printf(" <Packet filter list>\n"); - - for (i = 0; i < nbpacketfilters; i++) { - printf(" <Identifier>%u</Identifier>\n", (*packetfilters)[i].identifier); - printf(" <Direction>%u</Direction>\n", (*packetfilters)[i].direction); - printf(" <Evaluation precedence>%u</Evaluation precedence>\n", (*packetfilters)[i].eval_precedence); - printf(" <Packet filter>\n"); - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG) { - printf(" <IPv4 remote address>%u.%u.%u.%u</IPv4 remote address>\n", (*packetfilters)[i].packetfilter.ipv4remoteaddr[0].addr, (*packetfilters)[i].packetfilter.ipv4remoteaddr[1].addr, - (*packetfilters)[i].packetfilter.ipv4remoteaddr[2].addr, (*packetfilters)[i].packetfilter.ipv4remoteaddr[3].addr); - printf(" <IPv4 remote address mask>%u.%u.%u.%u</IPv4 remote address mask>\n", (*packetfilters)[i].packetfilter.ipv4remoteaddr[0].mask, - (*packetfilters)[i].packetfilter.ipv4remoteaddr[1].mask, (*packetfilters)[i].packetfilter.ipv4remoteaddr[2].mask, (*packetfilters)[i].packetfilter.ipv4remoteaddr[3].mask); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG) { - printf(" <Ipv6 remote address>%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x</Ipv6 remote address>\n", (*packetfilters)[i].packetfilter.ipv6remoteaddr[0].addr, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[1].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[2].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[3].addr, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[4].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[5].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[6].addr, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[7].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[8].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[9].addr, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[10].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[11].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[12].addr, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[13].addr, (*packetfilters)[i].packetfilter.ipv6remoteaddr[14].addr, (*packetfilters)[i].packetfilter. - ipv6remoteaddr[15].addr); - printf(" <Ipv6 remote address mask>%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x:%x%.2x</Ipv6 remote address mask>\n", (*packetfilters)[i].packetfilter.ipv6remoteaddr[0].mask, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[1].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[2].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[3].mask, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[4].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[5].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[6].mask, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[7].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[8].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[9].mask, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[10].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[11].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[12].mask, - (*packetfilters)[i].packetfilter.ipv6remoteaddr[13].mask, (*packetfilters)[i].packetfilter.ipv6remoteaddr[14].mask, (*packetfilters)[i]. - packetfilter.ipv6remoteaddr[15].mask); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG) { - printf(" <Protocol identifier - Next header type>%u</Protocol identifier - Next header type>\n", (*packetfilters)[i].packetfilter.protocolidentifier_nextheader); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG) { - printf(" <Single local port>%u</Single local port>\n", (*packetfilters)[i].packetfilter.singlelocalport); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG) { - printf(" <Local port range low limit>%u</Local port range low limit>\n", (*packetfilters)[i].packetfilter.localportrange.lowlimit); - printf(" <Local port range high limit>%u</Local port range high limit>\n", (*packetfilters)[i].packetfilter.localportrange.highlimit); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG) { - printf(" <Single remote port>%u</Single remote port>\n", (*packetfilters)[i].packetfilter.singleremoteport); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG) { - printf(" <Remote port range low limit>%u</Remote port range low limit>\n", (*packetfilters)[i].packetfilter.remoteportrange.lowlimit); - printf(" <Remote port range high limit>%u</Remote port range high limit>\n", (*packetfilters)[i].packetfilter.remoteportrange.highlimit); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX_FLAG) { - printf(" <Security parameter index>%u</Security parameter index>\n", (*packetfilters)[i].packetfilter.securityparameterindex); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS_FLAG) { - printf(" <Type of service - Traffic class>%u</Type of service - Traffic class>\n", (*packetfilters)[i].packetfilter.typdeofservice_trafficclass.value); - printf(" <Type of service - Traffic class mask>%u</Type of service - Traffic class mask>\n", (*packetfilters)[i].packetfilter.typdeofservice_trafficclass.mask); - } - - if ((*packetfilters)[i].packetfilter.flags & TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL_FLAG) { - printf(" <Flow label>%u</Flow label>\n", (*packetfilters)[i].packetfilter.flowlabel); - } - - printf(" </Packet filter>\n"); - } - - printf(" </Packet filter list>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.h deleted file mode 100644 index 5c01c228aa46ae2a9d09611d95a27ee60213167f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TrafficFlowTemplate.h +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#ifndef TRAFFIC_FLOW_TEMPLATE_H_ -#define TRAFFIC_FLOW_TEMPLATE_H_ - -#define TRAFFIC_FLOW_TEMPLATE_MINIMUM_LENGTH 2 -#define TRAFFIC_FLOW_TEMPLATE_MAXIMUM_LENGTH 256 - -/* - * ---------------------------------------------------------------------------- - * Packet filter list - * ---------------------------------------------------------------------------- - */ - -#define TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR 0b00010000 -#define TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR 0b00100000 -#define TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER 0b00110000 -#define TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT 0b01000000 -#define TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE 0b01000001 -#define TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT 0b01010000 -#define TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE 0b01010001 -#define TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX 0b01100000 -#define TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS 0b01110000 -#define TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL 0b10000000 - -/* - * Packet filter content - * --------------------- - */ -typedef struct { -#define TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG (1<<0) -#define TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG (1<<1) -#define TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG (1<<2) -#define TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG (1<<3) -#define TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG (1<<4) -#define TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG (1<<5) -#define TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG (1<<6) -#define TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX_FLAG (1<<7) -#define TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS_FLAG (1<<8) -#define TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL_FLAG (1<<9) - uint16_t flags; -#define TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE 4 - struct { - uint8_t addr; - uint8_t mask; - } ipv4remoteaddr[TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE]; -#define TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE 16 - struct { - uint8_t addr; - uint8_t mask; - } ipv6remoteaddr[TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE]; - uint8_t protocolidentifier_nextheader; - uint16_t singlelocalport; - struct { - uint16_t lowlimit; - uint16_t highlimit; - } localportrange; - uint16_t singleremoteport; - struct { - uint16_t lowlimit; - uint16_t highlimit; - } remoteportrange; - uint32_t securityparameterindex; - struct { - uint8_t value; - uint8_t mask; - } typdeofservice_trafficclass; - uint32_t flowlabel; -} PacketFilter; - -/* - * Packet filter list when the TFP operation is "delete existing TFT" - * and "no TFT operation" shall be empty. - * --------------------------------------------------------------- - */ -typedef struct {} NoPacketFilter; - -typedef NoPacketFilter DeleteExistingTft; -typedef NoPacketFilter NoTftOperation; - -/* - * Packet filter list when the TFT operation is "delete existing TFT" - * shall contain a variable number of packet filter identifiers. - * ------------------------------------------------------------------ - */ -#define TRAFFIC_FLOW_TEMPLATE_PACKET_IDENTIFIER_MAX 16 -typedef struct { - uint8_t identifier; -} PacketFilterIdentifiers[TRAFFIC_FLOW_TEMPLATE_PACKET_IDENTIFIER_MAX]; - -typedef PacketFilterIdentifiers DeletePacketFilter; - -/* - * Packet filter list when the TFT operation is "create new TFT", - * "add packet filters to existing TFT" and "replace packet filters - * in existing TFT" shall contain a variable number of packet filters - * ------------------------------------------------------------------ - */ -#define TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX 4 -typedef struct { - uint8_t identifier:4; -#define TRAFFIC_FLOW_TEMPLATE_PRE_REL7_TFT_FILTER 0b00 -#define TRAFFIC_FLOW_TEMPLATE_DOWNLINK_ONLY 0b01 -#define TRAFFIC_FLOW_TEMPLATE_UPLINK_ONLY 0b10 -#define TRAFFIC_FLOW_TEMPLATE_BIDIRECTIONAL 0b11 - uint8_t direction:2; - uint8_t eval_precedence; - PacketFilter packetfilter; -} PacketFilters[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX]; - -typedef PacketFilters CreateNewTft; -typedef PacketFilters AddPacketFilter; -typedef PacketFilters ReplacePacketFilter; - -/* - * Packet filter list - * ------------------ - */ -typedef union { - CreateNewTft createtft; - DeleteExistingTft deletetft; - AddPacketFilter addpacketfilter; - ReplacePacketFilter replacepacketfilter; - DeletePacketFilter deletepacketfilter; - NoTftOperation notftoperation; -} PacketFilterList; - -/* - * ---------------------------------------------------------------------------- - * Parameters list - * ---------------------------------------------------------------------------- - */ - -typedef struct { - /* TODO */ -} ParameterList; - -/* - * ---------------------------------------------------------------------------- - * Traffic Flow Template information element - * ---------------------------------------------------------------------------- - */ - -typedef struct TrafficFlowTemplate_tag { -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_SPARE 0b000 -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE 0b001 -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE 0b010 -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_ADD_PACKET 0b011 -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_REPLACE_PACKET 0b100 -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE_PACKET 0b101 -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_NO_OPERATION 0b110 -#define TRAFFIC_FLOW_TEMPLATE_OPCODE_RESERVED 0b111 - uint8_t tftoperationcode:3; -#define TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_NOT_INCLUDED 0 -#define TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_INCLUDED 1 - uint8_t ebit:1; - uint8_t numberofpacketfilters:4; - PacketFilterList packetfilterlist; - ParameterList parameterlist; -} TrafficFlowTemplate; - -int encode_traffic_flow_template(TrafficFlowTemplate *trafficflowtemplate, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_traffic_flow_template(TrafficFlowTemplate *trafficflowtemplate, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_traffic_flow_template_xml(TrafficFlowTemplate *trafficflowtemplate, uint8_t iei); - -#endif /* TRAFFIC FLOW TEMPLATE_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.c b/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.c deleted file mode 100644 index c3afd429508bdaeb574a251e4c0e69b9a8dbcdd6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.c +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "TransactionIdentifier.h" - -int decode_transaction_identifier(TransactionIdentifier *transactionidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_transaction_identifier(TransactionIdentifier *transactionidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.h b/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.h deleted file mode 100644 index 153432e3b716e1d7184481fdf92202d1ee8e7b9f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/TransactionIdentifier.h +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef TRANSACTION_IDENTIFIER_H_ -#define TRANSACTION_IDENTIFIER_H_ - -#define TRANSACTION_IDENTIFIER_MINIMUM_LENGTH 1 -#define TRANSACTION_IDENTIFIER_MAXIMUM_LENGTH 1 - -typedef struct { - uint8_t field; -} TransactionIdentifier; - -int encode_transaction_identifier(TransactionIdentifier *transactionidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_transaction_identifier_xml(TransactionIdentifier *transactionidentifier, uint8_t iei); - -int decode_transaction_identifier(TransactionIdentifier *transactionidentifier, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* TRANSACTION IDENTIFIER_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.c b/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.c deleted file mode 100644 index 839acc080bca3d131566bc8f4ebc127cbf67a9e6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.c +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <string.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "UeNetworkCapability.h" - -int decode_ue_network_capability(UeNetworkCapability *uenetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - DECODE_U8(buffer + decoded, ielen, decoded); - - memset(uenetworkcapability, 0, sizeof(UeNetworkCapability)); - - LOG_TRACE(INFO, "decode_ue_network_capability len = %d",ielen); - CHECK_LENGTH_DECODER(len - decoded, ielen); - uenetworkcapability->eea = *(buffer + decoded); - decoded++; - uenetworkcapability->eia = *(buffer + decoded); - decoded++; - - /* Parts below not mandatory and may not be present */ - if (ielen > 2) { - uenetworkcapability->uea = *(buffer + decoded); - decoded++; - - if (ielen > 3) { - uenetworkcapability->ucs2 = (*(buffer + decoded) >> 7) & 0x1; - uenetworkcapability->uia = *(buffer + decoded) & 0x7f; - decoded++; - uenetworkcapability->umts_present =1; - LOG_TRACE(INFO, "uenetworkcapability decoded UMTS\n"); - - if (ielen > 4) { - uenetworkcapability->spare = (*(buffer + decoded) >> 5) & 0x7; - uenetworkcapability->csfb = (*(buffer + decoded) >> 4) & 0x1; - uenetworkcapability->lpp = (*(buffer + decoded) >> 3) & 0x1; - uenetworkcapability->lcs = (*(buffer + decoded) >> 2) & 0x1; - uenetworkcapability->srvcc = (*(buffer + decoded) >> 1) & 0x1; - uenetworkcapability->nf = *(buffer + decoded) & 0x1; - decoded++; - uenetworkcapability->gprs_present =1; - LOG_TRACE(INFO, "uenetworkcapability decoded GPRS\n"); - } - -#warning "Force GPRS present if UMTS present" - uenetworkcapability->gprs_present =1; - } - } - - LOG_TRACE(INFO, "uenetworkcapability decoded=%u\n", decoded); - - if ((ielen + 2) != decoded) { - decoded = ielen + 1 + (iei > 0 ? 1 : 0) /* Size of header for this IE */; - LOG_TRACE(INFO, "uenetworkcapability then decoded=%u\n", decoded); - } - -#if defined (NAS_DEBUG) - dump_ue_network_capability_xml(uenetworkcapability, iei); -#endif - return decoded; -} -int encode_ue_network_capability(UeNetworkCapability *uenetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, UE_NETWORK_CAPABILITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_ue_network_capability_xml(uenetworkcapability, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = uenetworkcapability->eea; - encoded++; - *(buffer + encoded) = uenetworkcapability->eia; - encoded++; - LOG_TRACE(INFO, "uenetworkcapability encoded EPS %u\n", encoded); - - if (uenetworkcapability->umts_present) { - *(buffer + encoded) = uenetworkcapability->uea; - encoded++; - *(buffer + encoded) = 0x00 | ((uenetworkcapability->ucs2 & 0x1) << 7) | - (uenetworkcapability->uia & 0x7f); - encoded++; - LOG_TRACE(INFO, "uenetworkcapability encoded UMTS %u\n", encoded); - } - - if (uenetworkcapability->gprs_present) { -#warning "Force gea to 0x60" - *(buffer + encoded) = 0x00 | 0x60; - ////((uenetworkcapability->spare & 0x7) << 5) | // spare coded as zero - //((uenetworkcapability->csfb & 0x1) << 4) | - //((uenetworkcapability->lpp & 0x1) << 3) | - //((uenetworkcapability->lcs & 0x1) << 2) | - //((uenetworkcapability->srvcc & 0x1) << 1) | - //(uenetworkcapability->nf & 0x1); - encoded++; - LOG_TRACE(INFO, "uenetworkcapability encoded GPRS %u\n", encoded); - } - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_ue_network_capability_xml(UeNetworkCapability *uenetworkcapability, uint8_t iei) -{ - printf("<Ue Network Capability>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <EEA>%02x</EEA>\n", uenetworkcapability->eea); - printf(" <EIA>%02x</EIA>\n", uenetworkcapability->eia); - printf(" <UEA>%02x</UEA>\n", uenetworkcapability->uea); - printf(" <UCS2>%u</UCS2>\n", uenetworkcapability->ucs2); - printf(" <UIA>%u</UIA>\n", uenetworkcapability->uia); - printf(" <SPARE>%u</SPARE>\n", uenetworkcapability->spare); - printf(" <CSFB>%u</CSFB>\n", uenetworkcapability->csfb); - printf(" <LPP>%u</LPP>\n", uenetworkcapability->lpp); - printf(" <LCS>%u</LCS>\n", uenetworkcapability->lcs); - printf(" <SR VCC>%u</SR VCC>\n", uenetworkcapability->srvcc); - printf(" <NF>%u<NF/>\n", uenetworkcapability->nf); - printf(" <UMTS>%u<UMTS/>\n", uenetworkcapability->umts_present); - printf(" <GPRS>%u<GPRS/>\n", uenetworkcapability->gprs_present); - printf("</Ue Network Capability>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.h b/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.h deleted file mode 100644 index a385fefea9bf8d442289708e6f6232345daa2070..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/UeNetworkCapability.h +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef UE_NETWORK_CAPABILITY_H_ -#define UE_NETWORK_CAPABILITY_H_ - -#define UE_NETWORK_CAPABILITY_MINIMUM_LENGTH 4 -#define UE_NETWORK_CAPABILITY_MAXIMUM_LENGTH 7 - -typedef struct UeNetworkCapability_tag { - /* EPS encryption algorithms supported (octet 3) */ -#define UE_NETWORK_CAPABILITY_EEA0 0b10000000 -#define UE_NETWORK_CAPABILITY_EEA1 0b01000000 -#define UE_NETWORK_CAPABILITY_EEA2 0b00100000 -#define UE_NETWORK_CAPABILITY_EEA3 0b00010000 -#define UE_NETWORK_CAPABILITY_EEA4 0b00001000 -#define UE_NETWORK_CAPABILITY_EEA5 0b00000100 -#define UE_NETWORK_CAPABILITY_EEA6 0b00000010 -#define UE_NETWORK_CAPABILITY_EEA7 0b00000001 - uint8_t eea; - /* EPS integrity algorithms supported (octet 4) */ -#define UE_NETWORK_CAPABILITY_EIA0 0b10000000 -#define UE_NETWORK_CAPABILITY_EIA1 0b01000000 -#define UE_NETWORK_CAPABILITY_EIA2 0b00100000 -#define UE_NETWORK_CAPABILITY_EIA3 0b00010000 -#define UE_NETWORK_CAPABILITY_EIA4 0b00001000 -#define UE_NETWORK_CAPABILITY_EIA5 0b00000100 -#define UE_NETWORK_CAPABILITY_EIA6 0b00000010 -#define UE_NETWORK_CAPABILITY_EIA7 0b00000001 - uint8_t eia; - /* UMTS encryption algorithms supported (octet 5) */ -#define UE_NETWORK_CAPABILITY_UEA0 0b10000000 -#define UE_NETWORK_CAPABILITY_UEA1 0b01000000 -#define UE_NETWORK_CAPABILITY_UEA2 0b00100000 -#define UE_NETWORK_CAPABILITY_UEA3 0b00010000 -#define UE_NETWORK_CAPABILITY_UEA4 0b00001000 -#define UE_NETWORK_CAPABILITY_UEA5 0b00000100 -#define UE_NETWORK_CAPABILITY_UEA6 0b00000010 -#define UE_NETWORK_CAPABILITY_UEA7 0b00000001 - uint8_t uea; - /* UCS2 support (octet 6, bit 8) */ -#define UE_NETWORK_CAPABILITY_DEFAULT_ALPHABET 0 -#define UE_NETWORK_CAPABILITY_UCS2_ALPHABET 1 - uint8_t ucs2:1; - /* UMTS integrity algorithms supported (octet 6) */ -#define UE_NETWORK_CAPABILITY_UIA1 0b01000000 -#define UE_NETWORK_CAPABILITY_UIA2 0b00100000 -#define UE_NETWORK_CAPABILITY_UIA3 0b00010000 -#define UE_NETWORK_CAPABILITY_UIA4 0b00001000 -#define UE_NETWORK_CAPABILITY_UIA5 0b00000100 -#define UE_NETWORK_CAPABILITY_UIA6 0b00000010 -#define UE_NETWORK_CAPABILITY_UIA7 0b00000001 - uint8_t uia:7; - /* Bits 8 to 6 of octet 7 are spare and shall be coded as zero */ - uint8_t spare:3; - /* eNodeB-based access class control for CSFB capability */ -#define UE_NETWORK_CAPABILITY_CSFB 1 - uint8_t csfb:1; - /* LTE Positioning Protocol capability */ -#define UE_NETWORK_CAPABILITY_LPP 1 - uint8_t lpp:1; - /* Location services notification mechanisms capability */ -#define UE_NETWORK_CAPABILITY_LCS 1 - uint8_t lcs:1; - /* 1xSRVCC capability */ -#define UE_NETWORK_CAPABILITY_SRVCC 1 - uint8_t srvcc:1; - /* NF notification procedure capability */ -#define UE_NETWORK_CAPABILITY_NF 1 - uint8_t nf:1; - - uint8_t umts_present; - uint8_t gprs_present; -} UeNetworkCapability; - -int encode_ue_network_capability(UeNetworkCapability *uenetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_ue_network_capability(UeNetworkCapability *uenetworkcapability, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_ue_network_capability_xml(UeNetworkCapability *uenetworkcapability, uint8_t iei); - -#endif /* UE NETWORK CAPABILITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.c b/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.c deleted file mode 100644 index 08020581e4a494c30899ce4ca59764355f801017..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.c +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "UeRadioCapabilityInformationUpdateNeeded.h" - -int decode_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_MINIMUM_LENGTH, len); - - if (iei > 0) { - CHECK_IEI_DECODER((*buffer & 0xf0), iei); - } - - *ueradiocapabilityinformationupdateneeded = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_ue_radio_capability_information_update_needed_xml(ueradiocapabilityinformationupdateneeded, iei); -#endif - return decoded; -} - -int decode_u8_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei, uint8_t value, uint32_t len) -{ - int decoded = 0; - uint8_t *buffer = &value; - *ueradiocapabilityinformationupdateneeded = *buffer & 0x1; - decoded++; -#if defined (NAS_DEBUG) - dump_ue_radio_capability_information_update_needed_xml(ueradiocapabilityinformationupdateneeded, iei); -#endif - return decoded; -} - -int encode_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t encoded = 0; - /* Checking length and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_ue_radio_capability_information_update_needed_xml(ueradiocapabilityinformationupdateneeded, iei); -#endif - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*ueradiocapabilityinformationupdateneeded & 0x1); - encoded++; - return encoded; -} - -uint8_t encode_u8_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded) -{ - uint8_t bufferReturn; - uint8_t *buffer = &bufferReturn; - uint8_t encoded = 0; - uint8_t iei = 0; - dump_ue_radio_capability_information_update_needed_xml(ueradiocapabilityinformationupdateneeded, 0); - *(buffer + encoded) = 0x00 | (iei & 0xf0) | - (*ueradiocapabilityinformationupdateneeded & 0x1); - encoded++; - - return bufferReturn; -} - -void dump_ue_radio_capability_information_update_needed_xml(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei) -{ - printf("<Ue Radio Capability Information Update Needed>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <URC upd>%u</URC upd>\n", *ueradiocapabilityinformationupdateneeded); - printf("</Ue Radio Capability Information Update Needed>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.h b/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.h deleted file mode 100644 index 0876f663da402e9201ff562c4c90435b8d497281..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/UeRadioCapabilityInformationUpdateNeeded.h +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_H_ -#define UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_H_ - -#define UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_MINIMUM_LENGTH 1 -#define UE_RADIO_CAPABILITY_INFORMATION_UPDATE_NEEDED_MAXIMUM_LENGTH 1 - -typedef uint8_t UeRadioCapabilityInformationUpdateNeeded; - -int encode_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_ue_radio_capability_information_update_needed_xml(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei); - -uint8_t encode_u8_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded); - -int decode_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_u8_ue_radio_capability_information_update_needed(UeRadioCapabilityInformationUpdateNeeded *ueradiocapabilityinformationupdateneeded, uint8_t iei, uint8_t value, uint32_t len); - -#endif /* UE RADIO CAPABILITY INFORMATION UPDATE NEEDED_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.c b/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.c deleted file mode 100644 index 5c4610ccdea5199a06c64d8bf9d00fbfb170ab76..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.c +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <string.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "UeSecurityCapability.h" - -int decode_ue_security_capability(UeSecurityCapability *uesecuritycapability, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - memset(uesecuritycapability, 0, sizeof(UeSecurityCapability)); - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - uesecuritycapability->eea = *(buffer + decoded); - decoded++; - uesecuritycapability->eia = *(buffer + decoded); - decoded++; - - if (len >= decoded + 3) { - uesecuritycapability->umts_present = 1; - uesecuritycapability->uea = *(buffer + decoded); - decoded++; - uesecuritycapability->uia = *(buffer + decoded) & 0x7f; - decoded++; - - if (len == decoded + 4) { - uesecuritycapability->gprs_present = 1; - uesecuritycapability->gea = *(buffer + decoded) & 0x7f; - decoded++; - } - } - -#if defined (NAS_DEBUG) - dump_ue_security_capability_xml(uesecuritycapability, iei); -#endif - return decoded; -} -int encode_ue_security_capability(UeSecurityCapability *uesecuritycapability, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, UE_SECURITY_CAPABILITY_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_ue_security_capability_xml(uesecuritycapability, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = uesecuritycapability->eea; - encoded++; - *(buffer + encoded) = uesecuritycapability->eia; - encoded++; - - // From ETSI TS 124 301 V10.15.0 (2014-10) 9.9.3.36 Security capability: - // Octets 5, 6, and 7 are optional. If octet 5 is included, then also octet 6 shall be included and octet 7 may be included. - // If a UE did not indicate support of any security algorithm for Gb mode, octet 7 shall not be included. If the UE did not - // indicate support of any security algorithm for Iu mode and Gb mode, octets 5, 6, and 7 shall not be included. - // If the UE did not indicate support of any security algorithm for Iu mode but indicated support of a security algorithm for - // Gb mode, octets 5, 6, and 7 shall be included. In this case octets 5 and 6 are filled with the value of zeroes. - if (uesecuritycapability->umts_present) { - *(buffer + encoded) = uesecuritycapability->uea; - encoded++; - *(buffer + encoded) = 0x00 | - (uesecuritycapability->uia & 0x7f); - encoded++; - - if (uesecuritycapability->gprs_present) { - *(buffer + encoded) = 0x00 | (uesecuritycapability->gea & 0x7f); - encoded++; - } - } else { - if (uesecuritycapability->gprs_present) { - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00; - encoded++; - *(buffer + encoded) = 0x00 | (uesecuritycapability->gea & 0x7f); - encoded++; - } - } - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_ue_security_capability_xml(UeSecurityCapability *uesecuritycapability, uint8_t iei) -{ - printf("<Ue Security Capability>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <EEA>%u</EEA>\n", uesecuritycapability->eea); - printf(" <EIA>%u</EIA>\n", uesecuritycapability->eia); - - if (uesecuritycapability->umts_present == 1) { - printf(" <UEA>%u</UEA>\n", uesecuritycapability->uea); - printf(" <UIA>%u</UIA>\n", uesecuritycapability->uia); - } - - if (uesecuritycapability->gprs_present == 1) { - printf(" <GEA>%u</GEA>\n", uesecuritycapability->gea); - } - - printf("</Ue Security Capability>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.h b/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.h deleted file mode 100644 index 9009937cf4deece705d5c46cf1d6fb836c2d793b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/UeSecurityCapability.h +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef UE_SECURITY_CAPABILITY_H_ -#define UE_SECURITY_CAPABILITY_H_ - -#define UE_SECURITY_CAPABILITY_MINIMUM_LENGTH 2 -#define UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH 7 - -typedef struct UeSecurityCapability_tag { - /* EPS encryption algorithms supported (octet 3) */ -#define UE_SECURITY_CAPABILITY_EEA0 0b10000000 -#define UE_SECURITY_CAPABILITY_EEA1 0b01000000 -#define UE_SECURITY_CAPABILITY_EEA2 0b00100000 -#define UE_SECURITY_CAPABILITY_EEA3 0b00010000 -#define UE_SECURITY_CAPABILITY_EEA4 0b00001000 -#define UE_SECURITY_CAPABILITY_EEA5 0b00000100 -#define UE_SECURITY_CAPABILITY_EEA6 0b00000010 -#define UE_SECURITY_CAPABILITY_EEA7 0b00000001 - uint8_t eea; - /* EPS integrity algorithms supported (octet 4) */ -#define UE_SECURITY_CAPABILITY_EIA0 0b10000000 -#define UE_SECURITY_CAPABILITY_EIA1 0b01000000 -#define UE_SECURITY_CAPABILITY_EIA2 0b00100000 -#define UE_SECURITY_CAPABILITY_EIA3 0b00010000 -#define UE_SECURITY_CAPABILITY_EIA4 0b00001000 -#define UE_SECURITY_CAPABILITY_EIA5 0b00000100 -#define UE_SECURITY_CAPABILITY_EIA6 0b00000010 -#define UE_SECURITY_CAPABILITY_EIA7 0b00000001 - uint8_t eia; - uint8_t umts_present; - uint8_t gprs_present; - /* UMTS encryption algorithms supported (octet 5) */ -#define UE_SECURITY_CAPABILITY_UEA0 0b10000000 -#define UE_SECURITY_CAPABILITY_UEA1 0b01000000 -#define UE_SECURITY_CAPABILITY_UEA2 0b00100000 -#define UE_SECURITY_CAPABILITY_UEA3 0b00010000 -#define UE_SECURITY_CAPABILITY_UEA4 0b00001000 -#define UE_SECURITY_CAPABILITY_UEA5 0b00000100 -#define UE_SECURITY_CAPABILITY_UEA6 0b00000010 -#define UE_SECURITY_CAPABILITY_UEA7 0b00000001 - uint8_t uea; - /* UMTS integrity algorithms supported (octet 6) */ -#define UE_SECURITY_CAPABILITY_UIA1 0b01000000 -#define UE_SECURITY_CAPABILITY_UIA2 0b00100000 -#define UE_SECURITY_CAPABILITY_UIA3 0b00010000 -#define UE_SECURITY_CAPABILITY_UIA4 0b00001000 -#define UE_SECURITY_CAPABILITY_UIA5 0b00000100 -#define UE_SECURITY_CAPABILITY_UIA6 0b00000010 -#define UE_SECURITY_CAPABILITY_UIA7 0b00000001 - uint8_t uia:7; - /* GPRS encryption algorithms supported (octet 7) */ -#define UE_SECURITY_CAPABILITY_GEA1 0b01000000 -#define UE_SECURITY_CAPABILITY_GEA2 0b00100000 -#define UE_SECURITY_CAPABILITY_GEA3 0b00010000 -#define UE_SECURITY_CAPABILITY_GEA4 0b00001000 -#define UE_SECURITY_CAPABILITY_GEA5 0b00000100 -#define UE_SECURITY_CAPABILITY_GEA6 0b00000010 -#define UE_SECURITY_CAPABILITY_GEA7 0b00000001 - uint8_t gea:7; -} UeSecurityCapability; - -int encode_ue_security_capability(UeSecurityCapability *uesecuritycapability, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_ue_security_capability(UeSecurityCapability *uesecuritycapability, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_ue_security_capability_xml(UeSecurityCapability *uesecuritycapability, uint8_t iei); - -#endif /* UE SECURITY CAPABILITY_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.c b/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.c deleted file mode 100644 index 38a8cf10a6ac1f8df874ec579897c70c5f7ba3ae..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.c +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <string.h> - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "VoiceDomainPreferenceAndUeUsageSetting.h" - -int decode_voice_domain_preference_and_ue_usage_setting(VoiceDomainPreferenceAndUeUsageSetting *voicedomainpreferenceandueusagesetting, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - int decoded = 0; - uint8_t ielen = 0; - - if (iei > 0) { - CHECK_IEI_DECODER(iei, *buffer); - decoded++; - } - - memset(voicedomainpreferenceandueusagesetting, 0, sizeof(VoiceDomainPreferenceAndUeUsageSetting)); - ielen = *(buffer + decoded); - decoded++; - CHECK_LENGTH_DECODER(len - decoded, ielen); - - voicedomainpreferenceandueusagesetting->ue_usage_setting = (*(buffer + decoded) >> 2) & 0x1; - voicedomainpreferenceandueusagesetting->voice_domain_for_eutran = *(buffer + decoded) & 0x3; - decoded++; - -#if defined (NAS_DEBUG) - dump_voice_domain_preference_and_ue_usage_setting_xml(voicedomainpreferenceandueusagesetting, iei); -#endif - return decoded; -} -int encode_voice_domain_preference_and_ue_usage_setting(VoiceDomainPreferenceAndUeUsageSetting *voicedomainpreferenceandueusagesetting, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - uint8_t *lenPtr; - uint32_t encoded = 0; - /* Checking IEI and pointer */ - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) - dump_voice_domain_preference_and_ue_usage_setting_xml(voicedomainpreferenceandueusagesetting, iei); -#endif - - if (iei > 0) { - *buffer = iei; - encoded++; - } - - lenPtr = (buffer + encoded); - encoded ++; - *(buffer + encoded) = 0x00 | - (voicedomainpreferenceandueusagesetting->ue_usage_setting << 2) | - voicedomainpreferenceandueusagesetting->voice_domain_for_eutran; - encoded++; - - *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); - return encoded; -} - -void dump_voice_domain_preference_and_ue_usage_setting_xml(VoiceDomainPreferenceAndUeUsageSetting *voicedomainpreferenceandueusagesetting, uint8_t iei) -{ - printf("<Voice domain preference and UE usage setting>\n"); - - if (iei > 0) - /* Don't display IEI if = 0 */ - printf(" <IEI>0x%X</IEI>\n", iei); - - printf(" <UE_USAGE_SETTING>%u</UE_USAGE_SETTING>\n", voicedomainpreferenceandueusagesetting->ue_usage_setting); - printf(" <VOICE_DOMAIN_FOR_EUTRAN>%u</VOICE_DOMAIN_FOR_EUTRAN>\n", voicedomainpreferenceandueusagesetting->voice_domain_for_eutran); - printf("</Voice domain preference and UE usage setting>\n"); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.h b/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.h deleted file mode 100644 index 221620fa6a78945a3a03bc5087f878219ced1ae8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/ies/VoiceDomainPreferenceAndUeUsageSetting.h +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "OctetString.h" - -#ifndef VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_H_ -#define VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_H_ - -#define VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_MINIMUM_LENGTH 1 -#define VOICE_DOMAIN_PREFERENCE_AND_UE_USAGE_SETTING_MAXIMUM_LENGTH 1 - -typedef struct VoiceDomainPreferenceAndUeUsageSetting_tag { - uint8_t spare:5; -#define UE_USAGE_SETTING_VOICE_CENTRIC 0b0 -#define UE_USAGE_SETTING_DATA_CENTRIC 0b1 - uint8_t ue_usage_setting:1; -#define VOICE_DOMAIN_PREFERENCE_CS_VOICE_ONLY 0b00 -#define VOICE_DOMAIN_PREFERENCE_IMS_PS_VOICE_ONLY 0b01 -#define VOICE_DOMAIN_PREFERENCE_CS_VOICE_PREFERRED_IMS_PS_VOICE_AS_SECONDARY 0b10 -#define VOICE_DOMAIN_PREFERENCE_IMS_PS_VOICE_PREFERRED_CS_VOICE_AS_SECONDARY 0b11 - uint8_t voice_domain_for_eutran:2; -} VoiceDomainPreferenceAndUeUsageSetting; - -int encode_voice_domain_preference_and_ue_usage_setting(VoiceDomainPreferenceAndUeUsageSetting *voicedomainpreferenceandueusagesetting, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_voice_domain_preference_and_ue_usage_setting(VoiceDomainPreferenceAndUeUsageSetting *voicedomainpreferenceandueusagesetting, uint8_t iei, uint8_t *buffer, uint32_t len); - -void dump_voice_domain_preference_and_ue_usage_setting_xml(VoiceDomainPreferenceAndUeUsageSetting *voicedomainpreferenceandueusagesetting, uint8_t iei); - -#endif /* VOICE DOMAIN PREFERENCE AND UE USAGE SETTING_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/COPYING b/openair-cn/NAS/EURECOM-NAS/src/include/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/include/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/commonDef.h b/openair-cn/NAS/EURECOM-NAS/src/include/commonDef.h deleted file mode 120000 index 5d0024abc56a98a87d7f7ddbff034d66a713857b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/include/commonDef.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../openair2/COMMON/commonDef.h \ No newline at end of file diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/networkDef.h b/openair-cn/NAS/EURECOM-NAS/src/include/networkDef.h deleted file mode 120000 index 5fab87cc9250cc7ff40cfd8ccd18627da07a3cc9..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/include/networkDef.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../openair2/COMMON/networkDef.h \ No newline at end of file diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/securityDef.h b/openair-cn/NAS/EURECOM-NAS/src/include/securityDef.h deleted file mode 100644 index 88325f0aaf661a7dcf9760cf29e32f0475213ca3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/include/securityDef.h +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source securityDef.h - -Version 0.1 - -Date 2013/05/02 - -Product NAS stack - -Subsystem include - -Author Frederic Maurel - -Description Contains global security definitions - -*****************************************************************************/ -#ifndef __SECURITYDEF_H__ -#define __SECURITYDEF_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Index of the first byte of each fields of the AUTN parameter - */ -#define AUTH_SQN_INDEX 0 -#define AUTH_AMF_INDEX (AUTH_SQN_INDEX + AUTH_SQN_SIZE) -#define AUTH_MAC_INDEX (AUTH_AMF_INDEX + AUTH_AMF_SIZE) - -/* - * Size of the authentication challenge parameters in bytes - */ -#define AUTH_SQN_SIZE 6 /* Sequence number: 48 bits */ -#define AUTH_AK_SIZE 6 /* Anonymity key: 48 bits */ -#define AUTH_AMF_SIZE 2 /* Authentication Management Field: 16 bits */ -#define AUTH_MAC_SIZE 8 /* Message Authentication Code: 64 bits */ -#define AUTH_AUTN_SIZE 16 /* Authentication token: 128 bits - AUTN = (SQN ⊕ AK) || AMF || MAC */ -#define AUTH_MACS_SIZE 8 /* Re-synchronization MAC: 64 bits */ -#define AUTH_AUTS_SIZE 16 /* Re-synchronization AUT: 128 bits */ -#define AUTH_RAND_SIZE 16 /* Random challenge: 128 bits */ -#define AUTH_CK_SIZE 16 /* Ciphering key: 128 bits */ -#define AUTH_IK_SIZE 16 /* Integrity key: 128 bits */ -#define AUTH_RES_SIZE 16 /* Authentication response: 128 bits */ -#define AUTH_SNID_SIZE 3 /* Serving network's identity: 24 bits */ -#define AUTH_KASME_SIZE 32 /* KASME security key: 256 bits */ -#define AUTH_KNAS_INT_SIZE 16 /* NAS integrity key */ -#define AUTH_KNAS_ENC_SIZE 16 /* NAS cyphering key */ -#define AUTH_KENB_SIZE AUTH_KASME_SIZE /* eNodeB security key */ - -/* "Separation bit" of AMF field */ -#define AUTH_AMF_SEPARATION_BIT(a) ((a) & 0x80) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * EPS authentication vector - */ -typedef struct { - /* ASME security key */ - uint8_t kasme[AUTH_KASME_SIZE]; - /* Random challenge parameter */ - uint8_t rand[AUTH_RAND_SIZE]; - /* Authentication token parameter */ - uint8_t autn[AUTH_AUTN_SIZE]; - /* Expected Authentication response parameter */ -#define AUTH_XRES_SIZE AUTH_RES_SIZE - uint8_t xres_size; - uint8_t xres[AUTH_XRES_SIZE]; -} auth_vector_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __SECURITYDEF_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/include/userDef.h b/openair-cn/NAS/EURECOM-NAS/src/include/userDef.h deleted file mode 100644 index b99e263382cef4c04e2885e38497c5a0c5f899cc..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/include/userDef.h +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source userDef.h - -Version 0.1 - -Date 2012/09/21 - -Product NAS stack - -Subsystem include - -Author Frederic Maurel - -Description Contains user's global definitions - -*****************************************************************************/ -#ifndef __USERDEF_H__ -#define __USERDEF_H__ - -#include <stdint.h> - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * The name of the file used as non-volatile memory device to store - * UE data parameters - */ -#define USER_NVRAM_FILENAME ".ue.nvram" - -/* - * The name of the environment variable which defines the directory - * where the UE data file is located - */ -#define USER_NVRAM_DIRNAME "NVRAM_DIR" - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * ------------------------------ - * Structure of the UE parameters - * ------------------------------ - */ -typedef struct { - /* International Mobile Equipment Identity */ -#define USER_IMEI_SIZE 15 - char IMEI[USER_IMEI_SIZE+1]; - /* Manufacturer identifier */ -#define USER_MANUFACTURER_SIZE 16 - char manufacturer[USER_MANUFACTURER_SIZE+1]; - /* Model identifier */ -#define USER_MODEL_SIZE 16 - char model[USER_MODEL_SIZE+1]; - /* SIM Personal Identification Number */ -#define USER_PIN_SIZE 4 - char PIN[USER_PIN_SIZE+1]; -} user_nvdata_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __USERDEF_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_network.c b/openair-cn/NAS/EURECOM-NAS/src/nas_network.c deleted file mode 100644 index 9c5a0c38fe1a0f4c0d646be7bf234b2464c64266..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_network.c +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_network.h - -Version 0.1 - -Date 2012/09/20 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS procedure functions triggered by the network - -*****************************************************************************/ - -#include "nas_network.h" -#include "commonDef.h" -#include "nas_log.h" -#include "nas_timer.h" - -#include "as_message.h" -#include "nas_proc.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: nas_network_initialize() ** - ** ** - ** Description: Initializes network internal data ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME) -void nas_network_initialize(mme_config_t *mme_config_p) -#else -void nas_network_initialize(void) -#endif -{ - LOG_FUNC_IN; - -#ifdef NAS_MME - /* Initialize the internal NAS processing data */ -# if defined(NAS_BUILT_IN_EPC) - nas_timer_init(); - nas_proc_initialize(mme_config_p); -# else - nas_proc_initialize(); -# endif -#endif - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: nas_network_cleanup() ** - ** ** - ** Description: Performs clean up procedure before the system is shutdown ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void nas_network_cleanup(void) -{ - LOG_FUNC_IN; - - nas_proc_cleanup(); - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: nas_network_process_data() ** - ** ** - ** Description: Process Access Stratum messages received from the network ** - ** and call applicable NAS procedure function. ** - ** ** - ** Inputs: msg_id: AS message identifier ** - ** data: Generic pointer to data structure that has ** - ** to be processed ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok if the message has been success- ** - ** fully processed; RETURNerror otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_network_process_data(int msg_id, const void *data) -{ - LOG_FUNC_IN; - - const as_message_t *msg = (as_message_t *)(data); - int rc = RETURNok; - - /* Sanity check */ - if (msg_id != msg->msgID) { - LOG_TRACE(ERROR, "NET-MAIN - Message identifier 0x%x to process " - "is different from that of the network data (0x%x)", - msg_id, msg->msgID); - LOG_FUNC_RETURN (RETURNerror); - } - - switch (msg_id) { -#ifdef NAS_UE - - case AS_BROADCAST_INFO_IND: - break; - - case AS_CELL_INFO_CNF: { - /* Received cell information confirm */ - const cell_info_cnf_t *info = &msg->msg.cell_info_cnf; - int cell_found = (info->errCode == AS_SUCCESS); - rc = nas_proc_cell_info(cell_found, info->tac, - info->cellID, info->rat, - info->rsrp, info->rsrq); - break; - } - - case AS_CELL_INFO_IND: - break; - - case AS_PAGING_IND: - break; - - case AS_NAS_ESTABLISH_CNF: { - /* Received NAS signalling connection establishment confirm */ - const nas_establish_cnf_t *confirm = &msg->msg.nas_establish_cnf; - - if ( (confirm->errCode == AS_SUCCESS) || - (confirm->errCode == AS_TERMINATED_NAS) ) { - rc = nas_proc_establish_cnf(confirm->nasMsg.data, - confirm->nasMsg.length); - } else { - LOG_TRACE(WARNING, "NET-MAIN - " - "Initial NAS message not delivered"); - rc = nas_proc_establish_rej(); - } - - break; - } - - case AS_NAS_RELEASE_IND: - /* Received NAS signalling connection releaase indication */ - rc = nas_proc_release_ind(msg->msg.nas_release_ind.cause); - break; - - case AS_UL_INFO_TRANSFER_CNF: - - /* Received uplink data transfer confirm */ - if (msg->msg.ul_info_transfer_cnf.errCode != AS_SUCCESS) { - LOG_TRACE(WARNING, "NET-MAIN - " - "Uplink NAS message not delivered"); - rc = nas_proc_ul_transfer_rej(); - } else { - rc = nas_proc_ul_transfer_cnf(); - } - - break; - - case AS_DL_INFO_TRANSFER_IND: { - const dl_info_transfer_ind_t *info = &msg->msg.dl_info_transfer_ind; - /* Received downlink data transfer indication */ - rc = nas_proc_dl_transfer_ind(info->nasMsg.data, - info->nasMsg.length); - break; - } - - case AS_RAB_ESTABLISH_IND: - break; - - case AS_RAB_RELEASE_IND: - break; -#endif -#ifdef NAS_MME - - case AS_NAS_ESTABLISH_IND: { - /* Received NAS signalling connection establishment indication */ - const nas_establish_ind_t *indication = &msg->msg.nas_establish_ind; - rc = nas_proc_establish_ind(indication->UEid, - indication->tac, - indication->initialNasMsg.data, - indication->initialNasMsg.length); - break; - } - - case AS_DL_INFO_TRANSFER_CNF: { - const dl_info_transfer_cnf_t *info = &msg->msg.dl_info_transfer_cnf; - - /* Received downlink data transfer confirm */ - if (info->errCode != AS_SUCCESS) { - LOG_TRACE(WARNING, "NET-MAIN - " - "Downlink NAS message not delivered"); - rc = nas_proc_dl_transfer_rej(info->UEid); - } else { - rc = nas_proc_dl_transfer_cnf(info->UEid); - } - - break; - } - - case AS_UL_INFO_TRANSFER_IND: { - const ul_info_transfer_ind_t *info = &msg->msg.ul_info_transfer_ind; - /* Received uplink data transfer indication */ - rc = nas_proc_ul_transfer_ind(info->UEid, - info->nasMsg.data, - info->nasMsg.length); - break; - } - - case AS_RAB_ESTABLISH_CNF: - break; -#endif - - default: - LOG_TRACE(ERROR, "NET-MAIN - Unexpected AS message type: 0x%x", - msg_id); - rc = RETURNerror; - break; - } - - LOG_FUNC_RETURN (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_network.h b/openair-cn/NAS/EURECOM-NAS/src/nas_network.h deleted file mode 100644 index 193d98784a6eff7394b4dd54e486248169e4c6ec..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_network.h +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_network.h - -Version 0.1 - -Date 2012/09/20 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS procedure functions triggered by the network - -*****************************************************************************/ - -#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME) -# include "mme_config.h" -#endif - -#ifndef __NAS_NETWORK_H__ -#define __NAS_NETWORK_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#if defined(NAS_BUILT_IN_EPC) && defined(NAS_MME) -void nas_network_initialize(mme_config_t *mme_config_p); -#else -void nas_network_initialize(void); -#endif - -void nas_network_cleanup(void); - -int nas_network_process_data(int command_id, const void *data); - -const void *nas_network_get_data(void); - -#endif /* __NAS_NETWORK_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.c b/openair-cn/NAS/EURECOM-NAS/src/nas_parser.c deleted file mode 100644 index 8c7c7c5fcf5a29ec163bf181e1b4cf9592bfcced..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.c +++ /dev/null @@ -1,369 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_parser.c - -Version 0.1 - -Date 2012/02/27 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS command line parser - -*****************************************************************************/ - -#include "nas_parser.h" -#include "parser.h" - -#include <stdio.h> // fprintf -#include <stdlib.h> // atoi - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * Identifiers of the NAS command line options - */ -enum { -#ifdef NAS_UE - NAS_PARSER_UE_ID, /* User Equipement Identifier */ -#endif // NAS_UE - NAS_PARSER_TRACE_LEVEL, /* Logging trace level */ -#ifdef NAS_UE - NAS_PARSER_USER_HOST, /* User app layer's hostname */ -#endif // NAS_UE - NAS_PARSER_NETWORK_HOST, /* Network layer's hostname */ -#ifdef NAS_UE - NAS_PARSER_USER_PORT, /* User app layer's port number */ -#endif // NAS_UE - NAS_PARSER_NETWORK_PORT, /* Network layer's port number */ -#ifdef NAS_UE - NAS_PARSER_DEVICE_PATH, /* Device pathname */ - NAS_PARSER_DEVICE_ATTR, /* Device attribute parameters */ -#endif // NAS_UE - NAS_PARSER_NB_OPTIONS -}; - -/* ----------------------------------------------------- - * Definition of the internal NAS command line structure - * ----------------------------------------------------- - * The command line is defined with a name (default is "NASprocess" - * but it will be replaced by the command name actually used at - * runtime), a number of options and the list of options. - * An option is defined with a name, an argument following the name, - * the usage displayed by the usage function and a default value. - */ -static parser_command_line_t nasParserCommandLine = { - "NASprocess", /* Command name */ - NAS_PARSER_NB_OPTIONS, /* Number of options */ - { /* Command line options */ -#ifdef NAS_UE - { - "-ueid", "<ueid>", "UE identifier\t\t\t", - NAS_PARSER_DEFAULT_UE_ID - }, -#endif // NAS_UE - { - "-trace", "<mask>", "Logging trace level\t\t", - NAS_PARSER_DEFAULT_TRACE_LEVEL - }, -#ifdef NAS_UE - { - "-uhost", "<uhost>", "User app layer's hostname\t", - NAS_PARSER_DEFAULT_USER_HOSTNAME - }, -#endif // NAS_UE - { - "-nhost", "<nhost>", "Network layer's hostname\t", - NAS_PARSER_DEFAULT_NETWORK_HOSTNAME - }, -#ifdef NAS_UE - { - "-uport", "<uport>", "User app layer's port number\t", - NAS_PARSER_DEFAULT_USER_PORT_NUMBER - }, -#endif // NAS_UE - { - "-nport", "<nport>", "Network layer's port number\t", - NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER - }, -#ifdef NAS_UE - {"-dev", "<devpath>", "Device pathname\t\t", "NULL"}, - {"-params", "<params>", "Device attribute parameters", "NULL"}, -#endif // NAS_UE - } -}; - -/* - * Converts a string, containing hexadecimal formatted integer, to an integer - */ -static int atohex(const char *a_char); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: nas_parser_print_usage() ** - ** ** - ** Description: Displays the command line options used to run the NAS ** - ** process and the firmware version defined at compilation ** - ** time ** - ** ** - ** Inputs: version: Firmware version ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void nas_parser_print_usage(const char *version) -{ - parser_print_usage(&nasParserCommandLine); - fprintf(stderr, "Version: %s\n", version); -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_options() ** - ** ** - ** Description: Gets the command line options used to run the NAS process ** - ** ** - ** Inputs: argc: Number of options ** - ** argv: Pointer to the list of options ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_parser_get_options(int argc, const char **argv) -{ - return parser_get_options(argc, argv, &nasParserCommandLine); -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_nb_options() ** - ** ** - ** Description: Returns the number of the command line options used to ** - ** run the NAS process ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Number of command line options ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_parser_get_nb_options(void) -{ - return nasParserCommandLine.nb_options; -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_trace_level() ** - ** ** - ** Description: Returns the value of the logging trace level ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the logging trace level ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_parser_get_trace_level(void) -{ - return atohex( nasParserCommandLine.options[NAS_PARSER_TRACE_LEVEL].pvalue ); -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_network_host() ** - ** ** - ** Description: Returns the value of the network layer hostname ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the network layer hostname ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *nas_parser_get_network_host(void) -{ - return nasParserCommandLine.options[NAS_PARSER_NETWORK_HOST].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_network_port() ** - ** ** - ** Description: Returns the value of the network layer port number ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the network layer port number ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *nas_parser_get_network_port(void) -{ - return nasParserCommandLine.options[NAS_PARSER_NETWORK_PORT].pvalue; -} - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: nas_parser_get_ueid() ** - ** ** - ** Description: Returns the value of the UE identifier option ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the UE identifier option ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_parser_get_ueid(void) -{ - return atoi( nasParserCommandLine.options[NAS_PARSER_UE_ID].pvalue ); -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_user_host() ** - ** ** - ** Description: Returns the value of the user application layer hostname ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the user app layer hostname ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *nas_parser_get_user_host(void) -{ - return nasParserCommandLine.options[NAS_PARSER_USER_HOST].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_user_port() ** - ** ** - ** Description: Returns the value of the user application layer port ** - ** number ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the user app layer port number ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *nas_parser_get_user_port(void) -{ - return nasParserCommandLine.options[NAS_PARSER_USER_PORT].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_device_path() ** - ** ** - ** Description: Returns the value of the device pathname ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the device pathname ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *nas_parser_get_device_path(void) -{ - return nasParserCommandLine.options[NAS_PARSER_DEVICE_PATH].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: nas_parser_get_device_params() ** - ** ** - ** Description: Returns the value of the device attribute parameters ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the device attribute parameters ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char *nas_parser_get_device_params(void) -{ - return nasParserCommandLine.options[NAS_PARSER_DEVICE_ATTR].pvalue; -} -#endif // NAS_UE - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -static int atohex(const char *a_char) -{ - int result; - - for (result=0; a_char; a_char++) { - if (*a_char >= '0' && *a_char <= '9') { - result = (result << 4) + (*a_char - '0'); - } else if (*a_char >= 'A' && *a_char <= 'F') { - result = (result << 4) + (*a_char - 'A' + 10); - } else if (*a_char >= 'a' && *a_char <= 'f') { - result = (result << 4) + (*a_char - 'a' + 10); - } else { - break; - } - } - - return result; -} diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.h b/openair-cn/NAS/EURECOM-NAS/src/nas_parser.h deleted file mode 100644 index e8d18ae21227f4dbafdc24f8987649c3799b03a1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_parser.h +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_parser.h - -Version 0.1 - -Date 2012/02/27 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS command line parser - -*****************************************************************************/ -#ifndef __NAS_PARSER_H__ -#define __NAS_PARSER_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* Logging trace level default value */ -#define NAS_PARSER_DEFAULT_TRACE_LEVEL "0" /* No trace */ - -/* Network layer default hostname */ -#define NAS_PARSER_DEFAULT_NETWORK_HOSTNAME "localhost" - -/* Network layer default port number */ -#define NAS_PARSER_DEFAULT_NETWORK_PORT_NUMBER "12000" - -#ifdef NAS_UE -/* User Identifier default value */ -#define NAS_PARSER_DEFAULT_UE_ID "1" - -/* User application layer default hostname */ -#define NAS_PARSER_DEFAULT_USER_HOSTNAME "localhost" - -/* User application layer default port number */ -#define NAS_PARSER_DEFAULT_USER_PORT_NUMBER "10000" -#endif // NAS_UE - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void nas_parser_print_usage(const char *version); -int nas_parser_get_options(int argc, const char **argv); - -int nas_parser_get_nb_options(void); -int nas_parser_get_trace_level(void); -const char *nas_parser_get_network_host(void); -const char *nas_parser_get_network_port(void); - -#ifdef NAS_UE -int nas_parser_get_ueid(void); -const char *nas_parser_get_user_host(void); -const char *nas_parser_get_user_port(void); -const char *nas_parser_get_device_path(void); -const char *nas_parser_get_device_params(void); -#endif // NAS_UE - -#endif /* __NAS_PARSER_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c b/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c deleted file mode 100644 index 662dd6dfaaa02fe3d37a0013b423c480e63cae9a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.c +++ /dev/null @@ -1,1767 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_proc.c - -Version 0.1 - -Date 2012/09/20 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS procedure call manager - -*****************************************************************************/ - -#include "nas_proc.h" -#include "nas_log.h" - -#include "emm_main.h" -#include "emm_sap.h" - -#include "esm_main.h" -#include "esm_sap.h" -#include "msc.h" - -#include <stdio.h> // sprintf - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#ifdef NAS_UE -/* - * Signal strength/quality value not known or not detectable - */ -#define NAS_PROC_RSRQ_UNKNOWN 255 -#define NAS_PROC_RSRP_UNKNOWN 255 - -/* - * Local NAS data - */ -static struct { - /* EPS capibility status */ - int EPS_capability_status; - /* Reference signal received quality */ - int rsrq; - /* Reference signal received power */ - int rsrp; -} _nas_proc_data; - -static int _nas_proc_activate(int cid, int apply_to_all); -static int _nas_proc_deactivate(int cid, int apply_to_all); -#endif - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: nas_proc_initialize() ** - ** ** - ** Description: ** - ** ** - ** Inputs: emm_cb: Mobility Management indication callback ** - ** esm_cb: Session Management indication callback ** - ** imei: The IMEI read from the UE's non-volatile ** - ** memory ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_proc_data ** - ** ** - ***************************************************************************/ -void nas_proc_initialize(emm_indication_callback_t emm_cb, - esm_indication_callback_t esm_cb, const char *imei) -{ - LOG_FUNC_IN; - - /* Initialize local NAS data */ - _nas_proc_data.EPS_capability_status = FALSE; - _nas_proc_data.rsrq = NAS_PROC_RSRQ_UNKNOWN; - _nas_proc_data.rsrp = NAS_PROC_RSRP_UNKNOWN; - - /* Initialize the EMM procedure manager */ - emm_main_initialize(emm_cb, imei); - - /* Initialize the ESM procedure manager */ - esm_main_initialize(esm_cb); - - LOG_FUNC_OUT; -} -#endif -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: nas_proc_initialize() ** - ** ** - ** Description: ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -# if defined(NAS_BUILT_IN_EPC) -void nas_proc_initialize(mme_config_t *mme_config_p) -{ - LOG_FUNC_IN; - - /* Initialize the EMM procedure manager */ - emm_main_initialize(mme_config_p); - - /* Initialize the ESM procedure manager */ - esm_main_initialize(); - - LOG_FUNC_OUT; -} -# else -void nas_proc_initialize(void) -{ - LOG_FUNC_IN; - - /* Initialize the EMM procedure manager */ - emm_main_initialize(); - - /* Initialize the ESM procedure manager */ - esm_main_initialize(); - - LOG_FUNC_OUT; -} -# endif -#endif - -/**************************************************************************** - ** ** - ** Name: nas_proc_cleanup() ** - ** ** - ** Description: Performs clean up procedure before the system is shutdown ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void nas_proc_cleanup(void) -{ - LOG_FUNC_IN; - -#ifdef NAS_UE - /* Detach the UE from the EPS network */ - int rc = nas_proc_detach(TRUE); - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "NAS-PROC - Failed to detach from the network"); - } - -#endif - - /* Perform the EPS Mobility Manager's clean up procedure */ - emm_main_cleanup(); - - /* Perform the EPS Session Manager's clean up procedure */ - esm_main_cleanup(); - - LOG_FUNC_OUT; -} - -/* - * -------------------------------------------------------------------------- - * NAS procedures triggered by the user - * -------------------------------------------------------------------------- - */ -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: nas_proc_enable_s1_mode() ** - ** ** - ** Description: Notify the EPS Mobility Manager that the UE can be ** - ** operated ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_enable_s1_mode(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify the EMM procedure call manager that EPS capability - * of the UE is enabled - */ - _nas_proc_data.EPS_capability_status = TRUE; - emm_sap.primitive = EMMREG_S1_ENABLED; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_disable_s1_mode() ** - ** ** - ** Description: Notify the EPS Mobility Manager that the S1 mode is no ** - ** longer activated ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_disable_s1_mode(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify the EMM procedure call manager that EPS capability - * of the UE is disabled - */ - _nas_proc_data.EPS_capability_status = FALSE; - emm_sap.primitive = EMMREG_S1_DISABLED; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_eps() ** - ** ** - ** Description: Get the current value of the EPS capability status ** - ** ** - ** Inputs: None ** - ** Others: _nas_proc_data ** - ** ** - ** Outputs: stat: The current value of the EPS capability ** - ** status ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_eps(int *stat) -{ - LOG_FUNC_IN; - - *stat = _nas_proc_data.EPS_capability_status; - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_imsi() ** - ** ** - ** Description: Get the International Mobile Subscriber Identity number ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: imsi: The value of the IMSI ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_imsi(char *imsi_str) -{ - LOG_FUNC_IN; - - const imsi_t *imsi = emm_main_get_imsi(); - - if (imsi != NULL) { - int offset = 0; - offset += sprintf(imsi_str + offset, "%u%u%u%u%u", - imsi->u.num.digit1, imsi->u.num.digit2, - imsi->u.num.digit3, imsi->u.num.digit4, - imsi->u.num.digit5); - - if (imsi->u.num.digit6 != 0xf) { - offset += sprintf(imsi_str + offset, "%u", imsi->u.num.digit6); - } - - offset += sprintf(imsi_str + offset, "%u%u%u%u%u%u%u%u", - imsi->u.num.digit7, imsi->u.num.digit8, - imsi->u.num.digit9, imsi->u.num.digit10, - imsi->u.num.digit11, imsi->u.num.digit12, - imsi->u.num.digit13, imsi->u.num.digit14); - - if (imsi->u.num.digit15 != 0xf) { - offset += sprintf(imsi_str + offset, "%u", imsi->u.num.digit15); - } - - LOG_FUNC_RETURN (RETURNok); - } - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_msisdn() ** - ** ** - ** Description: Get the Mobile Subscriber dialing number ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: msisdn: The value of the subscriber dialing number ** - ** ton_npi: Type Of Number / Numbering Plan Indicator ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_msisdn(char *msisdn_str, int *ton_npi) -{ - LOG_FUNC_IN; - - const msisdn_t *msisdn = emm_main_get_msisdn(); - - if (msisdn != NULL) { - union { - struct { - Byte_t ext:1; - Byte_t ton:3; - Byte_t npi:4; - } ext_ton_npi; - Byte_t type; - } converter; - converter.ext_ton_npi.ext = msisdn->ext; - converter.ext_ton_npi.ton = msisdn->ton; - converter.ext_ton_npi.npi = msisdn->npi; - *ton_npi = converter.type; - - sprintf(msisdn_str, "%u%u%u%u%u%u%u%u%u%u%u", - msisdn->digit[0].msb, msisdn->digit[0].lsb, - msisdn->digit[1].msb, msisdn->digit[1].lsb, - msisdn->digit[2].msb, msisdn->digit[2].lsb, - msisdn->digit[3].msb, msisdn->digit[3].lsb, - msisdn->digit[4].msb, msisdn->digit[4].lsb, - msisdn->digit[5].msb); - - LOG_FUNC_RETURN (RETURNok); - } - - LOG_FUNC_RETURN (RETURNerror); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_signal_quality() ** - ** ** - ** Description: Get the signal strength/quality parameters ** - ** ** - ** Inputs: None ** - ** Others: _nas_proc_data ** - ** ** - ** Outputs: rsrq: Reference signal received quality value ** - ** rsrp: Reference signal received power value ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_signal_quality(int *rsrq, int *rsrp) -{ - LOG_FUNC_IN; - - *rsrq = _nas_proc_data.rsrq; - *rsrp = _nas_proc_data.rsrp; - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_register() ** - ** ** - ** Description: Execute the network selection and registration procedure. ** - ** ** - ** Inputs: mode: Network selection mode of operation ** - ** format: Represention format of the operator iden- ** - ** tifier ** - ** oper: Identifier of the network operator to re- ** - ** gister ** - ** AcT: The selected Access Technology ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_register(int mode, int format, const network_plmn_t *oper, int AcT) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - /* - * Set the PLMN selection mode of operation - */ - int index = emm_main_set_plmn_selection_mode(mode, format, oper, AcT); - - if ( !(index < 0) ) { - /* - * Notify the EMM procedure call manager that network (re)selection - * procedure has to be executed - */ - emm_sap_t emm_sap; - emm_sap.primitive = EMMREG_REGISTER_REQ; - emm_sap.u.emm_reg.u.regist.index = index; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_deregister() ** - ** ** - ** Description: Execute the network deregistration procedure. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_deregister(void) -{ - LOG_FUNC_IN; - - /* TODO: Force an attempt to deregister from the network */ - LOG_TRACE(ERROR, "NAS-PROC - Network deregistration procedure is " - "not implemented"); - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_reg_data() ** - ** ** - ** Description: Gets network registration data from EMM ** - ** ** - ** Inputs: format: Format of the representation of the net- ** - ** work operator identifier ** - ** Others: None ** - ** ** - ** Outputs: mode: The current network selection mode of ope- ** - ** ration ** - ** oper: The identifier of the selected network ** - ** operator ** - ** AcT: The access technology currently used ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_reg_data(int *mode, int *selected, int format, - network_plmn_t *oper, int *AcT) -{ - LOG_FUNC_IN; - - /* Get the PLMN selection mode of operation */ - *mode = emm_main_get_plmn_selection_mode(); - - /* Get the currently selected operator */ - const char *oper_name = emm_main_get_selected_plmn(oper, format); - - if (oper_name != NULL) { - /* An operator is currently selected */ - *selected = TRUE; - /* Get the supported Radio Access Technology */ - *AcT = emm_main_get_plmn_rat(); - } else { - /* No any operator is selected */ - *selected = FALSE; - *AcT = NET_ACCESS_UNAVAILABLE; - } - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_oper_list() ** - ** ** - ** Description: Gets the list of operators present in the network ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: oper_list: The list of operators ** - ** Return: The size of the list in bytes ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_oper_list(const char **oper_list) -{ - LOG_FUNC_IN; - - int size = emm_main_get_plmn_list(oper_list); - - LOG_FUNC_RETURN (size); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_reg_status() ** - ** ** - ** Description: Get the value of the network registration status which ** - ** shows whether the network has currently indicated the ** - ** registration of the UE ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: stat: The current network registration status ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_reg_status(int *stat) -{ - LOG_FUNC_IN; - - *stat = emm_main_get_plmn_status(); - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_loc_info() ** - ** ** - ** Description: Get the location information when the UE is registered in ** - ** the Network ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: tac: The code of the tracking area the registe- ** - ** red PLMN belongs to ** - ** ci: The identifier of the serving cell ** - ** AcT: The access technology in used ** - ** rac: The GPRS routing area code, if available ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_loc_info(char *tac, char *ci, int *AcT) -{ - LOG_FUNC_IN; - - sprintf(tac, "%.4x", emm_main_get_plmn_tac()); // two byte - sprintf(ci, "%.8x", emm_main_get_plmn_ci()); // four byte - *AcT = emm_main_get_plmn_rat(); // E-UTRAN - - LOG_FUNC_RETURN (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_detach() ** - ** ** - ** Description: Initiates a detach procedure ** - ** ** - ** Inputs: switch_off: TRUE if the detach is due to UE switch-off ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_detach(int switch_off) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc = RETURNok; - - if ( emm_main_is_attached() ) { - /* Initiate an Detach procedure */ - emm_sap.primitive = EMMREG_DETACH_INIT; - emm_sap.u.emm_reg.u.detach.switch_off = switch_off; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_attach() ** - ** ** - ** Description: Initiates an attach procedure ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_attach(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc = RETURNok; - - if ( !emm_main_is_attached() ) { - /* Initiate an Attach procedure */ - emm_sap.primitive = EMMREG_ATTACH_INIT; - emm_sap.u.emm_reg.u.attach.is_emergency = FALSE; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_attach_status() ** - ** ** - ** Description: Gets the current network attachment status ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: TRUE if the UE is currently attached to ** - ** the network ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_attach_status(void) -{ - LOG_FUNC_IN; - - int is_attached = emm_main_is_attached(); - - LOG_FUNC_RETURN (is_attached); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_pdn_range() ** - ** ** - ** Description: Gets the maximum value of a PDN context identifier ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The PDN context identifier maximum value ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_pdn_range(void) -{ - LOG_FUNC_IN; - - int max_pdn_id = esm_main_get_nb_pdns_max(); - - LOG_FUNC_RETURN (max_pdn_id); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_pdn_status() ** - ** ** - ** Description: Gets the activation state of every defined PDN contexts ** - ** ** - ** Inputs: n_pdn_max: Maximum number of PDN contexts ** - ** Others: None ** - ** ** - ** Outputs: cids: List of PDN context identifiers ** - ** states: List of PDN context activation states ** - ** Return: The number of PDN contexts that are cur- ** - ** rently in a defined state ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_pdn_status(int *cids, int *states, int n_pdn_max) -{ - LOG_FUNC_IN; - - int cid; - int n_defined_pdn = 0; - - /* Get the maximum number of supported PDN contexts */ - int n_pdn = esm_main_get_nb_pdns_max(); - - /* For all PDN contexts */ - for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) { - /* Get the status of this PDN */ - int state = FALSE; - int is_defined = esm_main_get_pdn_status(cid, &state); - - if (is_defined != FALSE) { - /* This PDN has been defined */ - *(cids++) = cid; - *(states++) = state; - n_defined_pdn += 1; - } - } - - LOG_FUNC_RETURN (n_defined_pdn); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_pdn_param() ** - ** ** - ** Description: Gets the parameters of every defined PDN contexts ** - ** ** - ** Inputs: n_pdn_max: Maximum number of PDN contexts ** - ** Others: None ** - ** ** - ** Outputs: cids: List of PDN context identifiers ** - ** types: List of PDN types (IPv4, IPv6, IPv4v6) ** - ** apns: List of Access Point Names ** - ** Return: The number of PDN contexts that are cur- ** - ** rently in a defined state ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_pdn_param(int *cids, int *types, const char **apns, - int n_pdn_max) -{ - LOG_FUNC_IN; - - int cid; - int n_defined_pdn = 0; - - /* Get the maximum number of supported PDN contexts */ - int n_pdn = esm_main_get_nb_pdns_max(); - - /* For all PDN contexts */ - for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) { - int emergency, active; - /* Get PDN connection parameters */ - int rc = esm_main_get_pdn(cid, types, apns, &emergency, &active); - - if (rc != RETURNerror) { - /* This PDN has been defined */ - *(cids++) = cid; - types++; - apns++; - n_defined_pdn += 1; - } - } - - LOG_FUNC_RETURN (n_defined_pdn); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_get_pdn_addr() ** - ** ** - ** Description: When the cid parameter value is positive, gets the addres-** - ** s(es) assigned to the specified PDN context. ** - ** When the cid parameter value is negative, gets the addres-** - ** s(es) assigned to each defined PDN context. ** - ** When the cid parameter value is null, gets the list of ** - ** defined PDN contexts. ** - ** ** - ** Inputs: cid: PDN context identifier ** - ** n_pdn_max: Maximum number of PDN contexts ** - ** Others: None ** - ** ** - ** Outputs: cids: List of PDN context identifiers ** - ** addr1: List of IPv4 addresses ** - ** addr2: List of IPv6 addresses ** - ** Return: The number PDN contexts that have at least ** - ** one IP address assigned ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_get_pdn_addr(int cid, int *cids, const char **addr1, - const char **addr2, int n_pdn_max) -{ - LOG_FUNC_IN; - - int rc; - int n_defined_pdn = 0; - - if (cid > 0) { - /* Get addresses assigned to the specified PDN */ - rc = esm_main_get_pdn_addr(cid, addr1, addr2); - - if (rc != RETURNerror) { - *cids = cid; - n_defined_pdn = 1; - } - } else if (cid < 0) { - /* Get the maximum number of supported PDN contexts */ - int n_pdn = esm_main_get_nb_pdns_max(); - - /* For all PDN contexts */ - for (cid = 1; (cid < n_pdn+1) && (n_defined_pdn < n_pdn_max); cid++) { - /* Get PDN connection addresses */ - rc = esm_main_get_pdn_addr(cid, addr1, addr2); - - if (rc != RETURNerror) { - /* This PDN has been defined */ - *(cids++) = cid; - addr1++; - addr2++; - n_defined_pdn += 1; - } - } - } else { - /* Get the list of defined PDN contexts */ - - } - - LOG_FUNC_RETURN (n_defined_pdn); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_set_pdn() ** - ** ** - ** Description: Setup parameters of a specified PDN context ** - ** ** - ** Inputs: cid: Identifier of the PDN context to setup ** - ** type: Type of PDN (IPv4, IPv6,IPv4v6) ** - ** apn: Access Point Name of the external network ** - ** to connect to ** - ** ipv4_addr: IPv4 address allocation (NAS, DHCP) ** - ** emergency: Emergency bearer support indication ** - ** p_cscf: Preference of P-CSCF address discovery ** - ** im_cn_signal: IM CN subsystem-related signalling indica- ** - ** tion parameter ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_set_pdn(int cid, int type, const char *apn, int ipv4_addr, - int emergency, int p_cscf, int im_cn_signal) -{ - LOG_FUNC_IN; - - int rc; - - esm_sap_t esm_sap; - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ; - esm_sap.is_standalone = TRUE; - esm_sap.data.pdn_connect.is_defined = FALSE; - esm_sap.data.pdn_connect.cid = cid; - esm_sap.data.pdn_connect.pdn_type = type; - esm_sap.data.pdn_connect.apn = apn; - esm_sap.data.pdn_connect.is_emergency = emergency; - /* - * Notify ESM that a new PDN context has to be defined for - * the specified APN - */ - rc = esm_sap_send(&esm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_reset_pdn() ** - ** ** - ** Description: Reset parameters of a specified PDN context ** - ** ** - ** Inputs: cid: Identifier of the PDN context to setup ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_reset_pdn(int cid) -{ - LOG_FUNC_IN; - - int rc; - - esm_sap_t esm_sap; - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REJ; - esm_sap.is_standalone = TRUE; - esm_sap.data.pdn_connect.is_defined = TRUE; - esm_sap.data.pdn_connect.cid = cid; - /* - * Notify ESM that the specified PDN context has to be undefined - */ - rc = esm_sap_send(&esm_sap); - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_deactivate_pdn() ** - ** ** - ** Description: Deactivates specified PDN context or all PDN contexts if ** - ** specified cid is negative ** - ** ** - ** Inputs: cid: Identifier of the PDN context to be deac- ** - ** tivate ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_deactivate_pdn(int cid) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - if (cid > 0) { - /* Deactivate only the specified PDN context */ - rc = _nas_proc_deactivate(cid, FALSE); - } else { - /* Do not deactivate the PDN connection established during initial - * network attachment (identifier 1) */ - cid = 2; - - /* Deactivate all active PDN contexts */ - while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max()+1)) { - rc = _nas_proc_deactivate(cid++, TRUE); - } - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_activate_pdn() ** - ** ** - ** Description: Activates specified PDN context or all PDN contexts if ** - ** specified cid is negative ** - ** ** - ** Inputs: cid: Identifier of the PDN context to be act- ** - ** tivate ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_activate_pdn(int cid) -{ - LOG_FUNC_IN; - - int rc = RETURNok; - - if ( !emm_main_is_attached() ) { - /* - * If the UE is not attached to the network, perform EPS attach - * procedure prior to attempt to request any PDN connectivity - */ - LOG_TRACE(WARNING, "NAS-PROC - UE is not attached to the network"); - rc = nas_proc_attach(); - } else if (emm_main_is_emergency()) { - /* The UE is attached for emergency bearer services; It shall not - * request a PDN connection to any other PDN */ - LOG_TRACE(WARNING,"NAS-PROC - Attached for emergency bearer services"); - rc = RETURNerror; - } - - if (rc != RETURNerror) { - if (cid > 0) { - /* Activate only the specified PDN context */ - rc = _nas_proc_activate(cid, FALSE); - } else { - cid = 1; - - /* Activate all defined PDN contexts */ - while ((rc != RETURNerror) && (cid < esm_main_get_nb_pdns_max()+1)) { - rc = _nas_proc_activate(cid++, TRUE); - } - } - } - - LOG_FUNC_RETURN (rc); -} - -/* - * -------------------------------------------------------------------------- - * NAS procedures triggered by the network - * -------------------------------------------------------------------------- - */ - -/**************************************************************************** - ** ** - ** Name: nas_proc_cell_info() ** - ** ** - ** Description: Processes the cell information received from the network ** - ** ** - ** Inputs: found: Indicates whether a suitable cell is found ** - ** for the selected PLMN to camp on ** - ** tac: The code of the tracking area the PLMN ** - ** belongs to ** - ** ci: The identifier of a cell serving this PLMN ** - ** AcT: The access technology supported by the ** - ** serving cell ** - ** rsrq: Reference signal received quality measure- ** - ** ment ** - ** rsrp: Reference signal received power measure- ** - ** ment ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _nas_proc_data ** - ** ** - ***************************************************************************/ -int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t AcT, - UInt8_t rsrq, UInt8_t rsrp) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* Store LTE signal strength/quality measurement data */ - _nas_proc_data.rsrq = rsrq; - _nas_proc_data.rsrp = rsrp; - - /* - * Notify the EMM procedure call manager that cell information - * have been received from the Access-Stratum sublayer - */ - emm_sap.primitive = EMMAS_CELL_INFO_RES; - emm_sap.u.emm_as.u.cell_info.found = found; - emm_sap.u.emm_as.u.cell_info.plmnIDs.n_plmns = 0; - emm_sap.u.emm_as.u.cell_info.rat = AcT; - emm_sap.u.emm_as.u.cell_info.tac = tac; - emm_sap.u.emm_as.u.cell_info.cellID = ci; - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_establish_cnf() ** - ** ** - ** Description: Processes the NAS signalling connection establishment ** - ** confirm message received from the network ** - ** ** - ** Inputs: data: The initial NAS message transfered within ** - ** the message ** - ** len: The length of the initial NAS message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_establish_cnf(const Byte_t *data, UInt32_t len) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify the EMM procedure call manager that NAS signalling - * connection establishment confirm message has been received - * from the Access-Stratum sublayer - */ - emm_sap.primitive = EMMAS_ESTABLISH_CNF; - emm_sap.u.emm_as.u.establish.NASmsg.length = len; - emm_sap.u.emm_as.u.establish.NASmsg.value = (uint8_t *)data; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_establish_rej() ** - ** ** - ** Description: Processes the NAS signalling connection establishment ** - ** confirm message received from the network while initial ** - ** NAS message has not been delivered to the NAS sublayer on ** - ** the receiver side. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_establish_rej(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify the EMM procedure call manager that transmission - * failure of initial NAS message indication has been received - * from lower layers - */ - emm_sap.primitive = EMMAS_ESTABLISH_REJ; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_release_ind() ** - ** ** - ** Description: Processes the NAS signalling connection release indica- ** - ** tion message received from the network ** - ** ** - ** Inputs: cause: The release cause ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_release_ind(int cause) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify the EMM procedure call manager that the NAS signalling - * connection has been terminated by the network - */ - emm_sap.primitive = EMMAS_RELEASE_IND; - emm_sap.u.emm_as.u.release.cause = cause; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_ul_transfer_cnf() ** - ** ** - ** Description: Processes the uplink data transfer confirm message recei- ** - ** ved from the network while NAS message has been success- ** - ** fully delivered to the NAS sublayer on the receiver side. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_ul_transfer_cnf(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify the EMM procedure call manager that uplink NAS message - * has been successfully delivered to the NAS sublayer on the - * receiver side - */ - emm_sap.primitive = EMMAS_DATA_IND; - emm_sap.u.emm_as.u.data.ueid = 0; - emm_sap.u.emm_as.u.data.delivered = TRUE; - emm_sap.u.emm_as.u.data.NASmsg.length = 0; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_ul_transfer_rej() ** - ** ** - ** Description: Processes the uplink data transfer confirm message recei- ** - ** ved from the network while NAS message has not been deli- ** - ** vered to the NAS sublayer on the receiver side. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_ul_transfer_rej(void) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - /* - * Notify the EMM procedure call manager that transmission - * failure of uplink NAS message indication has been received - * from lower layers - */ - emm_sap.primitive = EMMAS_DATA_IND; - emm_sap.u.emm_as.u.data.ueid = 0; - emm_sap.u.emm_as.u.data.delivered = FALSE; - emm_sap.u.emm_as.u.data.NASmsg.length = 0; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_dl_transfer_ind() ** - ** ** - ** Description: Processes downlink data transfer indication message re- ** - ** ceived from the network ** - ** ** - ** Inputs: data: The transfered NAS message ** - ** len: The length of the NAS message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_dl_transfer_ind(const Byte_t *data, UInt32_t len) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - if (len > 0) { - emm_sap_t emm_sap; - /* - * Notify the EMM procedure call manager that data transfer - * indication has been received from the Access-Stratum sublayer - */ - emm_sap.primitive = EMMAS_DATA_IND; - emm_sap.u.emm_as.u.data.ueid = 0; - emm_sap.u.emm_as.u.data.delivered = TRUE; - emm_sap.u.emm_as.u.data.NASmsg.length = len; - emm_sap.u.emm_as.u.data.NASmsg.value = (uint8_t *)data; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN (rc); -} -#endif // NAS_UE - -#ifdef NAS_MME -/**************************************************************************** - ** ** - ** Name: nas_proc_establish_ind() ** - ** ** - ** Description: Processes the NAS signalling connection establishment ** - ** indication message received from the network ** - ** ** - ** Inputs: ueid: UE identifier ** - ** tac: The code of the tracking area the initia- ** - ** ting UE belongs to ** - ** data: The initial NAS message transfered within ** - ** the message ** - ** len: The length of the initial NAS message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_establish_ind(UInt32_t ueid, tac_t tac, - const Byte_t *data, UInt32_t len) -{ - LOG_FUNC_IN; - - int rc = RETURNerror; - - if (len > 0) { - emm_sap_t emm_sap; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMAS_ESTABLISH_REQ ue id %06"PRIX32" tac %u", ueid, tac); - /* - * Notify the EMM procedure call manager that NAS signalling - * connection establishment indication message has been received - * from the Access-Stratum sublayer - */ - emm_sap.primitive = EMMAS_ESTABLISH_REQ; - emm_sap.u.emm_as.u.establish.ueid = ueid; - emm_sap.u.emm_as.u.establish.NASmsg.length = len; - emm_sap.u.emm_as.u.establish.NASmsg.value = (uint8_t *)data; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_dl_transfer_cnf() ** - ** ** - ** Description: Processes the downlink data transfer confirm message re- ** - ** ceived from the network while NAS message has been succes-** - ** sfully delivered to the NAS sublayer on the receiver side.** - ** ** - ** Inputs: ueid: UE identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_dl_transfer_cnf(UInt32_t ueid) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMAS_DATA_IND dl_transfer_conf ue id %06"PRIX32"", ueid); - - /* - * Notify the EMM procedure call manager that downlink NAS message - * has been successfully delivered to the NAS sublayer on the - * receiver side - */ - emm_sap.primitive = EMMAS_DATA_IND; - emm_sap.u.emm_as.u.data.ueid = ueid; - emm_sap.u.emm_as.u.data.delivered = TRUE; - emm_sap.u.emm_as.u.data.NASmsg.length = 0; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_dl_transfer_rej() ** - ** ** - ** Description: Processes the downlink data transfer confirm message re- ** - ** ceived from the network while NAS message has not been ** - ** delivered to the NAS sublayer on the receiver side. ** - ** ** - ** Inputs: ueid: UE identifier ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_dl_transfer_rej(UInt32_t ueid) -{ - LOG_FUNC_IN; - - emm_sap_t emm_sap; - int rc; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMAS_DATA_IND dl_transfer_reject ue id %06"PRIX32"", ueid); - - /* - * Notify the EMM procedure call manager that transmission - * failure of downlink NAS message indication has been received - * from lower layers - */ - emm_sap.primitive = EMMAS_DATA_IND; - emm_sap.u.emm_as.u.data.ueid = ueid; - emm_sap.u.emm_as.u.data.delivered = FALSE; - emm_sap.u.emm_as.u.data.NASmsg.length = 0; - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: nas_proc_ul_transfer_ind() ** - ** ** - ** Description: Processes uplink data transfer indication message recei- ** - ** ved from the network ** - ** ** - ** Inputs: ueid: UE identifier ** - ** data: The transfered NAS message ** - ** len: The length of the NAS message ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len) -{ - int rc = RETURNerror; - - LOG_FUNC_IN; - - if (len > 0) { - emm_sap_t emm_sap; - /* - * Notify the EMM procedure call manager that data transfer - * indication has been received from the Access-Stratum sublayer - */ - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMAS_DATA_IND ue id %06"PRIX32" len %u", ueid, len); - - emm_sap.primitive = EMMAS_DATA_IND; - emm_sap.u.emm_as.u.data.ueid = ueid; - emm_sap.u.emm_as.u.data.delivered = TRUE; - emm_sap.u.emm_as.u.data.NASmsg.length = len; - emm_sap.u.emm_as.u.data.NASmsg.value = (uint8_t *)data; - rc = emm_sap_send(&emm_sap); - } - - LOG_FUNC_RETURN (rc); -} - -# if defined(NAS_BUILT_IN_EPC) -int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res) -{ - int rc = RETURNerror; - emm_sap_t emm_sap; - - LOG_FUNC_IN; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMCN_AUTHENTICATION_PARAM_RES"); - - emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_RES; - emm_sap.u.emm_cn.u.auth_res = emm_cn_auth_res; - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail) -{ - int rc = RETURNerror; - emm_sap_t emm_sap; - - LOG_FUNC_IN; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMCN_AUTHENTICATION_PARAM_FAIL"); - - emm_sap.primitive = EMMCN_AUTHENTICATION_PARAM_FAIL; - emm_sap.u.emm_cn.u.auth_fail = emm_cn_auth_fail; - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -int nas_proc_deregister_ue(UInt32_t ue_id) -{ - int rc = RETURNerror; - emm_sap_t emm_sap; - - LOG_FUNC_IN; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMCN_DEREGISTER_UE ue_id %06"PRIX32"",ue_id); - - emm_sap.primitive = EMMCN_DEREGISTER_UE; - emm_sap.u.emm_cn.u.deregister.UEid = ue_id; - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -int nas_proc_pdn_connectivity_res(emm_cn_pdn_res_t *emm_cn_pdn_res) -{ - int rc = RETURNerror; - emm_sap_t emm_sap; - - LOG_FUNC_IN; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMCN_PDN_CONNECTIVITY_RES"); - - emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_RES; - emm_sap.u.emm_cn.u.emm_cn_pdn_res = emm_cn_pdn_res; - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - -int nas_proc_pdn_connectivity_fail(emm_cn_pdn_fail_t *emm_cn_pdn_fail) -{ - int rc = RETURNerror; - emm_sap_t emm_sap; - - LOG_FUNC_IN; - - MSC_LOG_TX_MESSAGE( - MSC_NAS_MME, - MSC_NAS_EMM_MME, - NULL,0, - "0 EMMCN_PDN_CONNECTIVITY_FAIL"); - - emm_sap.primitive = EMMCN_PDN_CONNECTIVITY_FAIL; - emm_sap.u.emm_cn.u.emm_cn_pdn_fail = emm_cn_pdn_fail; - - rc = emm_sap_send(&emm_sap); - - LOG_FUNC_RETURN (rc); -} - - - -# endif -#endif // NAS_MME - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -#ifdef NAS_UE -/**************************************************************************** - ** ** - ** Name: _nas_proc_activate() ** - ** ** - ** Description: Initiates a PDN connectivity procedure ** - ** ** - ** Inputs: cid: Identifier of the PDN context used to es- ** - ** tablished connectivity to specified PDN ** - ** apply_to_all: TRUE if the PDN connectivity procedure is ** - ** initiated to establish connectivity to all ** - ** defined PDNs ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_proc_activate(int cid, int apply_to_all) -{ - LOG_FUNC_IN; - - int rc; - int active = FALSE; - - esm_sap_t esm_sap; - - /* Get PDN context parameters */ - rc = esm_main_get_pdn(cid, &esm_sap.data.pdn_connect.pdn_type, - &esm_sap.data.pdn_connect.apn, - &esm_sap.data.pdn_connect.is_emergency, &active); - - if (rc != RETURNok) { - /* No any context is defined for the specified PDN */ - if (apply_to_all) { - /* Go ahead to activate next PDN context */ - LOG_FUNC_RETURN (RETURNok); - } - - /* Return an error */ - LOG_FUNC_RETURN (RETURNerror); - } - - if (active) { - /* The PDN context is already active */ - LOG_TRACE(WARNING, "NAS-PROC - PDN connection %d is active", cid); - LOG_FUNC_RETURN (RETURNok); - } - - if (esm_sap.data.pdn_connect.is_emergency) { - if (esm_main_has_emergency()) { - /* There is already a PDN connection for emergency - * bearer services established; the UE shall not - * request an additional PDN connection for emer- - * gency bearer services */ - LOG_TRACE(WARNING, "NAS-PROC - PDN connection for emergency " - "bearer services is already established (cid=%d)", cid); - LOG_FUNC_RETURN (RETURNerror); - } - } - - /* - * Notify ESM that a default EPS bearer has to be established - * for the specified PDN - */ - esm_sap.primitive = ESM_PDN_CONNECTIVITY_REQ; - esm_sap.is_standalone = TRUE; - esm_sap.data.pdn_connect.is_defined = TRUE; - esm_sap.data.pdn_connect.cid = cid; - rc = esm_sap_send(&esm_sap); - - LOG_FUNC_RETURN (rc); -} - -/**************************************************************************** - ** ** - ** Name: _nas_proc_deactivate() ** - ** ** - ** Description: Initiates a PDN disconnect procedure ** - ** ** - ** Inputs: cid: Identifier of the PDN context ** - ** apply_to_all: TRUE if the PDN disconnect procedure is ** - ** initiated to request disconnection from ** - ** all active PDNs ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_proc_deactivate(int cid, int apply_to_all) -{ - LOG_FUNC_IN; - - int rc; - int pdn_type; - const char *apn; - int emergency = FALSE; - int active = FALSE; - - /* Get PDN context parameters */ - rc = esm_main_get_pdn(cid, &pdn_type, &apn, &emergency, &active); - - if (rc != RETURNok) { - /* No any context is defined for the specified PDN */ - if (apply_to_all) { - /* Go ahead to deactivate next PDN connection */ - LOG_FUNC_RETURN (RETURNok); - } - - LOG_FUNC_RETURN (RETURNerror); - } - - if (!active) { - /* The PDN connection is already inactive */ - LOG_TRACE(WARNING, "NAS-PROC - PDN connection %d is not active", cid); - LOG_FUNC_RETURN (RETURNok); - } - - if (esm_main_get_nb_pdns() > 1) { - /* - * Notify ESM that all EPS bearers towards the specified PDN - * has to be released - */ - esm_sap_t esm_sap; - esm_sap.primitive = ESM_PDN_DISCONNECT_REQ; - esm_sap.data.pdn_disconnect.cid = cid; - rc = esm_sap_send(&esm_sap); - } else { - /* For EPS, if an attempt is made to disconnect the last PDN - * connection, then the MT responds with an error */ - LOG_TRACE(WARNING,"NAS-PROC - " - "Attempt to disconnect from the last PDN is not allowed"); - rc = RETURNerror; - } - - LOG_FUNC_RETURN (rc); -} - -#endif // NAS_UE - diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.h b/openair-cn/NAS/EURECOM-NAS/src/nas_proc.h deleted file mode 100644 index 11573a176479b4c002578dac45b0d226ba69055f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_proc.h +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_proc.h - -Version 0.1 - -Date 2012/09/20 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS procedure call manager - -*****************************************************************************/ -#ifndef __NAS_PROC_H__ -#define __NAS_PROC_H__ - -#if defined(NAS_BUILT_IN_EPC) -# include "mme_config.h" -# include "emm_cnDef.h" -#endif - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#ifdef NAS_UE -void nas_proc_initialize(emm_indication_callback_t emm_cb, - esm_indication_callback_t esm_cb, const char *imei); -#endif -#ifdef NAS_MME -# if defined(NAS_BUILT_IN_EPC) -void nas_proc_initialize(mme_config_t *mme_config_p); -# else -void nas_proc_initialize(void); -# endif -#endif - -void nas_proc_cleanup(void); - -/* - * -------------------------------------------------------------------------- - * NAS procedures triggered by the user - * -------------------------------------------------------------------------- - */ - -#ifdef NAS_UE -int nas_proc_enable_s1_mode(void); -int nas_proc_disable_s1_mode(void); -int nas_proc_get_eps(int *stat); - -int nas_proc_get_imsi(char *imsi_str); -int nas_proc_get_msisdn(char *msisdn_str, int *ton_npi); - -int nas_proc_get_signal_quality(int *rsrq, int *rsrp); - -int nas_proc_register(int mode, int format, const network_plmn_t *oper, int AcT); -int nas_proc_deregister(void); -int nas_proc_get_reg_data(int *mode, int *selected, int format, - network_plmn_t *oper, int *AcT); -int nas_proc_get_oper_list(const char **oper_list); - -int nas_proc_get_reg_status(int *stat); -int nas_proc_get_loc_info(char *tac, char *ci, int *AcT); - -int nas_proc_detach(int switch_off); -int nas_proc_attach(void); -int nas_proc_get_attach_status(void); - -int nas_proc_reset_pdn(int cid); -int nas_proc_set_pdn(int cid, int type, const char *apn, int ipv4_addr, - int emergency, int p_cscf, int im_cn_signal); -int nas_proc_get_pdn_range(void); -int nas_proc_get_pdn_status(int *cids, int *states, int n_pdn_max); -int nas_proc_get_pdn_param(int *cids, int *types, const char **apns, - int n_pdn_max); -int nas_proc_get_pdn_addr(int cid, int *cids, const char **addr1, - const char **addr2, int n_addr_max); -int nas_proc_deactivate_pdn(int cid); -int nas_proc_activate_pdn(int cid); -#endif - -/* - * -------------------------------------------------------------------------- - * NAS procedures triggered by the network - * -------------------------------------------------------------------------- - */ - -#ifdef NAS_UE -int nas_proc_cell_info(int found, tac_t tac, ci_t ci, AcT_t rat, UInt8_t rsrp, - UInt8_t rsrq); - -int nas_proc_establish_cnf(const Byte_t *data, UInt32_t len); -int nas_proc_establish_rej(void); - -int nas_proc_release_ind(int cause); - -int nas_proc_ul_transfer_cnf(void); -int nas_proc_ul_transfer_rej(void); -int nas_proc_dl_transfer_ind(const Byte_t *data, UInt32_t len); -#endif - -#ifdef NAS_MME -int nas_proc_establish_ind(UInt32_t ueid, tac_t tac, const Byte_t *data, - UInt32_t len); - -int nas_proc_dl_transfer_cnf(UInt32_t ueid); -int nas_proc_dl_transfer_rej(UInt32_t ueid); -int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len); -#endif - -/* - * -------------------------------------------------------------------------- - * NAS procedures triggered by the mme applicative layer - * -------------------------------------------------------------------------- - */ -#if defined(NAS_MME) && defined(NAS_BUILT_IN_EPC) -int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res); -int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail); -int nas_proc_deregister_ue(UInt32_t ue_id); -int nas_proc_pdn_connectivity_res(nas_pdn_connectivity_rsp_t *nas_pdn_connectivity_rsp); -int nas_proc_pdn_connectivity_fail(nas_pdn_connectivity_fail_t *nas_pdn_connectivity_fail); -#endif - -#endif /* __NAS_PROC_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_user.c b/openair-cn/NAS/EURECOM-NAS/src/nas_user.c deleted file mode 100644 index 37e55c7e7fd7e23456823255b1bd30dbac749a50..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_user.c +++ /dev/null @@ -1,2679 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_user.c - -Version 0.1 - -Date 2012/03/09 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS procedure functions triggered by the user - -*****************************************************************************/ - -#ifdef NAS_UE - -#include "nas_user.h" -#include "userDef.h" -#include "nas_log.h" -#include "memory.h" - -#include "at_command.h" -#include "at_response.h" -#include "at_error.h" -#include "user_indication.h" -#include "nas_proc.h" -#include "user_api.h" - -#include <string.h> // memset, strncpy, strncmp -#include <stdlib.h> // free - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * --------------------------------------------------------------------- - * Functions executed upon receiving AT command from the user - * --------------------------------------------------------------------- - */ -static int _nas_user_proc_cgsn (const at_command_t *data); -static int _nas_user_proc_cgmi (const at_command_t *data); -static int _nas_user_proc_cgmm (const at_command_t *data); -static int _nas_user_proc_cgmr (const at_command_t *data); -static int _nas_user_proc_cimi (const at_command_t *data); -static int _nas_user_proc_cfun (const at_command_t *data); -static int _nas_user_proc_cpin (const at_command_t *data); -static int _nas_user_proc_csq (const at_command_t *data); -static int _nas_user_proc_cesq (const at_command_t *data); -static int _nas_user_proc_cops (const at_command_t *data); -static int _nas_user_proc_cgatt (const at_command_t *data); -static int _nas_user_proc_creg (const at_command_t *data); -static int _nas_user_proc_cgreg (const at_command_t *data); -static int _nas_user_proc_cereg (const at_command_t *data); -static int _nas_user_proc_cgdcont (const at_command_t *data); -static int _nas_user_proc_cgact (const at_command_t *data); -static int _nas_user_proc_cmee (const at_command_t *data); -static int _nas_user_proc_clck (const at_command_t *data); -static int _nas_user_proc_cgpaddr (const at_command_t *data); -static int _nas_user_proc_cnum (const at_command_t *data); -static int _nas_user_proc_clac (const at_command_t *data); - -/* NAS procedures applicable to AT commands */ -typedef int (*_nas_user_procedure_t) (const at_command_t *); - -static _nas_user_procedure_t _nas_user_procedure[AT_COMMAND_ID_MAX] = { - NULL, - _nas_user_proc_cgsn, /* CGSN */ - _nas_user_proc_cgmi, /* CGMI */ - _nas_user_proc_cgmm, /* CGMM */ - _nas_user_proc_cgmr, /* CGMR */ - _nas_user_proc_cimi, /* CIMI */ - _nas_user_proc_cfun, /* CFUN */ - _nas_user_proc_cpin, /* CPIN */ - _nas_user_proc_csq, /* CSQ */ - _nas_user_proc_cesq, /* CESQ */ - _nas_user_proc_clac, /* CLAC */ - _nas_user_proc_cmee, /* CMEE */ - _nas_user_proc_cnum, /* CNUM */ - _nas_user_proc_clck, /* CLCK */ - _nas_user_proc_cops, /* COPS */ - _nas_user_proc_creg, /* CREG */ - _nas_user_proc_cgatt, /* CGATT */ - _nas_user_proc_cgreg, /* CGREG */ - _nas_user_proc_cereg, /* CEREG */ - _nas_user_proc_cgdcont, /* CGDCONT */ - _nas_user_proc_cgact, /* CGACT */ - _nas_user_proc_cgpaddr, /* CGPADDR */ -}; - -/* - * Internal representation of data structure returned to the user - * as the result of NAS procedure function call - */ -static at_response_t _nas_user_data = {}; - -/* - * --------------------------------------------------------------------- - * Local UE context - * --------------------------------------------------------------------- - */ -/* - * MT SIM pending status (see ETSI TS 127 007 V10.6.0, Note 2) - * Commands which interact with MT that are accepted when MT is pending SIM PIN, - * SIM PUK, or PH-SIM are: +CGMI, +CGMM, +CGMR, +CGSN, D112; (emergency call), - * +CPAS, +CFUN, +CPIN, +CPINR, +CDIS (read and test command only), and +CIND - * (read and test command only). -*/ -typedef enum { - NAS_USER_READY, /* MT is not pending for any password */ - NAS_USER_SIM_PIN, /* MT is waiting SIM PIN to be given */ - NAS_USER_SIM_PUK, /* MT is waiting SIM PUK to be given */ - NAS_USER_PH_SIM_PIN /* MT is waiting phone-to-SIM card - * password to be given */ -} nas_user_sim_status; -static const char *_nas_user_sim_status_str[] = { - "READY", - "SIM PIN", - "SIM PUK", - "PH-SIM PIN" -}; - -/* - * The local UE context - */ -static struct { - /* Firmware version number */ - const char *version; - /* SIM pending status */ - nas_user_sim_status sim_status; - /* Level of functionality */ - int fun; -} _nas_user_context; - -/* - * --------------------------------------------------------------------- - * UE parameters stored in the UE's non-volatile memory device - * --------------------------------------------------------------------- - */ -static user_nvdata_t _nas_user_nvdata; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: nas_user_initialize() ** - ** ** - ** Description: Initializes user internal data ** - ** ** - ** Inputs: emm_cb: Mobility Management indication callback ** - ** esm_cb: Session Management indication callback ** - ** version: Firmware version ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_user_nvdata, _nas_user_context ** - ** ** - ***************************************************************************/ -void nas_user_initialize(emm_indication_callback_t emm_cb, - esm_indication_callback_t esm_cb, const char *version) -{ - LOG_FUNC_IN; - - /* Get UE's data pathname */ - char *path = memory_get_path(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME); - - if (path == NULL) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get UE's data pathname"); - } - - /* Get UE data stored in the non-volatile memory device */ - else { - int rc = memory_read(path, &_nas_user_nvdata, sizeof(user_nvdata_t)); - - if (rc != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to read %s", path); - } - - free(path); - } - - _nas_user_context.version = version; - _nas_user_context.sim_status = NAS_USER_SIM_PIN; - _nas_user_context.fun = AT_CFUN_FUN_DEFAULT; - - /* Initialize the internal NAS processing data */ - nas_proc_initialize(emm_cb, esm_cb, _nas_user_nvdata.IMEI); - - LOG_FUNC_OUT; -} - -/**************************************************************************** - ** ** - ** Name: nas_user_receive_and_process() ** - ** ** - ** Description: Receives and process messages from user application ** - ** ** - ** Inputs: fd: File descriptor of the connection endpoint ** - ** from which data have been received ** - ** Others: None ** - ** ** - ** Outputs: Return: FALSE, TRUE ** - ** ** - ***************************************************************************/ -int nas_user_receive_and_process(int *fd, char *message) -{ - LOG_FUNC_IN; - - int ret_code; - int nb_command; - int bytes; - int i; - - if (message != NULL) { - /* Set the message in receive buffer (Use to simulate reception of data from UserProcess) */ - bytes = user_api_set_data(message); - } else { - /* Read the user data message */ - bytes = user_api_read_data (*fd); - - if (bytes == RETURNerror) { - /* Failed to read data from the user application layer; - * exit from the receiving loop */ - LOG_TRACE (ERROR, "UE-MAIN - " - "Failed to read data from the user application layer"); - LOG_FUNC_RETURN(TRUE); - } - } - - if (bytes == 0) { - /* A signal was caught before any data were available */ - LOG_FUNC_RETURN(FALSE); - } - - /* Decode the user data message */ - nb_command = user_api_decode_data (bytes); - - for (i = 0; i < nb_command; i++) { - /* Get the user data to be processed */ - const void *data = user_api_get_data (i); - - if (data == NULL) { - /* Failed to get user data at the given index; - * go ahead and process the next user data */ - LOG_TRACE (ERROR, "UE-MAIN - " - "Failed to get user data at index %d", - i); - continue; - } - - /* Process the user data message */ - ret_code = nas_user_process_data (data); - - if (ret_code != RETURNok) { - /* The user data message has not been successfully - * processed; cause code will be encoded and sent back - * to the user */ - LOG_TRACE - (WARNING, "UE-MAIN - " - "The user procedure call failed"); - } - - /* Send response to UserProcess (If not in simulated reception) */ - if (message == NULL) { - /* Encode the user data message */ - bytes = user_api_encode_data (nas_user_get_data (), i == nb_command - 1); - - if (bytes == RETURNerror) { - /* Failed to encode the user data message; - * go ahead and process the next user data */ - continue; - } - - /* Send the data message to the user */ - bytes = user_api_send_data (*fd, bytes); - - if (bytes == RETURNerror) { - /* Failed to send data to the user application layer; - * exit from the receiving loop */ - LOG_TRACE (ERROR, "UE-MAIN - " - "Failed to send data to the user application layer"); - LOG_FUNC_RETURN(TRUE); - } - } - } - - LOG_FUNC_RETURN(FALSE); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_process_data() ** - ** ** - ** Description: Executes AT command operations received from the user and ** - ** calls applicable NAS procedure function. ** - ** ** - ** Inputs: data: Generic pointer to data structure that has ** - ** to be processed ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok if the command has been success- ** - ** fully executed; RETURNerror otherwise ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -int nas_user_process_data(const void *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNerror; - - if (data) { - const at_command_t *user_data = (at_command_t *)(data); - _nas_user_procedure_t nas_procedure; - - LOG_TRACE(INFO, "USR-MAIN - Process %s AT command %d", - (user_data->type == AT_COMMAND_ACT) ? "action" : - (user_data->type == AT_COMMAND_SET) ? "set parameter" : - (user_data->type == AT_COMMAND_GET) ? "get parameter" : - (user_data->type == AT_COMMAND_TST) ? "test parameter" - : "unknown type", user_data->id); - - /* Call NAS procedure applicable to the AT command */ - nas_procedure = _nas_user_procedure[user_data->id]; - - if (nas_procedure != NULL) { - ret_code = (*nas_procedure)(user_data); - } else { - /* AT command related to result format only */ - _nas_user_data.id = user_data->id; - _nas_user_data.type = user_data->type; - _nas_user_data.mask = user_data->mask; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - ret_code = RETURNok; - } - } else { - LOG_TRACE(ERROR, "USR-MAIN - Data to be processed is null"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_get_data() ** - ** ** - ** Description: Get a generic pointer to the internal representation of ** - ** the data structure returned as the result of NAS proce- ** - ** dure function call. ** - ** Casting to the proper type is necessary before its usage. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: A generic pointer to the data structure ** - ** Others: None ** - ** ** - ***************************************************************************/ -const void *nas_user_get_data(void) -{ - LOG_FUNC_IN; - LOG_FUNC_RETURN ((void *) &_nas_user_data); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgsn() ** - ** ** - ** Description: Executes the AT CGSN command operations: ** - ** The AT CGSN command returns information text intended to ** - ** permit the user to identify the individual Mobile ** - ** Equipment to which it is connected to. ** - ** Typically, the text will consist of a single line contai- ** - ** ning the IMEI. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_nvdata ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgsn(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgsn_resp_t *cgsn = &_nas_user_data.response.cgsn; - memset(cgsn, 0, sizeof(at_cgsn_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CGSN_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - /* Get the Product Serial Number Identification (IMEI) */ - strncpy(cgsn->sn, _nas_user_nvdata.IMEI, - AT_RESPONSE_INFO_TEXT_SIZE); - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGSN command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgmi() ** - ** ** - ** Description: Executes the AT CGMI command operations: ** - ** The AT CGMI command returns information text intended to ** - ** permit the user to identify the manufacturer of the Mobi- ** - ** le Equipment to which it is connected to. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_nvdata ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgmi(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgmi_resp_t *cgmi = &_nas_user_data.response.cgmi; - memset(cgmi, 0, sizeof(at_cgmi_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CGMI_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - /* Get the Manufacturer identifier */ - strncpy(cgmi->manufacturer, _nas_user_nvdata.manufacturer, - AT_RESPONSE_INFO_TEXT_SIZE); - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGMI command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgmm() ** - ** ** - ** Description: Executes the AT CGMM command operations: ** - ** The AT CGMM command returns information text intended to ** - ** permit the user to identify specific model of the Mobile ** - ** Equipment to which it is connected to. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_nvdata ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgmm(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgmm_resp_t *cgmm = &_nas_user_data.response.cgmm; - memset(cgmm, 0, sizeof(at_cgmm_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CGMM_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - /* Get the Model identifier */ - strncpy(cgmm->model, _nas_user_nvdata.model, - AT_RESPONSE_INFO_TEXT_SIZE); - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGMM command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgmr() ** - ** ** - ** Description: Executes the AT CGMR command operations: ** - ** The AT CGMR command returns information text intended to ** - ** permit the user to identify the version, revision level ** - ** or date, or other pertinent information of the Mobile ** - ** Equipment to which it is connected to. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgmr(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgmr_resp_t *cgmr = &_nas_user_data.response.cgmr; - memset(cgmr, 0, sizeof(at_cgmr_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CGMR_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - /* Get the revision identifier */ - strncpy(cgmr->revision, _nas_user_context.version, - AT_RESPONSE_INFO_TEXT_SIZE); - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGMR command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cimi() ** - ** ** - ** Description: Executes the AT CIMI command operations: ** - ** The AT CIMI command returns information text intended to ** - ** permit the user to identify the individual SIM card or ** - ** active application in the UICC (GSM or USIM) which is ** - ** attached to the Mobile Equipment to which it is connected ** - ** to. ** - ** Typically, the text will consist of a single line contai- ** - ** ning the IMSI. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_nvdata ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cimi(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cimi_resp_t *cimi = &_nas_user_data.response.cimi; - memset(cimi, 0, sizeof(at_cimi_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CIMI_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* Get the International Mobile Subscriber Identity (IMSI) */ - ret_code = nas_proc_get_imsi(cimi->IMSI); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get IMSI number"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CIMI command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cfun() ** - ** ** - ** Description: Executes the AT CFUN command operations: ** - ** The AT CFUN command is used to set the Mobile Equipment ** - ** to different power consumption states. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cfun(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cfun_resp_t *cfun = &_nas_user_data.response.cfun; - memset(cfun, 0, sizeof(at_cfun_resp_t)); - - int fun = AT_CFUN_FUN_DEFAULT; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CFUN_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - - /* - * Set command selects the level of functionality in the MT - */ - if (data->mask & AT_CFUN_RST_MASK) { - if (data->command.cfun.rst == AT_CFUN_RST) { - /* TODO: Reset the MT before setting it to <fun> power level */ - } else if (data->command.cfun.rst != AT_CFUN_NORST) { - /* The value of the reset parameter is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <rst> parameter is not valid" - " (%d)", data->command.cfun.rst); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - } - - if (data->mask & AT_CFUN_FUN_MASK) { - if ( (data->command.cfun.fun < AT_CFUN_MIN) || - (data->command.cfun.fun > AT_CFUN_MAX) ) { - /* The value of the functionality level parameter - * is not valid; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <fun> parameter is not valid" - " (%d)", data->command.cfun.fun); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Set to the selected parameter value */ - fun = data->command.cfun.fun; - } - - switch (fun) { - case AT_CFUN_MIN: - /* TODO: Shutdown ??? */ - break; - - case AT_CFUN_FULL: - /* Notify the NAS procedure call manager that the UE is - * operational */ - ret_code = nas_proc_enable_s1_mode(); - break; - - default: - /* TODO: Disable the radio ??? */ - break; - } - - if (ret_code != RETURNerror) { - /* Update the functionality level */ - _nas_user_context.fun = fun; - } - - break; - - case AT_COMMAND_GET: - /* Get the MT's functionality level */ - cfun->fun = _nas_user_context.fun; - break; - - case AT_COMMAND_TST: - /* - * Test command returns values supported as a compound value - */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CFUN command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cpin() ** - ** ** - ** Description: Executes the AT CPIN command operations: ** - ** The AT CPIN command is used to enter the Mobile Equipment ** - ** passwords which are needed before any other functionality ** - ** can be operated. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_context, _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cpin(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cpin_resp_t *cpin = &_nas_user_data.response.cpin; - memset(cpin, 0, sizeof(at_cpin_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CPIN_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - - /* - * Set command sends to the MT a password which is necessary - * before it can be operated - */ - if (_nas_user_context.sim_status == NAS_USER_SIM_PIN) { - /* The MT is waiting for PIN password; check the PIN code */ - if (strncmp(_nas_user_nvdata.PIN, - data->command.cpin.pin, USER_PIN_SIZE) != 0) { - /* The PIN code is NOT matching; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - PIN code is not correct " - "(%s)", data->command.cpin.pin); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PASSWD; - ret_code = RETURNerror; - } else { - /* The PIN code is matching; update the user's PIN - * pending status */ - _nas_user_context.sim_status = NAS_USER_READY; - } - } else { - /* The MT is NOT waiting for PIN password; - * return an error message */ - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_ALLOWED; - ret_code = RETURNerror; - } - - break; - - case AT_COMMAND_GET: - /* - * Read command returns an alphanumeric string indicating - * whether some password is required or not. - */ - strncpy(cpin->code, - _nas_user_sim_status_str[_nas_user_context.sim_status], - AT_CPIN_RESP_SIZE); - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - /* Other types of AT CPIN command are not valid */ - LOG_TRACE(ERROR, "USR-MAIN - AT+CPIN command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_csq() ** - ** ** - ** Description: Executes the AT CSQ command operations: ** - ** The AT CSQ command returns received signal strength ** - ** indication and channel bit error rate from the Mobile ** - ** Equipment. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_csq(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_csq_resp_t *csq = &_nas_user_data.response.csq; - memset(csq, 0, sizeof(at_csq_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CSQ_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * Execution command returns received signal strength indication - * and channel bit error rate <ber> from the MT - */ - csq->rssi = AT_CESQ_RSSI_UNKNOWN; - csq->ber = AT_CESQ_BER_UNKNOWN; - break; - - case AT_COMMAND_TST: - /* - * Test command returns values supported as a compound value - */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CSQ command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cesq() ** - ** ** - ** Description: Executes the AT CESQ command operations: ** - ** The AT CESQ command returns received signal quality para- ** - ** meters. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cesq(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cesq_resp_t *cesq = &_nas_user_data.response.cesq; - memset(cesq, 0, sizeof(at_cesq_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CESQ_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * Execution command returns received signal quality parameters - */ - cesq->rssi = AT_CESQ_RSSI_UNKNOWN; - cesq->ber = AT_CESQ_BER_UNKNOWN; - cesq->rscp = AT_CESQ_RSCP_UNKNOWN; - cesq->ecno = AT_CESQ_ECNO_UNKNOWN; - ret_code = nas_proc_get_signal_quality(&cesq->rsrq, &cesq->rsrp); - break; - - case AT_COMMAND_TST: - /* - * Test command returns values supported as a compound value - */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CESQ command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cops() ** - ** ** - ** Description: Executes the AT COPS command operations: ** - ** The AT COPS command forces an attempt to select and ** - ** register the GSM/UMTS/EPS network operator using the ** - ** SIM/USIM card installed in the currently selected card ** - ** slot. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cops(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cops_resp_t *cops = &_nas_user_data.response.cops; - memset(cops, 0, sizeof(at_cops_resp_t)); - - static int read_format = AT_COPS_FORMAT_DEFAULT; - - int mode = AT_COPS_MODE_DEFAULT; - int format = AT_COPS_FORMAT_DEFAULT; - int AcT = AT_COPS_ACT_DEFAULT; - char oper_buffer[NET_FORMAT_MAX_SIZE], *oper = oper_buffer; - memset(oper, 0, NET_FORMAT_MAX_SIZE); - - int oper_is_selected; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_NO_PARAM; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * Set command forces an attempt to select and register the - * GSM/UMTS/EPS network operator using the SIM/USIM card - * installed in the currently selected card slot. - */ - if (data->mask & AT_COPS_MODE_MASK) { - mode = data->command.cops.mode; - - switch (mode) { - case AT_COPS_AUTO: - /* - * Register in automatic mode - */ - break; - - case AT_COPS_MANUAL: - - /* - * Register in manual mode - */ - - /** break is intentionaly missing */ - - case AT_COPS_MANAUTO: - - /* - * Register in manual/automatic mode - */ - - /* <oper> field shall be present */ - if ( !(data->mask & AT_COPS_OPER_MASK) ) { - LOG_TRACE(ERROR, "USR-MAIN - <oper> parameter is not present"); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* <format> field shall be present */ - if ( !(data->mask & AT_COPS_FORMAT_MASK) ) { - LOG_TRACE(ERROR, "USR-MAIN - <format> parameter is not present"); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Set the operator's representation format */ - if ( (data->command.cops.format < AT_COPS_FORMAT_MIN) || - (data->command.cops.format > AT_COPS_FORMAT_MAX) ) { - /* The value of <format> field is not valid */ - LOG_TRACE(ERROR, "USR-MAIN - <format> parameter is not valid (%d)", - data->command.cops.format); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - read_format = format = data->command.cops.format; - - /* Set the access technology */ - if (data->mask & AT_COPS_ACT_MASK) { - if ( (data->command.cops.AcT < AT_COPS_ACT_MIN) || - (data->command.cops.AcT > AT_COPS_ACT_MAX) ) { - /* The value of <AcT> field is not valid */ - LOG_TRACE(ERROR, "USR-MAIN - <AcT> parameter is not valid (%d)", - data->command.cops.AcT); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - AcT = data->command.cops.AcT; - } - - break; - - case AT_COPS_DEREG: - /* - * Deregister from network - */ - /* Nothing to do there */ - break; - - case AT_COPS_FORMAT: - - /* - * Set only <format> for read command +COPS? - */ - if (data->mask & AT_COPS_FORMAT_MASK) { - if ( (data->command.cops.format < AT_COPS_FORMAT_MIN) || - (data->command.cops.format > AT_COPS_FORMAT_MAX) ) { - /* The value of <format> field is not valid */ - LOG_TRACE(ERROR, "USR-MAIN - <format> parameter is not valid (%d)", - data->command.cops.format); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Set to the selected representation format */ - read_format = data->command.cops.format; - } else { - /* Format is not present; set to default */ - read_format = AT_COPS_FORMAT_DEFAULT; - } - - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - <mode> parameter is not supported (%d)", mode); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - } - - /* - * Performs network registration - */ - if (ret_code != RETURNerror) { - if (mode == AT_COPS_DEREG) { - /* Force an attempt to deregister from the network */ - ret_code = nas_proc_deregister(); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Network deregistration failed"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - break; - } - } else if (mode != AT_COPS_FORMAT) { - /* Force an attempt to automatically/manualy select - * and register the GSM/UMTS/EPS network operator */ - ret_code = nas_proc_register(mode, format, - &data->command.cops.plmn, AcT); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Network registration failed (<mode>=%d)", mode); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - break; - } - } - } - - break; - - case AT_COMMAND_GET: - /* - * Read command returns the current mode, the currently selected - * network operator and the current Access Technology. - */ - - /* Get the current network registration data */ - ret_code = nas_proc_get_reg_data(&mode, - &oper_is_selected, read_format, - &cops->get.plmn, &cops->get.AcT); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get registration data (<mode>=%d)", - mode); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - break; - } - - /* Set the network selection operating mode */ - if (mode == NET_PLMN_AUTO) { - cops->get.mode = AT_COPS_AUTO; - } else if (mode == NET_PLMN_MANUAL) { - cops->get.mode = AT_COPS_MANUAL; - } else { - cops->get.mode = AT_COPS_MANAUTO; - } - - /* Set optional parameter bitmask */ - if (oper_is_selected) { - cops->get.format = read_format; - _nas_user_data.mask |= (AT_COPS_RESP_FORMAT_MASK | - AT_COPS_RESP_OPER_MASK); - - if (cops->get.AcT != NET_ACCESS_UNAVAILABLE) { - _nas_user_data.mask |= AT_COPS_RESP_ACT_MASK; - } - } - - break; - - case AT_COMMAND_TST: - /* - * Test command returns a set of parameters, each representing - * an operator present in the network. - */ - cops->tst.size = nas_proc_get_oper_list(&cops->tst.data); - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+COPS command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgatt() ** - ** ** - ** Description: Executes the AT CGATT command operations: ** - ** The AT CGATT command is used to attach the MT to, ** - ** or detach the MT from, the EPS service. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgatt(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgatt_resp_t *cgatt = &_nas_user_data.response.cgatt; - memset(cgatt, 0, sizeof(at_cgatt_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CGATT_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * The execution command is used to attach the MT to, or detach the - * MT from, the EPS service - */ - if (data->mask & AT_CGATT_STATE_MASK) { - if ( (data->command.cgatt.state < AT_CGATT_STATE_MIN) || - (data->command.cgatt.state > AT_CGATT_STATE_MAX) ) { - /* The value of the EPS attachment code is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <state> parameter is not valid (%d)", - data->command.cgatt.state); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* - * Perform EPS service attach/detach - */ - ret_code = RETURNerror; - - if (data->command.cgatt.state == AT_CGATT_ATTACHED) { - ret_code = nas_proc_attach(); - } else if (data->command.cgatt.state == AT_CGATT_DETACHED) { - ret_code = nas_proc_detach(FALSE); - } - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to attach/detach " - "to/from EPS service (<state>=%d)", - data->command.cgatt.state); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - } - - break; - - case AT_COMMAND_GET: - - /* - * Read command returns the current EPS service state. - */ - if (nas_proc_get_attach_status() != TRUE) { - cgatt->state = AT_CGATT_DETACHED; - } else { - cgatt->state = AT_CGATT_ATTACHED; - } - - break; - - case AT_COMMAND_TST: - /* - * Test command is used for requesting information on the supported - * EPS service states - */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGATT command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_creg() ** - ** ** - ** Description: Executes the AT CREG command operations: ** - ** The AT CREG command returns the Mobile Equipment's ** - ** circuit mode network registration status and optionnally ** - ** location information in GERA/UTRA/E-UTRA Network. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_creg(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_creg_resp_t *creg = &_nas_user_data.response.creg; - memset(creg, 0, sizeof(at_creg_resp_t)); - - static int n = AT_CREG_N_DEFAULT; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_NO_PARAM; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * The set command controls the presentation of an unsolicited - * result code when there is a change in the MT's circuit mode - * network registration status, or when there is a change of the - * network cell in GERAN/UTRAN/E-UTRAN. - */ - if (data->mask & AT_CREG_N_MASK) { - if ( (data->command.creg.n < AT_CREG_N_MIN) || - (data->command.creg.n > AT_CREG_N_MAX) ) { - /* The value of the unsolicited result code is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <n> parameter is not valid" - " (%d)", data->command.creg.n); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Set to the selected parameter value */ - n = data->command.creg.n; - } else { - /* The numeric parameter is not present; set to default */ - n = AT_CREG_N_DEFAULT; - } - - /* Disable/Enable network logging */ - switch (n) { - case AT_CREG_OFF: - /* Disable logging of network registration status */ - ret_code = user_ind_deregister(USER_IND_REG); - - if (ret_code != RETURNerror) { - /* Disable logging of location information */ - ret_code = user_ind_deregister(USER_IND_LOC); - } - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, - "USR-MAIN - Failed to disable logging of network notification"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_CREG_BOTH: - - /* Location Area Code (lac) is not available */ - case AT_CREG_ON: - /* Enable logging of the MT's circuit mode network - * registration status in GERAN/UTRAN/E_UTRAN */ - ret_code = user_ind_register(USER_IND_REG, AT_CREG, NULL); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to enable logging of registration status"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - default: - break; - } - - break; - - case AT_COMMAND_GET: - /* - * The read command returns the status of result code presentation, - * and indication of whether the network has currently indicated - * the registration of the MT, and available location information - * elements when the MT is registered in the network. - */ - creg->n = n; - - switch (n) { - case AT_CREG_BOTH: - - /* Location Area Code (lac) is not available */ - case AT_CREG_OFF: - case AT_CREG_ON: - /* Get network registration status */ - ret_code = nas_proc_get_reg_status(&creg->stat); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get registration status"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - default: - break; - } - - break; - - case AT_COMMAND_TST: - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CREG command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgreg() ** - ** ** - ** Description: Executes the AT CGREG command operations: ** - ** The AT CGREG command returns the Mobile Equipment's GPRS ** - ** network registration status and optionnally location ** - ** information in GERA/UTRA Network. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgreg(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgreg_resp_t *cgreg = &_nas_user_data.response.cgreg; - memset(cgreg, 0, sizeof(at_cgreg_resp_t)); - - static int n = AT_CGREG_N_DEFAULT; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_NO_PARAM; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * The set command controls the presentation of an unsolicited - * result code when there is a change in the MT's GPRS network - * registration status, or when there is a change of the network - * cell in GERAN/UTRAN. - */ - if (data->mask & AT_CGREG_N_MASK) { - if ( (data->command.cgreg.n < AT_CGREG_N_MIN) || - (data->command.cgreg.n > AT_CGREG_N_MAX) ) { - /* The value of the unsolicited result code is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <n> parameter is not valid" - " (%d)", data->command.cgreg.n); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Set to the selected parameter value */ - n = data->command.cgreg.n; - } else { - /* The numeric parameter is not present; set to default */ - n = AT_CGREG_N_DEFAULT; - } - - /* Disable/Enable network logging */ - switch (n) { - case AT_CGREG_OFF: - /* Disable logging of network registration status */ - ret_code = user_ind_deregister(USER_IND_REG); - - if (ret_code != RETURNerror) { - /* Disable logging of location information */ - ret_code = user_ind_deregister(USER_IND_LOC); - } - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, - "USR-MAIN - Failed to disable logging of network notification"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_CGREG_BOTH: - - /* Location Area Code (lac) is not available */ - case AT_CGREG_ON: - /* Enable logging of the MT's GPRS network registration - * status in GERAN/UTRAN/E_UTRAN */ - ret_code = user_ind_register(USER_IND_REG, AT_CGREG, NULL); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to enable logging of registration status"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - default: - break; - } - - break; - - case AT_COMMAND_GET: - /* - * The read command returns the status of result code presentation, - * and indication of whether the network has currently indicated - * the registration of the MT, and available location information - * elements when the MT is registered in the network. - */ - cgreg->n = n; - - switch (n) { - case AT_CGREG_BOTH: - - /* Location Area Code (lac) is not available */ - case AT_CGREG_OFF: - case AT_CGREG_ON: - /* Get network registration status */ - ret_code = nas_proc_get_reg_status(&cgreg->stat); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get registration status"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - default: - break; - } - - break; - - case AT_COMMAND_TST: - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGREG command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cereg() ** - ** ** - ** Description: Executes the AT CEREG command operations: ** - ** The AT CEREG command returns the Mobile Equipment's EPS ** - ** services registration status and optionnally location ** - ** information in E-UTRA Network. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cereg(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cereg_resp_t *cereg = &_nas_user_data.response.cereg; - memset(cereg, 0, sizeof(at_cereg_resp_t)); - - static int n = AT_CEREG_N_DEFAULT; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_NO_PARAM; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * The set command controls the presentation of an unsolicited - * result code when there is a change in the MT's EPS network - * registration status, or when there is a change of the network - * cell in E-UTRAN. - */ - if (data->mask & AT_CEREG_N_MASK) { - if ( (data->command.cereg.n < AT_CEREG_N_MIN) || - (data->command.cereg.n > AT_CEREG_N_MAX) ) { - /* The value of the unsolicited result code is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <n> parameter is not valid" - " (%d)", data->command.cereg.n); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Set to the selected parameter value */ - n = data->command.cereg.n; - } else { - /* The numeric parameter is not present; set to default */ - n = AT_CEREG_N_DEFAULT; - } - - /* Disable/Enable network logging */ - switch (n) { - case AT_CEREG_OFF: - /* Disable logging of network registration status */ - ret_code = user_ind_deregister(USER_IND_REG); - - if (ret_code != RETURNerror) { - /* Disable logging of location information */ - ret_code = user_ind_deregister(USER_IND_LOC); - } - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, - "USR-MAIN - Failed to disable logging of network notification"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_CEREG_BOTH: - /* Enable logging of the location information in E-UTRAN */ - ret_code = user_ind_register(USER_IND_LOC, AT_CEREG, NULL); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to enable logging of location information"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_CEREG_ON: - /* Enable logging of the MT's EPS network registration - * status in E-UTRAN */ - ret_code = user_ind_register(USER_IND_REG, AT_CEREG, NULL); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to enable logging of registration status"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - default: - break; - } - - break; - - case AT_COMMAND_GET: - /* - * The read command returns the status of result code presentation, - * and indication of whether the network has currently indicated - * the registration of the MT, and available location information - * elements when the MT is registered in the network. - */ - cereg->n = n; - - switch (n) { - case AT_CEREG_BOTH: - /* Get EPS location information */ - ret_code = nas_proc_get_loc_info(cereg->tac, cereg->ci, - &cereg->AcT); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get location information"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - break; - } - - if (cereg->tac[0] != 0) { - _nas_user_data.mask |= (AT_CEREG_RESP_TAC_MASK | - AT_CEREG_RESP_CI_MASK); - - if (cereg->AcT != NET_ACCESS_UNAVAILABLE) { - _nas_user_data.mask |= (AT_CEREG_RESP_ACT_MASK); - } - } - - /** break is intentionaly missing */ - - case AT_CEREG_OFF: - case AT_CEREG_ON: - /* Get network registration status */ - ret_code = nas_proc_get_reg_status(&cereg->stat); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get registration status"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - default: - break; - } - - break; - - case AT_COMMAND_TST: - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CEREG command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgdcont() ** - ** ** - ** Description: Executes the AT CGDCONT command operations: ** - ** The AT CGDCONT command specifies PDP context parameter ** - ** values for a PDP context identified by the local context ** - ** identification parameter (cid). ** - ** ** - ** There is a 1 to 1 mapping between EPS bearer context and ** - ** PDP context. Therefore a PDP context used for UMTS/GPRS ** - ** designates a PDN connection and its associated EPS de- ** - ** fault bearer and traffic flows in EPS. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgdcont(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgdcont_get_t *cgdcont = &_nas_user_data.response.cgdcont.get; - memset(cgdcont, 0, sizeof(at_cgdcont_resp_t)); - - int cid = AT_CGDCONT_CID_DEFAULT; - int pdn_type = NET_PDN_TYPE_IPV4; - const char *apn = NULL; - int ipv4_addr_allocation = AT_CGDCONT_IPV4_DEFAULT; - int emergency = AT_CGDCONT_EBS_DEFAULT; - int p_cscf = AT_CGDCONT_PCSCF_DEFAULT; - int im_cn_signalling = AT_CGDCONT_IM_CM_DEFAULT; - int reset_pdn = TRUE; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_NO_PARAM; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * Set command specifies PDN connection and its default - * EPS bearer context parameter values - */ - if (data->mask & AT_CGDCONT_CID_MASK) { - if (data->command.cgdcont.cid < AT_CGDCONT_CID_MIN) { - /* The value of the PDP context identifier is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <cid> parameter is not valid" - " (%d)", data->command.cgdcont.cid); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - cid = data->command.cgdcont.cid; - } - - if (data->mask & AT_CGDCONT_PDP_TYPE_MASK) { - if (strcmp(data->command.cgdcont.PDP_type, "IP") == 0) { - pdn_type = NET_PDN_TYPE_IPV4; - } else if (strcmp(data->command.cgdcont.PDP_type, "IPV6") == 0) { - pdn_type = NET_PDN_TYPE_IPV6; - } else if (strcmp(data->command.cgdcont.PDP_type,"IPV4V6") == 0) { - pdn_type = NET_PDN_TYPE_IPV4V6; - } else { - /* The value of the PDP type is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <PDN_type> parameter is not " - "valid (%s)", data->command.cgdcont.PDP_type); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - reset_pdn = FALSE; - } - - if (data->mask & AT_CGDCONT_APN_MASK) { - apn = data->command.cgdcont.APN; - } - - if (data->mask & AT_CGDCONT_D_COMP_MASK) { - if ( (data->command.cgdcont.d_comp < AT_CGDCONT_D_COMP_MIN) || - (data->command.cgdcont.d_comp > AT_CGDCONT_D_COMP_MAX) ) { - /* The value of the PDP data compression parameter is - * not valid; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <d_comp> parameter is not " - "valid (%d)", data->command.cgdcont.d_comp); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Not supported: Applicable for SNDCP only */ - } - - if (data->mask & AT_CGDCONT_H_COMP_MASK) { - if ( (data->command.cgdcont.h_comp < AT_CGDCONT_H_COMP_MIN) || - (data->command.cgdcont.h_comp > AT_CGDCONT_H_COMP_MAX) ) { - /* The value of the PDP header compression parameter is - * not valid; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <h_comp> parameter is not " - "valid (%d)", data->command.cgdcont.h_comp); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Not supported */ - } - - if (data->mask & AT_CGDCONT_IPV4ADDRALLOC_MASK) { - if ( (data->command.cgdcont.IPv4AddrAlloc < AT_CGDCONT_IPV4_MIN) - || (data->command.cgdcont.IPv4AddrAlloc > AT_CGDCONT_IPV4_MAX) ) { - /* The value of the IPv4 address allocation parameter is - * not valid; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <IPv4AddrAlloc> parameter " - "is not valid (%d)", - data->command.cgdcont.IPv4AddrAlloc); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - ipv4_addr_allocation = data->command.cgdcont.IPv4AddrAlloc; - } - - if (data->mask & AT_CGDCONT_EMERGECY_INDICATION_MASK) { - if ( (data->command.cgdcont.emergency_indication < AT_CGDCONT_EBS_MIN) - || (data->command.cgdcont.emergency_indication > AT_CGDCONT_EBS_MAX) ) { - /* The value of the emergency indication parameter is - * not valid; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <emergency indication> " - "parameter is not valid (%d)", - data->command.cgdcont.emergency_indication); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - emergency = data->command.cgdcont.emergency_indication; - } - - if (data->mask & AT_CGDCONT_P_CSCF_DISCOVERY_MASK) { - if ( (data->command.cgdcont.P_CSCF_discovery < AT_CGDCONT_PCSCF_MIN) - || (data->command.cgdcont.P_CSCF_discovery > AT_CGDCONT_PCSCF_MAX) ) { - /* The value of the P-CSCF address discovery parameter is - * not valid; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <P-CSCF_discovery> " - "parameter is not valid (%d)", - data->command.cgdcont.P_CSCF_discovery); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - p_cscf = data->command.cgdcont.P_CSCF_discovery; - } - - if (data->mask & AT_CGDCONT_IM_CN_SIGNALLING_FLAG_IND_MASK) { - if ( (data->command.cgdcont.IM_CN_Signalling_Flag_Ind < AT_CGDCONT_IM_CM_MIN) - || (data->command.cgdcont.IM_CN_Signalling_Flag_Ind > AT_CGDCONT_IM_CM_MAX) ) { - /* The value of the IM CN subsystem-related signalling - * support indication is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <IM_CN_Signalling_Flag_Ind> " - "parameter is not valid (%d)", - data->command.cgdcont.IM_CN_Signalling_Flag_Ind); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - im_cn_signalling = data->command.cgdcont.IM_CN_Signalling_Flag_Ind; - } - - /* - * Setup PDN context - */ - if (reset_pdn) { - /* A special form of the set command, +CGDCONT=<cid> causes - * the values for context number <cid> to become undefined */ - ret_code = nas_proc_reset_pdn(cid); - } else { - /* Define a new PDN connection */ - ret_code = nas_proc_set_pdn(cid, pdn_type, apn, - ipv4_addr_allocation, emergency, - p_cscf, im_cn_signalling); - } - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to setup PDN connection " - "(<cid>=%d)", data->command.cgdcont.cid); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_GET: - /* - * Read command returns the current settings for each - * defined PDN connection/default EPS bearer context - */ - cgdcont->n_pdns = nas_proc_get_pdn_param(cgdcont->cid, - cgdcont->PDP_type, - cgdcont->APN, - AT_CGDCONT_RESP_SIZE); - - if (cgdcont->n_pdns == 0) { - LOG_TRACE(ERROR, "USR-MAIN - No any PDN context is defined"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_TST: - /* - * Test command returns values supported as a compound value - */ - { - /* Get the maximum value of a PDN context identifier */ - int cid_max = nas_proc_get_pdn_range(); - - if (cid_max > AT_CGDCONT_RESP_SIZE) { - /* The range is defined by the user interface */ - _nas_user_data.response.cgdcont.tst.n_cid = - AT_CGDCONT_RESP_SIZE; - } else { - /* The range is defined by the ESM sublayer application */ - _nas_user_data.response.cgdcont.tst.n_cid = cid_max; - } - } - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGDCONT command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgact() ** - ** ** - ** Description: Executes the AT CGACT command operations: ** - ** The AT CGACT command is used to activate or deactivate ** - ** the specified PDP context(s) or PDN/EPS bearer context(s) ** - ** for E-UTRAN ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgact(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgact_resp_t *cgact = &_nas_user_data.response.cgact; - memset(cgact, 0, sizeof(at_cgact_resp_t)); - - int cid = -1; - int state = AT_CGACT_STATE_DEFAULT; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CGACT_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * The execution command is used to activate or deactivate - * the specified PDN/EPS bearer context(s). - */ - if (data->mask & AT_CGACT_STATE_MASK) { - if ( (data->command.cgact.state < AT_CGACT_STATE_MIN) || - (data->command.cgact.state > AT_CGACT_STATE_MAX) ) { - /* The value of the PDP context activation status is - * not valid; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <state> parameter is " - "not valid (%d)", data->command.cgact.state); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - state = data->command.cgact.state; - } - - if (data->mask & AT_CGACT_CID_MASK) { - if (data->command.cgact.cid < AT_CGACT_CID_MIN) { - /* The value of the PDP context identifier is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <cid> parameter is " - "not valid (%d)", data->command.cgact.cid); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - cid = data->command.cgact.cid; - } - - /* - * Activate/Deactivate PDN context - */ - ret_code = RETURNerror; - - if (state == AT_CGACT_DEACTIVATED) { - ret_code = nas_proc_deactivate_pdn(cid); - } else if (state == AT_CGACT_ACTIVATED) { - ret_code = nas_proc_activate_pdn(cid); - } - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to %s PDN context " - "(<state>=%d,<cid>=%d)", - (state != AT_CGACT_ACTIVATED)? "deactivate" : - "activate", state, cid); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_GET: - /* - * The read command returns the current activation states for - * all the defined PDN/EPS bearer contexts - */ - cgact->n_pdns = nas_proc_get_pdn_status(cgact->cid, cgact->state, - AT_CGACT_RESP_SIZE); - - if (cgact->n_pdns == 0) { - LOG_TRACE(ERROR, "USR-MAIN - No any PDN context is defined"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_TST: - /* - * The test command is used for requesting information on the - * supported PDN/EPS bearer context activation states. - */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGACT command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cmee() ** - ** ** - ** Description: Executes the AT CMEE command operations: ** - ** The AT CMEE command disables or enables the use of final ** - ** result code +CME ERROR: <err> as an indication of an er- ** - ** ror relating to the functionality of the MT. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cmee(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cmee_resp_t *cmee = &_nas_user_data.response.cmee; - memset(cmee, 0, sizeof(at_cmee_resp_t)); - - int n = AT_CMEE_N_DEFAULT; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CMEE_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: /* ATV0, ATV1 response format commands */ - case AT_COMMAND_SET: - - /* - * The set command controls the presentation of final result code - * +CME ERROR: <err> as an indication of an error relating to the - * functionality of the MT. - */ - if (data->mask & AT_CMEE_N_MASK) { - if ( (data->command.cmee.n < AT_CMEE_N_MIN) || - (data->command.cmee.n > AT_CMEE_N_MAX) ) { - /* The value of the numeric parameter is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <n> parameter is not valid" - " (%d)", data->command.cmee.n); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Set to the selected parameter value */ - n = data->command.cmee.n; - } - - /* Disable/Enable final result code logging */ - switch (n) { - case AT_CMEE_OFF: - /* Disable logging of final result code */ - at_error_set_format(AT_ERROR_OFF); - break; - - case AT_CMEE_NUMERIC: - /* Enable logging of numeric final result code */ - at_error_set_format(AT_ERROR_NUMERIC); - break; - - case AT_CMEE_VERBOSE: - /* Enable logging of verbose final result code */ - at_error_set_format(AT_ERROR_VERBOSE); - break; - - default: - break; - } - - break; - - case AT_COMMAND_GET: - /* - * Read command returns the status of the final result code - * presentation. - */ - n = at_error_get_format(); - cmee->n = ( (n == AT_ERROR_OFF)? AT_CMEE_OFF : - (n == AT_ERROR_NUMERIC)? AT_CMEE_NUMERIC : - (n == AT_ERROR_VERBOSE)? AT_CMEE_VERBOSE : RETURNerror); - - if (cmee->n == RETURNerror) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get format of the final result code"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_TST: - /* - * Test command returns values supported as a compound value - */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CMEE command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_clck() ** - ** ** - ** Description: Executes the AT CLCK command operations: ** - ** The AT CLCK command locks, unlocks or interrogates a MT ** - ** or a network facility. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_clck(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_clck_resp_t *clck = &_nas_user_data.response.clck; - memset(clck, 0, sizeof(at_clck_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CLCK_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - - /* - * Execution command locks, unlocks or returns status of a network - * facility - */ - - /* Check facility parameter */ - if (strncmp(data->command.clck.fac, AT_CLCK_SC, - AT_CLCK_FAC_SIZE) != 0) { - /* Facilities other than SIM is not supported */ - LOG_TRACE(ERROR, "USR-MAIN - Facility is not supported (%s)", - data->command.clck.fac); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - /* Check password parameter */ - if (data->mask & AT_CLCK_PASSWD_MASK) { - /* Check the PIN code */ - if (strncmp(_nas_user_nvdata.PIN, - data->command.clck.passwd, USER_PIN_SIZE) != 0) { - /* The PIN code is NOT matching; return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - Password is not correct " - "(%s)", data->command.clck.passwd); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PASSWD; - ret_code = RETURNerror; - break; - } - } - - /* Execute the command with specified mode of operation */ - switch (data->command.clck.mode) { - case AT_CLCK_UNLOCK: - - /* unlock facility */ - if ( !(data->mask & AT_CLCK_PASSWD_MASK) ) { - /* unlock requires password */ - LOG_TRACE(ERROR, "USR-MAIN - unlock mode of operation " - "requires a password"); - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - ret_code = RETURNerror; - break; - } - - LOG_TRACE(ERROR, "USR-MAIN - unlock mode of operation " - "is not supported"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - - case AT_CLCK_LOCK: - - /* lock facility */ - if ( !(data->mask & AT_CLCK_PASSWD_MASK) ) { - /* unlock requires password */ - LOG_TRACE(ERROR, "USR-MAIN - lock mode of operation " - "requires a password"); - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - ret_code = RETURNerror; - break; - } - - LOG_TRACE(ERROR, "USR-MAIN - lock mode of operation " - "is not supported"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - - case AT_CLCK_STATUS: - /* Read facility status */ - clck->status = AT_CLCK_RESP_STATUS_NOT_ACTIVE; - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - <mode> parameter is not valid" - " (%d)", data->command.clck.mode); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - break; - - case AT_COMMAND_TST: - /* - * Test command returns values supported as a compound value - */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CLCK command type %d is not supported", - data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cgpaddr() ** - ** ** - ** Description: Executes the AT CGPADDR command operations: ** - ** The AT CGPADDR command returns a list of PDP addresses ** - ** for the specified context identifiers ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cgpaddr(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cgpaddr_resp_t *cgpaddr = &_nas_user_data.response.cgpaddr; - memset(cgpaddr, 0, sizeof(at_cgpaddr_resp_t)); - - int cid = -1; - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CGPADDR_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_SET: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* - * The execution command returns a list of PDP addresses for - * the specified context identifiers - */ - if (data->mask & AT_CGPADDR_CID_MASK) { - if (data->command.cgpaddr.cid < AT_CGPADDR_CID_MIN) { - /* The value of the PDP context identifier is not valid; - * return an error message */ - LOG_TRACE(ERROR, "USR-MAIN - <cid> parameter is " - "not valid (%d)", data->command.cgpaddr.cid); - _nas_user_data.cause_code = AT_ERROR_INCORRECT_PARAMETERS; - ret_code = RETURNerror; - break; - } - - cid = data->command.cgpaddr.cid; - } - - /* - * Get the PDP addresses - */ - cgpaddr->n_pdns = nas_proc_get_pdn_addr(cid, cgpaddr->cid, - cgpaddr->PDP_addr_1, - cgpaddr->PDP_addr_2, - AT_CGPADDR_RESP_SIZE); - - if (cgpaddr->n_pdns == 0) { - LOG_TRACE(ERROR, "USR-MAIN - No any PDN context is defined"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_TST: - /* - * The test command returns a list of defined <cid>s. - */ - cgpaddr->n_pdns = nas_proc_get_pdn_addr(cid, cgpaddr->cid, - cgpaddr->PDP_addr_1, - cgpaddr->PDP_addr_2, - AT_CGPADDR_RESP_SIZE); - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CGPADDR command type %d is " - "not supported", data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_cnum() ** - ** ** - ** Description: Executes the AT CNUM command operations: ** - ** The AT CNUM command returns the MSISDNs related to the ** - ** subscriber. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_cnum(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_cnum_resp_t *cnum = &_nas_user_data.response.cnum; - memset(cnum, 0, sizeof(at_cnum_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CNUM_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - if (_nas_user_context.sim_status != NAS_USER_READY) { - _nas_user_data.cause_code = AT_ERROR_SIM_PIN_REQUIRED; - LOG_FUNC_RETURN(RETURNerror); - } - - /* Get the International Mobile Subscriber Identity (IMSI) */ - ret_code = nas_proc_get_msisdn(cnum->number, &cnum->type); - - if (ret_code != RETURNok) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get MS dialing number"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CNUM command type %d is " - "not supported", data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -/**************************************************************************** - ** ** - ** Name: nas_user_proc_clac() ** - ** ** - ** Description: Executes the AT CLAC command operations: ** - ** The AT CLAC command returns the list of AT Commands that ** - ** are available for the user. ** - ** ** - ** Inputs: data: Pointer to the AT command data structure ** - ** Others: _nas_user_context ** - ** ** - ** Outputs: None ** - ** Return: RETURNok; RETURNerror; ** - ** Others: _nas_user_data ** - ** ** - ***************************************************************************/ -static int _nas_user_proc_clac(const at_command_t *data) -{ - LOG_FUNC_IN; - - int ret_code = RETURNok; - at_clac_resp_t *clac = &_nas_user_data.response.clac; - memset(clac, 0, sizeof(at_clac_resp_t)); - - _nas_user_data.id = data->id; - _nas_user_data.type = data->type; - _nas_user_data.mask = AT_RESPONSE_CLAC_MASK; - _nas_user_data.cause_code = AT_ERROR_SUCCESS; - - switch (data->type) { - case AT_COMMAND_ACT: - /* Get the list of supported AT commands */ - clac->n_acs = at_command_get_list(clac->ac, AT_CLAC_RESP_SIZE); - - if (clac->n_acs == 0) { - LOG_TRACE(ERROR, "USR-MAIN - Failed to get the list of " - "supported AT commands"); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - } - - break; - - case AT_COMMAND_TST: - /* Nothing to do */ - break; - - default: - LOG_TRACE(ERROR, "USR-MAIN - AT+CLAC command type %d is " - "not supported", data->type); - _nas_user_data.cause_code = AT_ERROR_OPERATION_NOT_SUPPORTED; - ret_code = RETURNerror; - break; - } - - LOG_FUNC_RETURN (ret_code); -} - -#endif // NAS_UE diff --git a/openair-cn/NAS/EURECOM-NAS/src/nas_user.h b/openair-cn/NAS/EURECOM-NAS/src/nas_user.h deleted file mode 100644 index 21f66802603956401dfd0a09d1bb33fe4e8e8353..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/nas_user.h +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_user.h - -Version 0.1 - -Date 2012/03/09 - -Product NAS stack - -Subsystem NAS main process - -Author Frederic Maurel - -Description NAS procedure functions triggered by the user - -*****************************************************************************/ -#ifndef __NAS_USER_H__ -#define __NAS_USER_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void nas_user_initialize(emm_indication_callback_t emm_cb, - esm_indication_callback_t esm_cb, const char *version); - -int nas_user_receive_and_process(int * fd, char *message); - -int nas_user_process_data(const void *data); - -const void *nas_user_get_data(void); - -#endif /* __NAS_USER_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/COPYING b/openair-cn/NAS/EURECOM-NAS/src/util/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/Makefile b/openair-cn/NAS/EURECOM-NAS/src/util/Makefile deleted file mode 100644 index 799bb8599a3c20a4174a4ff225f70f343b328872..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -INCLUDES = -I. -I$(INCDIR) - -TARGET = $(LIBUTIL) -TARGETS = $(TARGET).a $(TARGET).so - -all: $(TARGETS) - -%.o: %.c Makefile - @echo Compiling $< - @$(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET).a: $(OBJS) - @$(RM) $@ - @$(AR) $(ARFLAGS) $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -$(TARGET).so: $(OBJS) - @$(LD) -G -o $@ $(OBJS) - @echo Replacing $@ to $(LIBDIR) - @$(RM) $(LIBDIR)/$@ - @$(CP) $@ $(LIBDIR) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGETS) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c b/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c deleted file mode 100644 index fd16e270144e7d9719cc6cd00b49807101d31f38..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.c +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "OctetString.h" - -#define DUMP_OUTPUT_SIZE 1024 -static char _dump_output[DUMP_OUTPUT_SIZE]; - -OctetString* dup_octet_string(OctetString *octetstring) -{ - OctetString *os_p = NULL; - - if (octetstring) { - os_p = calloc(1,sizeof(OctetString)); - os_p->length = octetstring->length; - os_p->value = malloc(octetstring->length+1); - memcpy(os_p->value, octetstring->value, octetstring->length); - os_p->value[octetstring->length] = '\0'; - } - return os_p; -} - - -void free_octet_string(OctetString *octetstring) -{ - if (octetstring) { - if (octetstring->value) free(octetstring->value); - octetstring->value = NULL; - octetstring->length = 0; - free(octetstring); - } -} - - -int encode_octet_string(OctetString *octetstring, uint8_t *buffer, uint32_t buflen) -{ - if (octetstring != NULL) { - if ((octetstring->value != NULL) && (octetstring->length > 0)) { - CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, octetstring->length, buflen); - memcpy((void*)buffer, (void*)octetstring->value, octetstring->length); - return octetstring->length; - } else { - return 0; - } - } else { - return 0; - } -} - -int decode_octet_string(OctetString *octetstring, uint16_t pdulen, uint8_t *buffer, uint32_t buflen) -{ - if (buflen < pdulen) - return -1; - - if ((octetstring != NULL) && (buffer!= NULL)) { - octetstring->length = pdulen; - octetstring->value = malloc(sizeof(uint8_t) * (pdulen+1)); - memcpy((void*)octetstring->value, (void*)buffer, pdulen); - octetstring->value[pdulen] = '\0'; - return octetstring->length; - } else { - return -1; - } -} - -char* dump_octet_string_xml( const OctetString * const octetstring) -{ - int i; - int remaining_size = DUMP_OUTPUT_SIZE; - int size = 0; - int size_print = 0; - - size_print = snprintf(_dump_output, remaining_size, "<Length>%u</Length>\n\t<values>", octetstring->length); - size += size_print; - remaining_size -= size_print; - - for (i = 0; i < octetstring->length; i++) { - size_print = snprintf(&_dump_output[size], remaining_size, "0x%x ", octetstring->value[i]); - size += size_print; - remaining_size -= size_print; - } - - size_print = snprintf(&_dump_output[size], remaining_size, "</values>\n"); - return _dump_output; -} - -char* dump_octet_string( const OctetString * const octetstring) -{ - int i; - int remaining_size = DUMP_OUTPUT_SIZE; - int size = 0; - int size_print = 0; - - for (i = 0; i < octetstring->length; i++) { - size_print = snprintf(&_dump_output[size], remaining_size, "0x%x ", octetstring->value[i]); - size += size_print; - remaining_size -= size_print; - } - - return _dump_output; -} diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h b/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h deleted file mode 100644 index 15cd8f6823bec27a52793670e5b3fa6e9710c14d..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/OctetString.h +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdint.h> -#include <assert.h> - -#ifndef OCTET_STRING_H_ -#define OCTET_STRING_H_ - -typedef struct OctetString_tag { - uint32_t length; - uint8_t *value; -} OctetString; -#define FREE_OCTET_STRING(oCTETsTRING) \ - do { \ - if ((oCTETsTRING).value != NULL) { \ - free((oCTETsTRING).value); \ - (oCTETsTRING).value = NULL; \ - } \ - (oCTETsTRING).length = 0; \ - } while (0); - - -#define DUP_OCTET_STRING(oCTETsTRINGoRIG,oCTETsTRINGcOPY) \ - do { \ - if ((oCTETsTRINGoRIG).value == NULL) { \ - (oCTETsTRINGcOPY).length = 0; \ - (oCTETsTRINGcOPY).value = NULL; \ - break; \ - } \ - (oCTETsTRINGcOPY).length = (oCTETsTRINGoRIG).length; \ - (oCTETsTRINGcOPY).value = malloc((oCTETsTRINGoRIG).length+1); \ - (oCTETsTRINGcOPY).value[(oCTETsTRINGoRIG).length] = '\0'; \ - memcpy((oCTETsTRINGcOPY).value, \ - (oCTETsTRINGoRIG).value, \ - (oCTETsTRINGoRIG).length); \ - } while (0); - -OctetString* dup_octet_string(OctetString*octetstring); - -void free_octet_string(OctetString *octetstring); - -int encode_octet_string(OctetString *octetstring, uint8_t *buffer, uint32_t len); - -int decode_octet_string(OctetString *octetstring, uint16_t pdulen, uint8_t *buffer, uint32_t buflen); - -char* dump_octet_string_xml(const OctetString * const octetstring); - -char* dump_octet_string(const OctetString * const octetstring); - -#endif /* OCTET_STRING_H_ */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.c b/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.c deleted file mode 100644 index 744a00d99cf1b924e575c38e298165423dfa5b81..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.c +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "TLVDecoder.h" - -int errorCodeDecoder = 0; - -const char *errorCodeStringDecoder[] = { - "No error", - "Buffer NULL", - "Buffer too short", - "Unexpected IEI", - "Mandatory field not present", - "Wrong message type", - "EXT value doesn't match", - "Protocol not supported", -}; - -void tlv_decode_perror(void) -{ - if (errorCodeDecoder >= 0) - // No error or TLV_DECODE_ERR_OK - return; - - printf("TLV decoder error: (%d, %s)\n", errorCodeDecoder, errorCodeStringDecoder[errorCodeDecoder * -1]); -} - - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.h b/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.h deleted file mode 100644 index 6e1764edadc257f268bd8337717157d67ea9e3f8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/TLVDecoder.h +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#ifndef TLV_DECODER_H_ -#define TLV_DECODER_H_ - -#include <arpa/inet.h> // ntohl, ntohs -#include "nas_log.h" - -#ifndef NAS_DEBUG -# define NAS_DEBUG 1 -#endif - -#define DECODE_U8(bUFFER, vALUE, sIZE) \ - vALUE = *(uint8_t*)(bUFFER); \ - sIZE += sizeof(uint8_t) - -#define DECODE_U16(bUFFER, vALUE, sIZE) \ - vALUE = ntohs(*(uint16_t*)(bUFFER)); \ - sIZE += sizeof(uint16_t) - -#define DECODE_U24(bUFFER, vALUE, sIZE) \ - vALUE = ntohl(*(uint32_t*)(bUFFER)) >> 8; \ - sIZE += sizeof(uint8_t) + sizeof(uint16_t) - -#define DECODE_U32(bUFFER, vALUE, sIZE) \ - vALUE = ntohl(*(uint32_t*)(bUFFER)); \ - sIZE += sizeof(uint32_t) - -#if (BYTE_ORDER == LITTLE_ENDIAN) -# define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \ - vALUE = ((*(bUFFER)) << 8) | (*((bUFFER) + 1)); \ - sIZE += sizeof(uint16_t) -#else -# define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \ - vALUE = (*(bUFFER)) | (*((bUFFER) + 1) << 8); \ - sIZE += sizeof(uint16_t) -#endif - -#define IES_DECODE_U8(bUFFER, dECODED, vALUE) \ - DECODE_U8(bUFFER + dECODED, vALUE, dECODED) - -#define IES_DECODE_U16(bUFFER, dECODED, vALUE) \ - DECODE_U16(bUFFER + dECODED, vALUE, dECODED) - -#define IES_DECODE_U24(bUFFER, dECODED, vALUE) \ - DECODE_U24(bUFFER + dECODED, vALUE, dECODED) - -#define IES_DECODE_U32(bUFFER, dECODED, vALUE) \ - DECODE_U32(bUFFER + dECODED, vALUE, dECODED) - -typedef enum { - TLV_DECODE_ERROR_OK = 0, - TLV_DECODE_UNEXPECTED_IEI = -1, - TLV_DECODE_MANDATORY_FIELD_NOT_PRESENT = -2, - TLV_DECODE_VALUE_DOESNT_MATCH = -3, - - /* Fatal errors - received message should not be processed */ - TLV_DECODE_WRONG_MESSAGE_TYPE = -10, - TLV_DECODE_PROTOCOL_NOT_SUPPORTED = -11, - TLV_DECODE_BUFFER_TOO_SHORT = -12, - TLV_DECODE_BUFFER_NULL = -13, - TLV_DECODE_MAC_MISMATCH = -14, -} tlv_decoder_error_code; - -/* Defines error code limit below which received message should be discarded - * because it cannot be further processed */ -#define TLV_DECODE_FATAL_ERROR (TLV_DECODE_VALUE_DOESNT_MATCH) - -extern int errorCodeDecoder; - -void tlv_decode_perror(void); - -#define CHECK_PDU_POINTER_AND_LENGTH_DECODER(bUFFER, mINIMUMlENGTH, lENGTH) \ - if (bUFFER == NULL) \ - { \ - printf("(%s:%d) Got NULL pointer for the payload\n", \ - __FILE__, __LINE__); \ - errorCodeDecoder = TLV_DECODE_BUFFER_NULL; \ - LOG_FUNC_RETURN(TLV_DECODE_BUFFER_NULL); \ - } \ - if (lENGTH < mINIMUMlENGTH) \ - { \ - printf("(%s:%d) Expecting at least %d bytes, got %d\n", \ - __FILE__, __LINE__, mINIMUMlENGTH, lENGTH); \ - errorCodeDecoder = TLV_DECODE_BUFFER_TOO_SHORT; \ - LOG_FUNC_RETURN(TLV_DECODE_BUFFER_TOO_SHORT); \ - } - -#define CHECK_LENGTH_DECODER(bUFFERlENGTH, lENGTH) \ - if (bUFFERlENGTH < lENGTH) \ - { \ - errorCodeDecoder = TLV_DECODE_BUFFER_TOO_SHORT; \ - LOG_FUNC_RETURN(TLV_DECODE_BUFFER_TOO_SHORT); \ - } - -#define CHECK_MESSAGE_TYPE(mESSAGE_tYPE, bUFFER) \ - { \ - if (mESSAGE_tYPE != bUFFER) \ - { \ - errorCodeDecoder = TLV_DECODE_WRONG_MESSAGE_TYPE; \ - LOG_FUNC_RETURN(errorCodeDecoder); \ - } \ - } - -#define CHECK_IEI_DECODER(iEI, bUFFER) \ - if(iEI != bUFFER) \ - { \ - printf("IEI is different than the one expected." \ - "(Got: 0x%x, expecting: 0x%x\n", bUFFER, iEI); \ - errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; \ - LOG_FUNC_RETURN(TLV_DECODE_UNEXPECTED_IEI); \ - } - -#endif /* define (TLV_DECODER_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.c b/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.c deleted file mode 100644 index 39a5d94761eeb0b62160e819d8338f38dfb3eda3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.c +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -#include "TLVEncoder.h" - -int errorCodeEncoder = 0; - -const char *errorCodeStringEncoder[] = { - "No error", - "Buffer NULL", - "Buffer too short", - "Octet string too long for IEI", - "Wrong message type", - "Protocol not supported", -}; - -void tlv_encode_perror(void) -{ - if (errorCodeEncoder >= 0) - // No error or TLV_DECODE_ERR_OK - return; - - printf("error: (%d, %s)\n", errorCodeEncoder, errorCodeStringEncoder[errorCodeEncoder * -1]); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.h b/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.h deleted file mode 100644 index 287635e9be9a428f2236160672e404744c485039..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/TLVEncoder.h +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -#ifndef TLV_ENCODER_H_ -#define TLV_ENCODER_H_ - -#include <arpa/inet.h> // htonl, htons - -#define ENCODE_U8(buffer, value, size) \ - *(uint8_t*)(buffer) = value; \ - size += sizeof(uint8_t) - -#define ENCODE_U16(buffer, value, size) \ - *(uint16_t*)(buffer) = htons(value); \ - size += sizeof(uint16_t) - -#define ENCODE_U24(buffer, value, size) \ - *(uint32_t*)(buffer) = htonl(value); \ - size += sizeof(uint8_t) + sizeof(uint16_t) - -#define ENCODE_U32(buffer, value, size) \ - *(uint32_t*)(buffer) = htonl(value); \ - size += sizeof(uint32_t) - -#define IES_ENCODE_U8(buffer, encoded, value) \ - ENCODE_U8(buffer + encoded, value, encoded) - -#define IES_ENCODE_U16(buffer, encoded, value) \ - ENCODE_U16(buffer + encoded, value, encoded) - -#define IES_ENCODE_U24(buffer, encoded, value) \ - ENCODE_U24(buffer + encoded, value, encoded) - -#define IES_ENCODE_U32(buffer, encoded, value) \ - ENCODE_U32(buffer + encoded, value, encoded) - -typedef enum { - TLV_ENCODE_ERROR_OK = 0, - TLV_ENCODE_VALUE_DOESNT_MATCH = -1, - /* Fatal errors - message should not be sent */ - TLV_ENCODE_OCTET_STRING_TOO_LONG_FOR_IEI = -10, - TLV_ENCODE_WRONG_MESSAGE_TYPE = -11, - TLV_ENCODE_PROTOCOL_NOT_SUPPORTED = -12, - TLV_ENCODE_BUFFER_TOO_SHORT = -13, - TLV_ENCODE_BUFFER_NULL = -14, -} tlv_encoder_error_code; - -/* Defines error code limit below which message should be sent because - * it cannot be further processed */ -#define TLV_ENCODE_FATAL_ERROR (TLV_ENCODE_VALUE_DOESNT_MATCH) - -extern int errorCodeEncoder; - -void tlv_encode_perror(void); - -#define CHECK_PDU_POINTER_AND_LENGTH_ENCODER(bUFFER, mINIMUMlENGTH, lENGTH) \ - if (bUFFER == NULL) \ - { \ - printf("Got NULL pointer for the payload\n"); \ - errorCodeEncoder = TLV_ENCODE_BUFFER_NULL; \ - return TLV_ENCODE_BUFFER_NULL; \ - } \ - if (lENGTH < mINIMUMlENGTH) \ - { \ - printf("(%s:%d) Expecting at least %d bytes, got %d\n", \ - __FILE__, __LINE__, mINIMUMlENGTH, lENGTH); \ - errorCodeEncoder = TLV_ENCODE_BUFFER_TOO_SHORT; \ - return TLV_ENCODE_BUFFER_TOO_SHORT; \ - } - -#define CHECK_PDU_POINTER_ENCODER(bUFFER) \ - if (bUFFER == NULL) \ - { \ - printf("Got NULL pointer for the payload\n"); \ - errorCodeEncoder = TLV_ENCODE_BUFFER_NULL; \ - return TLV_ENCODE_BUFFER_NULL; \ - } - -#endif /* define (TLV_ENCODER_H_) */ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/device.c b/openair-cn/NAS/EURECOM-NAS/src/util/device.c deleted file mode 100644 index d6ab908a6cfb9ff97acec00d375f33db2ccea423..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/device.c +++ /dev/null @@ -1,271 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source device.c - -Version 0.1 - -Date 2012/11/29 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Implements Linux/UNIX I/O device handlers - -*****************************************************************************/ - -#include "device.h" -#include "commonDef.h" - -#include <stdio.h> // fflush -#include <stdlib.h> // malloc, free -#include <string.h> // strncpy -#include <unistd.h> // read, write, close - -#include <sys/stat.h> -#include <fcntl.h> // open - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/* Function used to configure TTY I/O terminal attributes */ -extern int stty_set(int fd, const char *params); - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* ------------------------ - * Identifier of the device - * ------------------------ - * A device is defined with a pathname and attribute parameters. - * A file descriptor is created to handle the setup of the device - * attributes. - */ -struct device_id_s { -#define DEVICE_PATHNAME_SIZE 32 - char pathname[DEVICE_PATHNAME_SIZE+1]; /* device pathname */ - int fd; /* device file descriptor */ -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: device_open() ** - ** ** - ** Description: Open a device to get a file descriptor for use with read ** - ** and write I/O operations ** - ** ** - ** Inputs: devpath: Device path name ** - ** params: Device parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: A pointer to the device identifier alloca- ** - ** ted for I/O operations. NULL if the device ** - ** has not been successfully opened. ** - ** Others: None ** - ** ** - ***************************************************************************/ -void* device_open(int type, const char* devpath, const char* params) -{ - int fd; - - /* Parameters sanity check */ - if (devpath == NULL) { - return NULL; - } - - if (type != DEVICE) { - return NULL; - } - - /* Open the device for I/O operations */ - fd = open(devpath, O_RDWR); - - if (fd < 0) { - return NULL; - } - - /* The device has been successfully opened */ - device_id_t * devid = (device_id_t *)malloc(sizeof(struct device_id_s)); - - if (devid != NULL) { - strncpy(devid->pathname, devpath, DEVICE_PATHNAME_SIZE); - devid->fd = fd; - - if (params != NULL) { - /* Set TTY parameters */ - if (stty_set(fd, params) != RETURNok) { - device_close(devid); - devid = NULL; - } - } - } - - return devid; -} - -/**************************************************************************** - ** ** - ** Name: device_close() ** - ** ** - ** Description: Close the specified device and frees memory space alloca- ** - ** ted to handle access to the device ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: id: The identifier of the device ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void device_close(void* id) -{ - if (id) { - close( ((device_id_t*)id)->fd ); - free(id); - } -} - -/**************************************************************************** - ** ** - ** Name: device_read() ** - ** ** - ** Description: Read data from the given I/O device into the input buffer ** - ** of specified length ** - ** ** - ** Inputs: id: The identifier of the device ** - ** len: The number of bytes to read ** - ** Others: None ** - ** ** - ** Outputs: buffer: The input buffer ** - ** Return: The number of bytes read when success; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -ssize_t device_read(void* id, char* buffer, size_t len) -{ - const device_id_t* devid = (device_id_t*)(id); -#if 0 - ssize_t rbytes = read(devid->fd, buffer, len); - - if (rbytes < 0) { - return RETURNerror; - } - -#endif - - //#if 0 - ssize_t rbytes = 0; - - do { - ssize_t size = read(devid->fd, buffer + rbytes, len - rbytes); - - if (size < 0) { - return RETURNerror; - } - - rbytes += size; - } while ( (buffer[rbytes-1] != '\r') && (buffer[rbytes-1] != '\n') - && (buffer[rbytes-1] != '\0') ); - - //#endif - - return rbytes; -} - -/**************************************************************************** - ** ** - ** Name: device_write() ** - ** ** - ** Description: Write data to the given I/O device from the output buffer ** - ** of specified length ** - ** ** - ** Inputs: id: The identifier of the device ** - ** buffer: The output buffer ** - ** len: The number of bytes to write ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of bytes written when success; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -ssize_t device_write(const void* id, const char* buffer, size_t len) -{ - const device_id_t* devid = (device_id_t*)(id); - ssize_t sbytes = write(devid->fd, buffer, len); - fflush(NULL); - - if (sbytes != len) { - return RETURNerror; - } - - return sbytes; -} - -/**************************************************************************** - ** ** - ** Name: device_get_fd() ** - ** ** - ** Description: Get the value of the file descriptor created to handle ** - ** the device with the given identifier ** - ** ** - ** Inputs: id: The identifier of the device ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The file descriptor of the device ** - ** Others: None ** - ** ** - ***************************************************************************/ -int device_get_fd(const void* id) -{ - if (id) { - return ((device_id_t*)id)->fd; - } - - return RETURNerror; -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/device.h b/openair-cn/NAS/EURECOM-NAS/src/util/device.h deleted file mode 100644 index b67a2cdbc3ec24122dc1e06952cedd3191a09dea..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/device.h +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source device.h - -Version 0.1 - -Date 2012/11/29 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Implements Linux/UNIX I/O device handlers - -*****************************************************************************/ -#ifndef __DEVICE_H__ -#define __DEVICE_H__ - -#include <sys/types.h> - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* Type of the connection endpoint */ -#define DEVICE 3 - -/* Hidden structure that handles device data */ -typedef struct device_id_s device_id_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void* device_open(int type, const char* devname, const char* params); -int device_get_fd(const void* id); - -ssize_t device_read(void* id, char* buffer, size_t length); -ssize_t device_write(const void* id, const char* buffer, size_t length); - -void device_close(void* id); - -#endif /* __DEVICE_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/memory.c b/openair-cn/NAS/EURECOM-NAS/src/util/memory.c deleted file mode 100644 index 739509c2284c9be0ce3fef8af7e46a84ef5dfdf5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/memory.c +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source memory.c - -Version 0.1 - -Date 2012/10/09 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Memory access utilities - -*****************************************************************************/ - -#include "memory.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <stdio.h> // fopen, fread, fclose -#include <stdlib.h> // getenv, malloc, free -#include <string.h> // strlen - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: memory_get_path() ** - ** ** - ** Description: Gets the absolute path of the file where non-volatile ** - ** data are located ** - ** ** - ** Inputs: dirname: The directory where data file is located ** - ** filename: The name of the data file ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The absolute path of the non-volatile data ** - ** file. The returned value is a dynamically ** - ** allocated octet string that needs to be ** - ** freed after usage. ** - ** Others: None ** - ** ** - ***************************************************************************/ -char* memory_get_path(const char* dirname, const char* filename) -{ - /* Get non-volatile data directory */ - const char* path = getenv(dirname); - - if (path == NULL) { - path = getenv(DEFAULT_NAS_PATH); - } - - if (path == NULL) { - LOG_TRACE(WARNING, "MEMORY - %s and %s environment variables are not defined trying local directory", dirname, DEFAULT_NAS_PATH); - path = "."; - } - - /* Append non-volatile data file name */ - size_t size = strlen(path) + strlen(filename) + 1; - char* data_filename = (char*)malloc(size+1); - - if (data_filename != NULL) { - if (size != sprintf(data_filename, "%s/%s", path, filename)) { - free(data_filename); - return NULL; - } - } - - return data_filename; -} - -/**************************************************************************** - ** ** - ** Name: memory_read() ** - ** ** - ** Description: Reads data from a non-volatile data file ** - ** ** - ** Inputs: datafile: The absolute path to the data file ** - ** size: The size of the data to read ** - ** Others: None ** - ** ** - ** Outputs: data: Pointer to the data read ** - ** Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -int memory_read(const char* datafile, void* data, size_t size) -{ - int rc = RETURNerror; - - /* Open the data file for reading operation */ - FILE* fp = fopen(datafile, "rb"); - - if (fp != NULL) { - /* Read data */ - size_t n = fread(data, size, 1, fp); - - if (n == 1) { - rc = RETURNok; - } - - /* Close the data file */ - fclose(fp); - } - - return (rc); -} - -/**************************************************************************** - ** ** - ** Name: memory_write() ** - ** ** - ** Description: Writes data to a non-volatile data file ** - ** ** - ** Inputs: datafile: The absolute path to the data file ** - ** data: Pointer to the data to write ** - ** size: The size of the data to write ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -int memory_write(const char* datafile, const void* data, size_t size) -{ - int rc = RETURNerror; - - /* Open the data file for writing operation */ - FILE* fp = fopen(datafile, "wb"); - - if (fp != NULL) { - /* Write data */ - size_t n = fwrite(data, size, 1, fp); - - if (n == 1) { - rc = RETURNok; - } - - /* Close the data file */ - fclose(fp); - } - - return (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/memory.h b/openair-cn/NAS/EURECOM-NAS/src/util/memory.h deleted file mode 100644 index 5d7734fc47b3a576909dbd199bc89a85f4d31894..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/memory.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source memory.h - -Version 0.1 - -Date 2012/10/09 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Memory access utilities - -*****************************************************************************/ -#ifndef __MEMORY_H__ -#define __MEMORY_H__ - -#include <stddef.h> // size_t - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -char* memory_get_path(const char* dirname, const char* filename); - -int memory_read(const char* datafile, void* data, size_t size); - -int memory_write(const char* datafile, const void* data, size_t size); - -#endif /* __MEMORY_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c b/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c deleted file mode 100644 index 5479122b5f9fceabeb3025230514e92dbef54a63..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.c +++ /dev/null @@ -1,279 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_log.c - -Version 0.1 - -Date 2012/02/28 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Usefull logging functions - -*****************************************************************************/ - -#include "nas_log.h" -#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE) -int nas_log_func_indent; -#else -#include <stdio.h> // stderr, sprintf, fprintf, vfprintf -#include <stdarg.h> // va_list, va_start, va_end - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/* ANSI escape codes for colored display */ -#define LOG_BLACK "\033[30m" -#define LOG_RED "\033[31m" -#define LOG_GREEN "\033[32m" -#define LOG_YELLOW "\033[33m" -#define LOG_BLUE "\033[34m" -#define LOG_MAGENTA "\033[35m" -#define LOG_CYAN "\033[36m" -#define LOG_WHITE "\033[37m" -#define LOG_END "\033[0m" -#define LOG_AUTO LOG_END - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* ------------------------ - * Internal logging context - * ------------------------ - * Internal logging context consists on: - * - The file name and the line number from where the data have been - * logged. These information are gathered into a string that will - * be displayed as a prefix of the logging trace with the format - * filename[line] - * - The severity level filter - * - The indentation level to convey FUNC logging traces - * - The data definition of each logging trace level: name and mask - * (the mask is used against the severity level filter to enable - * or disable specific logging traces) - */ -typedef struct { -#define LOG_PREFIX_SIZE 118 - char prefix[LOG_PREFIX_SIZE]; - unsigned char filter; - int indent; - const struct { - char* name; - unsigned char mask; - char* color; - } level[]; -} log_context_t; - -/* - * Definition of the logging context - */ -static log_context_t _log_context = { - "", /* prefix */ - 0x00, /* filter */ - 0, /* indent */ - { - { "DEBUG", NAS_LOG_DEBUG, LOG_GREEN }, /* DEBUG */ - { "INFO", NAS_LOG_INFO, LOG_AUTO }, /* INFO */ - { "WARNING", NAS_LOG_WARNING, LOG_BLUE }, /* WARNING */ - { "ERROR", NAS_LOG_ERROR, LOG_RED }, /* ERROR */ - { "", NAS_LOG_FUNC, LOG_AUTO }, /* FUNC_IN */ - { "", NAS_LOG_FUNC, LOG_AUTO }, /* FUNC_OUT */ - } /* level[] */ -}; - -/* Maximum number of bytes into a line of dump logging data */ -#define LOG_DUMP_LINE_SIZE 16 - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: log_init() ** - ** ** - ** Description: Initializes internal logging data ** - ** ** - ** Inputs: filter: Value of the severity level that will be ** - ** used as a filter to enable or disable ** - ** specific logging traces ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void nas_log_init(char filter) -{ - _log_context.filter = filter; -} - -/**************************************************************************** - ** ** - ** Name: log_data() ** - ** ** - ** Description: Defines internal logging data ** - ** ** - ** Inputs: filename: Name of the file from where the data have ** - ** been logged ** - ** line: Number of the line in the file ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void log_data(const char* filename, int line) -{ - int len = strlen(filename) + 2 + 1; //2:[], 1:/0 - if (line > 9999) len+=5; - else if (line > 999) len+=4; - else if (line > 99) len+=3; - else if (line > 9) len+=2; - else len+=1; - if (len > LOG_PREFIX_SIZE) { - snprintf(_log_context.prefix, LOG_PREFIX_SIZE, "%s:%d", &filename[len - LOG_PREFIX_SIZE], line); - } else { - snprintf(_log_context.prefix, LOG_PREFIX_SIZE, "%s:%d", filename, line); - } -} - -/**************************************************************************** - ** ** - ** Name: log_trace() ** - ** ** - ** Description: Displays logging data ** - ** ** - ** Inputs: severity: Severity level of the logging data ** - ** data: Formated logging data to display ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void log_trace(log_severity_t severity, const char* data, ...) -{ - int i; - - /* Sanity check */ - if (severity > LOG_SEVERITY_MAX) return; - - /* Display only authorized logging traces */ - if (_log_context.level[severity].mask & _log_context.filter) { - va_list argp; - - /* - * First, display internal logging data (logging trace prefix: file - * name and line number from where the data have been logged) and - * the severity level. - */ - fprintf(stderr, "%s%-120.118s%-10s", _log_context.level[severity].color, - _log_context.prefix, _log_context.level[severity].name); - { - /* Next, perform indentation for FUNC logging trace */ - if (severity == FUNC_OUT) { - _log_context.indent--; - } - - for (i=0; i<_log_context.indent; i++) { - fprintf(stderr, " "); - } - - if (severity == FUNC_IN) { - _log_context.indent++; - } - } - - /* Finally, display logging data */ - va_start(argp, data); - vfprintf(stderr, data, argp); - - /* Terminate with line feed character */ - fprintf(stderr, "%s\n", LOG_END); - - va_end(argp); - } -} - -/**************************************************************************** - ** ** - ** Name: log_dump() ** - ** ** - ** Description: Dump logging data ** - ** ** - ** Inputs: data: Logging data to dump ** - ** len: Number of bytes to be dumped ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void log_dump(const char* data, int len) -{ - int i; - - /* Display only authorized logging traces */ - if ( (len > 0) && (NAS_LOG_HEX & _log_context.filter) ) { - int bytes = 0; - - fprintf(stderr, "\n\t"); - - for (i=0; i < len; i++) { - fprintf(stderr, "%.2hx ", (const unsigned char) data[i]); - - /* Add new line when the number of displayed bytes exceeds - * the line's size */ - if ( ++bytes > (LOG_DUMP_LINE_SIZE - 1) ) { - bytes = 0; - fprintf(stderr, "\n\t"); - } - } - - if (bytes % LOG_DUMP_LINE_SIZE) { - fprintf(stderr, "\n"); - } - - fprintf(stderr, "\n"); - fflush(stderr); - } -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ -#endif - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.h b/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.h deleted file mode 100644 index b947e3356393f2adba4642a74edd155e7999a03f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/nas_log.h +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_log.h - -Version 0.1 - -Date 2012/02/28 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Usefull logging functions - -*****************************************************************************/ -#ifndef __NAS_LOG_H__ -#define __NAS_LOG_H__ - -#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE) -# include "UTIL/LOG/log.h" -# undef LOG_TRACE -#endif - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* ----------------------- - * Logging severity levels - * ----------------------- - * OFF : Disables logging trace utilities. - * DEBUG : Only used for debug purpose. Should be removed from the code. - * INFO : Informational trace - * WARNING : The program displays the warning message and doesn't stop. - * ERROR : The program displays the error message and usually exits or - * runs appropriate procedure. - * FUNC : Prints trace when entering/leaving to/from function. Usefull - * to display the function's calling tree information at runtime. - * ON : Enables logging traces excepted FUNC. - * ALL : Turns on ALL logging traces. - */ -#define NAS_LOG_OFF 0x00 /* No trace */ -#define NAS_LOG_DEBUG 0x01 /* Debug trace */ -#define NAS_LOG_INFO 0x02 /* Informational trace */ -#define NAS_LOG_WARNING 0x04 /* Warning trace */ -#define NAS_LOG_ERROR 0x08 /* Error trace */ -#define NAS_LOG_FUNC 0x10 /* Entering/Leaving function trace */ -#define NAS_LOG_HEX 0x20 /* Dump trace */ - -#define NAS_LOG_ON 0x0F /* All traces excepted FUNC and HEX */ -#define NAS_LOG_ALL 0xFF /* All traces */ - -/* Logging severity type */ -typedef enum { - DEBUG, - INFO, - WARNING, - ERROR, - FUNC_IN, - FUNC_OUT, - LOG_SEVERITY_MAX -} log_severity_t; - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE) -# define LOG_TRACE(s, x, args...) \ -do { \ - switch (s) { \ - case ERROR: LOG_E(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ - case WARNING: LOG_W(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ - case INFO: LOG_I(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ - default: LOG_D(NAS, " %s:%d " x "\n", __FILE__, __LINE__, ##args); break; \ - } \ -} while (0) - -# define LOG_DUMP(dATA, lEN) \ -do { \ - char buffer[3*lEN + 1]; \ - int i; \ - for (i = 0; i < lEN; i++) \ - sprintf (&buffer[3*i], "%02x ", dATA[i]); \ - LOG_D(NAS, " Dump %d: %s\n", lEN, buffer); \ -} while (0) - -# define LOG_FUNC_IN \ -do { \ - LOG_D(NAS, " %s:%d %*sEntering %s()\n", __FILE__, __LINE__, nas_log_func_indent, "", __FUNCTION__); \ - nas_log_func_indent += 2; \ -} while (0) - -# define LOG_FUNC_OUT \ -do { \ - nas_log_func_indent -= 2; \ - LOG_D(NAS, " %s:%d %*sLeaving %s()\n", __FILE__, __LINE__, nas_log_func_indent, "", __FUNCTION__); \ -} while (0) - -# define LOG_FUNC_RETURN(rETURNcODE) \ -do { \ - nas_log_func_indent -= 2; \ - LOG_D(NAS, " %s:%d %*sLeaving %s(rc = %ld)\n", __FILE__, __LINE__, nas_log_func_indent, "", \ - __FUNCTION__, (long) rETURNcODE); \ - return (rETURNcODE); \ -} while (0) - -extern int nas_log_func_indent; - -#else -# define LOG_TRACE log_data(__FILE__, __LINE__); log_trace -# define LOG_DUMP(a, b) log_dump((a),(b)); - -# define LOG_FUNC_IN LOG_TRACE(FUNC_IN, "Entering %s()", __FUNCTION__) -# define LOG_FUNC_OUT LOG_TRACE(FUNC_OUT, "Leaving %s()", __FUNCTION__) -# define LOG_FUNC_RETURN(rETURNcODE) \ -do { \ - LOG_TRACE(FUNC_OUT, "Leaving %s(rc = %ld)", __FUNCTION__, \ - (long) rETURNcODE); \ - return (rETURNcODE); \ -} while(0) - -void nas_log_init(char filter); -void log_data(const char* filename, int line); -void log_trace(log_severity_t severity, const char* data, ...); -void log_dump(const char* data, int len); -#endif - -#endif /* __NAS_LOG_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.c b/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.c deleted file mode 100644 index f1363433f2b3bbaaf7048f5e70ef82256fe3d9ed..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.c +++ /dev/null @@ -1,880 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_timer.c - -Version 0.1 - -Date 2012/10/09 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Timer utilities - -*****************************************************************************/ - -#include <pthread.h> -#include <assert.h> -#include <stdint.h> - -#include <string.h> // memset -#include <stdlib.h> // malloc, free -#include <sys/time.h> // setitimer - -#if defined(ENABLE_ITTI) -# include "intertask_interface.h" -# include "timer.h" -#else -# include <signal.h> -# include <time.h> // clock_gettime -#endif -#include "nas_timer.h" -#include "commonDef.h" -#include "msc.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* Structure of an interval timer entry - * ------------------------------------ - * The callback function is scheduled to be executed upon expiration of - * the timer that has been previously setup to the initial interval time - * value when the timer entry was allocated. - */ -typedef struct { -#if defined(ENABLE_ITTI) - long timer_id; /* Timer id returned by the timer API from ITTI */ -#else - pthread_t pid; /* Thread identifier of the callback */ -#endif - - struct timeval itv; /* Initial interval timer value */ - struct timeval tv; /* Interval timer value */ - - nas_timer_callback_t cb; /* Callback executed at timer expiration */ - void *args; /* Callback argument parameters */ -} nas_timer_entry_t; - -/* Structure of a timer queue - list of active interval timer entries - * ------------------------------------------------------------------ - * At any time, the first entry of the queue is always associated to the - * first timer that will come to expire. Upon timer expiration, the first - * entry is removed from the queue and freed. - */ -typedef struct _nas_timer_queue_t { - int id; /* Identifier of the current timer entry */ - nas_timer_entry_t *entry; /* The current timer entry */ - struct _nas_timer_queue_t *prev;/* The previous timer entry in the queue */ - struct _nas_timer_queue_t *next;/* The next timer entry in the queue */ -} timer_queue_t; - -/* Structure of a timer database - * ----------------------------- - * The timer database is managed to provide unique identifier to timer at - * startup and to maintain an ordered queue of active timer entries. - */ -typedef struct { - int timer_id; /* Identifier of the first available timer entry */ -#define TIMER_DATABASE_SIZE 256 - timer_queue_t tq[TIMER_DATABASE_SIZE]; - timer_queue_t *head;/* Pointer to the first timer entry to be fired */ - -#if !defined(ENABLE_ITTI) - pthread_mutex_t mutex; -#endif -} nas_timer_database_t; - -/* - * The timer database - */ -static nas_timer_database_t _nas_timer_db = { - 0, - {}, - NULL -#if !defined(ENABLE_ITTI) - , PTHREAD_MUTEX_INITIALIZER -#endif -}; - -#if defined(ENABLE_ITTI) -#define nas_timer_lock_db() -#define nas_timer_unlock_db() -#else -#define nas_timer_lock_db() pthread_mutex_lock(&_nas_timer_db.mutex) -#define nas_timer_unlock_db() pthread_mutex_unlock(&_nas_timer_db.mutex) -#endif - -/* - * The handler executed whenever the system timer expires - */ -#if !defined(ENABLE_ITTI) -static void _nas_timer_handler(int signal); -#endif - -/* - * ----------------------------------------------------------------------------- - * Functions used to manage the timer database - * ----------------------------------------------------------------------------- - */ -static void _nas_timer_db_init(void); - -static int _nas_timer_db_get_id(void); -static int _nas_timer_db_is_active(int id); -static nas_timer_entry_t *_nas_timer_db_create_entry(long sec, - nas_timer_callback_t cb, void *args); -static void _nas_timer_db_delete_entry(int id); - -static void _nas_timer_db_insert_entry(int id, nas_timer_entry_t *te); -static int _nas_timer_db_insert(timer_queue_t *entry); - -static nas_timer_entry_t *_nas_timer_db_remove_entry(int id); -static int _nas_timer_db_remove(timer_queue_t *entry); - -/* - * ----------------------------------------------------------------------------- - * Operator functions for timeval structures - * ----------------------------------------------------------------------------- - */ -static int _nas_timer_cmp(const struct timeval *a, const struct timeval *b); -static void _nas_timer_add(const struct timeval *a, const struct timeval *b, - struct timeval *result); -static int _nas_timer_sub(const struct timeval *a, const struct timeval *b, - struct timeval *result); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: timer_init() ** - ** ** - ** Description: Initializes internal data used to manage timers ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ -int nas_timer_init(void) -{ - /* Initialize the timer database */ - _nas_timer_db_init(); - -#if !defined(ENABLE_ITTI) - /* Setup the timer database handler */ - struct sigaction act; - - (void) memset (&act, 0, sizeof (act)); - (void) sigfillset (&act.sa_mask); - (void) sigdelset (&act.sa_mask, SIGHUP); - (void) sigdelset (&act.sa_mask, SIGINT); - (void) sigdelset (&act.sa_mask, SIGTERM); - (void) sigdelset (&act.sa_mask, SIGILL); - (void) sigdelset (&act.sa_mask, SIGTRAP); - (void) sigdelset (&act.sa_mask, SIGIOT); -# ifndef LINUX - (void) sigdelset (&act.sa_mask, SIGEMT); -# endif - (void) sigdelset (&act.sa_mask, SIGFPE); - (void) sigdelset (&act.sa_mask, SIGBUS); - (void) sigdelset (&act.sa_mask, SIGSEGV); - (void) sigdelset (&act.sa_mask, SIGSYS); - - act.sa_handler = _nas_timer_handler; - - if ( sigaction (SIGALRM, &act, 0) < 0 ) { - return (RETURNerror); - } - -#endif - return (RETURNok); -} - -/**************************************************************************** - ** ** - ** Name: timer_start() ** - ** ** - ** Description: Schedules the execution of the given callback function ** - ** upon expiration of the specified time interval ** - ** ** - ** Inputs: sec: The value of the time interval in seconds ** - ** cb: Function executed upon timer expiration ** - ** args: Callback argument parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The timer identifier when successfully ** - ** started; NAS_TIMER_INACTIVE_ID otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_timer_start(long sec, nas_timer_callback_t cb, void *args) -{ - int id; - nas_timer_entry_t *te; -#if defined(ENABLE_ITTI) - int ret; - long timer_id; -#endif - - /* Do not start null timer */ - if (sec == 0) { - return (NAS_TIMER_INACTIVE_ID); - } - - /* Get an identifier for the new timer entry */ - id = _nas_timer_db_get_id(); - - if (id < 0) { - /* No available timer entry found */ - return (NAS_TIMER_INACTIVE_ID); - } - - /* Create a new timer entry */ - te = _nas_timer_db_create_entry(sec, cb, args); - - if (te == NULL) { - return (NAS_TIMER_INACTIVE_ID); - } - - /* Insert the new entry into the timer queue */ - _nas_timer_db_insert_entry(id, te); -#if defined(ENABLE_ITTI) -# if defined(NAS_BUILT_IN_EPC) - ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); -# else - ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); -# endif - - if (ret == -1) { - return NAS_TIMER_INACTIVE_ID; - } - - te->timer_id = timer_id; -#endif - - return (id); -} - -/**************************************************************************** - ** ** - ** Name: timer_stop() ** - ** ** - ** Description: Stop the timer with the specified identifier ** - ** ** - ** Inputs: id: The identifier of the timer to be stopped ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: NAS_TIMER_INACTIVE_ID when successfully stop- ** - ** ped; The timer identifier otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_timer_stop(int id) -{ - /* Check if the timer entry is active */ - if (_nas_timer_db_is_active(id)) { - nas_timer_entry_t *entry; - /* Remove the entry from the timer queue */ - entry = _nas_timer_db_remove_entry(id); -#if defined(ENABLE_ITTI) - timer_remove(entry->timer_id); -#else - (void)entry; -#endif - /* Delete the timer entry */ - _nas_timer_db_delete_entry(id); - return (NAS_TIMER_INACTIVE_ID); - } - - return (id); -} - -/**************************************************************************** - ** ** - ** Name: timer_restart() ** - ** ** - ** Description: Restart the timer with the specified identifier. The ti- ** - ** mer is scheduled to expire after the same period of time ** - ** and will execute the callback function that has been set ** - ** when it was started. ** - ** ** - ** Inputs: id: The identifier of the timer to be started ** - ** again ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The timer identifier when successfully ** - ** re-started; NAS_TIMER_INACTIVE_ID otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -int nas_timer_restart(int id) -{ - /* Check if the timer entry is active */ - if (_nas_timer_db_is_active(id)) { - /* Remove the entry from the timer queue */ - nas_timer_entry_t *te = _nas_timer_db_remove_entry(id); - /* Initialize its interval timer value */ - te->tv = te->itv; - /* Insert again the entry into the timer queue */ - _nas_timer_db_insert_entry(id, te); - return (id); - } - - return (NAS_TIMER_INACTIVE_ID); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _nas_timer_handler() ** - ** ** - ** Description: The timer handler is executed whenever the system deli- ** - ** vers signal SIGALARM. It starts execution of the callback ** - ** function of the first entry within the queue of active ** - ** timer entries. The entry is not removed from the queue of ** - ** active timer entries and shall be explicitly removed when ** - ** the timer expires. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ -#if defined(ENABLE_ITTI) -void nas_timer_handle_signal_expiry(long timer_id, void *arg_p) -{ - /* Get the timer entry for which the system timer expired */ - nas_timer_entry_t *te = _nas_timer_db.head->entry; - - te->cb(te->args); -} -#else -static void _nas_timer_handler(int signal) -{ - /* At least one timer has been started */ - assert( (_nas_timer_db.head != NULL) && (_nas_timer_db.head->entry != NULL) ); - - /* Get the timer entry for which the system timer expired */ - nas_timer_entry_t *te = _nas_timer_db.head->entry; - - /* Execute the callback function */ - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - int rc = pthread_create (&te->pid, &attr, te->cb, te->args); - pthread_attr_destroy(&attr); - - /* Wait for the thread to terminate before releasing the timer entry */ - if (rc == 0) { - void *result = NULL; - (void) pthread_join(te->pid, &result); - - /* TODO: Check returned result ??? */ - if (result) { - free(result); - } - } -} -#endif - -/* - * ----------------------------------------------------------------------------- - * Functions used to manage the timer database - * ----------------------------------------------------------------------------- - */ -/**************************************************************************** - ** ** - ** Name: _nas_timer_db_init() ** - ** ** - ** Description: Initializes the timer database ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ -static void _nas_timer_db_init(void) -{ - int i; - - for (i = 0; i < TIMER_DATABASE_SIZE; i++) { - _nas_timer_db.tq[i].id = NAS_TIMER_INACTIVE_ID; - } -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_db_get_id() ** - ** ** - ** Description: Gets the identifier of the first available timer entry in ** - ** the queue of active timer entries ** - ** ** - ** Inputs: None ** - ** Others: _nas_timer_db ** - ** ** - ** Outputs: None ** - ** Return: The identifier of the first available ** - ** timer entry if the queue of active timers ** - ** is not full; -1 otherwise. ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ -static int _nas_timer_db_get_id(void) -{ - int i; - - /* Search from the current timer entry to the last timer entry */ - for (i = _nas_timer_db.timer_id; i < TIMER_DATABASE_SIZE; i++) { - if (_nas_timer_db.tq[i].id < 0 ) { - _nas_timer_db.timer_id = i+1; - return i; - } - } - - /* Search from the first timer entry to the current timer entry */ - for (i = 0; i < _nas_timer_db.timer_id; i++) { - if (_nas_timer_db.tq[i].id < 0 ) { - _nas_timer_db.timer_id = i+1; - return i; - } - } - - /* No available timer entry found */ - return (-1); -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_db_is_active() ** - ** ** - ** Description: Checks whether the entry with the given identifier is ** - ** active within the queue of active timer entries ** - ** ** - ** Inputs: id: Identifier of the timer entry to check ** - ** Others: _nas_timer_db ** - ** ** - ** Outputs: None ** - ** Return: TRUE if the timer entry is active; FALSE ** - ** if it is not an active timer entry. ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_timer_db_is_active(int id) -{ - return ( (id != NAS_TIMER_INACTIVE_ID) && - (_nas_timer_db.tq[id].id != NAS_TIMER_INACTIVE_ID) ); -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_db_create_entry() ** - ** ** - ** Description: Creates a new timer entry ** - ** ** - ** Inputs: sec: Time interval value ** - ** cb: Function executed upon timer expiration ** - ** args: Callback argument parameters ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: A pointer to the new timer entry if ** - ** successfully allocated; NULL otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -static nas_timer_entry_t *_nas_timer_db_create_entry( - long sec, nas_timer_callback_t cb, - void *args) -{ - nas_timer_entry_t *te = (nas_timer_entry_t *)malloc(sizeof(nas_timer_entry_t)); - - if (te != NULL) { - te->itv.tv_sec = sec; - te->itv.tv_usec = 0; - te->tv = te->itv; - te->cb = cb; - te->args = args; - } - - return (te); -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_db_delete_entry() ** - ** ** - ** Description: Deletes the entry with the given identifier from the ti- ** - ** mer database. ** - ** ** - ** Inputs: id: Identifier of the entry to be deleted ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ -static void _nas_timer_db_delete_entry(int id) -{ - /* The identifier of the timer is valid within the timer queue */ - assert(_nas_timer_db.tq[id].id == id); - - /* Delete the timer entry from the queue */ - _nas_timer_db.tq[id].id = NAS_TIMER_INACTIVE_ID; - free(_nas_timer_db.tq[id].entry); - _nas_timer_db.tq[id].entry = NULL; -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_db_insert_entry() ** - ** ** - ** Description: Inserts the entry with the given identifier into the ** - ** queue of active timer entries and restarts the system ** - ** timer if the new entry is the next entry for which the ** - ** timer should be scheduled to expire. ** - ** ** - ** Inputs: id: Identifier of the new entry ** - ** te: Pointer to the entry to be inserted ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ -static void _nas_timer_db_insert_entry(int id, nas_timer_entry_t *te) -{ - struct itimerval it; - struct timespec ts; - struct timeval current_time; - int restart; - - /* Enqueue the new timer entry */ - _nas_timer_db.tq[id].id = id; - _nas_timer_db.tq[id].entry = te; - - /* Save its interval timer value */ - it.it_interval.tv_sec = it.it_interval.tv_usec = 0; - it.it_value = te->tv; - - /* Update its interval timer value */ - clock_gettime(CLOCK_MONOTONIC, &ts); - current_time.tv_sec = ts.tv_sec; - current_time.tv_usec = ts.tv_nsec/1000; - /* tv = tv + time() */ - _nas_timer_add(&te->tv, ¤t_time, &te->tv); - - /* Insert the new timer entry into the list of active entries */ - nas_timer_lock_db(); - restart = _nas_timer_db_insert(&_nas_timer_db.tq[id]); - nas_timer_unlock_db(); - -#if !defined(ENABLE_ITTI) - - if (restart) { - /* The new entry is the first entry of the list; - * restart the system timer */ - setitimer(ITIMER_REAL, &it, 0); - } - -#else - (void)(restart); -#endif -} - -static int _nas_timer_db_insert(timer_queue_t *entry) -{ - timer_queue_t *prev, *next; /* previous and next entry in the list */ - - /* - * Search the list of timer entries for the first entry with an interval - * timer value greater than the interval timer value of the new timer entry - */ - for (prev = NULL, next = _nas_timer_db.head; next != NULL; next = next->next) { - if (_nas_timer_cmp(&next->entry->tv, &entry->entry->tv) > 0) { - break; - } - - prev = next; - } - - /* Insert the new entry in the list of active timer entries */ - /* prev <-- entry --> next */ - entry->prev = prev; - entry->next = next; - - /* Update the pointer from the previous entry */ - if (entry->next != NULL) { - /* prev <-- entry <--> next */ - entry->next->prev = entry; - } - - /* Update the pointer from the next entry */ - if (entry->prev != NULL) { - /* prev <--> entry <--> next */ - entry->prev->next = entry; - } else { - /* The new entry is the first entry of the list */ - _nas_timer_db.head = entry; - return TRUE; - } - - /* The new entry is NOT the first entry of the list */ - return FALSE; -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_db_remove_entry() ** - ** ** - ** Description: Removes the entry with the given identifier from the ** - ** queue of active timer entries and restarts the system ** - ** timer if the entry was the next entry for which the timer ** - ** was scheduled to expire. ** - ** ** - ** Inputs: id: Identifier of the entry to be removed ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: A pointer to the removed entry ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ -static nas_timer_entry_t *_nas_timer_db_remove_entry(int id) -{ - int restart; - - /* The identifier of the timer is valid within the timer queue */ - assert(_nas_timer_db.tq[id].id == id); - - /* Remove the timer entry from the list of active entries */ - nas_timer_lock_db(); - restart = _nas_timer_db_remove(&_nas_timer_db.tq[id]); - nas_timer_unlock_db(); - - if (restart) { - int rc; - /* The entry was the first entry of the list; - * the system timer needs to be restarted */ - struct itimerval it; - struct timeval tv; - struct timespec ts; - - it.it_interval.tv_sec = it.it_interval.tv_usec = 0; - - clock_gettime(CLOCK_MONOTONIC, &ts); - - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec/1000; - /* tv = tv - time() */ - rc = _nas_timer_sub(&_nas_timer_db.head->entry->tv, &tv, &it.it_value); - -#if defined(ENABLE_ITTI) - timer_remove(_nas_timer_db.head->entry->timer_id); - (void) (rc); -#else - - if (rc < 0) { - /* The system timer should have already expired */ - _nas_timer_handler(SIGALRM); - } else { - /* Restart the system timer */ - setitimer(ITIMER_REAL, &it, 0); - } - -#endif - } - - /* Return a pointer to the removed entry */ - return (_nas_timer_db.tq[id].entry); -} - -static int _nas_timer_db_remove(timer_queue_t *entry) -{ - /* Update the pointer from the previous entry */ - /* prev ---> entry ---> next */ - /* prev <--- entry <--- next */ - if (entry->next != NULL) { - /* prev ---> entry ---> next */ - /* prev <-------------- next */ - entry->next->prev = entry->prev; - } - - /* Update the pointer from the next entry */ - if (entry->prev != NULL) { - /* prev --------------> next */ - /* prev <-------------- next */ - entry->prev->next = entry->next; - } else { - /* The entry was the first entry of the list */ - _nas_timer_db.head = entry->next; - - if (_nas_timer_db.head != NULL) { - /* Other timers are scheduled to expire */ - return TRUE; - } - -#if !defined(ENABLE_ITTI) - { - /* No more timer is scheduled to expire; stop the system timer */ - struct itimerval it; - it.it_interval.tv_sec = it.it_interval.tv_usec = 0; - it.it_value.tv_sec = it.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &it, 0); - return FALSE; - } -#endif - } - - /* The entry was NOT the first entry of the list */ - return FALSE; -} - -/* - * ----------------------------------------------------------------------------- - * Operator functions for timeval structures - * ----------------------------------------------------------------------------- - */ -/**************************************************************************** - ** ** - ** Name: _nas_timer_cmp() ** - ** ** - ** Description: Performs timeval comparaison ** - ** ** - ** Inputs: a: The first timeval structure ** - ** b: The second timeval structure ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: -1 if a < b; 1 if a > b; 0 if a == b ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_timer_cmp(const struct timeval *a, const struct timeval *b) -{ - if (a->tv_sec < b->tv_sec) { - return -1; - } else if (a->tv_sec > b->tv_sec) { - return 1; - } else if (a->tv_usec < b->tv_usec) { - return -1; - } else if (a->tv_usec > b->tv_usec) { - return 1; - } - - return 0; -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_add() ** - ** ** - ** Description: Performs timeval addition ** - ** ** - ** Inputs: a: The first timeval structure ** - ** b: The second timeval structure ** - ** Others: None ** - ** ** - ** Outputs: result: result = timeval(a + b) ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -static void _nas_timer_add(const struct timeval *a, const struct timeval *b, - struct timeval *result) -{ - result->tv_sec = a->tv_sec + b->tv_sec; - result->tv_usec = a->tv_usec + b->tv_usec; - - if (result->tv_usec > 1000000) { - result->tv_sec++; - result->tv_usec -= 1000000; - } -} - -/**************************************************************************** - ** ** - ** Name: _nas_timer_sub() ** - ** ** - ** Description: Performs timeval substraction ** - ** ** - ** Inputs: a: The first timeval structure ** - ** b: The second timeval structure ** - ** Others: None ** - ** ** - ** Outputs: result: a >= b, result = timeval(a - b) ** - ** Return: -1 if a < b; 0 otherwise ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _nas_timer_sub(const struct timeval *a, const struct timeval *b, - struct timeval *result) -{ - if (_nas_timer_cmp(a,b) > 0 ) { - result->tv_sec = a->tv_sec - b->tv_sec; - result->tv_usec = a->tv_usec - b->tv_usec; - - if (result->tv_usec < 0) { - result->tv_sec--; - result->tv_usec += 1000000; - } - - return 0; - } - - return -1; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.h b/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.h deleted file mode 100644 index 891eeab5e78ff574c4f5930ac295eb961458f2c8..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/nas_timer.h +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source nas_timer.h - -Version 0.1 - -Date 2012/11/22 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Timer utilities - -*****************************************************************************/ -#ifndef __NAS_TIMER_H__ -#define __NAS_TIMER_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Timer identifier returned when in inactive state (timer is stopped or has - * failed to be started) - */ -#define NAS_TIMER_INACTIVE_ID (-1) - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* Timer structure */ -struct nas_timer_t { - int id; /* The timer identifier */ - long sec; /* The timer interval value in seconds */ -}; - -/* Type of the callback executed when the timer expired */ -typedef void *(*nas_timer_callback_t)(void *); - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int nas_timer_init(void); -int nas_timer_start(long sec, nas_timer_callback_t cb, void *args); -int nas_timer_stop(int id); -int nas_timer_restart(int id); - -#if defined(NAS_BUILT_IN_EPC) -void nas_timer_handle_signal_expiry(long timer_id, void *arg_p); -#endif - -#endif /* __NAS_TIMER_H__ */ diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/parser.c b/openair-cn/NAS/EURECOM-NAS/src/util/parser.c deleted file mode 100644 index cb69a6370332fbb62772e1eeaea17c831ff0fd32..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/parser.c +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source parser.c - -Version 0.1 - -Date 2012/02/27 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Usefull command line parser - -*****************************************************************************/ - -#include "parser.h" -#include "commonDef.h" - -#include <stdio.h> // fprintf -#include <string.h> // strcmp, strncpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: parser_print_usage() ** - ** ** - ** Description: Displays command line usage ** - ** ** - ** Inputs: command_line: Pointer to the command line structure ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void parser_print_usage(const parser_command_line_t* command_line) -{ - fprintf(stderr, "Usage: %s", command_line->name); - - for (int i=0; i < command_line->nb_options; i++) { - fprintf(stderr, " [%s %s]", - command_line->options[i].name, - command_line->options[i].argument); - } - - fprintf(stderr, "\n"); - - for (int i=0; i < command_line->nb_options; i++) { - fprintf(stderr, "\t%s\t%s\t(%s)\n", - command_line->options[i].argument, - command_line->options[i].usage, - command_line->options[i].value); - } -} - -/**************************************************************************** - ** ** - ** Name: parser_get_options() ** - ** ** - ** Description: Parses the command line options ** - ** ** - ** Inputs: argc: Number of command line options ** - ** argv: Pointer to the command line ** - ** command_line: Pointer to the command line structure ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** command_line: Pointer to the command line structure ** - ** Others: None ** - ** ** - ***************************************************************************/ -int parser_get_options(int argc, const char** argv, - parser_command_line_t* command_line) -{ - int argument_not_found, option_not_found = 1; - int option_length; - - /* Initialize command line structure */ - strncpy(command_line->name, argv[0], PARSER_COMMAND_NAME_SIZE); - - for (int i=0; i < command_line->nb_options; i++) { - if ( strcmp(command_line->options[i].value, "NULL") ) { - command_line->options[i].pvalue = command_line->options[i].value; - } - } - - /* No command line options */ - if (argc == 1) { - return RETURNok; - } - - /* Parse the command line looking for options */ - while (*++argv && **argv == '-') { - argument_not_found = 1; - option_not_found = 1; - - for (int i=0; i < command_line->nb_options; i++) { - if ( !strcmp(command_line->options[i].name, *argv) ) { - option_not_found = 0; - - if (argv[1] && *argv[1] != '-') { - argument_not_found = 0; - option_length = (int) strlen(*++argv); - - if (option_length >= PARSER_OPTION_VALUE_SIZE) { - fprintf(stderr, "%s: option name too long (%d), should be less than %d characters\n", - *argv, option_length, - PARSER_OPTION_VALUE_SIZE); - return RETURNerror; - } - - strcpy(command_line->options[i].value, *argv); - - if (command_line->options[i].pvalue == NULL) { - command_line->options[i].pvalue = - command_line->options[i].value; - } - } - - break; - } - } - - if (option_not_found) { - if ( strcmp(*argv, "-?") && strcmp(*argv, "-h") && - strcmp(*argv, "-help") && strcmp(*argv, "--help") ) { - fprintf(stderr, "%s: illegal option %s\n", - command_line->name, *argv); - return RETURNerror; - } - } else if (argument_not_found) { - fprintf(stderr, "%s: option %s requires an argument\n", - command_line->name, *argv); - return RETURNerror; - } - } - - if (option_not_found) { - return RETURNerror; - } - - return RETURNok; -} -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/parser.h b/openair-cn/NAS/EURECOM-NAS/src/util/parser.h deleted file mode 100644 index 0fe247015f6ff2248285fc12990693c7603235a2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/parser.h +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source parser.h - -Version 0.1 - -Date 2012/02/27 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Usefull command line parser - -*****************************************************************************/ -#ifndef __PARSER_H__ -#define __PARSER_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* ----------- - * Option type - * ----------- - * An option is defined with a name, an argument following the option's - * name, the usage message and a value - */ -typedef struct { - const char* name; /* Option name */ - const char* argument; /* Argument following the option */ - const char* usage; /* Option and Argument usage */ -#define PARSER_OPTION_VALUE_SIZE 32 - char value[PARSER_OPTION_VALUE_SIZE]; /* Option value */ - char* pvalue; -} parser_option_t; - -/* ----------------- - * Command line type - * ----------------- - * An command line is defined with a name, the number of options and the - * list of command's options - */ -typedef struct { -#define PARSER_COMMAND_NAME_SIZE 32 - char name[PARSER_COMMAND_NAME_SIZE]; /* Command name */ - const int nb_options; /* Number of options */ - parser_option_t options[]; /* Command line options */ -} parser_command_line_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void parser_print_usage(const parser_command_line_t* commamd_line); -int parser_get_options(int argc, const char** argv, - parser_command_line_t* commamd_line); - -#endif /* __PARSER_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/socket.c b/openair-cn/NAS/EURECOM-NAS/src/util/socket.c deleted file mode 100644 index f7793204f2c6918c8326b56f579d7cefa1c7f6d0..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/socket.c +++ /dev/null @@ -1,426 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** - Source socket.c - - Version 0.1 - - Date 2012/02/28 - - Product NAS stack - - Subsystem Utilities - - Author Frederic Maurel - - Description Implements socket handlers - - *****************************************************************************/ - -#include "socket.h" -#include "commonDef.h" - -#include <stdlib.h> // malloc, free, atoi -#include <string.h> // memset -#include <unistd.h> // close -#include <errno.h> // EINTR -#include <sys/types.h> -#include <sys/socket.h> // socket, setsockopt, connect, bind, recv, send -#include <netdb.h> // getaddrinfo -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* ------------------------------------- - * Identifier of network socket endpoint - * ------------------------------------- - * A network socket endpoint is defined with a type (client or server), - * a port number, and the name and address of the remote host it should - * be connected to. A socket file descriptor is created to handle the - * setup of the communication channel with the remote peer. - */ -struct socket_id_s { - int type; /* connection type (client/server) */ - int port; /* port number */ -#define SOCKET_HOSTNAME_SIZE 32 - char rhost[SOCKET_HOSTNAME_SIZE]; /* remote hostname */ - struct sockaddr_storage addr; /* remote address */ - int fd; /* socket file descriptor */ -}; - -/* Set socket option at the sockets API level (SOL_SOCKET) */ -static int _socket_set_option(int sfd); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: socket_udp_open() ** - ** ** - ** Description: Initializes a communication endpoint for any IPv4 and ** - ** IPv6 protocol used by a local host to send/receive UDP ** - ** datagrams to/from a remote host in "connected" mode of ** - ** operation. ** - ** ** - ** Inputs: type: Type of the connection (client/server) ** - ** host: For client application, the remote host- ** - ** name, or numerical IPv4 or IPv6 network ** - ** address to connect to. NULL for server ** - ** application. ** - ** port: The port number ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: A pointer to the local endpoint identifier ** - ** that has been allocated for communication ** - ** with the remote peer. NULL if the setup of ** - ** the communication endpoint failed. ** - ** Others: None ** - ** ** - ***************************************************************************/ -void* socket_udp_open(int type, const char* host, const char* port) -{ - struct addrinfo socket_info; /* endpoint information */ - struct addrinfo *socket_addr, *sp; /* endpoint address */ - int sfd; /* socket file descriptor */ - - /* - * Parameters sanity check - * ----------------------- - * The local connection endpoint shall be of type CLIENT or SERVER - */ - if (host == NULL) { - type = SOCKET_SERVER; - } else if (type != SOCKET_CLIENT && type != SOCKET_SERVER) { - return NULL; - } - - /* - * Initialize the endpoint address information - * ------------------------------------------- - * The AI_PASSIVE flag allows "wildcard address" when hostname is not - * provided (NULL). The wildcard address is used by applications (ty- - * pically servers) that intend to accept connections on any of the - * hosts's network addresses. If the hostname is not NULL, then the - * AI_PASSIVE flag is ignored. - * When the AI_V4MAPPED flag is set, and AF_INET6 is specified, and no - * matching IPv6 addresses could be found, then IPv4-mapped IPv6 addresses - * are returned by getaddrinfo in the list pointed to by result. - */ - memset (&socket_info, 0, sizeof(struct addrinfo)); - socket_info.ai_socktype = SOCK_DGRAM; /* Datagram socket */ - socket_info.ai_flags = AI_NUMERICSERV; /* numeric port number */ - - if (type != SOCKET_CLIENT) { - /* Setup socket address options at the server side */ - socket_info.ai_family = AF_INET6; /* Accept either IPv4 or IPv6 - * connections */ - socket_info.ai_flags |= AI_PASSIVE; /* Use "wildcard address" */ - socket_info.ai_flags |= AI_V4MAPPED; /* IPv4-mapped IPv6 address */ - } else { - /* Setup socket address options at the client side */ - socket_info.ai_family = AF_INET; /* Any address family */ - // socket_info.ai_flags |= AI_V4MAPPED; /* IPv4-mapped IPv6 address */ - } - - /* - * getaddrinfo() returns a linked list of address structures: - * - The network host may be multi-homed, accessible over multiple - * protocols (e.g. both AF_INET and AF_INET6); - * - The same service (port number) may be available from multiple - * socket types (one SOCK_STREAM address and another SOCK_DGRAM address); - */ - int rc = getaddrinfo (host, port, &socket_info, &socket_addr); - - if (rc != 0) { - if (rc != EAI_SYSTEM) { - errno = rc; - } - - return NULL; - } - - /* - * Try each address until we successfully connect - */ - for (sp = socket_addr; sp != NULL; sp = sp->ai_next) { - /* Create the socket endpoint for communication */ - sfd = socket (sp->ai_family, sp->ai_socktype, sp->ai_protocol); - - if (sfd < 0) { - continue; - } - - /* - * Initiate a communication channel at the CLIENT side - */ - if (type == SOCKET_CLIENT) { - /* Connect the socket to the remote server's address */ - if (connect (sfd, sp->ai_addr, sp->ai_addrlen) != -1) { - break; /* Connection succeed */ - } - } - - /* - * Initiate a communication channel at the SERVER side - */ - else { - if (type == SOCKET_SERVER) { - /* Set socket options */ - if (_socket_set_option (sfd) != RETURNok) { - continue; - } - - /* Bind the socket to the local server's address */ - if (bind (sfd, sp->ai_addr, sp->ai_addrlen) != -1) { - break; /* Bind succeed */ - } - } - } - - close (sfd); - } - - /* Free the memory that was dynamically allocated for the linked list */ - freeaddrinfo (socket_addr); - - if (sp == NULL) { - /* Connect or bind failed */ - return NULL; - } - - /* The connection endpoint has been successfully setup */ - socket_id_t * sid = (socket_id_t *) malloc (sizeof(struct socket_id_s)); - - if (sid != NULL) { - sid->type = type; - sid->port = atoi (port); - sid->fd = sfd; - } - - return sid; -} - -/**************************************************************************** - ** ** - ** Name: socket_close() ** - ** ** - ** Description: Cleanup the specified communication endpoint: Close the ** - ** socket file descriptor and frees all the memory space ** - ** allocated to handle the communication channel towards the ** - ** remote peer ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: id: The identifier of the connection endpoint ** - ** Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void socket_close(void* id) -{ - if (id) { - close (((socket_id_t*) id)->fd); - free (id); - } -} - -/**************************************************************************** - ** ** - ** Name: socket_recv() ** - ** ** - ** Description: Receives data from a given communication endpoint to a ** - ** receive buffer of specified length ** - ** ** - ** Inputs: id: The identifier of the connection endpoint ** - ** length: Length of the receive buffer ** - ** Others: None ** - ** ** - ** Outputs: id: The identifier of the connection endpoint ** - ** buffer: The receive buffer ** - ** Return: The number of bytes received when success; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -ssize_t socket_recv(void* id, char* buffer, size_t length) -{ - socket_id_t* sid = (socket_id_t*) (id); - ssize_t rbytes = -1; - - if (sid->type == SOCKET_CLIENT) { - /* Receive data from the connected socket */ - rbytes = recv (sid->fd, buffer, length, 0); - } else if (sid->type == SOCKET_SERVER) { - struct sockaddr_storage addr; - socklen_t addrlen = sizeof(addr); - - /* Receive data from the socket and retreive the remote host address */ - rbytes = recvfrom (sid->fd, buffer, length, 0, (struct sockaddr *) &addr, &addrlen); - sid->addr = addr; - } - - if (errno == EINTR) { - /* A signal was caught */ - return 0; - } else if (rbytes < 0) { - /* Receive failed */ - return RETURNerror; - } - - return rbytes; -} - -/**************************************************************************** - ** ** - ** Name: socket_send() ** - ** ** - ** Description: Sends data to a given communication endpoint from a send ** - ** buffer of specified length ** - ** ** - ** Inputs: id: The identifier of the connection endpoint ** - ** buffer: The send buffer ** - ** length: Length of the send buffer ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The number of bytes sent when success; ** - ** RETURNerror otherwise. ** - ** Others: None ** - ** ** - ***************************************************************************/ -ssize_t socket_send(const void* id, const char* buffer, size_t length) -{ - const socket_id_t* sid = (socket_id_t*) (id); - ssize_t sbytes = -1; - - if (sid->type == SOCKET_CLIENT) { - /* Send data to the connected socket */ - sbytes = send (sid->fd, buffer, length, 0); - } else if (sid->type == SOCKET_SERVER) { - /* Send data to the socket using the remote host address */ - sbytes = sendto (sid->fd, buffer, length, 0, (struct sockaddr *) &sid->addr, (socklen_t) sizeof(sid->addr)); - } - - if (errno == EINTR) { - /* A signal was caught */ - return 0; - } else if (sbytes != length) { - /* Send failed */ - return RETURNerror; - } - - return sbytes; -} - -/**************************************************************************** - ** ** - ** Name: socket_get_fd() ** - ** ** - ** Description: Get the value of the socket file descriptor created for ** - ** the given connection endpoint ** - ** ** - ** Inputs: id: The identifier of the connection endpoint ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: The file descriptor of the socket created ** - ** for this connection endpoint ** - ** Others: None ** - ** ** - ***************************************************************************/ -int socket_get_fd(const void* id) -{ - if (id) { - return ((socket_id_t*) id)->fd; - } - - return RETURNerror; -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _socket_set_option() ** - ** ** - ** Description: Set socket option at the sockets API level (SOL_SOCKET) ** - ** ** - ** Inputs: sfd: Socket file descriptor ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _socket_set_option(int sfd) -{ - int optval; - - /* SO_REUSEADDR socket option: - * --------------------------- - * Allows the server to bind a socket to this port, unless - * there is an active listening socket already bound to the - * port. This is useful when recovering from a crash and the - * socket was not properly closed. The server can be restarted - * and it will simply open another socket on the same port and - * continue listening. - */ - optval = TRUE; - - if (setsockopt (sfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) { - return RETURNerror; - } - - /* IPV6_V6ONLY socket option - * ------------------------- - * When option is set to TRUE, the socket is restricted to sending and - * receiving IPv6 packets only. - * When option is set to FALSE, the socket can be used to send and receive - * packets to and from an IPv6 address or an IPv4-mapped IPv6 address. - */ - optval = FALSE; - - if (setsockopt (sfd, IPPROTO_IPV6, IPV6_V6ONLY, &optval, sizeof(optval)) < 0) { - return RETURNerror; - } - - return RETURNok; -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/socket.h b/openair-cn/NAS/EURECOM-NAS/src/util/socket.h deleted file mode 100644 index 1bf885d962863d941a07088d0b314a939b57edd3..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/socket.h +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source socket.h - -Version 0.1 - -Date 2012/02/28 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Implements TCP socket handlers - -*****************************************************************************/ -#ifndef __SOCKET_H__ -#define __SOCKET_H__ - -#include <sys/types.h> - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* Type of the connection endpoint */ -#define SOCKET_CLIENT 1 -#define SOCKET_SERVER 2 - -/* Hidden structure that handles the connection endpoint data */ -typedef struct socket_id_s socket_id_t; - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void* socket_udp_open(int type, const char* host, const char* port); -int socket_get_fd(const void* id); - -ssize_t socket_recv(void* id, char* buffer, size_t length); -ssize_t socket_send(const void* id, const char* buffer, size_t length); - -void socket_close(void* id); - -#endif /* __SOCKET_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/stty.c b/openair-cn/NAS/EURECOM-NAS/src/util/stty.c deleted file mode 100644 index 67819a8e46773e916f501a3e7f31e23146716a50..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/stty.c +++ /dev/null @@ -1,353 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source stty.c - -Version 0.1 - -Date 2012/11/29 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Terminal I/O device control setup - -*****************************************************************************/ - -#include "commonDef.h" - -#include <termios.h> // tcgetattr, tcsetattr -#include <unistd.h> -#include <string.h> // strdup, strtok, strcmp -#include <stdlib.h> // free - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* Terminal I/O setting flags */ -#define CFLG 0 /* control modes */ -#define IFLG 1 /* input modes */ -#define OFLG 2 /* output modes */ -#define LFLG 3 /* local modes */ -#define RFLG 4 /* control chars */ -#define BFLG 5 /* baud speed modes */ - -/* Terminal I/O setting parameters */ -typedef struct sttyset_s { - char *name; - int which; - int mask; - int value; -} sttyset_t; - -/* Table of terminal I/O parameters */ -static sttyset_t stty_params[] = { - { "0", BFLG, 0, B0 }, - { "50", BFLG, 0, B50 }, - { "75", BFLG, 0, B75 }, - { "110", BFLG, 0, B110 }, - { "134", BFLG, 0, B134 }, - { "150", BFLG, 0, B150 }, - { "200", BFLG, 0, B200 }, - { "300", BFLG, 0, B300 }, - { "600", BFLG, 0, B600 }, - { "1200", BFLG, 0, B1200 }, - { "1800", BFLG, 0, B1800 }, - { "2400", BFLG, 0, B2400 }, - { "4800", BFLG, 0, B4800 }, - { "9600", BFLG, 0, B9600 }, - { "19200", BFLG, 0, B19200 }, - { "38400", BFLG, 0, B38400 }, -#ifdef B57600 - { "57600", BFLG, 0, B57600 }, -#endif -#ifdef B115200 - { "115200", BFLG, 0, B115200 }, -#endif -#ifdef B230400 - { "230400", BFLG, 0, B230400 }, -#endif - { "cs7", CFLG, CSIZE, CS7 }, - { "cs8", CFLG, CSIZE, CS8 }, - { "cstopb", CFLG, CSTOPB, CSTOPB }, - { "cread", CFLG, CREAD, CREAD }, - { "parenb", CFLG, PARENB, PARENB }, - { "parodd", CFLG, PARODD, PARODD }, - { "hubcl", CFLG, HUPCL, HUPCL }, - { "clocal", CFLG, CLOCAL, CLOCAL }, -#ifdef CRTSCTS - { "crtscts",CFLG, CRTSCTS, CRTSCTS }, -#endif -#ifdef ORTSFL - { "ortsfl", CFLG, ORTSFL, ORTSFL }, -#endif -#ifdef CTSFLOW - { "ctsflow",CFLG, CTSFLOW, CTSFLOW }, -#endif -#ifdef RTSFLOW - { "rtsflow",CFLG, RTSFLOW, RTSFLOW }, -#endif - { "ignbrk", IFLG, IGNBRK, IGNBRK }, - { "brkint", IFLG, BRKINT, BRKINT }, - { "ignpar", IFLG, IGNPAR, IGNPAR }, - { "parmrk", IFLG, PARMRK, PARMRK }, - { "inpck", IFLG, INPCK, INPCK }, - { "istrip", IFLG, ISTRIP, ISTRIP }, - { "inlcr", IFLG, INLCR, INLCR }, - { "igncr", IFLG, IGNCR, IGNCR }, - { "icrnl", IFLG, ICRNL, ICRNL }, -#ifdef IUCLC // Missing on OSX, FreeBSD - { "iuclc", IFLG, IUCLC, IUCLC }, -#endif - { "ixon", IFLG, IXON, IXON }, - { "ixany", IFLG, IXANY, IXANY }, - { "ixoff", IFLG, IXOFF, IXOFF }, -#ifdef IMAXBEL - { "imaxbel",IFLG, IMAXBEL, IMAXBEL }, -#endif - { "opost", OFLG, OPOST, OPOST }, -#ifdef ILCUC // Missing on OSX, FreeBSD - { "olcuc", OFLG, OLCUC, OLCUC }, -#endif - { "onlcr", OFLG, ONLCR, ONLCR }, - { "ocrnl", OFLG, OCRNL, OCRNL }, - { "onocr", OFLG, ONOCR, ONOCR }, - { "onlret", OFLG, ONLRET, ONLRET }, - { "ofil", OFLG, OFILL, OFILL }, - { "ofdel", OFLG, OFDEL, OFDEL }, - { "nl0", OFLG, NLDLY, NL0 }, - { "nl1", OFLG, NLDLY, NL1 }, - { "cr0", OFLG, CRDLY, CR0 }, - { "cr1", OFLG, CRDLY, CR1 }, - { "cr2", OFLG, CRDLY, CR2 }, - { "cr3", OFLG, CRDLY, CR3 }, - { "tab0", OFLG, TABDLY, TAB0 }, - { "tab1", OFLG, TABDLY, TAB1 }, - { "tab2", OFLG, TABDLY, TAB2 }, - { "tab3", OFLG, TABDLY, TAB3 }, - { "bs0", OFLG, BSDLY, BS0 }, - { "bs1", OFLG, BSDLY, BS1 }, - { "vt0", OFLG, VTDLY, VT0 }, - { "vt1", OFLG, VTDLY, VT1 }, - { "ff0", OFLG, FFDLY, FF0 }, - { "ff1", OFLG, FFDLY, FF1 }, - { "isig", LFLG, ISIG, ISIG }, - { "icanon", LFLG, ICANON, ICANON }, -#ifdef XCASE // Missing on OSX, FreeBSD - { "xcase", LFLG, XCASE, XCASE }, -#endif - { "echo", LFLG, ECHO, ECHO }, - { "echoe", LFLG, ECHOE, ECHOE }, - { "echok", LFLG, ECHOK, ECHOK }, - { "echonl", LFLG, ECHONL, ECHONL }, - { "noflsh", LFLG, NOFLSH, NOFLSH }, - { "tostop", LFLG, TOSTOP, TOSTOP }, -#ifdef ECHOCTL - { "echoctl",LFLG, ECHOCTL, ECHOCTL }, -#endif -#ifdef ECHOPRT - { "echoprt",LFLG, ECHOPRT, ECHOPRT }, -#endif -#ifdef ECHOKE - { "echoke", LFLG, ECHOKE, ECHOKE }, -#endif -#ifdef FLUSHO - { "flusho", LFLG, FLUSHO, FLUSHO }, -#endif -#ifdef PENDIN - { "pendin", LFLG, PENDIN, PENDIN }, -#endif - { "iexten", LFLG, IEXTEN, IEXTEN }, -#ifdef TOSTOP - { "tostop", LFLG, TOSTOP, TOSTOP }, -#endif - { "raw", RFLG, 0, 0 }, - { NULL, 0, 0, 0 } -}; - -static int _stty_set_this(struct termios *term, const sttyset_t *p, int turnon); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: stty_set() ** - ** ** - ** Description: Set the parameters associated with the terminal referred ** - ** by the given descriptor ** - ** ** - ** Inputs: p: The TTY parameters ** - ** turnon: Indicate whether the parameter should be ** - ** turned on (TRUE) or turned off (FALSE) ** - ** Others: None ** - ** ** - ** Outputs: term: The termios structure to fill ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -int stty_set(int fd, const char *params) -{ - int rc = RETURNok; - - register char *p; - register char *s; - struct termios term; - register int i; - int mode; - - /* Get current tty attributes */ - if ( tcgetattr(fd, &term) < 0 ) { - return RETURNerror; - } - - s = strdup(params); - p = strtok(s," \t\n"); - - while (p && (rc != RETURNerror)) { - mode = 1; - - if ( *p == '-' ) { - mode = 0; - p++; - } - - for ( i=0; stty_params[i].name; i++ ) { - if ( !strcmp(p, stty_params[i].name) ) { - rc = _stty_set_this(&term, &stty_params[i], mode); - break; - } - } - - p = strtok(NULL," \t\n"); - } - - free(s); - - /* Apply new tty settings immediatly */ - if (rc != RETURNerror) { - if ( tcsetattr(fd, TCSANOW, &term) < 0 ) { - rc = RETURNerror; - } - } - - return (rc); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _stty_set_this() ** - ** ** - ** Description: Fills the termios structure with the given TTY parameters ** - ** ** - ** Inputs: p: The TTY parameters ** - ** turnon: Indicate whether the parameter should be ** - ** turned on (TRUE) or turned off (FALSE) ** - ** Others: None ** - ** ** - ** Outputs: term: The termios structure to fill ** - ** Return: RETURNok, RETURNerror ** - ** Others: None ** - ** ** - ***************************************************************************/ -static int _stty_set_this(struct termios *term, const sttyset_t *p, int turnon) -{ - int rc = RETURNok; - - switch ( p->which ) { - case CFLG: - term->c_cflag &= ~(p->mask); - - if ( turnon ) - term->c_cflag |= p->value; - - break; - - case IFLG: - term->c_iflag &= ~(p->mask); - - if ( turnon ) - term->c_iflag |= p->value; - - break; - - case OFLG: - term->c_oflag &= ~(p->mask); - - if ( turnon ) - term->c_oflag |= p->value; - - break; - - case LFLG: - term->c_lflag &= ~(p->mask); - - if ( turnon ) - term->c_lflag |= p->value; - - break; - - case RFLG: - term->c_iflag = 0; - term->c_oflag = 0; - term->c_lflag = 0; - term->c_cc[VMIN] = 1; - term->c_cc[VTIME] = 0; - break; - - case BFLG: - if (cfsetispeed(term, p->value) < 0) { - rc = RETURNerror; - } else if (cfsetospeed(term, p->value) < 0) { - rc = RETURNerror; - } - - break; - - default: - rc = RETURNerror; - } - - return (rc); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/tst/Makefile b/openair-cn/NAS/EURECOM-NAS/src/util/tst/Makefile deleted file mode 100644 index ab0d17c98288f69450592019b6b7a5d6728eeeda..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/tst/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -ifndef PROJDIR -PROJDIR = $(PWD)/../../.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc - -LIBS = -lutil -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) - -LIBSUTIL = $(LIBDIR)/$(LIBUTIL).a $(LIBDIR)/$(LIBUTIL).so - -TIMER_OBJ = timer.o - -TIMER_TARGET = timer - -TARGETS = $(TIMER_TARGET) - -all: $(TARGETS) - -%.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -$(TIMER_TARGET): $(TIMER_OBJ) $(LIBSUTIL) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -clean: - $(RM) $(OBJS) $(TARGETS) *.bak *~ - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -timer.o: $(UTILDIR)/timer.h $(INCDIR)/commonDef.h diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer.c b/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer.c deleted file mode 100644 index 458a94861dbc1e49e29b99e2d7814922ad88500b..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer.c +++ /dev/null @@ -1,248 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source timer.c - -Version 0.1 - -Date 2012/11/27 - -Product Test - -Subsystem Timer utility main test - -Author Frederic Maurel - -Description Tests the timer utility functions - -*****************************************************************************/ - -#include "nas_timer.h" -#include "commonDef.h" - -#include <pthread.h> -#include <stdio.h> // printf -#include <stdlib.h> // exit -#include <time.h> // clock_gettime -#include <poll.h> // poll - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#define TIMER_1S 1 /* 1 second */ -#define TIMER_2S 2 /* 2 seconds */ -#define TIMER_3S 3 /* 3 seconds */ -#define TIMER_4S 4 /* 4 seconds */ - -typedef struct { - unsigned int id; - unsigned int sec; - struct timespec start; -} _timer_t; - -static void* _timer_callback(void* args); -static void* _timer_callback_joinable(void* args); - -static pthread_mutex_t _mutex = PTHREAD_MUTEX_INITIALIZER; - -static unsigned int _nb_timers = 0; -static int _start(_timer_t* timer, unsigned int sec); -static int _stop(_timer_t* timer); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int main (int argc, const char* argv[]) -{ - int rc; - _timer_t timer1, timer2, timer3, timer4; - -#define NB_TIMERS_MAX 10 - _timer_t timer[NB_TIMERS_MAX]; - - /* Initialize timer utility */ - rc = timer_init(); - - if (rc == RETURNerror) { - printf("ERROR: timer_init() failed\n"); - exit (EXIT_FAILURE); - } - - /* Start NB_TIMERS_MAX timers to expire at time interval of 1s */ - for (int i=0; i < NB_TIMERS_MAX; i++) { - if (_start(&timer[i], i) != RETURNok) { - printf("ERROR: timer_start(i=%u) failed\n", i); - } - } - - /* Start timer 1 to expire in 1s */ - if (_start(&timer1, TIMER_1S) != RETURNok) { - printf("ERROR: timer_start() failed\n"); - } - - /* Start timer 2 to expire in 3s */ - if (_start(&timer2, TIMER_3S) != RETURNok) { - printf("ERROR: timer_start() failed\n"); - } - - /* Start timer 3 to expire in 2s */ - if (_start(&timer3, TIMER_2S) != RETURNok) { - printf("ERROR: timer_start() failed\n"); - } - - /* Stop timer 1 */ - if (_stop(&timer1) != RETURNok) { - printf("ERROR: timer_stop(id=%u) failed\n", timer3.id); - } - - /* Wait for the first timer to expire */ - poll(0, 0, -1); - - /* Start timer 4 to expire in 4s */ - if (_start(&timer4, TIMER_4S) != RETURNok) { - printf("ERROR: timer_start() failed\n"); - } - - /* Wait for all timers to expire */ - while (_nb_timers > 0) { - poll(0, 0, 10000); - } - - exit(EXIT_SUCCESS); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -static int _timespec_sub(struct timespec* a, struct timespec* b, struct timespec* result) -{ - if (a->tv_sec < b->tv_sec) return -1; - else if (a->tv_nsec < b->tv_nsec) return -1; - - result->tv_sec = a->tv_sec - b->tv_sec; - result->tv_nsec = a->tv_nsec - b->tv_nsec; - - if (result->tv_nsec < 0) { - result->tv_sec--; - result->tv_nsec += 1000000000; - } - - return 0; -} - -static void* _timer_callback(void* args) -{ - _timer_t* timer = (_timer_t*) args; - struct timespec ts; - - clock_gettime(CLOCK_MONOTONIC, &ts); - - if (_timespec_sub(&ts, &timer->start, &ts) < 0) { - printf("ERROR:_timespec_sub() failed: %ld.%.9ld > %ld.%.9ld\n", - timer->start.tv_sec, timer->start.tv_nsec, - ts.tv_sec, ts.tv_nsec); - } else { - printf("%s\t: Timer %u expired after %ld.%.9ld seconds (%u s)\n", - __FUNCTION__, timer->id, ts.tv_sec, ts.tv_nsec, timer->sec); - timer->id = timer_stop(timer->id); - pthread_mutex_lock(&_mutex); - _nb_timers -= 1; - pthread_mutex_unlock(&_mutex); - } - - return NULL; -} - -static void* _timer_callback_joinable(void* args) -{ - _timer_t* timer = (_timer_t*) args; - struct timespec ts; - int* rc = (int*)malloc(sizeof(int)); - - clock_gettime(CLOCK_MONOTONIC, &ts); - - if (_timespec_sub(&ts, &timer->start, &ts) < 0) { - printf("ERROR:_timespec_sub() failed: %ld.%.9ld > %ld.%.9ld\n", - timer->start.tv_sec, timer->start.tv_nsec, - ts.tv_sec, ts.tv_nsec); - *rc = RETURNerror; - } else { - printf("%s\t: Timer %u expired after %ld.%.9ld seconds (%u s)\n", - __FUNCTION__, timer->id, ts.tv_sec, ts.tv_nsec, timer->sec); - timer->id = timer_stop(timer->id); - pthread_mutex_lock(&_mutex); - _nb_timers -= 1; - pthread_mutex_unlock(&_mutex); - *rc = timer->id; - } - - return rc; -} - -static int _start(_timer_t* timer, unsigned int sec) -{ - int rc = RETURNerror; - - timer->sec = sec; - clock_gettime(CLOCK_MONOTONIC, &timer->start); - timer->id = timer_start(timer->sec, _timer_callback_joinable, - (void*) timer); - - if (timer->id != TIMER_INACTIVE_ID) { - printf("Timer id=%u scheduled to expire in %u seconds\n", - timer->id, timer->sec); - _nb_timers += 1; - rc = RETURNok; - } - - return (rc); -} - -static int _stop(_timer_t* timer) -{ - int rc = RETURNerror; - - printf("Stop timer id=%u\n", timer->id); - timer->id = timer_stop(timer->id); - - if (timer->id == TIMER_INACTIVE_ID) { - _nb_timers -= 1; - rc = RETURNok; - } - - return (rc); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer_debug.txt b/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer_debug.txt deleted file mode 100644 index 14e6912f7e6bbc3323e9a927675fc702735bab45..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/src/util/tst/timer_debug.txt +++ /dev/null @@ -1,101 +0,0 @@ -Attach.c[168] DEBUG Start timer T3410 (id=-1, time=15) -_timer_db_insert_entry: DEBUG - Restart system timer for id=0, time=15.000000 -timer_start: DEBUG - Timer id=0 started -Attach.c[171] DEBUG Timer T3410 (id=0) started - -Attach.c[173] DEBUG Stop T3402 (id=-1) -timer_stop: DEBUG - Stop timer id=-1 -Attach.c[175] DEBUG Timer T3402 (id=-1) stopped - -Attach.c[176] DEBUG Stop T3411 (id=-1) -timer_stop: DEBUG - Stop timer id=-1 -Attach.c[178] DEBUG Timer T3411 (id=-1) stopped - --------------------------------------------------------------------------------- - -Attach.c[219] WARNING T3410 timer expired, attach counter = 0 - -Attach.c[226] DEBUG Start timer T3411 (id=-1, time=10) -timer_start: DEBUG - Timer id=1 started -Attach.c[229] DEBUG Timer T3411 (id=1, time=10) started - -_timer_db_remove_entry: DEBUG - Remove entry id=0 -_timer_db_remove: DEBUG - Remove timer id=0 -_timer_db_remove_entry: DEBUG - Restart system timer for id=1, time=9.999921 - --------------------------------------------------------------------------------- - -Attach.c[288] WARNING T3411 timer expired - -Attach.c[168] DEBUG Start timer T3410 (id=0, time=15) -timer_start: DEBUG - Timer id=2 started -Attach.c[171] DEBUG Timer T3410 (id=2) started - -Attach.c[173] DEBUG Stop T3402 (id=-1) -timer_stop: DEBUG - Stop timer id=-1 -Attach.c[175] DEBUG Timer T3402 (id=-1) stopped - -Attach.c[176] DEBUG Stop T3411 (id=1) -timer_stop: DEBUG - Stop timer id=1 - -_timer_db_remove_entry: DEBUG - Remove entry id=1 -_timer_db_remove: DEBUG - Remove timer id=1 -_timer_db_remove_entry: DEBUG - Restart system timer for id=2, time=14.988820 - -Attach.c[178] DEBUG Timer T3411 (id=1) stopped - -_timer_db_remove_entry: DEBUG - Remove entry id=2 -_timer_db_remove: DEBUG - Remove timer id=2 -_timer_db_remove: DEBUG - Stop system timer - - --------------------------------------------------------------------------------- - -Attach.c[168] DEBUG Start timer T3410 (id=-1, time=15) -_timer_db_insert_entry: DEBUG - Restart system timer for id=0, time=15.000000 -timer_start: DEBUG - Timer id=0 started -Attach.c[171] DEBUG Timer T3410 (id=0) started - -Attach.c[173] DEBUG Stop T3402 (id=-1) -timer_stop: DEBUG - Stop timer id=-1 -Attach.c[175] DEBUG Timer T3402 (id=-1) stopped - -Attach.c[176] DEBUG Stop T3411 (id=-1) -timer_stop: DEBUG - Stop timer id=-1 -Attach.c[178] DEBUG Timer T3411 (id=-1) stopped - --------------------------------------------------------------------------------- - -Attach.c[219] WARNING T3410 timer expired, attach counter = 0 -Attach.c[226] DEBUG Start timer T3411 (id=-1, time=10) -timer_start: DEBUG - Timer id=1 started -Attach.c[229] DEBUG Timer T3411 (id=1, time=10) started - -timer_stop: DEBUG - Stop timer id=0 -_timer_db_remove_entry: DEBUG - Remove entry id=0 -_timer_db_remove: DEBUG - Remove timer id=0 -_timer_db_remove_entry: DEBUG - Restart system timer for id=1, time=9.999934 - --------------------------------------------------------------------------------- - -Attach.c[288] WARNING T3411 timer expired - -Attach.c[168] DEBUG Start timer T3410 (id=0, time=15) -timer_start: DEBUG - Timer id=2 started -Attach.c[171] DEBUG Timer T3410 (id=2) started - -Attach.c[173] DEBUG Stop T3402 (id=-1) -timer_stop: DEBUG - Stop timer id=-1 -Attach.c[175] DEBUG Timer T3402 (id=-1) stopped - -Attach.c[176] DEBUG Stop T3411 (id=1) -timer_stop: DEBUG - Stop timer id=1 - -timer_stop: DEBUG - Stop timer id=1 -_timer_db_remove_entry: DEBUG - Remove entry id=1 -_timer_db_remove: DEBUG - Remove timer id=1 -_timer_db_remove_entry: DEBUG - Restart system timer for id=2, time=14.999969 -Attach.c[178] DEBUG Timer T3411 (id=1) stopped - -UEprocess: timer.c:519: _timer_db_remove_entry: Assertion `_timer_db.tq[id].id == id' failed. -Aborted diff --git a/openair-cn/NAS/EURECOM-NAS/tools/COPYING b/openair-cn/NAS/EURECOM-NAS/tools/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tools/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/tools/Makefile b/openair-cn/NAS/EURECOM-NAS/tools/Makefile deleted file mode 100644 index 9c3c54e602f1c1005003fc1be5b137a113d4298f..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tools/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -export PROCESS = UE - -ifndef PROJDIR -PROJDIR = $(PWD)/.. -endif - -include $(PROJDIR)/Makerules -include $(PROJDIR)/Makefile.inc -include $(PROJDIR)/../Makefile.tools - -export LD_RUN_PATH = $(LIBDIR):$(LIBPROCESS) - -LIBS = -luenas.a -lrt -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(USIMAPIDIR) -I$(EMMDIR) -I$(ESMDIR) -I$(IESDIR) - -#LIBSUTIL = $(LIBDIR)/$(LIBUTIL).a $(LIBDIR)/$(LIBUTIL).so - -USIM_OBJ = usim_data.o -UE_OBJ = ue_data.o - -USIM_TARGET = usim_data -UE_TARGET = ue_data - -TARGETS = $(USIM_TARGET) $(UE_TARGET) - -all: $(TARGETS) - -#-DIMSI_USA_MNC_3DIGITS -%.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -$(USIM_TARGET): $(USIM_OBJ) $(LIBSUTIL) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lnettle -lcrypto -lm - @echo Replacing $@ to $(BINDIR) - @$(RM) $(BINDIR)/$@ - @$(CP) $@ $(BINDIR) - -$(UE_TARGET): $(UE_OBJ) $(LIBSUTIL) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lnettle -lcrypto -lm - @echo Replacing $@ to $(BINDIR) - @$(RM) $(BINDIR)/$@ - @$(CP) $@ $(BINDIR) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGETS) - -veryveryclean: veryclean - $(RM) -Rf *.o $(PROJDIR) - $(RM) -Rf *.a $(PROJDIR) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/tools/network.h b/openair-cn/NAS/EURECOM-NAS/tools/network.h deleted file mode 100644 index 849c30f88fdcac1daa17478b042ea1beda53e3b5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tools/network.h +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source network.h - -Version 0.1 - -Date 2013/03/26 - -Product USIM data generator - -Subsystem PLMN network operators - -Author Frederic Maurel - -Description Defines a list of PLMN network operators - -*****************************************************************************/ -#ifndef __NETWORK_H__ -#define __NETWORK_H__ - -#include "commonDef.h" -#include "networkDef.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ -/* - * PLMN network operator record index - */ -#define TEST1 0 -#define SFR1 1 -#define SFR2 2 -#define SFR3 3 -#define TM1 4 -#define FCT1 5 -#define VDF1 6 -#define VDF2 7 -#define VDF3 8 -#define VDF4 9 -#define VDF5 10 - - -#define SELECTED_PLMN SFR1 - -#define TEST_PLMN {0,0,0x0f,1,1,0} // 00101 -#define SFR_PLMN_1 {0,2,0x0f,8,0,1} // 20810 -#define SFR_PLMN_2 {0,2,0x0f,8,1,1} // 20811 -#define SFR_PLMN_3 {0,2,0x0f,8,3,1} // 20813 -#define TM_PLMN_1 {1,3,0,0,8,2} // 310280 -#define FCT_PLMN_1 {1,3,8,0,2,0} // 310028 -#define VDF_PLMN_1 {2,2,0x0f,2,0,1} // 22210 -#define VDF_PLMN_2 {1,2,0x0f,4,0x0f,1} // 2141 -#define VDF_PLMN_3 {1,2,0x0f,4,0x0f,6} // 2146 -#define VDF_PLMN_4 {6,2,0x0f,2,0x0f,2} // 2622 -#define VDF_PLMN_5 {6,2,0x0f,2,0x0f,4} // 2624 - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* - * PLMN network operator record - */ -typedef struct { - unsigned int num; - plmn_t plmn; - char fullname[NET_FORMAT_LONG_SIZE + 1]; - char shortname[NET_FORMAT_SHORT_SIZE + 1]; - tac_t tac_start; - tac_t tac_end; -} network_record_t; - - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/* - * The list of PLMN network operator records - */ -network_record_t network_records[] = { - {00101, TEST_PLMN, "Test network", "OAI4G", 0x0001, 0xfffd}, - {20810, SFR_PLMN_1, "SFR France", "SFR", 0x0001, 0xfffd}, - {20811, SFR_PLMN_2, "SFR France", "SFR", 0x0001, 0xfffd}, - {20813, SFR_PLMN_3, "SFR France", "SFR", 0x0001, 0xfffd}, - {310280,TM_PLMN_1, "T-Mobile USA", "T-Mobile", 0x0001, 0xfffd}, - {310028,FCT_PLMN_1, "FICTITIOUS USA", "FICTITIO", 0x0001, 0xfffd}, - {22210, VDF_PLMN_1, "Vodafone Italia", "VODAFONE", 0x0001, 0xfffd}, - {2141, VDF_PLMN_2, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd}, - {2146, VDF_PLMN_3, "Vodafone Spain", "VODAFONE", 0x0001, 0xfffd}, - {2622, VDF_PLMN_4, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd}, - {2624, VDF_PLMN_5, "Vodafone Germ", "VODAFONE", 0x0001, 0xfffd}, -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -#endif /* __NETWORK_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tools/ue_data.c b/openair-cn/NAS/EURECOM-NAS/tools/ue_data.c deleted file mode 100644 index 5dcbdf79de79ddcad95f4f9335dcdad4ca856d83..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tools/ue_data.c +++ /dev/null @@ -1,513 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source ue_data.c - -Version 0.1 - -Date 2012/11/02 - -Product UE data generator - -Subsystem UE data generator main process - -Author Frederic Maurel - -Description Implements the utility used to generate data stored in the - UE's non-volatile memory device - -*****************************************************************************/ - -#include "userDef.h" -#include "memory.h" - -#include "emmData.h" -#include "network.h" - -#include <stdio.h> // perror, printf, fprintf, snprintf -#include <stdlib.h> // exit, free -#include <string.h> // memset, strncpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -#define USER_IMEI "35611302209414" -#define USER_MANUFACTURER "EURECOM" -#define USER_MODEL "LTE Android PC" -//#define USER_MANUFACTURER "SAGEM" -//#define USER_MODEL "my225x" -#define USER_PIN "0000" - -#define PRINT_PLMN_DIGIT(d) if ((d) != 0xf) printf("%u", (d)) - -#define PRINT_PLMN(plmn) \ - PRINT_PLMN_DIGIT((plmn).MCCdigit1); \ - PRINT_PLMN_DIGIT((plmn).MCCdigit2); \ - PRINT_PLMN_DIGIT((plmn).MCCdigit3); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit1); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit2); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit3) - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -static void _display_usage(const char* command); - -static void _gen_user_data(user_nvdata_t* data); -static void _gen_emm_data(emm_nvdata_t* data); - -static int _luhn(const char* cc); -static void _display_ue_data(const user_nvdata_t* data); -static void _display_emm_data(const emm_nvdata_t* data); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int main (int argc, const char* argv[]) -{ - int rc; - char* path; - user_nvdata_t user_data; - emm_nvdata_t emm_data; - - unsigned char gen_data; - - /* - * ---------------------------- - * Read command line parameters - * ---------------------------- - */ - if (argc != 2) { - fprintf(stderr, "Invalid parameter\n"); - _display_usage(argv[0]); - exit(EXIT_FAILURE); - } else if ( (strcmp(argv[1], "--gen") == 0) || - (strcmp(argv[1], "-g") == 0) ) { - /* Generate UE data files */ - gen_data = TRUE; - } else if ( (strcmp(argv[1], "--print") == 0) || - (strcmp(argv[1], "-p") == 0) ) { - /* Display content of UE data files */ - gen_data = FALSE; - } else { - /* Display usage */ - _display_usage(argv[0]); - exit(EXIT_SUCCESS); - } - /* - * ---------------------- - * UE's non-volatile data - * ---------------------- - */ - path = memory_get_path(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME); - - if (path == NULL) { - perror("ERROR\t: memory_get_path() failed"); - exit(EXIT_FAILURE); - } - - if (gen_data) { - /* - * Initialize UE's non-volatile data - */ - memset(&user_data, 0, sizeof(user_nvdata_t)); - _gen_user_data(&user_data); - /* - * Write UE's non-volatile data - */ - rc = memory_write(path, &user_data, sizeof(user_nvdata_t)); - - if (rc != RETURNok) { - perror("ERROR\t: memory_write() failed"); - free(path); - exit(EXIT_FAILURE); - } - } - - /* - * Read UE's non-volatile data - */ - memset(&user_data, 0, sizeof(user_nvdata_t)); - rc = memory_read(path, &user_data, sizeof(user_nvdata_t)); - - if (rc != RETURNok) { - perror("ERROR\t: memory_read() failed"); - free(path); - exit(EXIT_FAILURE); - } - - free(path); - /* - * Display UE's non-volatile data - */ - printf("\nUE's non-volatile data:\n\n"); - _display_ue_data(&user_data); - - /* - * --------------------- - * EMM non-volatile data - * --------------------- - */ - path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME); - - if (path == NULL) { - perror("ERROR\t: memory_get_path() failed"); - exit(EXIT_FAILURE); - } - - if (gen_data) { - /* - * Initialize EMM non-volatile data - */ - memset(&emm_data, 0, sizeof(emm_nvdata_t)); - _gen_emm_data(&emm_data); - /* - * Write EMM non-volatile data - */ - rc = memory_write(path, &emm_data, sizeof(emm_nvdata_t)); - - if (rc != RETURNok) { - perror("ERROR\t: memory_write() failed"); - free(path); - exit(EXIT_FAILURE); - } - } - - /* - * Read EMM non-volatile data - */ - memset(&emm_data, 0, sizeof(emm_nvdata_t)); - rc = memory_read(path, &emm_data, sizeof(emm_nvdata_t)); - - if (rc != RETURNok) { - perror("ERROR\t: memory_read() failed "); - free(path); - exit(EXIT_FAILURE); - } - - free(path); - /* - * Display EMM non-volatile data - */ - printf("\nEMM non-volatile data:\n\n"); - _display_emm_data(&emm_data); - - /* - *--------------- - * Files location - *--------------- - */ - path = memory_get_path(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME); - printf("\nUE identity data file: %s\n", path); - free(path); - path = memory_get_path(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME); - printf("EPS Mobility Management data file: %s\n", path); - free(path); - - exit(EXIT_SUCCESS); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * Displays command line usage - */ -static void _display_usage(const char* command) -{ - fprintf(stderr, "usage: %s [OPTION]\n", command); - fprintf(stderr, "\t[--gen|-g]\tGenerate the UE data files\n"); - fprintf(stderr, "\t[--print|-p]\tDisplay the content of the UE data files\n"); - fprintf(stderr, "\t[--help|-h]\tDisplay this usage\n"); - const char* path = getenv("NVRAM_DIR"); - - if (path != NULL) { - fprintf(stderr, "NVRAM_DIR = %s\n", path); - } else { - fprintf(stderr, "NVRAM_DIR environment variable is not defined\n"); - } -} - -/* - * Generates UE's non-volatile data - */ -static void _gen_user_data(user_nvdata_t* data) -{ - /* - * Product Serial Number Identification - * IMEI = AA-BBBBBB-CCCCCC-D - * AA-BBBBBB: Type Allocation Code (TAC) - * CCCCCC: Serial Number - * D: Luhn check digit - */ - snprintf(data->IMEI, USER_IMEI_SIZE+1, "%s%d", - USER_IMEI, _luhn(USER_IMEI)); - /* - * Manufacturer identifier - */ - strncpy(data->manufacturer, USER_MANUFACTURER, USER_MANUFACTURER_SIZE); - /* - * Model identifier - */ - strncpy(data->model, USER_MODEL, USER_MODEL_SIZE); - /* - * SIM Personal Identification Number - */ - strncpy(data->PIN, USER_PIN, USER_PIN_SIZE); -} - -/* - * Generates UE's non-volatile EMM data - */ -static void _gen_emm_data(emm_nvdata_t* data) -{ -#if (SELECTED_PLMN == FCT1) - /* - * International Mobile Subscriber Identity - * IMSI = MCC + MNC + MSIN = 310 (USA) + 028 (UNKNOWN) + 90832150 - */ -#warning "IMSI 310.028.90832150" - data->imsi.length = 8; - data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even - data->imsi.u.num.digit1 = 3; // MCC digit 1 - data->imsi.u.num.digit2 = 1; // MCC digit 2 - data->imsi.u.num.digit3 = 0; // MCC digit 3 - data->imsi.u.num.digit4 = 0; // MNC digit 1 - data->imsi.u.num.digit5 = 2; // MNC digit 2 - data->imsi.u.num.digit6 = 8; // MNC digit 3 - data->imsi.u.num.digit7 = 9; - data->imsi.u.num.digit8 = 0; - data->imsi.u.num.digit9 = 8; - data->imsi.u.num.digit10 = 3; - data->imsi.u.num.digit11 = 2; - data->imsi.u.num.digit12 = 1; - data->imsi.u.num.digit13 = 5; - data->imsi.u.num.digit14 = 0; - data->imsi.u.num.digit15 = 0xF; - /* - * Last registered home PLMN - */ - data->rplmn.MCCdigit1 = 3; - data->rplmn.MCCdigit2 = 1; - data->rplmn.MCCdigit3 = 0; - data->rplmn.MNCdigit1 = 0; - data->rplmn.MNCdigit2 = 2; - data->rplmn.MNCdigit3 = 8; -#endif -#if (SELECTED_PLMN == SFR1) - /* - * International Mobile Subscriber Identity - * IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234 - */ - data->imsi.length = 8; - data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even - data->imsi.u.num.digit1 = 2; // MCC digit 1 - data->imsi.u.num.digit2 = 0; // MCC digit 2 - data->imsi.u.num.digit3 = 8; // MCC digit 3 - data->imsi.u.num.digit4 = 1; // MNC digit 1 - data->imsi.u.num.digit5 = 0; // MNC digit 2 - data->imsi.u.num.digit6 = 0;//0xF; // MNC digit 3 - data->imsi.u.num.digit7 = 0; - data->imsi.u.num.digit8 = 0; - data->imsi.u.num.digit9 = 0; - data->imsi.u.num.digit10 = 0; - data->imsi.u.num.digit11 = 1; - data->imsi.u.num.digit12 = 2; - data->imsi.u.num.digit13 = 3; - data->imsi.u.num.digit14 = 4; - data->imsi.u.num.digit15 = 0xF; - - data->rplmn.MCCdigit1 = 2; - data->rplmn.MCCdigit2 = 0; - data->rplmn.MCCdigit3 = 8; - data->rplmn.MNCdigit1 = 1; - data->rplmn.MNCdigit2 = 0; - data->rplmn.MNCdigit3 = 0xf; -#endif -#if (SELECTED_PLMN == TEST1) - /* - * International Mobile Subscriber Identity - * IMSI = MCC + MNC + MSIN = 001 + 01 + 00001234 - */ - data->imsi.length = 8; - data->imsi.u.num.parity = 0x0; // Type of identity = IMSI, even - data->imsi.u.num.digit1 = 0; // MCC digit 1 - data->imsi.u.num.digit2 = 0; // MCC digit 2 - data->imsi.u.num.digit3 = 1; // MCC digit 3 - data->imsi.u.num.digit4 = 0; // MNC digit 1 - data->imsi.u.num.digit5 = 1; // MNC digit 2 - data->imsi.u.num.digit6 = 0; - data->imsi.u.num.digit7 = 0; - data->imsi.u.num.digit8 = 0; - data->imsi.u.num.digit9 = 0; - data->imsi.u.num.digit10 = 0; - data->imsi.u.num.digit11 = 1; - data->imsi.u.num.digit12 = 2; - data->imsi.u.num.digit13 = 3; - data->imsi.u.num.digit14 = 4; - data->imsi.u.num.digit15 = 0xF; - - /* - * Last registered home PLMN - */ - data->rplmn.MCCdigit1 = 0; - data->rplmn.MCCdigit2 = 0; - data->rplmn.MCCdigit3 = 1; - data->rplmn.MNCdigit1 = 0; - data->rplmn.MNCdigit2 = 1; - data->rplmn.MNCdigit3 = 0xf; -#endif - /* - * List of Equivalent PLMNs - */ - data->eplmn.n_plmns = 0; -} - -/* - * Computes the check digit using Luhn algorithm - */ -static int _luhn(const char* cc) -{ - const int m[] = {0,2,4,6,8,1,3,5,7,9}; - int odd = 1, sum = 0; - - for (int i = strlen(cc); i--; odd = !odd) { - int digit = cc[i] - '0'; - sum += odd ? m[digit] : digit; - } - - return 10 - (sum % 10); -} - -/* - * Displays UE's non-volatile data - */ -static void _display_ue_data(const user_nvdata_t* data) -{ - printf("IMEI\t\t= %s\n", data->IMEI); - printf("manufacturer\t= %s\n", data->manufacturer); - printf("model\t\t= %s\n", data->model); - printf("PIN\t\t= %s\n", data->PIN); -} - -/* - * Displays UE's non-volatile EMM data - */ -static void _display_emm_data(const emm_nvdata_t* data) -{ - printf("IMSI\t\t= "); - - if (data->imsi.u.num.digit6 == 0b1111) { - if (data->imsi.u.num.digit15 == 0b1111) { - printf("%u%u%u.%u%u.%u%u%u%u%u%u%u%u\n", - data->imsi.u.num.digit1, - data->imsi.u.num.digit2, - data->imsi.u.num.digit3, - data->imsi.u.num.digit4, - data->imsi.u.num.digit5, - - data->imsi.u.num.digit7, - data->imsi.u.num.digit8, - data->imsi.u.num.digit9, - data->imsi.u.num.digit10, - data->imsi.u.num.digit11, - data->imsi.u.num.digit12, - data->imsi.u.num.digit13, - data->imsi.u.num.digit14); - } else { - printf("%u%u%u.%u%u.%u%u%u%u%u%u%u%u%u\n", - data->imsi.u.num.digit1, - data->imsi.u.num.digit2, - data->imsi.u.num.digit3, - data->imsi.u.num.digit4, - data->imsi.u.num.digit5, - - data->imsi.u.num.digit7, - data->imsi.u.num.digit8, - data->imsi.u.num.digit9, - data->imsi.u.num.digit10, - data->imsi.u.num.digit11, - data->imsi.u.num.digit12, - data->imsi.u.num.digit13, - data->imsi.u.num.digit14, - data->imsi.u.num.digit15); - } - } else { - if (data->imsi.u.num.digit15 == 0b1111) { - printf("%u%u%u.%u%u%u.%u%u%u%u%u%u%u%u\n", - data->imsi.u.num.digit1, - data->imsi.u.num.digit2, - data->imsi.u.num.digit3, - data->imsi.u.num.digit4, - data->imsi.u.num.digit5, - data->imsi.u.num.digit6, - - data->imsi.u.num.digit7, - data->imsi.u.num.digit8, - data->imsi.u.num.digit9, - data->imsi.u.num.digit10, - data->imsi.u.num.digit11, - data->imsi.u.num.digit12, - data->imsi.u.num.digit13, - data->imsi.u.num.digit14); - } else { - printf("%u%u%u.%u%u%u.%u%u%u%u%u%u%u%u\n", - data->imsi.u.num.digit1, - data->imsi.u.num.digit2, - data->imsi.u.num.digit3, - data->imsi.u.num.digit4, - data->imsi.u.num.digit5, - data->imsi.u.num.digit6, - - data->imsi.u.num.digit7, - data->imsi.u.num.digit8, - data->imsi.u.num.digit9, - data->imsi.u.num.digit10, - data->imsi.u.num.digit11, - data->imsi.u.num.digit12, - data->imsi.u.num.digit13, - data->imsi.u.num.digit14, - data->imsi.u.num.digit15); - } - } - - printf("RPLMN\t\t= "); - PRINT_PLMN(data->rplmn); - printf("\n"); - - for (int i = 0; i < data->eplmn.n_plmns; i++) { - printf("EPLMN[%d]\t= ", i); - PRINT_PLMN(data->eplmn.plmn[i]); - printf("\n"); - } -} diff --git a/openair-cn/NAS/EURECOM-NAS/tools/usim_data.c b/openair-cn/NAS/EURECOM-NAS/tools/usim_data.c deleted file mode 100644 index 5354ebac88c362159a0501122e19c4c63edf2e66..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tools/usim_data.c +++ /dev/null @@ -1,639 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see <http://www.gnu.org/licenses/>. - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ -/***************************************************************************** -Source usim_data.c - -Version 0.1 - -Date 2012/10/31 - -Product USIM data generator - -Subsystem USIM data generator main process - -Author Frederic Maurel - -Description Implements the utility used to generate data stored in the - USIM application - - *****************************************************************************/ - -#include "network.h" - -#include "usim_api.h" -#include "memory.h" -#include "network.h" - -#include <stdio.h> // perror, printf -#include <stdlib.h> // exit -#include <string.h> // memset, memcpy, strncpy - - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -#define KSI USIM_KSI_NOT_AVAILABLE -#define KSI_ASME USIM_KSI_NOT_AVAILABLE -#define INT_ALGO USIM_INT_EIA1 -#define ENC_ALGO USIM_ENC_EEA0 -#define SECURITY_ALGORITHMS (ENC_ALGO | INT_ALGO) - -#define MIN_TAC 0x0000 -#define MAX_TAC 0xFFFE - -#define DEFAULT_TMSI 0x0000000D -#define DEFAULT_P_TMSI 0x0000000D -#define DEFAULT_M_TMSI 0x0000000D -#define DEFAULT_LAC 0xFFFE -#define DEFAULT_RAC 0x01 -#define DEFAULT_TAC 0x0001 - -#define DEFAULT_MME_ID 0x0102 -#define DEFAULT_MME_CODE 0x0F - -#define PRINT_PLMN_DIGIT(d) if ((d) != 0xf) printf("%u", (d)) - -#define PRINT_PLMN(plmn) \ - PRINT_PLMN_DIGIT((plmn).MCCdigit1); \ - PRINT_PLMN_DIGIT((plmn).MCCdigit2); \ - PRINT_PLMN_DIGIT((plmn).MCCdigit3); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit1); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit2); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit3) - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -static void _display_usage(const char* command); - -static void _display_usim_data(const usim_data_t* data); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int main (int argc, const char* argv[]) -{ - int rc; - usim_data_t usim_data; - - unsigned char gen_data; - - /* - * Read command line parameters - */ - if (argc != 2) { - fprintf(stderr, "Invalid parameter\n"); - _display_usage(argv[0]); - exit(EXIT_FAILURE); - } else if ( (strcmp(argv[1], "--gen") == 0) || - (strcmp(argv[1], "-g") == 0) ) { - /* Generate USIM data files */ - gen_data = TRUE; - } else if ( (strcmp(argv[1], "--print") == 0) || - (strcmp(argv[1], "-p") == 0) ) { - /* Display content of USIM data files */ - gen_data = FALSE; - } else { - /* Display usage */ - _display_usage(argv[0]); - exit(EXIT_SUCCESS); - } - - if (gen_data) { - /* - * Initialize USIM data - */ - memset(&usim_data, 0, sizeof(usim_data_t)); - -#if (SELECTED_PLMN == FCT1) - /* - * International Mobile Subscriber Identity - * IMSI = MCC + MNC + MSIN = 310 (USA) + 028 (UNKNOWN) + 90832150 - */ -#warning "IMSI 310.028.90832150" - usim_data.imsi.length = 8; - usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even - usim_data.imsi.u.num.digit1 = 3; // MCC digit 1 - usim_data.imsi.u.num.digit2 = 1; // MCC digit 2 - usim_data.imsi.u.num.digit3 = 0; // MCC digit 3 - usim_data.imsi.u.num.digit4 = 0; // MNC digit 1 - usim_data.imsi.u.num.digit5 = 2; // MNC digit 2 - usim_data.imsi.u.num.digit6 = 8; // MNC digit 3 - usim_data.imsi.u.num.digit7 = 9; - usim_data.imsi.u.num.digit8 = 0; - usim_data.imsi.u.num.digit9 = 8; - usim_data.imsi.u.num.digit10 = 3; - usim_data.imsi.u.num.digit11 = 2; - usim_data.imsi.u.num.digit12 = 1; - usim_data.imsi.u.num.digit13 = 5; - usim_data.imsi.u.num.digit14 = 0; - usim_data.imsi.u.num.digit15 = 0b1111; -#endif -#if (SELECTED_PLMN == SFR1) -#warning "IMSI 208.10.00001234" - /* - * International Mobile Subscriber Identity - * IMSI = MCC + MNC + MSIN = 208 (France) + 10 (SFR) + 00001234 - */ - #warning "IMSI 208.10.00001234" - usim_data.imsi.length = 8; - usim_data.imsi.u.num.parity = EVEN_PARITY; // Parity: even - usim_data.imsi.u.num.digit1 = 2; // MCC digit 1 - usim_data.imsi.u.num.digit2 = 0; // MCC digit 2 - usim_data.imsi.u.num.digit3 = 8; // MCC digit 3 - usim_data.imsi.u.num.digit4 = 1; // MNC digit 1 - usim_data.imsi.u.num.digit5 = 0; // MNC digit 2 - usim_data.imsi.u.num.digit6 = 0;//0b1111; // MNC digit 3 - usim_data.imsi.u.num.digit7 = 0; - usim_data.imsi.u.num.digit8 = 0; - usim_data.imsi.u.num.digit9 = 0; - usim_data.imsi.u.num.digit10 = 0; - usim_data.imsi.u.num.digit11 = 1; - usim_data.imsi.u.num.digit12 = 2; - usim_data.imsi.u.num.digit13 = 3; - usim_data.imsi.u.num.digit14 = 4; - usim_data.imsi.u.num.digit15 = 0b1111; -#endif -#if (SELECTED_PLMN == TEST1) -#warning "IMSI 001.01.000001234" - usim_data.imsi.length = 8; - usim_data.imsi.u.num.parity = 0x0; // Type of identity = IMSI, even - usim_data.imsi.u.num.digit1 = 0; // MCC digit 1 - usim_data.imsi.u.num.digit2 = 0; // MCC digit 2 - usim_data.imsi.u.num.digit3 = 1; // MCC digit 3 - usim_data.imsi.u.num.digit4 = 0; // MNC digit 1 - usim_data.imsi.u.num.digit5 = 1; // MNC digit 2 - usim_data.imsi.u.num.digit6 = 0; - usim_data.imsi.u.num.digit7 = 0; - usim_data.imsi.u.num.digit8 = 0; - usim_data.imsi.u.num.digit9 = 0; - usim_data.imsi.u.num.digit10 = 0; - usim_data.imsi.u.num.digit11 = 1; - usim_data.imsi.u.num.digit12 = 2; - usim_data.imsi.u.num.digit13 = 3; - usim_data.imsi.u.num.digit14 = 4; - usim_data.imsi.u.num.digit15 = 0xF; -#endif - /* - * Ciphering and Integrity Keys - */ - usim_data.keys.ksi = KSI; - memset(&usim_data.keys.ck, 0, USIM_CK_SIZE); - memset(&usim_data.keys.ik, 0, USIM_IK_SIZE); - - /* - * Higher Priority PLMN search period - */ - usim_data.hpplmn = 0x00; /* Disable timer */ - - /* - * List of Forbidden PLMNs - */ - for (int i = 0; i < USIM_FPLMN_MAX; i++) { - memset(&usim_data.fplmn[i], 0xff, sizeof(plmn_t)); - } - - /* - * Location Information - */ - usim_data.loci.tmsi = DEFAULT_TMSI; - usim_data.loci.lai.plmn = network_records[SELECTED_PLMN].plmn; - usim_data.loci.lai.lac = DEFAULT_LAC; - usim_data.loci.status = USIM_LOCI_NOT_UPDATED; - /* - * Packet Switched Location Information - */ - usim_data.psloci.p_tmsi = DEFAULT_P_TMSI; - usim_data.psloci.signature[0] = 0x01; - usim_data.psloci.signature[1] = 0x02; - usim_data.psloci.signature[2] = 0x03; - usim_data.psloci.rai.plmn = network_records[SELECTED_PLMN].plmn; - usim_data.psloci.rai.lac = DEFAULT_LAC; - usim_data.psloci.rai.rac = DEFAULT_RAC; - usim_data.psloci.status = USIM_PSLOCI_NOT_UPDATED; - /* - * Administrative Data - */ - usim_data.ad.UE_Operation_Mode = USIM_NORMAL_MODE; - usim_data.ad.Additional_Info = 0xffff; - usim_data.ad.MNC_Length = 2; - /* - * EPS NAS security context - */ - usim_data.securityctx.length = 52; - usim_data.securityctx.KSIasme.type = USIM_KSI_ASME_TAG; - usim_data.securityctx.KSIasme.length = 1; - usim_data.securityctx.KSIasme.value[0] = KSI_ASME; - usim_data.securityctx.Kasme.type = USIM_K_ASME_TAG; - usim_data.securityctx.Kasme.length = USIM_K_ASME_SIZE; - memset(usim_data.securityctx.Kasme.value, 0, - usim_data.securityctx.Kasme.length); - usim_data.securityctx.ulNAScount.type = USIM_UL_NAS_COUNT_TAG; - usim_data.securityctx.ulNAScount.length = USIM_UL_NAS_COUNT_SIZE; - memset(usim_data.securityctx.ulNAScount.value, 0, - usim_data.securityctx.ulNAScount.length); - usim_data.securityctx.dlNAScount.type = USIM_DL_NAS_COUNT_TAG; - usim_data.securityctx.dlNAScount.length = USIM_DL_NAS_COUNT_SIZE; - memset(usim_data.securityctx.dlNAScount.value, 0, - usim_data.securityctx.dlNAScount.length); - usim_data.securityctx.algorithmID.type = USIM_INT_ENC_ALGORITHMS_TAG; - usim_data.securityctx.algorithmID.length = 1; - usim_data.securityctx.algorithmID.value[0] = SECURITY_ALGORITHMS; - /* - * Subcriber's Number - */ - usim_data.msisdn.length = 7; - usim_data.msisdn.number.ext = 1; - usim_data.msisdn.number.ton = MSISDN_TON_UNKNOWKN; - usim_data.msisdn.number.npi = MSISDN_NPI_ISDN_TELEPHONY; - usim_data.msisdn.number.digit[0].msb = 3; - usim_data.msisdn.number.digit[0].lsb = 3; - usim_data.msisdn.number.digit[1].msb = 6; - usim_data.msisdn.number.digit[1].lsb = 1; - usim_data.msisdn.number.digit[2].msb = 1; - usim_data.msisdn.number.digit[2].lsb = 1; - usim_data.msisdn.number.digit[3].msb = 2; - usim_data.msisdn.number.digit[3].lsb = 3; - usim_data.msisdn.number.digit[4].msb = 4; - usim_data.msisdn.number.digit[4].lsb = 5; - usim_data.msisdn.number.digit[5].msb = 6; - usim_data.msisdn.number.digit[5].lsb = 0xf; - usim_data.msisdn.number.digit[6].msb = 0xf; - usim_data.msisdn.number.digit[6].lsb = 0xf; - usim_data.msisdn.number.digit[7].msb = 0xf; - usim_data.msisdn.number.digit[7].lsb = 0xf; - usim_data.msisdn.number.digit[8].msb = 0xf; - usim_data.msisdn.number.digit[8].lsb = 0xf; - usim_data.msisdn.number.digit[9].msb = 0xf; - usim_data.msisdn.number.digit[9].lsb = 0xf; - usim_data.msisdn.conf1_record_id = 0xff; /* Not used */ - usim_data.msisdn.ext1_record_id = 0xff; /* Not used */ - - /* - * PLMN Network Name and Operator PLMN List - */ - for (int i = TEST1; i < VDF1; i++) { - network_record_t record = network_records[i]; - usim_data.pnn[i].fullname.type = USIM_PNN_FULLNAME_TAG; - usim_data.pnn[i].fullname.length = strlen(record.fullname); - strncpy((char*)usim_data.pnn[i].fullname.value, record.fullname, - usim_data.pnn[i].fullname.length); - usim_data.pnn[i].shortname.type = USIM_PNN_SHORTNAME_TAG; - usim_data.pnn[i].shortname.length = strlen(record.shortname); - strncpy((char*)usim_data.pnn[i].shortname.value, record.shortname, - usim_data.pnn[i].shortname.length); - usim_data.opl[i].plmn = record.plmn; - usim_data.opl[i].start = record.tac_start; - usim_data.opl[i].end = record.tac_end; - usim_data.opl[i].record_id = i; - } - - for (int i = VDF2; i < USIM_OPL_MAX; i++) { - memset(&usim_data.opl[i].plmn, 0xff, sizeof(plmn_t)); - } - - /* - * List of Equivalent HPLMNs - */ - usim_data.ehplmn[0] = network_records[SFR2].plmn; - usim_data.ehplmn[1] = network_records[SFR3].plmn; - /* - * Home PLMN Selector with Access Technology - */ - usim_data.hplmn.plmn = network_records[SELECTED_PLMN].plmn; - usim_data.hplmn.AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN); - - /* - * List of user controlled PLMN selector with Access Technology - */ - for (int i = 0; i < USIM_PLMN_MAX; i++) { - memset(&usim_data.plmn[i], 0xff, sizeof(plmn_t)); - } - - /* - * List of operator controlled PLMN selector with Access Technology - */ - usim_data.oplmn[0].plmn = network_records[VDF1].plmn; - usim_data.oplmn[0].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN); - usim_data.oplmn[1].plmn = network_records[VDF2].plmn; - usim_data.oplmn[1].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN); - usim_data.oplmn[2].plmn = network_records[VDF3].plmn; - usim_data.oplmn[2].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN); - usim_data.oplmn[3].plmn = network_records[VDF4].plmn; - usim_data.oplmn[3].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN); - usim_data.oplmn[4].plmn = network_records[VDF5].plmn; - usim_data.oplmn[4].AcT = (USIM_ACT_GSM | USIM_ACT_UTRAN | USIM_ACT_EUTRAN); - - for (int i = 5; i < USIM_OPLMN_MAX; i++) { - memset(&usim_data.oplmn[i], 0xff, sizeof(plmn_t)); - } - - /* - * EPS Location Information - */ - usim_data.epsloci.guti.gummei.plmn = network_records[SELECTED_PLMN].plmn; - usim_data.epsloci.guti.gummei.MMEgid = DEFAULT_MME_ID; - usim_data.epsloci.guti.gummei.MMEcode = DEFAULT_MME_CODE; - usim_data.epsloci.guti.m_tmsi = DEFAULT_M_TMSI; - usim_data.epsloci.tai.plmn = usim_data.epsloci.guti.gummei.plmn; - usim_data.epsloci.tai.tac = DEFAULT_TAC; - usim_data.epsloci.status = USIM_EPSLOCI_UPDATED; - /* - * Non-Access Stratum configuration - */ - usim_data.nasconfig.NAS_SignallingPriority.type = USIM_NAS_SIGNALLING_PRIORITY_TAG; - usim_data.nasconfig.NAS_SignallingPriority.length = 1; - usim_data.nasconfig.NAS_SignallingPriority.value[0] = 0x00; - usim_data.nasconfig.NMO_I_Behaviour.type = USIM_NMO_I_BEHAVIOUR_TAG; - usim_data.nasconfig.NMO_I_Behaviour.length = 1; - usim_data.nasconfig.NMO_I_Behaviour.value[0] = 0x00; - usim_data.nasconfig.AttachWithImsi.type = USIM_ATTACH_WITH_IMSI_TAG; - usim_data.nasconfig.AttachWithImsi.length = 1; -#if defined(START_WITH_GUTI) - usim_data.nasconfig.AttachWithImsi.value[0] = 0x00; -#else - usim_data.nasconfig.AttachWithImsi.value[0] = 0x01; -#endif - usim_data.nasconfig.MinimumPeriodicSearchTimer.type = USIM_MINIMUM_PERIODIC_SEARCH_TIMER_TAG; - usim_data.nasconfig.MinimumPeriodicSearchTimer.length = 1; - usim_data.nasconfig.MinimumPeriodicSearchTimer.value[0] = 0x00; - usim_data.nasconfig.ExtendedAccessBarring.type = USIM_EXTENDED_ACCESS_BARRING_TAG; - usim_data.nasconfig.ExtendedAccessBarring.length = 1; - usim_data.nasconfig.ExtendedAccessBarring.value[0] = 0x00; - usim_data.nasconfig.Timer_T3245_Behaviour.type = USIM_TIMER_T3245_BEHAVIOUR_TAG; - usim_data.nasconfig.Timer_T3245_Behaviour.length = 1; - usim_data.nasconfig.Timer_T3245_Behaviour.value[0] = 0x00; - - /* - * Write USIM application data - */ - rc = usim_api_write(&usim_data); - - if (rc != RETURNok) { - perror("ERROR\t: usim_api_write() failed"); - exit(EXIT_FAILURE); - } - } - - /* - * Read USIM application data - */ - memset(&usim_data, 0, sizeof(usim_data_t)); - rc = usim_api_read(&usim_data); - - if (rc != RETURNok) { - perror("ERROR\t: usim_api_read() failed"); - exit(EXIT_FAILURE); - } - - /* - * Display USIM application data - */ - printf("\nUSIM data:\n\n"); - _display_usim_data(&usim_data); - - /* - * Display USIM file location - */ - char* path = memory_get_path("USIM_DIR", ".usim.nvram"); - printf("\nUSIM data file: %s\n", path); - free(path); - - exit(EXIT_SUCCESS); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * Displays command line usage - */ -static void _display_usage(const char* command) -{ - fprintf(stderr, "usage: %s [OPTION]\n", command); - fprintf(stderr, "\t[--gen|-g]\tGenerate the USIM data file\n"); - fprintf(stderr, "\t[--print|-p]\tDisplay the content of the USIM data file\n"); - fprintf(stderr, "\t[--help|-h]\tDisplay this usage\n"); - const char* path = getenv("USIM_DIR"); - - if (path != NULL) { - fprintf(stderr, "USIM_DIR = %s\n", path); - } else { - fprintf(stderr, "USIM_DIR environment variable is not defined\n"); - } -} - -/* - * Displays USIM application data - */ -static void _display_usim_data(const usim_data_t* data) -{ - int digits; - - printf("Administrative Data:\n"); - printf("\tUE_Operation_Mode\t= 0x%.2x\n", data->ad.UE_Operation_Mode); - printf("\tAdditional_Info\t\t= 0x%.4x\n", data->ad.Additional_Info); - printf("\tMNC_Length\t\t= %d\n\n", data->ad.MNC_Length); - - printf("IMSI:\n"); - printf("\tlength\t= %d\n", data->imsi.length); - printf("\tparity\t= %s\n", data->imsi.u.num.parity == EVEN_PARITY ? "Even" : "Odd"); - digits = (data->imsi.length * 2) - 1 - (data->imsi.u.num.parity == EVEN_PARITY ? 1 : 0); - printf("\tdigits\t= %d\n", digits); - printf("\tdigits\t= %u%u%u%u%u%x%u%u%u%u", - data->imsi.u.num.digit1, // MCC digit 1 - data->imsi.u.num.digit2, // MCC digit 2 - data->imsi.u.num.digit3, // MCC digit 3 - data->imsi.u.num.digit4, // MNC digit 1 - data->imsi.u.num.digit5, // MNC digit 2 - data->imsi.u.num.digit6, // MNC digit 3 - data->imsi.u.num.digit7, - data->imsi.u.num.digit8, - data->imsi.u.num.digit9, - data->imsi.u.num.digit10); - - if (digits >= 11) - printf("%x", data->imsi.u.num.digit11); - - if (digits >= 12) - printf("%x", data->imsi.u.num.digit12); - - if (digits >= 13) - printf("%x", data->imsi.u.num.digit13); - - if (digits >= 14) - printf("%x", data->imsi.u.num.digit14); - - if (digits >= 15) - printf("%x", data->imsi.u.num.digit15); - - printf("\n\n"); - - printf("Ciphering and Integrity Keys:\n"); - printf("\tKSI\t: 0x%.2x\n", data->keys.ksi); - char key[USIM_CK_SIZE + 1]; - key[USIM_CK_SIZE] = '\0'; - memcpy(key, data->keys.ck, USIM_CK_SIZE); - printf("\tCK\t: \"%s\"\n", key); - memcpy(key, data->keys.ik, USIM_IK_SIZE); - printf("\tIK\t: \"%s\"\n", key); - - printf("EPS NAS security context:\n"); - printf("\tKSIasme\t: 0x%.2x\n", data->securityctx.KSIasme.value[0]); - char kasme[USIM_K_ASME_SIZE + 1]; - kasme[USIM_K_ASME_SIZE] = '\0'; - memcpy(kasme, data->securityctx.Kasme.value, USIM_K_ASME_SIZE); - printf("\tKasme\t: \"%s\"\n", kasme); - printf("\tulNAScount\t: 0x%.8x\n", - *(UInt32_t*)data->securityctx.ulNAScount.value); - printf("\tdlNAScount\t: 0x%.8x\n", - *(UInt32_t*)data->securityctx.dlNAScount.value); - printf("\talgorithmID\t: 0x%.2x\n\n", - data->securityctx.algorithmID.value[0]); - - printf("MSISDN\t= %u%u%u %u%u%u%u %u%u%u%u\n\n", - data->msisdn.number.digit[0].msb, - data->msisdn.number.digit[0].lsb, - data->msisdn.number.digit[1].msb, - data->msisdn.number.digit[1].lsb, - data->msisdn.number.digit[2].msb, - data->msisdn.number.digit[2].lsb, - data->msisdn.number.digit[3].msb, - data->msisdn.number.digit[3].lsb, - data->msisdn.number.digit[4].msb, - data->msisdn.number.digit[4].lsb, - data->msisdn.number.digit[5].msb); - - for (int i = 0; i < USIM_PNN_MAX; i++) { - printf("PNN[%d]\t= {%s, %s}\n", i, - data->pnn[i].fullname.value, data->pnn[i].shortname.value); - } - - printf("\n"); - - for (int i = 0; i < USIM_OPL_MAX; i++) { - printf("OPL[%d]\t= ", i); - PRINT_PLMN(data->opl[i].plmn); - printf(", TAC = [%.4x - %.4x], record_id = %d\n", - data->opl[i].start, data->opl[i].end, data->opl[i].record_id); - } - - printf("\n"); - - printf("HPLMN\t\t= "); - PRINT_PLMN(data->hplmn.plmn); - printf(", AcT = 0x%x\n\n", data->hplmn.AcT); - - for (int i = 0; i < USIM_FPLMN_MAX; i++) { - printf("FPLMN[%d]\t= ", i); - PRINT_PLMN(data->fplmn[i]); - printf("\n"); - } - - printf("\n"); - - for (int i = 0; i < USIM_EHPLMN_MAX; i++) { - printf("EHPLMN[%d]\t= ", i); - PRINT_PLMN(data->ehplmn[i]); - printf("\n"); - } - - printf("\n"); - - for (int i = 0; i < USIM_PLMN_MAX; i++) { - printf("PLMN[%d]\t\t= ", i); - PRINT_PLMN(data->plmn[i].plmn); - printf(", AcTPLMN = 0x%x", data->plmn[i].AcT); - printf("\n"); - } - - printf("\n"); - - for (int i = 0; i < USIM_OPLMN_MAX; i++) { - printf("OPLMN[%d]\t= ", i); - PRINT_PLMN(data->oplmn[i].plmn); - printf(", AcTPLMN = 0x%x", data->oplmn[i].AcT); - printf("\n"); - } - - printf("\n"); - - printf("HPPLMN\t\t= 0x%.2x (%d minutes)\n\n", data->hpplmn, data->hpplmn); - - printf("LOCI:\n"); - printf("\tTMSI = 0x%.4x\n", data->loci.tmsi); - printf("\tLAI\t: PLMN = "); - PRINT_PLMN(data->loci.lai.plmn); - printf(", LAC = 0x%.2x\n", data->loci.lai.lac); - printf("\tstatus\t= %d\n\n", data->loci.status); - - printf("PSLOCI:\n"); - printf("\tP-TMSI = 0x%.4x\n", data->psloci.p_tmsi); - printf("\tsignature = 0x%x 0x%x 0x%x\n", - data->psloci.signature[0], - data->psloci.signature[1], - data->psloci.signature[2]); - printf("\tRAI\t: PLMN = "); - PRINT_PLMN(data->psloci.rai.plmn); - printf(", LAC = 0x%.2x, RAC = 0x%.1x\n", - data->psloci.rai.lac, data->psloci.rai.rac); - printf("\tstatus\t= %d\n\n", data->psloci.status); - - printf("EPSLOCI:\n"); - printf("\tGUTI\t: GUMMEI\t: (PLMN = "); - PRINT_PLMN(data->epsloci.guti.gummei.plmn); - printf(", MMEgid = 0x%.2x, MMEcode = 0x%.1x)", - data->epsloci.guti.gummei.MMEgid, - data->epsloci.guti.gummei.MMEcode); - printf(", M-TMSI = 0x%.4x\n", data->epsloci.guti.m_tmsi); - printf("\tTAI\t: PLMN = "); - PRINT_PLMN(data->epsloci.tai.plmn); - printf(", TAC = 0x%.2x\n", - data->epsloci.tai.tac); - printf("\tstatus\t= %d\n\n", data->epsloci.status); - - printf("NASCONFIG:\n"); - printf("\tNAS_SignallingPriority\t\t: 0x%.2x\n", - data->nasconfig.NAS_SignallingPriority.value[0]); - printf("\tNMO_I_Behaviour\t\t\t: 0x%.2x\n", - data->nasconfig.NMO_I_Behaviour.value[0]); - printf("\tAttachWithImsi\t\t\t: 0x%.2x\n", - data->nasconfig.AttachWithImsi.value[0]); - printf("\tMinimumPeriodicSearchTimer\t: 0x%.2x\n", - data->nasconfig.MinimumPeriodicSearchTimer.value[0]); - printf("\tExtendedAccessBarring\t\t: 0x%.2x\n", - data->nasconfig.ExtendedAccessBarring.value[0]); - printf("\tTimer_T3245_Behaviour\t\t: 0x%.2x\n", - data->nasconfig.Timer_T3245_Behaviour.value[0]); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/ActivatePDN.png b/openair-cn/NAS/EURECOM-NAS/tst/MSC/ActivatePDN.png deleted file mode 100644 index 7bdfb63d699e306fd53e495fc0b4cc7d13cd98e6..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/ActivatePDN.png and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/AuthenticationReject.png b/openair-cn/NAS/EURECOM-NAS/tst/MSC/AuthenticationReject.png deleted file mode 100644 index de5d3ead9db8457be75a1d26a9eb8d73c3d0655b..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/AuthenticationReject.png and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/MSC/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/MSC/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/DeactivatePDN.png b/openair-cn/NAS/EURECOM-NAS/tst/MSC/DeactivatePDN.png deleted file mode 100644 index 28401eadea1b6b9de9b311d0bc7d6822272b158d..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/DeactivatePDN.png and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttach.png b/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttach.png deleted file mode 100644 index 35723a48fe2593974950dcfaee36faffed9518ac..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttach.png and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttachReject.png b/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttachReject.png deleted file mode 100644 index efe658694f10fa535f9ab36d749cdd2594eb66fe..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/InitialAttachReject.png and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/NomalDetach.png b/openair-cn/NAS/EURECOM-NAS/tst/MSC/NomalDetach.png deleted file mode 100644 index e5ca319adaa40233cc3e0ac570d547f6ebfa7093..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/NomalDetach.png and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/README b/openair-cn/NAS/EURECOM-NAS/tst/MSC/README deleted file mode 100644 index b78a7b3e747a5e24d0072b09aa15c66faf55c680..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/MSC/README +++ /dev/null @@ -1,34 +0,0 @@ -================================================================================ - Message Sequence Chart generation -================================================================================ - -Message Sequence Charts (MSCs) are a way of representing entities and -interactions to demonstrate how protocols operate between network elements. - -The Access Stratum simulator generates MSC description file that can be -processed by the Python script msc_gen.py to generate a PNG (Portable -Network Graphic) file. - -msc_gen.py use mscgen utility that is fully discribed at -http://www.mcternan.me.uk/mscgen/ - --------------------------------------------------------------------------------- - How to generate MSC description file ? --------------------------------------------------------------------------------- - -Redirect stderr stream to a file that will be used as input by the Python -script msc_gen.py: - -ASprocess 2> ASprocess.msc - --------------------------------------------------------------------------------- - How to generate PNG file ? --------------------------------------------------------------------------------- - -Parse the MSC description file using the Python script msc_gen.py: - -./msc_gen.py ASprocess.msc - -Warning: msc_gen.py needs mscgen utility to be installed. mscgen is a C -program that uses the GD graphics library for PNG output. - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/SwitchOffDetach.png b/openair-cn/NAS/EURECOM-NAS/tst/MSC/SwitchOffDetach.png deleted file mode 100644 index 77b28c11a52b7f5b8b6af762c6ea7bc3c77c6c93..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/SwitchOffDetach.png and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/msc_gen.py b/openair-cn/NAS/EURECOM-NAS/tst/MSC/msc_gen.py deleted file mode 100755 index 2857cddc331d49cbe396e0f41321695c2d4800f2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/MSC/msc_gen.py +++ /dev/null @@ -1,354 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# Lionel GAUTHIER -# This script is a downgrade of a python script written for the openair stack, generating sequence diagrams charts, displaying -# messages exchanged between LTE access stratum protocol entities. -# This script needs mscgen tool (http://www.mcternan.me.uk/mscgen/). -# -# The aim of this script is to collect some traces from oaisim stack and generate a mscgen script, then generate a sequence diagram -# image (png or jpeg) based on the scripts generated. -# An example of how it can be invoqued: msc_gen.py /tmp/msc_log.txt /tmp/msc_log2.txt msc_logx.txt are input text files, -# They/It are/is generated by the execution of executables in linux user space. May be it is better to operate on log files 'grepped' with MSC: -# ./my_exe.exe | grep \[MSC > /tmp/msc_log1.txt - - -# Now, examples of how to generate a mscgen trace in a C executable: -# -First you have to declare the instance(s) of the protocol(s) that will send or receive messages. -# This is done with the following line: -# [MSC_NEW][system time][protocol_name=instance_name] -# examples: -# printf("[MSC_NEW][%s][MIH-F=%s]\n", getTimeStamp4Log(), g_mihf_id); for declaring a new instance of a protocol entity of type MIH-F -# with an instance name g_mihf_id (of type char*) -# printf("[MSC_NEW][%s][NAS=%s]\n", getTimeStamp4Log(), "nas"); other example. -# This declaration of instances of protocols is mandatory to for this script to work. -# -# -Then for tracing a message you have to log a line following this format: -# [MSC_MSG][system time][source instance_name][--- message_name --->][destination instance_name] -# Note: -# ---> means a message that has been received correctly by destination -# ---x means a message lost by destination -# example -# NOTICE("[MSC_MSG][%s][%s][--- Link_Register.indication\\n%s ---x][%s]\n",getTimeStamp4Log(),g_link_id,g_msc_gen_buf,g_mihf_id); -# - - - - -import sys -import subprocess -import re -import socket -import datetime -import os.path -from datetime import date - -MSCGEN_OUTPUT_TYPE = "png" -MAX_MESSAGES_PER_PAGE = 36 - -SYSTEM_FRAME_NUMBER_STR = 'FRAME' -MODULE_STR = 'MOD' -RADIO_BEARER_STR = 'RB' -MSC_NEW_STR = '[MSC_NEW]' -MSC_MSG_STR = '[MSC_MSG]' -MSC_NBOX_STR = '[MSC_NBOX]' -MSC_BOX_STR = '[MSC_BOX]' -MSC_ABOX_STR = '[MSC_ABOX]' -MSC_RBOX_STR = '[MSC_RBOX]' - -# This dic is filled as follow : g_entities_dic[protocol_instance_name].append(protocol_name) -# where protocol_name can be any of the following MI-USER, MIH-F, RAL, LINK-SAP -g_entities_dic = {} -g_reverse_entities_dic = {} - - -# g_messages is filled with dictionnaries: -# message_dic['entity_src'] = protocol_entity_src -# message_dic['entity_dst'] = protocol_entity_dest -# message_dic['msg'] = message -# message_dic['line_color'] = g_display_color[entity_name] -# message_dic['text_color'] = g_display_color[entity_name] -# message_dic['time'] = system_frame_number -# message_dic['seq_no'] = sequence_number_generator() -# g_messages.append(message_dic) -g_messages = [] -g_messages_dic = {} - - -# g_display_order_dic is a dictionnary where the order of the display of entities sharing the same module identifier is hardcoded -#MAC and PHY valus have to be above num max radio bearer value -#g_display_order_dic = {'MIH-USER': 0, 'MIH-F': 1, 'RAL': 3, 'NAS': 4} -g_display_order_dic = {'NAS-UE': 0, 'AS': 1, 'NAS-MME': 3} - -# Display color of messages of sending entities -g_display_color = {'IP': '\"teal\"', - 'RRC_UE': '\"red\"', - 'MIH-USER': '\"black\"', - 'MIH-F': '\"black\"', - 'RAL': '\"black\"', - 'RAL_M': '\"black\"', - 'RLC_UM': '\"navy\"', - 'RLC_TM': '\"navy\"', - 'NAS': '\"black\"', - 'MAC_eNB': '\"indigo\"', - 'PHY': '\"purple\"', - 'NAS-UE': '\"black\"', - 'NAS-MME': '\"black\"', - 'AS': '\"black\"'} - - -g_final_display_order_list = [] -g_sequence_generator = 0 - -def sequence_number_generator(): - global g_sequence_generator - l_seq = g_sequence_generator - g_sequence_generator = g_sequence_generator + 1 - return l_seq - -def parse_log_file_for_discovering_protocol_entities(filename): - global g_entities_dic - global g_entities - global g_messages - global g_final_display_order_list - #open TXT file that contain OAI filtered traces for mscgen - - fhandle = open(filename, 'r') - fcontent = fhandle.read() - fhandle.close() - - # split file content in lines - lines = fcontent.splitlines() - for line in lines: - system_time = 'unknown' - - # if line is a trace of the creation of a new protocol instance - if MSC_NEW_STR in line: - partition = line.rpartition(MSC_NEW_STR) - msc_log_string = partition[2] - #print (" %s " % msc_log_string) - partition = msc_log_string.split('[') - print ("\n\n %s \n" % partition) - #if len(partition) == 2: - - item = partition[1] - item = item.strip() - item = item.strip(']') - system_time = item.split(' ')[-1] - print ("NEW system_time %s " % system_time) - - item = partition[2] - item = item.strip() - item = item.strip(']') - protocol_entity_type = item.split('=')[0] - protocol_entity_name = item.split('=')[-1] - print ("NEW protocol_entity_type %s " % protocol_entity_type) - print ("NEW protocol_entity_name %s " % protocol_entity_name) - - if protocol_entity_name not in g_entities_dic: - g_entities_dic[protocol_entity_name] = protocol_entity_type - - if protocol_entity_type not in g_reverse_entities_dic: - g_reverse_entities_dic[protocol_entity_type] = protocol_entity_name - else: - entity_name_list = g_reverse_entities_dic[protocol_entity_type] - entity_name_list.append(protocol_entity_name) - g_reverse_entities_dic[protocol_entity_type] = entity_name_list - #print (" g_entities_dic[%d][%d].append(%s)" % (module_id_int, radio_bearer_id_int, entity_name_src)) - print (" g_entities_dic= %s\n\n" % (g_entities_dic)) - print (" g_reverse_entities_dic= %s\n\n" % (g_reverse_entities_dic)) - - #g_entities.append(protocol_entity_type) - #print (" %s \n" % protocol_entity) - - - - - -def parse_log_file(filename): - global g_entities_dic - global g_entities - global g_messages - global g_final_display_order_list - #open TXT file that contain OAI filtered traces for mscgen - fhandle = open(filename, 'r') - fcontent = fhandle.read() - fhandle.close() - - # split file content in lines - lines = fcontent.splitlines() - for line in lines: - system_time = 'unknown' - message = 'unknown' - entity_name_src = 'unknown' - entity_name_dest = 'unknown' - - - # if line is a trace of the creation of a new protocol instance - if MSC_MSG_STR in line: - partition = line.strip().rpartition(MSC_MSG_STR) - msc_log_string = partition[2].strip() - print (" ++++ %s " % msc_log_string) - partition = msc_log_string.split('[') - print (" ++++ %s " % partition) - - #if len(partition) == 9: - message_dic = {} - - system_time = partition[1].strip().split(' ')[-1].strip(']') - message_dic['display_time'] = system_time - seconds_int = int(system_time.split(':')[0]) - micro_seconds_int = int(system_time.split(':')[-1]) - system_time_int = seconds_int*1000000 + micro_seconds_int - system_time=str(system_time_int) - print ('system_time %s' % system_time) - - entity_name_src = partition[2].strip().split(' ')[-1].strip(']') - print ('entity_name_src %s' % entity_name_src) - - message = partition[3].strip().strip(']').strip() - if (message[-1] == 'x') or (message[-1] == 'X'): - message_dic['arc'] = '-x' - elif message[-1] == '>': - message_dic['arc'] = '=>' - message = message.strip('<').strip('>').strip('x').strip('X').strip('-').strip('=').strip() - print ('message %s' % message) - - entity_name_dest = partition[4].strip().split(' ')[-1].strip(']') - print ('entity_name_dest %s' % entity_name_dest) - message_dic['entity_src'] = entity_name_src - message_dic['entity_dst'] = entity_name_dest - message_dic['msg'] = message - message_dic['line_color'] = g_display_color[g_entities_dic[entity_name_src]] - message_dic['text_color'] = g_display_color[g_entities_dic[entity_name_src]] - message_dic['time'] = system_time - #message_dic['seq_no'] = sequence_number_generator() - print ('%s\n\n' % message_dic) - g_messages_dic[system_time_int] = message_dic - #g_messages.append(message_dic) - -#TODO !!! - if MSC_RBOX_STR in line: - partition = line.strip().rpartition(MSC_RBOX_STR) - msc_log_string = partition[2].strip() - print (" ==== %s " % msc_log_string) - partition = msc_log_string.split('[') - print (" ==== %s " % partition) -#TODO !!! - -def generate_sorted_message_list(): - first_time_stamp = 0 - for system_time_int in sorted(g_messages_dic.iterkeys()): - if first_time_stamp == 0: - first_time_stamp = system_time_int - message_dic = g_messages_dic[system_time_int] - message_dic['seq_no'] = sequence_number_generator() - message_dic['display_time'] = str(system_time_int - first_time_stamp) - g_messages.append(message_dic) - -def generate_sorted_entity_display_list(): - module_display_order_dic = {} - for entity_name in sorted(g_entities_dic.iterkeys()): - module_display_order_dic[g_display_order_dic[g_entities_dic[entity_name]]] = entity_name - - - print("------------------------------------") - print(" %s " % (module_display_order_dic)) - - for display_priority in sorted(module_display_order_dic.iterkeys()): - g_final_display_order_list.append(module_display_order_dic[display_priority]) - -def msc_chart_write_header(fileP): - global g_final_display_order_list - fileP.write("msc {\n") - fileP.write("width = \"2048\";\n") - - entity_line_list_str = '' - for entity in g_final_display_order_list: - entity_line_list_str = entity_line_list_str + ' ' + entity + ',' - - entity_line_list_str = entity_line_list_str.rstrip().strip(',') - fileP.write(" %s;" % (entity_line_list_str)) - - -def msc_chart_write_footer(fileP): - fileP.write("\n}\n") - -def msc_chart_generate(file_nameP): - global MSCGEN_OUTPUT_TYPE - command_line = "mscgen -T " + MSCGEN_OUTPUT_TYPE + " -i " + file_nameP + "; chmod 777 " +file_nameP + ";" - - print("Command Line: %s " % (command_line)) - fi,fo,fe=os.popen3(command_line) - for i in fe.readlines(): - print "error:",i - -def get_nem_file_descriptor(): - global g_base_file_name - global g_page_index - l_file_name = g_base_file_name + str(g_page_index)+'.txt' - l_file = open(l_file_name, "w", 0777) - return l_file - - -###### MAIN START HERE ################# -num_args = len(sys.argv) -if num_args < 2: # the program name and the arguments - # stop the program and print an error message - sys.exit("Must provide at least one file to parse") - -for i in range(1,num_args): - print sys.argv[i] - -for i in range(1,num_args): - parse_log_file_for_discovering_protocol_entities(sys.argv[i]) - -for i in range(1,num_args): - parse_log_file(sys.argv[i]) - -generate_sorted_message_list() -generate_sorted_entity_display_list() - -g_page_index = 0 -g_message_index = 0 -g_message_index_in_current_page = 0 -g_now = datetime.datetime.now() -g_now_formated = g_now.strftime("%Y-%m-%d_%H.%M.%S") -g_currentdir = os.curdir -g_resultdir = os.path.join(g_currentdir, g_now_formated) -os.mkdir(g_resultdir, 0777) -os.chdir(g_resultdir) - -g_base_file_name = 'mih_mscgen_page_' - -g_file = get_nem_file_descriptor() -msc_chart_write_header(g_file) - -for message in g_messages: - - if 'msg' in message: - print ('message %s' % message) - g_file.write(" %s%s%s [ label = \"(%d) T%s %s\", linecolour=%s , textcolour=%s ] ;\n" % (message['entity_src'], message['arc'], message['entity_dst'], message['seq_no'], message['display_time'], message['msg'], message['line_color'], message['text_color'])) - elif 'box' in message: - g_file.write(" %s %s %s [ label = \"%s\", textbgcolour=%s , textcolour=%s ] ;\n" % (message['entity_src'], message['box_type'], message['entity_dst'], message['box'], message['textbg_color'], message['text_color'])) - - g_message_index = g_message_index + 1 - g_message_index_in_current_page = g_message_index_in_current_page + 1 - - if (g_message_index_in_current_page == MAX_MESSAGES_PER_PAGE): - msc_chart_write_footer(g_file) - g_file.close() - msc_chart_generate(g_file.name) - g_page_index = g_page_index + 1 - g_message_index_in_current_page = 0 - - g_file = get_nem_file_descriptor() - msc_chart_write_header(g_file) - - -msc_chart_write_footer(g_file) -g_file.close() -if g_message_index_in_current_page >= 1: - msc_chart_generate(g_file.name) -else: - print("Removing empty seq diagram file: %s " % (g_file.name)) - os.remove(g_file.name) diff --git a/openair-cn/NAS/EURECOM-NAS/tst/MSC/mscgen b/openair-cn/NAS/EURECOM-NAS/tst/MSC/mscgen deleted file mode 100755 index 7a146811c77e7c0256a4bea0078cae6f1cc802d1..0000000000000000000000000000000000000000 Binary files a/openair-cn/NAS/EURECOM-NAS/tst/MSC/mscgen and /dev/null differ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/Makefile b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/Makefile deleted file mode 100644 index 94c27037e4f1964ca5682d206d75977dcd46fe4a..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -export PROCESS = MME - -include ../../Makerules -include ../../Makefile.inc - -PROJDIR = $(PWD)/../.. - -export LD_RUN_PATH = $(LIBDIR):$(LIBPROCESS) - -LIBS = -lutil -lapi -lEMMmsg -lESMmsg -lies -lrt -INCLUDES = -I. -I$(INCDIR) -I$(UTILDIR) -I$(NETAPIDIR) \ - -I$(EMMMSGDIR) -I$(ESMMSGDIR) -I$(IESDIR) - -TARGET = ASprocess - -all: $(TARGET) - -%.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - @$(CP) $@ $(BINDIR) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGET) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.c b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.c deleted file mode 100644 index 2ed7cdc7a3f619672f968c406d89aadc1da941a5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.c +++ /dev/null @@ -1,139 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source as_data.c - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem Access-Stratum data - -Author Frederic Maurel - -Description Defines constants and functions used by the AS simulator - process. - -*****************************************************************************/ - -#include "as_data.h" - -#include "as_message.h" - -#include <stdio.h> // snprintf -#include <time.h> // clock_gettime - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Time stamp generator - * ----------------------------------------------------------------------------- - */ -const char* getTime(void) -{ -#define TIME_BUFFER_SIZE 16 - static char time_buffer[TIME_BUFFER_SIZE]; - struct timespec ts; - - clock_gettime (CLOCK_REALTIME, &ts); - snprintf(time_buffer, TIME_BUFFER_SIZE, "%.6ld:%.6ld", - ts.tv_sec % 3600, ts.tv_nsec / 1000); - return (time_buffer); -} - -/* - * ----------------------------------------------------------------------------- - * Return RRC establishment cause - * ----------------------------------------------------------------------------- - */ -const char* rrcCause(char cause) -{ - if (cause == AS_CAUSE_EMERGENCY) { - return "EMERGENCY"; - } else if (cause == AS_CAUSE_HIGH_PRIO) { - return "HIGH_PRIORITY"; - } else if (cause == AS_CAUSE_MT_ACCESS) { - return "MT_ACCESS"; - } else if (cause == AS_CAUSE_MO_SIGNAL) { - return "MO_SIGNALLING"; - } else if (cause == AS_CAUSE_MO_DATA) { - return "MO_DATA"; - } else if (cause == AS_CAUSE_V1020) { - return "V1020"; - } else { - return "Unknown"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return RRC call type - * ----------------------------------------------------------------------------- - */ -const char* rrcType(char type) -{ - if (type == AS_TYPE_ORIGINATING_SIGNAL) { - return "ORIGINATING_SIGNAL"; - } else if (type == AS_TYPE_EMERGENCY_CALLS) { - return "EMERGENCY_CALLS"; - } else if (type == AS_TYPE_ORIGINATING_CALLS) { - return "ORIGINATING_CALLS"; - } else if (type == AS_TYPE_TERMINATING_CALLS) { - return "TERMINATING_CALLS"; - } else if (type == AS_TYPE_MO_CS_FALLBACK) { - return "MO_CS_FALLBACK"; - } else { - return "Unknown"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return Error Code - * ----------------------------------------------------------------------------- - */ -const char* rrcErrCode(char code) -{ - if (code == AS_SUCCESS) { - return "SUCCESS"; - } else if (code == AS_TERMINATED_NAS) { - return "TERMINATED_NAS"; - } else if (code == AS_TERMINATED_AS) { - return "TERMINATED_AS"; - } else if (code == AS_FAILURE) { - return "FAILURE"; - } else { - return "Unknown"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return NAS release cause - * ----------------------------------------------------------------------------- - */ -const char* rrcReleaseCause(char cause) -{ - if (cause == AS_AUTHENTICATION_FAILURE) { - return "AUTHENTICATION FAILURE"; - } else if (cause == AS_DETACH) { - return "DETACH"; - } else { - return "Unknown"; - } -} - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.h b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.h deleted file mode 100644 index 2f94f40bb900945c6483a9f8a9ae0e3d664dcb0e..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_data.h +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source as_data.h - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem Access-Stratum data - -Author Frederic Maurel - -Description Defines constants and functions used by the AS simulator - process. - -*****************************************************************************/ - -#ifndef __AS_DATA_H__ -#define __AS_DATA_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* - * Constansts used for MSCGEN (Message Sequence Chart Generator) - */ -#define MSCGEN(args...) fprintf(stderr, ##args); -#define _ue_id "UE" -#define _mme_id "MME" -#define _as_id "AS" - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -const char* getTime(void); - -const char* rrcCause(char cause); -const char* rrcType(char type); -const char* rrcErrCode(char code); -const char* rrcReleaseCause(char cause); - -#endif // __AS_DATA_H__ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.c b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.c deleted file mode 100644 index e3c71fe839c04f5eceb0250af461cf2529688e00..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.c +++ /dev/null @@ -1,1246 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source as_process.c - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem AS message processing - -Author Frederic Maurel - -Description Defines functions executed by the Access-Stratum sublayer - upon receiving AS messages from the Non-Access-Stratum. - -*****************************************************************************/ - -#include "as_process.h" -#include "nas_process.h" - -#include "commonDef.h" -#include "as_data.h" - -#include <sys/types.h> -#include <stdio.h> // snprintf -#include <string.h> // memcpy - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* Message Sequence Chart Generator's buffer */ -#define MSCGEN_BUFFER_SIZE 1024 -static char _mscgen_buffer[MSCGEN_BUFFER_SIZE]; - -/* Tracking area code */ -#define DEFAULT_TAC 0xCAFE // two byte in hexadecimal format - -/* Cell identity */ -#define DEFAULT_CI 0x01020304 // four byte in hexadecimal format - -/* Reference signal received power */ -#define DEFAULT_RSRP 27 - -/* Reference signal received quality */ -#define DEFAULT_RSRQ 55 - -static ssize_t _process_plmn(char* buffer, const plmn_t* plmn, size_t len); -static int _process_dump(char* buffer, int len, const char* msg, int size); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * ============================================================================= - * Functions used to process messages received from the UE NAS process - * ============================================================================= - */ - -/* - * ----------------------------------------------------------------------------- - * Process cell information request message - * ----------------------------------------------------------------------------- - */ -int process_cell_info_req(int msg_id, const cell_info_req_t* req, - cell_info_cnf_t* cnf) -{ - int index = 0; - - printf("INFO\t: %s - Process cell information request\n", __FUNCTION__); - - index += _process_plmn(_mscgen_buffer, &req->plmnID, MSCGEN_BUFFER_SIZE); - snprintf(_mscgen_buffer + index, MSCGEN_BUFFER_SIZE - index, - ", rat = 0x%x%c", req->rat, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- Cell Information Request (0x%.4x)\\n%s --->][%s]\n", - getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id); - - /* Setup cell information confirm message */ - cnf->errCode = AS_SUCCESS; - cnf->tac = DEFAULT_TAC; - cnf->cellID = DEFAULT_CI; - cnf->rat = AS_EUTRAN; - cnf->rsrp = DEFAULT_RSRP; - cnf->rsrq = DEFAULT_RSRQ; - - snprintf(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - "tac = 0x%.4x, cellID = 0x%.8x, rat = 0x%x, RSRQ = %u, RSRP = %u%c", - cnf->tac, cnf->cellID, cnf->rat, cnf->rsrq, cnf->rsrp, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- Cell Information Confirm (0x%.4x)\\n%s --->][%s]\n", - getTime(), _as_id, AS_CELL_INFO_CNF, _mscgen_buffer, _ue_id); - - printf("INFO\t: %s - Send cell informtion confirm\n", __FUNCTION__); - return (AS_CELL_INFO_CNF); -} - -/* - * ----------------------------------------------------------------------------- - * Process NAS signalling connection establishment request message - * ----------------------------------------------------------------------------- - */ -int process_nas_establish_req(int msg_id, const nas_establish_req_t* req, - nas_establish_ind_t* ind, - nas_establish_cnf_t* cnf) -{ - int bytes; - - printf("INFO\t: %s - Process NAS signalling connection establishment " - "request\n", __FUNCTION__); - - // Attach_Request.Pdn_Connectivity_Request.ebi = 5 - //req->initialNasMsg.data[23] = 0x52; // MME DEBUG (Reject Attachment) - // Attach_Request.Pdn_Connectivity_Request.messagetype = WRONG_MESSAGE_TYPE - //req->initialNasMsg.data[25] = 0xc4; // MME DEBUG (Send ESM status) - - snprintf(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - "cause = %s, type = %s, tmsi = {MMEcode = %d, m_tmsi = %u}%c", - rrcCause(req->cause), rrcType(req->type), - req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment Request " - "(0x%.4x)\\n%s --->][%s]\n", - getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id); - - _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)req->initialNasMsg.data, req->initialNasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer); - - /* Process initial NAS message */ - bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)req->initialNasMsg.data, - req->initialNasMsg.length); - - if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " - "Indication (0x%.4x)\\ntac = 0x%.4x\\n%s ---x][%s]\n", getTime(), - _as_id, AS_NAS_ESTABLISH_IND, ind->tac, _mscgen_buffer, _mme_id); - /* Setup NAS signalling connection establishment confirmation message */ - cnf->errCode = AS_TERMINATED_AS; - return (0); - } - - /* Setup NAS signalling connection establishment indication message */ - ind->UEid = 1; // Valid UEid starts at index 1 - ind->tac = DEFAULT_TAC; - - if (req->initialNasMsg.length > 0) { - ind->initialNasMsg.data = (Byte_t*)malloc(req->initialNasMsg.length); - - if (ind->initialNasMsg.data) { - memcpy(ind->initialNasMsg.data, req->initialNasMsg.data, - req->initialNasMsg.length); - ind->initialNasMsg.length = req->initialNasMsg.length; - } - } - - // Attach_Request.messagetype = WRONG_MESSAGE_TYPE - //ind->initialNasMsg.data[1] = 0x47; // MME DEBUG (Send EMM status) - - /* Setup NAS signalling connection establishment confirmation message */ - cnf->errCode = AS_SUCCESS; - // Transmission failure of Attach Request message - //cnf->errCode = AS_FAILURE; // UE DEBUG - - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment Indication " - "(0x%.4x)\\nUEid = %u, tac = 0x%.4x\\n%s --->][%s]\n", getTime(), - _as_id, AS_NAS_ESTABLISH_IND, ind->UEid, ind->tac, _mscgen_buffer, _mme_id); - - printf("INFO\t: %s - Send NAS signalling connection establishment " - "indication\n", __FUNCTION__); - return (AS_NAS_ESTABLISH_IND); -} - -/* - * ----------------------------------------------------------------------------- - * Process Uplink data transfer request message - * ----------------------------------------------------------------------------- - */ -int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req, - ul_info_transfer_ind_t* ind, - ul_info_transfer_cnf_t* cnf) -{ - int bytes; - - printf("INFO\t: %s - Process uplink data transfer request\n", __FUNCTION__); - - // Attach_Complete.Activate_Default_EPS_Bearer_Context_Accept.ebi = UNASSIGNED - //if (req->nasMsg.data[7] == 0x43) { - // req->nasMsg.data[10] = 0x02; // MME DEBUG (Send ESM status) - //} - // Deactivate_EPS_Bearer_Context_Accept.ebi = UNASSIGNED - //if (req->nasMsg.data[8] == 0xCE) { - // req->nasMsg.data[6] = 0x02; // MME DEBUG (Discard ESM message) - //} - - snprintf(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - "tmsi = {MMEcode = %d, m_tmsi = %u}%c", - req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Request " - "(0x%.4x)\\n%s --->][%s]\n", - getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id); - - _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)req->nasMsg.data, req->nasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer); - - /* Process NAS message */ - bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)req->nasMsg.data, - req->nasMsg.length); - - if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Indication " - "(0x%.4x)\\n%s ---x][%s]\n", getTime(), - _as_id, AS_UL_INFO_TRANSFER_IND, _mscgen_buffer, _mme_id); - /* Setup uplink information confirmation message */ - cnf->errCode = AS_TERMINATED_AS; - return (0); - } - - /* Setup uplink information indication message */ - ind->UEid = 1; // Valid UEid starts at index 1 - - if (req->nasMsg.length > 0) { - ind->nasMsg.data = (Byte_t*)malloc(req->nasMsg.length); - - if (ind->nasMsg.data) { - memcpy(ind->nasMsg.data, req->nasMsg.data, req->nasMsg.length); - ind->nasMsg.length = req->nasMsg.length; - } - } - - // Identity-Response.messagetype = WRONG_MESSAGE_TYPE - //if (ind->nasMsg.data[1] == 0x56) { - // ind->nasMsg.data[1] = 0x47; // MME DEBUG (Send EMM status) - //} - // Authentication-Response.messagetype = WRONG_MESSAGE_TYPE - //if (ind->nasMsg.data[1] == 0x53) { - // ind->nasMsg.data[1] = 0x47; // MME DEBUG (Send EMM status) - //} - // Security-Mode-Complete.messagetype = WRONG_MESSAGE_TYPE - //if (ind->nasMsg.data[7] == 0x5e) { - // ind->nasMsg.data[7] = 0x47; // MME DEBUG (Send EMM status) - //} - - /* Setup uplink information confirmation message */ - cnf->UEid = 0; - cnf->errCode = AS_SUCCESS; - // Transmission failure of Attach Complete message - //if (req->nasMsg.data[7] == 0x43) { - // cnf->errCode = AS_FAILURE; // UE DEBUG - //} - - MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Indication " - "(0x%.4x), UEid = %u\\n%s --->][%s]\n", getTime(), - _as_id, AS_UL_INFO_TRANSFER_IND, ind->UEid, _mscgen_buffer, _mme_id); - - printf("INFO\t: %s - Send uplink data transfer indication\n", __FUNCTION__); - return (AS_UL_INFO_TRANSFER_IND); -} - -/* - * ----------------------------------------------------------------------------- - * Process NAS signalling connection release request message - * ----------------------------------------------------------------------------- - */ -int process_nas_release_req(int msg_id, const nas_release_req_t* req) -{ - printf("INFO\t: %s - Process NAS signalling connection release request\n", - __FUNCTION__); - - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Release Request " - "(0x%.4x), tmsi = {MMEcode = %d, m_tmsi = %u}, " - "cause = %s (%u) --->][%s]\n", getTime(), _ue_id, msg_id, - req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, - rrcReleaseCause(req->cause), req->cause, _as_id); - return (AS_NAS_RELEASE_REQ); -} - -/* - * ============================================================================= - * Functions used to process messages received from the MME NAS process - * ============================================================================= - */ - -/* - * ----------------------------------------------------------------------------- - * Process NAS signalling connection establishment response message - * ----------------------------------------------------------------------------- - */ -int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp, - nas_establish_cnf_t* cnf) -{ - int bytes; - - printf("INFO\t: %s - Process NAS signalling connection establishment " - "response\n", __FUNCTION__); - - // Attach_Accept - //if (rsp->nasMsg.data[7] == 0x42) { - // Activate_Default_EPS_Bearer_Context_Request.ebi = UNASSIGNED - //rsp->nasMsg.data[19] = 0x02; // UE DEBUG (Send ESM status) - // Activate_Default_EPS_Bearer_Context_Request.messagetype = WRONG_MESSAGE_TYPE - //rsp->nasMsg.data[21] = 0xc4; // MME DEBUG (Send ESM status) - //} - - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " - "Response (0x%.4x)\\nerrCode = %s, UEid = %u --->][%s]\n", - getTime(), _mme_id, msg_id, - rrcErrCode(rsp->errCode), rsp->UEid, _as_id); - - _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)rsp->nasMsg.data, rsp->nasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer); - - // Discard Attach Accept message - //return (0); // UE DEBUG - - /* Process initial NAS message */ - bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)rsp->nasMsg.data, - rsp->nasMsg.length); - - if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " - "Confirm (0x%.4x)\\n%s ---x][%s]\n", getTime(), - _as_id, AS_NAS_ESTABLISH_CNF, _mscgen_buffer, _ue_id); - return (0); - } - - /* Setup NAS signalling connection establishment confirm message */ - cnf->errCode = rsp->errCode; - - if (rsp->nasMsg.length > 0) { - cnf->nasMsg.data = (Byte_t*)malloc(rsp->nasMsg.length); - - if (cnf->nasMsg.data) { - memcpy(cnf->nasMsg.data, rsp->nasMsg.data, - rsp->nasMsg.length); - cnf->nasMsg.length = rsp->nasMsg.length; - } - } - - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " - "Confirm (0x%.4x)\\n%s --->][%s]\n", getTime(), - _as_id, AS_NAS_ESTABLISH_CNF, _mscgen_buffer, _ue_id); - - printf("INFO\t: %s - Send NAS signalling connection establishment " - "confirm\n", __FUNCTION__); - return (AS_NAS_ESTABLISH_CNF); -} - -/* - * ----------------------------------------------------------------------------- - * Process Downlink data transfer request message - * ----------------------------------------------------------------------------- - */ -int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req, - dl_info_transfer_ind_t* ind, - dl_info_transfer_cnf_t* cnf) -{ - int bytes; - - printf("INFO\t: %s - Process downlink data transfer request\n", - __FUNCTION__); - - // Activate_default_EPS_Bearer_Context_Request.ebi = 6 (already active) - //if (req->nasMsg.data[8] == 0xC1) { - // req->nasMsg.data[6] = 0x52; // UE DEBUG (Accept with same ebi) - //} - // Deactivate_EPS_Bearer_Context_Request.ebi = UNASSIGNED - //if (req->nasMsg.data[8] == 0xCD) { - // req->nasMsg.data[6] = 0x02; // UE DEBUG - //} - - MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Request " - "(0x%.4x), UEid = %u --->][%s]\n", - getTime(), _mme_id, msg_id, req->UEid, _as_id); - - _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)req->nasMsg.data, req->nasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer); - - /* Process NAS message */ - bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE, - (char*)req->nasMsg.data, - req->nasMsg.length); - - if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Indication " - "(0x%.4x)\\n%s ---x][%s]\n", getTime(), - _as_id, AS_DL_INFO_TRANSFER_IND, _mscgen_buffer, _ue_id); - /* Setup downlink information confirmation message */ - cnf->UEid = req->UEid; - cnf->errCode = AS_TERMINATED_AS; - return (0); - } - - /* Setup downlink information indication message */ - if (req->nasMsg.length > 0) { - ind->nasMsg.data = (Byte_t*)malloc(req->nasMsg.length); - - if (ind->nasMsg.data) { - memcpy(ind->nasMsg.data, req->nasMsg.data, req->nasMsg.length); - ind->nasMsg.length = req->nasMsg.length; - } - } - - /* Setup downlink information confirmation message */ - cnf->UEid = req->UEid; - cnf->errCode = AS_SUCCESS; - - //if (req->nasMsg.data[1] == 0x55) { - // Transmission failure of identification request message - // cnf->errCode = AS_FAILURE; // MME DEBUG - // Discard identification request message - // return (0); // MME DEBUG - //} - - MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Indication " - "(0x%.4x)\\n%s --->][%s]\n", getTime(), - _as_id, AS_DL_INFO_TRANSFER_IND, _mscgen_buffer, _ue_id); - - printf("INFO\t: %s - Send downlink data transfer indication\n", __FUNCTION__); - return (AS_DL_INFO_TRANSFER_IND); -} - -/* - * ----------------------------------------------------------------------------- - * Process NAS signalling connection release indication message - * ----------------------------------------------------------------------------- - */ -int process_nas_release_ind(int msg_id, const nas_release_req_t* req, - nas_release_ind_t* ind) -{ - printf("INFO\t: %s - Process NAS signalling connection release request\n", - __FUNCTION__); - - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Release Request " - "(0x%.4x), UEid = %u, cause = %s (%u) --->][%s]\n", - getTime(), _mme_id, msg_id, req->UEid, - rrcReleaseCause(req->cause), req->cause, _as_id); - - /* Forward NAS release indication to the UE */ - ind->cause = req->cause; - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Release Indication " - "(0x%.4x), cause = %s (%u) --->][%s]\n", - getTime(), _as_id, msg_id, rrcReleaseCause(req->cause), - ind->cause, _ue_id); - - printf("INFO\t: %s - Send NAS signalling connection release indication\n", - __FUNCTION__); - return (AS_NAS_RELEASE_IND); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Display PLMN identity - * ----------------------------------------------------------------------------- - */ -static ssize_t _process_plmn(char* buffer, const plmn_t* plmn, size_t len) -{ - int index = 0; - index += snprintf(buffer + index, len - index, "plmnID = %u%u%u%u%u", - plmn->MCCdigit1, plmn->MCCdigit2, plmn->MCCdigit3, - plmn->MNCdigit1, plmn->MNCdigit2); - - if ( (index < len) && (plmn->MNCdigit3 != 0xf) ) { - index += snprintf(buffer + index, len - index, "%u", plmn->MNCdigit3); - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Message dump utility - * ----------------------------------------------------------------------------- - */ -static int _process_dump(char* buffer, int len, const char* msg, int size) -{ - int index = 0; - - for (int i = 0; i < size; i++) { - if ( (i%16) == 0 ) index += snprintf(buffer + index, - len - index, "\\n"); - - index += snprintf(buffer + index, len - index, - " %.2hx", (unsigned char)(msg[i])); - } - - buffer[index] = '\0'; - return (index); -} - -/* - 04 01 04 10 00 00 0f 00 00 00 01 00 00 00 20 8f - 10 00 22 00 00 00 07 41 71 0b f6 02 f8 01 01 02 - 0f 00 00 00 01 05 80 80 00 00 00 00 04 02 01 d0 - 31 52 02 f8 01 00 01 e0 -*/ -/* - U16 msgID = [04 01] - AS_NAS_ESTABLISH_REQ - U8 cause = [04] - NET_ESTABLISH_CAUSE_MO_SIGNAL - U8 type = [10] - NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - plmn_t plmnID = [20 8f 10] - Byte_t MCCdigit2:4 = [0] - Byte_t MCCdigit1:4 = [2] - Byte_t MNCdigit3:4 = [f] - Byte_t MCCdigit3:4 = [8] - Byte_t MNCdigit2:4 = [0] - Byte_t MNCdigit1:4 = [1] - - U32 Length = [22 00 00 00] (34 octets) - U8* initialNasMsg = [07 41 71 0b f6 02 f8 01 01 02 0f 00 00 00 01 05] - [80 80 00 00 00 00 04 02 01 d0 31 52 02 f8 01 00] - [01 e0] - - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [41] - Attach Request - - U8:4 NAS KSI = [7] - No key available - U8:4 Attach Type = [1] - EPS Mobile Identity = [0b f6 02 f8 01 01 02 0f 00 00 00 01] - Length = [0b] (11 bytes) - U8:4 = 1111 = [f] - U8:1 oddeven = 0 - U8:3 typeofidentity = 110 = [6] - GUTI - U8:4 mccdigit2 = [0] - U8:4 mccdigit1 = [2] - U8:4 mncdigit3 = [f] - U8:4 mccdigit3 = [8] - U8:4 mncdigit2 = [0] - U8:4 mncdigit1 = [1] - U16 mmegroupid = [01 02] - U8 mmecode = [0f] - U32 mtmsi = [00 00 00 01] - UE network capability = [05 80 80 00 00 00] - Length = [05] (5 bytes) - U8 eea = [80] - EEA0 - U8 eia = [80] - EIA0 - U8 uea = [00] - U8:1 ucs2 = 0 - U8:7 uia = 0000000 = [00] - U8:3 spare = 000 - U8:1 csfb = 0 - U8:1 lpp = 0 - U8:1 lcs = 0 - U8:1 srvcc = 0 - U8:1 nf = 0 = [00] - - ESM message container = [00 04 02 01 d0 31] - Length = [00 04] (4 bytes) - ESM message = [02 01 d0 31] - U8:4 EPS bearer identity = [0] - Not assigned - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [01] - U8 ESM message identifier = [d0] - PDN Connectivity Request - U8:4 Pdn type = [3] - IPv4v6 - U8:4 Request type = [1] - Initial request - - Last TAI = [52 02 f8 01 00 01] - PLMN = 20810, TAC = 00 01 - Old GUTI type = [e0] - Native GUTI -*/ - -/* - 07 04 00 00 00 00 03 00 00 00 07 44 03 -*/ -/* - U16 msgID = [07 04] - AS_DL_INFO_TRANSFER_IND - U32 UEid = [00 00 00 00] - - U32 Length = [03 00 00 00] (3 octets) - U8* NasMsg = [07 44 03] - - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [44] - Attach Reject - - U8 EMM cause code = [03] - EMM_CAUSE_ILLEGAL_UE -*/ - -/* - 07 04 00 00 00 00 10 00 00 00 27 ab ab ab ab 00 - 07 44 13 78 00 04 02 01 d1 1f -*/ -/* - U16 msgID = [07 04] - AS_DL_INFO_TRANSFER_IND - U32 UEid = [00 00 00 00] - - U32 Length = [10 00 00 00] (16 octets) - U8* NasMsg = [27 ab ab ab ab 00 07 44 13 78 00 04 02 01 d1 1f] - - U8:4 Security header type = [2] - Integrity protected and cyphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - 0 - - NAS message = [07 44 13 78 00 04 02 d1 1f] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [44] - Attach Reject - - U8 EMM cause code = [13] - #19 ESM failure - - ESM message container = [00 04 02 01 d1 1f] - U16 Length = [00 04] (4 octets) - U8* EsmMsg = [02 01 d1 1f] - U8:4 EPS bearer identity = [0] - Not assigned - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [01] - U8 ESM message identifier = [d1] - PDN Connectivity Reject - - U8 ESM cause code = [1f] - REQUEST_REJECTED_UNSPECIFIED -*/ - -/* - 04 08 01 00 00 00 46 00 00 00 27 ab ab ab ab 00 - 07 42 01 e0 06 24 02 f8 01 00 01 00 26 52 01 c1 - 05 03 48 87 40 78 0e 77 77 77 2e 65 75 72 65 63 - 6f 6d 2e 66 72 0d 03 c0 a8 02 3c 02 21 70 ff c0 - a8 02 3c 50 0b f6 02 f8 01 01 02 0f 00 00 00 01 -*/ -/* - U16 msgID = [04 08] - AS_NAS_ESTABLISH_CNF - U8 errCode = [01] - SUCCESS - - U32 Length = [00 00 00 46] (70 octets) - U8* NasMsg = [27 ab ab ab ab 00 07 42 01 e0 06 24 02 f8 01 00] - [01 00 26 52 01 c1 05 03 48 87 40 78 0e 77 77 77] - [2e 65 75 72 65 63 6f 6d 2e 66 72 0d 03 c0 a8 02] - [3c 02 21 70 ff c0 a8 02 3c 50 0b f6 02 f8 01 01] - [02 0f 00 00 00 01] - - U8:4 Security header type = [2] - Integrity protected and cyphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - 0 - - NAS message = [07 42 01 e0 06 24 02 f8 01 00 01 00 26 52 01 c1] - [05 03 48 87 40 78 0e 77 77 77 2e 65 75 72 65 63] - [6f 6d 2e 66 72 0d 03 c0 a8 02 3c 02 21 70 ff c0] - [a8 02 3c 50 0b f6 02 f8 01 01 02 0f 00 00 00 01] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [42] - Attach Accept - - U8:4 Spare = [0] - U8:4 EPS attach result = [1] - EPS - U8:3 T3412 unit = 111 - Deactivated - U8:5 T3412 value = 00000 - - TAI list = [06 24 02 f8 01 00 01] - Length = [06] - U8:1 spare = 0 - U8:2 Type of list = 01 - list of TACs belonging to one PLMN, - with consecutive TAC values - U8:5 Number of elements = 0 0100 - 4 consecutive TACs - TAI = [02 f8 01 00 01] - PLMN = 20810, TAC = 00 01 - - ESM message container = [00 26 52 01 c1 05 03 48 87 40 78 0e 77 77 77 2e] - [65 75 72 65 63 6f 6d 2e 66 72 0d 03 c0 a8 02 3c] - [02 21 70 ff c0 a8 02 3c] - U16 Length = [00 26] (38 octets) - U8:4 EPS bearer identity = [5] - ebi = 5 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [01] - U8 ESM message identifier = [c1] - Activate Default EPS Bearer Context Request - - EPS Qos = [05 03 48 87 40 78] - Length = [05] - 5 octets - QCI = [03] - 3 - Maximum bit rate for uplink = [48] - 128K - Maximum bit rate for downlink = [87] - 1024K - Guaranteed bit rate for uplink = [40] - 64K - Guaranteed bit rate for downlink = [78] - 512K - - Access point name = [0e 77 77 77 2e 65 75 72 65 63 6f 6d 2e 66 72] - Length = [0e] - 14 octets - APN = "www.eurecom.fr" - - PDN address = [0d 03 c0 a8 02 3c 02 21 70 ff c0 a8 02 3c] - Length = [0d] - 13 octets - U8:5 Spare = 00000 - 0 - U8:3 Pdn type = 011 - IPv4v6 - PDN address information = [c0 a8 02 3c 02 21 70 ff c0 a8 02 3c] -*/ - -/* - 06 01 00 00 00 00 0f 00 00 00 01 00 00 00 0d 00 - 00 00 27 ab ab ab ab 00 07 43 00 03 52 00 c2 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 0d] (13 octets) - U8* NasMsg = [27 ab ab ab ab 00 07 43 00 03 52 00 c2] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [07 43 00 03 52 00 c2] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [43] - Attach Complete - - ESM message container = [00 03 52 00 c2] - Length = [00 03] (3 bytes) - ESM message = [52 00 c2] - U8:4 EPS bearer identity = [5] - ebi = 5 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [00] - unassigned - U8 ESM message identifier = [c2] - Activate Default EPS Bearer Context Accept -*/ - -/* - 07 04 00 00 00 00 03 00 00 00 07 55 10 -*/ -/* - U16 msgID = [07 04] - AS_DL_INFO_TRANSFER_IND - U32 UEid = [00 00 00 00] - - U32 Length = [03 00 00 00] (3 octets) - U8* NasMsg = [07 55 10] - - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [55] - Identity Request - - U8:4 Identity type = [1] - IMSI - U8:4 spare = [0] -*/ - -/* - 06 01 00 00 00 00 0f 00 00 00 01 00 00 00 0b 00 - 00 00 07 56 08 21 80 01 0f 00 10 32 f4 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 0b] (11 octets) - U8* NasMsg = [07 56 08 21 80 01 0f 00 10 32 f4] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [56] - Identity Response - - Mobile identity = [08 21 80 01 0f 00 10 32 f4] - Length = [08] - 8 octets - U8:4 Identity digit 1 = [2] - 2 - U8:1 odd/even indicator = [0] - even number of identity digits - U8:3 Type of identity = [001] - IMSI - U8:4 Identity digit 3 = [8] - 8 - U8:4 Identity digit 2 = [0] - 0 - U8:4 Identity digit 5 = [0] - 0 - U8:4 Identity digit 4 = [1] - 1 - U8:4 Identity digit 7 = [0] - 0 - U8:4 Identity digit 6 = [f] - f - U8:4 Identity digit 9 = [0] - 0 - U8:4 Identity digit 8 = [0] - 0 - U8:4 Identity digit 11 = [1] - 1 - U8:4 Identity digit 10 = [0] - 0 - U8:4 Identity digit 13 = [3] - 3 - U8:4 Identity digit 12 = [2] - 2 - U8:4 Identity digit 15 = [f] - f - U8:4 Identity digit 16 = [4] - 4 - -IMSI = 20810f00001234f (2081000001234) -*/ - -/* - 07 04 00 00 00 00 24 00 00 00 07 52 00 00 00 00 - 00 00 00 00 00 00 00 00 00 01 02 03 04 10 00 00 - 00 00 00 00 80 05 04 03 02 00 00 00 00 00 -*/ -/* - U16 msgID = [07 04] - AS_DL_INFO_TRANSFER_IND - U32 UEid = [00 00 00 00] - - U32 Length = [24 00 00 00] (36 octets) - U8* NasMsg = [07 52 00 00 00 00 00 00 00 00 00 00 00 00 00 01] - [02 03 04 10 00 00 00 00 00 00 80 05 04 03 02 00] - [00 00 00 00] - - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [52] - Authentication Request - - U8:4 NAS key set identifier = [0] - 000 - U8:4 spare = [0] - RAND = [00 00 00 00 00 00 00 00 00 00 00 00 01 02 03 04] - AUTHN Length = [10] - 16 octets - AUTHN = [00 00 00 00 00 00 80 05 04 03 02 00 00 00 00 00] -*/ - -/* - 06 01 00 00 00 00 0f 00 00 00 01 00 00 00 13 00 - 00 00 07 53 10 67 70 3a 31 f2 2a 2d 51 00 00 00 - 00 00 00 00 00 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 13] (19 octets) - U8* NasMsg = [07 53 10 67 70 3a 31 f2 2a 2d 51 00 00 00 00 00 00 00 00] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [53] - Authentication Response - - RES Length = [10] - 16 octets - RES = [67 70 3a 31 f2 2a 2d 51 00 00 00 00 00 00 00 00] -*/ - -/* - 07 04 00 00 00 00 10 00 00 00 37 ab ab ab ab 00 - 07 5d 00 00 05 80 80 00 00 00 -*/ -/* - U16 msgID = [07 04] - AS_DL_INFO_TRANSFER_IND - U32 UEid = [00 00 00 00] - - U32 Length = [10 00 00 00] (16 octets) - U8* NasMsg = [37 ab ab ab ab 00 07 5d 00 00 05 80 80 00 00 00] - - U8:4 Security header type = [3] - Integrity protected with - new EPS security context - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - 0 - - NAS message = [07 5d 00 00 05 80 80 00 00 00] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [5d] - Security Mode Command - - U8 Selected NAS security algorithms = [00] - U8:4 Spare half octet = [0] - U8:4 NAS key set identifier = [0] - Replayed UE security capabilities = [05 80 80 00 00 00] - U8 EEA = [80] - EEA0 - U8 EIA = [80] - EIA0 - U8 UEA = [00] - U8 UIA = [00] - U8 GEA = [00] -*/ - -/* - 06 01 00 00 00 00 0f 00 00 00 01 00 00 00 08 00 - 00 00 47 ab ab ab ab 00 07 5e -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 08] (8 octets) - U8* NasMsg = [47 ab ab ab ab 00 07 5e] - - U8:4 Security header type = [4] - Integrity protected and ciphered with - new EPS security context - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [07 5e] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [5e] - Security Mode Complete -*/ - -/* - 06 01 00 00 00 00 0f 00 00 00 01 00 00 00 09 00 - 00 00 27 ab ab ab ab 00 07 5f 18 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 09] (9 octets) - U8* NasMsg = [27 ab ab ab ab 00 07 5f 18] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [07 5f 18] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [5f] - Security Mode Reject - - U8 EMM cause code = [18] - EMM_CAUSE_SECURITY_MODE_REJECTED -*/ - -/* - 07 01 00 00 00 00 00 00 00 00 00 00 00 00 04 00 - 00 00 52 00 e8 6f -*/ -/* - U16 msgID = [07 01] - AS_DL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [00] - !!! - U32 m_tmsi = [00 00 00 00] - !!! - - U32 Length = [00 00 00 04] (4 octets) - NAS message = [52 00 e8 6f] - - U8:4 EPS bearer identity = [5] - ebi = 5 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [00] - unassigned - U8 ESM message identifier = [e8] - ESM Status - - U8 ESM cause code = [6f] - #111 PROTOCOL_ERROR -*/ - -/* - 06 01 00 00 00 00 12 00 00 00 01 00 00 00 0a 00 - 00 00 27 ab ab ab ab 00 02 01 e8 2b -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [12] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 0a] (10 octets) - U8* NasMsg = [27 ab ab ab ab 00 02 01 e8 2b] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [02 01 e8 2b] - U8:4 EPS bearer identity = [0] - Not assigned - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [01] - U8 ESM message identifier = [e8] - ESM Status - - U8 ESM cause code = [2b] - #43 INVALID_EPS_BEARER_IDENTITY -*/ - -/* - 06 01 00 00 00 00 12 00 00 00 01 00 00 00 0a 00 - 00 00 27 ab ab ab ab 00 02 03 d2 06 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [12] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 0a] (10 octets) - U8* NasMsg = [27 ab ab ab ab 00 02 03 d2 06] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [02 03 d2 06] - U8:4 EPS bearer identity = [0] - Not assigned - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [03] - U8 ESM message identifier = [d2] - PDN Disconnect Request - - U8:4 Spare half octet = [0] - U8:4 Linked EPS bearer identity = [6] - ebi = 6 -*/ - -/* - 06 08 00 00 00 00 01 00 00 00 -*/ -/* - U16 msgID = [06 08] - AS_UL_INFO_TRANSFER_CNF - U32 UEid = [00 00 00 00] - U8 errCode = [01] - SUCCESS -*/ - -/* - 06 01 00 00 00 00 12 00 00 00 01 00 00 00 09 00 - 00 00 27 ab ab ab ab 00 82 00 ce -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [12] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 09] (9 octets) - U8* NasMsg = [27 ab ab ab ab 00 82 00 ce] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [82 00 ce] - U8:4 EPS bearer identity = [8] - 8 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [00] - U8 ESM message identifier = [ce] - Deactivate EPS Bearer Context Accept -*/ - -/* - 07 01 01 00 00 00 00 00 00 00 00 00 00 00 0a 00 - 00 00 27 ab ab ab ab 00 62 02 cd 24 -*/ -/* - U16 msgID = [07 01] - AS_DL_INFO_TRANSFER_REQ - U32 UEid = [01 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [00] - U32 m_tmsi = [00 00 00 00] - - U32 Length = [00 00 00 0a] (10 octets) - NAS message = [27 ab ab ab ab 00 62 02 cd 24] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [62 02 cd 24] - U8:4 EPS bearer identity = [6] - ebi = 6 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [02] - U8 ESM message identifier = [cd] - Deactivate EPS Bearer Context Request - - U8 ESM cause code = [24] - #36 REGULAR_DEACTIVATION -*/ - -/* - 04 08 01 00 00 00 00 00 00 00 -*/ -/* - U16 msgID = [04 08] - AS_NAS_ESTABLISH_CNF - U8 errCode = [01] - SUCCESS - U32 Length = [00 00 00 00] (0 octets) -*/ - - -/* - 07 01 01 00 00 00 00 00 00 00 00 00 00 00 0e 00 - 00 00 27 ab ab ab ab 00 72 00 c5 06 01 02 01 00 -*/ -/* - U16 msgID = [07 01] - AS_DL_INFO_TRANSFER_REQ - U32 UEid = [01 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [00] - U32 m_tmsi = [00 00 00 00] - - U32 Length = [00 00 00 0e] (14 octets) - NAS message = [27 ab ab ab ab 00 72 00 c5 06 01 02 01 00] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [72 00 c5 06 00 00 00 00] - U8:4 EPS bearer identity = [7] - ebi = 7 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity - Unassigned - U8 ESM message identifier = [c5] - Activate dedicated EPS Bearer Context Request - - U8:4 Spare half octet = [0] - U8:4 Linked EPS bearer identity = [6] - U8 QoS length = [01] - U8 QCI = [02] - U8 TFT length = [01] - U8 TFT = [00] -*/ - -/* - 07 04 00 00 00 00 36 00 00 00 27 ab ab ab ab 00 - 72 00 c5 06 01 02 29 22 11 02 11 10 c0 a8 0c 01 - ff ff ff 00 30 11 40 27 11 50 2e e1 22 03 11 10 - c0 a8 0c 01 ff ff ff 00 30 11 40 27 12 50 2e e2 -*/ -/* - U16 msgID = [07 04] - AS_DL_INFO_TRANSFER_IND - U32 UEid = [00 00 00 00] - - U32 Length = [36 00 00 00] (54 octets) - U8* NasMsg = [27 ab ab ab ab 00 72 00 c5 06 01 02 29 22 11 02] - [11 10 c0 a8 0c 01 ff ff ff 00 30 11 40 27 11 50] - [2e e1 22 03 11 10 c0 a8 0c 01 ff ff ff 00 30 11] - [40 27 12 50 2e e2] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - 0 - - NAS message = [72 00 c5 06 01 02 29 22 11 02 11 10 c0 a8 0c 01] - [ff ff ff 00 30 11 40 27 11 50 2e e1 22 03 11 10] - [c0 a8 0c 01 ff ff ff 00 30 11 40 27 12 50 2e e2] - U8:4 EPS bearer identity = [7] - ebi = 7 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity - Unassigned - U8 ESM message identifier = [c5] - Activate dedicated EPS Bearer Context Request - - U8:4 Spare half octet = [0] - U8:4 Linked EPS bearer identity = [6] - U8 QoS length = [01] - 1 octet - U8 QCI = [02] - U8 TFT length = [29] - 41 octets - U8 TFT = [22 11 02 11 10 c0 a8 0c 01 ff ff ff 00 30 11 40] - [27 11 50 2e e1 22 03 11 10 c0 a8 0c 01 ff ff ff] - [00 30 11 40 27 12 50 2e e2] -*/ - -/* - 06 01 00 00 00 00 12 00 00 00 01 00 00 00 0a 00 - 00 00 27 ab ab ab ab 00 72 00 c7 2d -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [12] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 0a] (10 octets) - U8* NasMsg = [27 ab ab ab ab 00 72 00 c7 2d] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [72 00 c7 2d] - U8:4 EPS bearer identity = [7] - 7 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [00] - U8 ESM message identifier = [c7] - Activate Dedicated EPS Bearer Context - Reject - - U8 ESM cause code = [2d] - SYNTACTICAL_ERROR_IN_PACKET_FILTER -*/ - -/* - 06 01 00 00 00 00 12 00 00 00 01 00 00 00 09 00 - 00 00 27 ab ab ab ab 00 72 00 c6 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [12] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 09] (9 octets) - U8* NasMsg = [27 ab ab ab ab 00 72 00 c6] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [72 00 c6] - U8:4 EPS bearer identity = [7] - 7 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [00] - U8 ESM message identifier = [c6] - Activate Dedicated EPS Bearer Context - Accept -*/ - -/* - 06 01 00 00 00 00 12 00 00 00 01 00 00 00 15 00 - 00 00 27 ab ab ab ab 00 07 45 01 0b f6 02 f8 01 - 01 02 12 00 00 00 01 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - U32 UEid = [00 00 00 00] - as_stmsi_t s_tmsi - U8 MMEcode = [12] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 15] (21 octets) - U8* NasMsg = [27 ab ab ab ab 00 07 45 01 0b f6 02 f8 01 01 02] - [12 00 00 00 01] - - U8:4 Security header type = [2] - Integrity protected and ciphered - U8:4 Protocol discriminator = [7] - EMM message - U32 Message authentication code = [ab ab ab ab] - U8 Sequence number = [00] - Uplink counter value - - NAS message = [07 45 01 0b f6 02 f8 01 01 02 12 00 00 00 01] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [45] - Detach Request - - U8:4 NAS key set identifier = [0] - Native 0 - U8:4 Detach type = [1] - EPS Detach - - Mobile identity = [0b f6 02 f8 01 01 02 12 00 00 00 01] - Length = [0b] - 11 octets - U8:4 = 1111 = [f] - U8:1 odd/even indicator = [0] - even number of identity digits - U8:3 Type of identity = [110] - GUTI - plmn = [02 f8 01] - 20810 - U16 mmegroupid = [01 02] - U8 mmecode = [12] - U32 mtmsi = [00 00 00 01] -*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.h b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.h deleted file mode 100644 index 4791118cd842edc63b9ade48d85a5aeb995cd0f5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_process.h +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source as_process.h - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem AS message processing - -Author Frederic Maurel - -Description Defines functions executed by the Access-Stratum sublayer - upon receiving AS messages from the Non-Access-Stratum. - -*****************************************************************************/ - -#ifndef __AS_PROCESS_H__ -#define __AS_PROCESS_H__ - -#include "as_message.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Functions used to process messages received from the UE NAS process - * ----------------------------------------------------------------------------- - */ - -int process_cell_info_req(int msg_id, const cell_info_req_t* req, - cell_info_cnf_t* cnf); -int process_nas_establish_req(int msg_id, const nas_establish_req_t* req, - nas_establish_ind_t* ind, nas_establish_cnf_t* cnf); -int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req, - ul_info_transfer_ind_t* ind, ul_info_transfer_cnf_t* cnf); -int process_nas_release_req(int msg_id, const nas_release_req_t* req); - -/* - * ----------------------------------------------------------------------------- - * Functions used to process messages received from the MME NAS process - * ----------------------------------------------------------------------------- - */ - -int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp, - nas_establish_cnf_t* cnf); -int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req, - dl_info_transfer_ind_t* ind, dl_info_transfer_cnf_t* cnf); -int process_nas_release_ind(int msg_id, const nas_release_req_t* req, - nas_release_ind_t* ind); - -#endif /* __AS_PROCESS_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator.c b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator.c deleted file mode 100644 index 39139e11dfbcc925a8ac6f3250802d59d7b775fd..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator.c +++ /dev/null @@ -1,653 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source as_simulator.c - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem Main process - -Author Frederic Maurel - -Description Implements the Access-Stratum simulator operating between - the Non-Access-Stratum running in the UE at the user side - and the Non-Access-Stratum running in the MME at the network - side for testing purpose. - -*****************************************************************************/ - -#include "as_simulator_parser.h" - -#include "as_data.h" -#include "as_process.h" - -#include "commonDef.h" -#include "socket.h" - -#include "nas_log.h" - -#include <stdio.h> // printf, perror, snprintf -#include <errno.h> // errno -#include <netdb.h> // gai_strerror -#include <stdlib.h> // exit -#include <string.h> // memset -#include <poll.h> // poll -#include <signal.h> // sigaction -#include <pthread.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#define SLEEP_TIMEOUT 1000 /* 1 second */ - -#define AS_SIMULATOR_NO_TRANSFER (0) -#define AS_SIMULATOR_TRANSFER_TO_UE (1 << 0) -#define AS_SIMULATOR_TRANSFER_TO_MME (1 << 1) - -/* - * Direction of the message to be transfered to the UE NAS process - */ -static UInt8_t _as_simulator_ue_transfer = AS_SIMULATOR_NO_TRANSFER; - -/* - * Direction of the message to be transfered to the MME NAS process - */ -static UInt8_t _as_simulator_mme_transfer = AS_SIMULATOR_NO_TRANSFER; - -/* - * Size of the message to be transfered to the UE NAS process - */ -static int _as_simulator_ue_size = 0; - -/* - * Size of the message to be transfered to the MME NAS process - */ -static int _as_simulator_mme_size = 0; - -/* - * String buffer used to send/receive messages to/from the UE NAS process - */ -#define AS_SIMULATOR_UE_BUFFER_SIZE 1024 -static char _as_simulator_ue_buffer [AS_SIMULATOR_UE_BUFFER_SIZE]; - -/* - * String buffer used to send/receive messages to/from the MME NAS process - */ -#define AS_SIMULATOR_MME_BUFFER_SIZE 1024 -static char _as_simulator_mme_buffer [AS_SIMULATOR_MME_BUFFER_SIZE]; - -/* - * The connection endpoint used for communication with the UE NAS process - */ -static socket_id_t * _as_simulator_ue_sid = NULL; - -/* - * The connection endpoint used for communication with the MME NAS process - */ -static socket_id_t * _as_simulator_mme_sid = NULL; - -/* - * UE NAS process connection manager's running indicator - */ -static int _as_simulator_ue_is_running = FALSE; - -/* - * MME NAS process connection manager's running indicator - */ -static int _as_simulator_mme_is_running = FALSE; - -static int _set_signal_handler(int signal, void (handler)(int)); -static void _signal_handler(int signal_number); - -static void* _as_simulator_ue_mngr(void*); -static void* _as_simulator_mme_mngr(void*); - -static int _as_simulator_ue_process(int msg_id, as_message_t* msg); -static int _as_simulator_mme_process(int msg_id, as_message_t* msg); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * RRC simulator main process - * ----------------------------------------------------------------------------- - */ -int main (int argc, const char* argv[]) -{ - /* - * Get the command line options - */ - if ( as_simulator_parser_get_options(argc, argv) != RETURNok ) { - as_simulator_parser_print_usage(); - exit(EXIT_FAILURE); - } - - const char* uhost = as_simulator_parser_get_uhost(); - const char* uport = as_simulator_parser_get_uport(); - const char* mhost = as_simulator_parser_get_mhost(); - const char* mport = as_simulator_parser_get_mport(); - - nas_log_init(0x2f); - - /* - * Initialize the communication channel to the UE NAS process - */ - _as_simulator_ue_sid = socket_udp_open(SOCKET_SERVER, uhost, uport); - - if (_as_simulator_ue_sid == NULL) { - const char* error = ( (errno < 0) ? - gai_strerror(errno) : strerror(errno) ); - printf("ERROR\t: socket_udp_open() failed: %s\n", error); - exit(EXIT_FAILURE); - } - - printf("INFO\t: %s - The RRC Simulator is now connected to %s/%s (%d)\n", - __FUNCTION__, uhost, uport, socket_get_fd(_as_simulator_ue_sid)); - - /* - * Initialize the communication channel to the MME NAS process - */ - _as_simulator_mme_sid = socket_udp_open(SOCKET_CLIENT, mhost, mport); - - if (_as_simulator_mme_sid == NULL) { - const char* error = ( (errno < 0) ? - gai_strerror(errno) : strerror(errno) ); - printf("ERROR\t: socket_udp_open() failed: %s\n", error); - socket_close(_as_simulator_ue_sid); - exit(EXIT_FAILURE); - } - - printf("INFO\t: %s - The RRC Simulator is now connected to %s/%s (%d)\n", - __FUNCTION__, mhost, mport, socket_get_fd(_as_simulator_mme_sid)); - - MSCGEN("[MSC_NEW][%s][AS=%s]\n", getTime(), _as_id); - - /* - * Set up signal handler - */ - (void) _set_signal_handler(SIGINT, _signal_handler); - (void) _set_signal_handler(SIGTERM, _signal_handler); - - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - /* - * Start thread use to manage the connection endpoint with the - * UE NAS process - */ - pthread_t ue_mngr; - - if ( pthread_create (&ue_mngr, &attr, _as_simulator_ue_mngr, NULL) != 0 ) { - perror("ERROR\t: Failed to create the UE management thread\n"); - socket_close(_as_simulator_ue_sid); - socket_close(_as_simulator_mme_sid); - exit(EXIT_FAILURE); - } - - /* - * Start thread use to manage the connection endpoint with the - * MME NAS process - */ - pthread_t mme_mngr; - - if ( pthread_create (&mme_mngr, &attr, _as_simulator_mme_mngr, NULL) != 0 ) { - perror("ERROR\t: Failed to create the MME management thread\n"); - socket_close(_as_simulator_ue_sid); - socket_close(_as_simulator_mme_sid); - exit(EXIT_FAILURE); - } - - pthread_attr_destroy(&attr); - - /* - * Suspend execution of the main process until connection - * managers are running - */ - poll(NULL, 0, SLEEP_TIMEOUT); - - while (_as_simulator_ue_is_running && _as_simulator_mme_is_running) { - poll(NULL, 0, SLEEP_TIMEOUT); - } - - /* - * Termination cleanup - */ - printf("INFO\t: %s - Closing UE's connection endpoint %d\n", - __FUNCTION__, socket_get_fd(_as_simulator_ue_sid)); - socket_close(_as_simulator_ue_sid); - printf("INFO\t: %s - Closing MME's connection endpoint %d\n", - __FUNCTION__, socket_get_fd(_as_simulator_mme_sid)); - socket_close(_as_simulator_mme_sid); - - printf("INFO\t: %s - RRC simulator exited\n", __FUNCTION__); - exit(EXIT_SUCCESS); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Signal handler setup function - * ----------------------------------------------------------------------------- - */ -static int _set_signal_handler(int signal, void (handler)(int)) -{ - struct sigaction act; - - /* Initialize signal set */ - (void) memset (&act, 0, sizeof (act)); - (void) sigfillset (&act.sa_mask); - (void) sigdelset (&act.sa_mask, SIGHUP); - (void) sigdelset (&act.sa_mask, SIGINT); - (void) sigdelset (&act.sa_mask, SIGTERM); - (void) sigdelset (&act.sa_mask, SIGILL); - (void) sigdelset (&act.sa_mask, SIGTRAP); - (void) sigdelset (&act.sa_mask, SIGIOT); -#ifndef LINUX - (void) sigdelset (&act.sa_mask, SIGEMT); -#endif - (void) sigdelset (&act.sa_mask, SIGFPE); - (void) sigdelset (&act.sa_mask, SIGBUS); - (void) sigdelset (&act.sa_mask, SIGSEGV); - (void) sigdelset (&act.sa_mask, SIGSYS); - - /* Initialize signal handler */ - act.sa_handler = handler; - - if ( sigaction (signal, &act, 0) < 0 ) { - return RETURNerror; - } - - return RETURNok; -} - -/* - * ----------------------------------------------------------------------------- - * Signal handler - * ----------------------------------------------------------------------------- - */ -static void _signal_handler(int signal_number) -{ - printf("\nWARNING\t: %s - Signal %d received\n", __FUNCTION__, - signal_number); - _as_simulator_ue_is_running = FALSE; - _as_simulator_mme_is_running = FALSE; -} - -/* - * ----------------------------------------------------------------------------- - * UE connection manager - * ----------------------------------------------------------------------------- - */ -static void* _as_simulator_ue_mngr(void* args) -{ - int msg_id; - as_message_t msg; - - _as_simulator_ue_is_running = TRUE; - - printf("INFO\t: %s - UE connection manager started\n", __FUNCTION__); - - MSCGEN("[MSC_NEW][%s][NAS-UE=%s]\n", getTime(), _ue_id); - - /* Receiving loop */ - while (_as_simulator_ue_is_running) { - int rc, rbytes, sbytes; - - /* Receive message from the UE NAS process */ - rbytes = socket_recv(_as_simulator_ue_sid, _as_simulator_ue_buffer, - AS_SIMULATOR_UE_BUFFER_SIZE); - - if (rbytes == RETURNerror) { - perror("ERROR\t: socket_recv() failed"); - break; - } - - /* Decode the received message */ - msg_id = as_message_decode(_as_simulator_ue_buffer, &msg, rbytes); - - if (msg_id == RETURNerror) { - printf("WARNING\t: %s - Failed to decode AS message\n", - __FUNCTION__); - continue; - } - - /* Reset the size of the message to be transfered */ - _as_simulator_ue_size = 0; - _as_simulator_mme_size = 0; - - /* Process the received message */ - rc = _as_simulator_ue_process(msg_id, &msg); - - if (rc != RETURNok) { - printf("WARNING\t: %s - Failed to process AS message (0x%x)\n", - __FUNCTION__, msg_id); - continue; - } - - if (_as_simulator_ue_size > 0) { - /* Return the response message to the UE NAS process */ - sbytes = socket_send(_as_simulator_ue_sid, - _as_simulator_ue_buffer, - _as_simulator_ue_size); - - if (sbytes == RETURNerror) { - perror("ERROR\t: socket_send() failed"); - break; - } - } - - if (_as_simulator_mme_size > 0) { - /* Forward the received message to the MME NAS process */ - sbytes = socket_send(_as_simulator_mme_sid, - _as_simulator_mme_buffer, - _as_simulator_mme_size); - - if (sbytes == RETURNerror) { - perror("ERROR\t: socket_send() failed"); - break; - } - } - } - - /* Close the connection to the network sublayer */ - _as_simulator_ue_is_running = FALSE; - printf("ERROR\t: The UE connection manager exited\n"); - return (NULL); -} - -/* - * ----------------------------------------------------------------------------- - * MME connection manager - * ----------------------------------------------------------------------------- - */ -static void* _as_simulator_mme_mngr(void* args) -{ - int msg_id; - as_message_t msg; - - _as_simulator_mme_is_running = TRUE; - - printf("INFO\t: %s - MME connection manager started\n", __FUNCTION__); - - MSCGEN("[MSC_NEW][%s][NAS-MME=%s]\n", getTime(), _mme_id); - - /* Receiving loop */ - while (_as_simulator_mme_is_running) { - int rc, rbytes, sbytes; - - /* Receive message from the MME NAS process */ - rbytes = socket_recv(_as_simulator_mme_sid, _as_simulator_mme_buffer, - AS_SIMULATOR_MME_BUFFER_SIZE); - - if (rbytes == RETURNerror) { - perror("ERROR\t: socket_recv() failed"); - break; - } - - /* Decode the received message */ - msg_id = as_message_decode(_as_simulator_mme_buffer, &msg, rbytes); - - if (msg_id == RETURNerror) { - printf("ERROR\t: %s - as_message_decode() failed\n", __FUNCTION__); - continue; - } - - /* Reset the size of the message to be transfered */ - _as_simulator_ue_size = 0; - _as_simulator_mme_size = 0; - - /* Process the received message */ - rc = _as_simulator_mme_process(msg_id, &msg); - - if (rc != RETURNok) { - printf("WARNING\t: %s - Failed to process AS message (0x%x)\n", - __FUNCTION__, msg_id); - continue; - } - - if (_as_simulator_mme_size > 0) { - /* Return the response message to the MME NAS process */ - sbytes = socket_send(_as_simulator_mme_sid, - _as_simulator_mme_buffer, - _as_simulator_mme_size); - - if (sbytes == RETURNerror) { - perror("ERROR\t: socket_send() failed"); - break; - } - } - - if (_as_simulator_ue_size > 0) { - /* Forward the received message to the UE NAS process */ - sbytes = socket_send(_as_simulator_ue_sid, - _as_simulator_ue_buffer, - _as_simulator_ue_size); - - if (sbytes == RETURNerror) { - perror("ERROR\t: socket_send() failed"); - break; - } - } - } - - /* Close the connection to the network sublayer */ - _as_simulator_mme_is_running = FALSE; - printf("ERROR\t: %s - The MME connection manager exited\n", __FUNCTION__); - return (NULL); -} - -/* - * ----------------------------------------------------------------------------- - * Functions used to process messages received from the UE NAS process - * ----------------------------------------------------------------------------- - */ -static int _as_simulator_ue_process(int msg_id, as_message_t* msg) -{ - int rc = RETURNok; - - as_message_t cnf; - as_message_t ind; - - printf("\nINFO\t: %s - Received AS message 0x%x from UE NAS process\n", - __FUNCTION__, msg_id); - - _as_simulator_ue_transfer = AS_SIMULATOR_NO_TRANSFER; - - memset(&cnf, 0, sizeof(as_message_t)); - memset(&ind, 0, sizeof(as_message_t)); - - switch (msg_id) { - case AS_CELL_INFO_REQ: - cnf.msgID = process_cell_info_req(msg_id, - &msg->msg.cell_info_req, - &cnf.msg.cell_info_cnf); - /* Return confirm message to the UE */ - _as_simulator_ue_transfer |= AS_SIMULATOR_TRANSFER_TO_UE; - break; - - case AS_NAS_ESTABLISH_REQ: - ind.msgID = process_nas_establish_req(msg_id, - &msg->msg.nas_establish_req, - &ind.msg.nas_establish_ind, - &cnf.msg.nas_establish_cnf); - - if (ind.msgID) { - /* Forward indication message to the MME */ - _as_simulator_ue_transfer |= AS_SIMULATOR_TRANSFER_TO_MME; - } - - /* Return confirm message to the UE */ - cnf.msgID = AS_NAS_ESTABLISH_CNF; - _as_simulator_ue_transfer |= AS_SIMULATOR_TRANSFER_TO_UE; - break; - - case AS_UL_INFO_TRANSFER_REQ: - ind.msgID = process_ul_info_transfer_req(msg_id, - &msg->msg.ul_info_transfer_req, - &ind.msg.ul_info_transfer_ind, - &cnf.msg.ul_info_transfer_cnf); - - if (ind.msgID) { - /* Forward indication message to the MME */ - _as_simulator_ue_transfer |= AS_SIMULATOR_TRANSFER_TO_MME; - } - - /* Return confirm message to the UE */ - cnf.msgID = AS_UL_INFO_TRANSFER_CNF; - _as_simulator_ue_transfer |= AS_SIMULATOR_TRANSFER_TO_UE; - break; - - case AS_NAS_RELEASE_REQ: - ind.msgID = process_nas_release_req(msg_id, - &msg->msg.nas_release_req); - break; - - default: - printf("WARNING\t: %s - AS message is not valid (0x%x)\n", - __FUNCTION__, msg_id); - rc = RETURNerror; - break; - } - - if (_as_simulator_ue_transfer & AS_SIMULATOR_TRANSFER_TO_UE) { - /* Encode the message confirmation returned to the NAS running - * at the UE side */ - _as_simulator_ue_size = as_message_encode(_as_simulator_ue_buffer, &cnf, - AS_SIMULATOR_UE_BUFFER_SIZE); - - if (_as_simulator_ue_size == RETURNerror) { - _as_simulator_ue_size = 0; - rc = RETURNerror; - } - } - - if (_as_simulator_ue_transfer & AS_SIMULATOR_TRANSFER_TO_MME) { - /* Encode the message indication forwarded to the NAS running - * at the MME side */ - _as_simulator_mme_size = as_message_encode(_as_simulator_mme_buffer, &ind, - AS_SIMULATOR_MME_BUFFER_SIZE); - - if (_as_simulator_mme_size == RETURNerror) { - _as_simulator_mme_size = 0; - rc = RETURNerror; - } - } - - return (rc); -} - -/* - * ----------------------------------------------------------------------------- - * Functions used to process messages received from the MME NAS process - * ----------------------------------------------------------------------------- - */ -static int _as_simulator_mme_process(int msg_id, as_message_t* msg) -{ - int rc = RETURNok; - - as_message_t cnf; - as_message_t ind; - - printf("\nINFO\t: %s - Received AS message 0x%x from MME NAS process\n", - __FUNCTION__, msg_id); - - _as_simulator_mme_transfer = AS_SIMULATOR_NO_TRANSFER; - - memset(&cnf, 0, sizeof(as_message_t)); - memset(&ind, 0, sizeof(as_message_t)); - - switch (msg_id) { - case AS_NAS_ESTABLISH_RSP: - cnf.msgID = process_nas_establish_rsp(msg_id, - &msg->msg.nas_establish_rsp, - &cnf.msg.nas_establish_cnf); - - if (cnf.msgID) { - /* Forward confirm message to the UE */ - _as_simulator_mme_transfer |= AS_SIMULATOR_TRANSFER_TO_UE; - } - - break; - - case AS_DL_INFO_TRANSFER_REQ: - ind.msgID = process_dl_info_transfer_req(msg_id, - &msg->msg.dl_info_transfer_req, - &ind.msg.dl_info_transfer_ind, - &cnf.msg.dl_info_transfer_cnf); - - if (ind.msgID) { - /* Forward indication message to the UE */ - _as_simulator_mme_transfer |= AS_SIMULATOR_TRANSFER_TO_UE; - } - - /* Return confirm message to the MME */ - cnf.msgID = AS_DL_INFO_TRANSFER_CNF; - _as_simulator_mme_transfer |= AS_SIMULATOR_TRANSFER_TO_MME; - break; - - case AS_NAS_RELEASE_REQ: - ind.msgID = process_nas_release_ind(msg_id, - &msg->msg.nas_release_req, - &ind.msg.nas_release_ind); - /* Forward indication message to the UE */ - _as_simulator_mme_transfer |= AS_SIMULATOR_TRANSFER_TO_UE; - break; - - default: - printf("WARNING\t: %s - AS message is not valid (0x%x)\n", - __FUNCTION__, msg_id); - rc = RETURNerror; - break; - } - - if (_as_simulator_mme_transfer & AS_SIMULATOR_TRANSFER_TO_UE) { - if (ind.msgID > 0) { - /* Encode the message indication forwarded to the NAS running - * at the UE side */ - _as_simulator_ue_size = as_message_encode(_as_simulator_ue_buffer, - &ind, AS_SIMULATOR_UE_BUFFER_SIZE); - } else if (cnf.msgID > 0) { - /* Encode the message confirmation forwarded to the NAS running - * at the UE side */ - _as_simulator_ue_size = as_message_encode(_as_simulator_ue_buffer, - &cnf, AS_SIMULATOR_UE_BUFFER_SIZE); - } - - if (_as_simulator_ue_size == RETURNerror) { - _as_simulator_ue_size = 0; - rc = RETURNerror; - } - } - - if (_as_simulator_mme_transfer & AS_SIMULATOR_TRANSFER_TO_MME) { - /* Encode the message confirmation returned to the NAS running - * at the MME side */ - _as_simulator_mme_size = as_message_encode(_as_simulator_mme_buffer, - &cnf, AS_SIMULATOR_MME_BUFFER_SIZE); - - if (_as_simulator_mme_size == RETURNerror) { - _as_simulator_mme_size = 0; - rc = RETURNerror; - } - } - - return (rc); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.c b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.c deleted file mode 100644 index 0c306ad6c5ec0da6aaa46808b31cc525cc3211d5..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.c +++ /dev/null @@ -1,213 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source as_simulator_parser.c - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem Command line parser - -Author Frederic Maurel - -Description Command line parser of the AS Simulator process - -*****************************************************************************/ - -#include "as_simulator_parser.h" - -#include "parser.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * Identifiers of the AS Simulator command line options - */ -enum { - AS_SIMULATOR_PARSER_UE_HOST, /* UE process hostname */ - AS_SIMULATOR_PARSER_UE_PORT, /* UE process port number */ - AS_SIMULATOR_PARSER_MME_HOST, /* MME process hostname */ - AS_SIMULATOR_PARSER_MME_PORT, /* MME process port number */ - AS_SIMULATOR_PARSER_NB_OPTIONS -}; - -/* -------------------------------------------------------------- - * Definition of the internal AS Simulator command line structure - * -------------------------------------------------------------- - * The command line is defined with a name (default is "ASprocess" - * but it will be replaced by the command name actually used at - * runtime), a number of options and the list of options. - * An option is defined with a name, an argument following the name, - * the usage displayed by the usage function and a default value. - */ -static parser_command_line_t asParserCommandLine = { - "ASprocess", /* Command name */ - AS_SIMULATOR_PARSER_NB_OPTIONS, /* Number of options */ - { /* Command line options */ - { - "-uhost", "<uhost>", "UE process hostname\t\t", - AS_SIMULATOR_PARSER_DEFAULT_UE_HOSTNAME - }, - { - "-uport", "<uport>", "UE process port number\t\t", - AS_SIMULATOR_PARSER_DEFAULT_UE_PORT_NUMBER - }, - { - "-mhost", "<mhost>", "MME process hostname\t\t", - AS_SIMULATOR_PARSER_DEFAULT_MME_HOSTNAME - }, - { - "-mport", "<mport>", "MME process port number\t\t", - AS_SIMULATOR_PARSER_DEFAULT_MME_PORT_NUMBER - }, - } -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: as_simulator_parser_print_usage() ** - ** ** - ** Description: Displays the command line options used to run the AS ** - ** Simulator process ** - ** ** - ** Inputs: None ** - ** Others: asParserCommandLine.options ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline void as_simulator_parser_print_usage(void) -{ - parser_print_usage(&asParserCommandLine); -} - -/**************************************************************************** - ** ** - ** Name: as_simulator_parser_get_options() ** - ** ** - ** Description: Gets the command line options used to run the AS ** - ** Simulator process ** - ** ** - ** Inputs: argc: Number of options ** - ** argv: Pointer to the list of options ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: asParserCommandLine.options ** - ** ** - ***************************************************************************/ -inline int as_simulator_parser_get_options(int argc, const char** argv) -{ - return parser_get_options(argc, argv, &asParserCommandLine); -} - -/**************************************************************************** - ** ** - ** Name: as_simulator_parser_get_nb_options() ** - ** ** - ** Description: Returns the number of the command line options used to ** - ** run the As Simulator process ** - ** ** - ** Inputs: None ** - ** Others: asParserCommandLine.options ** - ** ** - ** Outputs: Return: Number of command line options ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline int as_simulator_parser_get_nb_options(void) -{ - return asParserCommandLine.nb_options; -} - -/**************************************************************************** - ** ** - ** Name: as_simulator_parser_get_uhost() ** - ** ** - ** Description: Returns the value of the UE process hostname ** - ** ** - ** Inputs: None ** - ** Others: asParserCommandLine.options ** - ** ** - ** Outputs: Return: Value of the remote hostname ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline const char* as_simulator_parser_get_uhost(void) -{ - return asParserCommandLine.options[AS_SIMULATOR_PARSER_UE_HOST].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: as_simulator_parser_get_uport() ** - ** ** - ** Description: Returns the value of the UE process port number ** - ** ** - ** Inputs: None ** - ** Others: asParserCommandLine.options ** - ** ** - ** Outputs: Return: Value of the remote port number ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline const char* as_simulator_parser_get_uport(void) -{ - return asParserCommandLine.options[AS_SIMULATOR_PARSER_UE_PORT].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: as_simulator_parser_get_mhost() ** - ** ** - ** Description: Returns the value of the MME process hostname ** - ** ** - ** Inputs: None ** - ** Others: asParserCommandLine.options ** - ** ** - ** Outputs: Return: Value of the remote hostname ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline const char* as_simulator_parser_get_mhost(void) -{ - return asParserCommandLine.options[AS_SIMULATOR_PARSER_MME_HOST].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: as_simulator_parser_get_mport() ** - ** ** - ** Description: Returns the value of the MME process port number ** - ** ** - ** Inputs: None ** - ** Others: asParserCommandLine.options ** - ** ** - ** Outputs: Return: Value of the remote port number ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline const char* as_simulator_parser_get_mport(void) -{ - return asParserCommandLine.options[AS_SIMULATOR_PARSER_MME_PORT].pvalue; -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.h b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.h deleted file mode 100644 index 75028a8bd84a3f390eff1f117f3653080bedcca1..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/as_simulator_parser.h +++ /dev/null @@ -1,61 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source as_simulator_parser.h - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem Command line parser - -Author Frederic Maurel - -Description Command line parser of the AS Simulator process - -*****************************************************************************/ - -#ifndef __AS_SIMULATOR_PARSER_H__ -#define __AS_SIMULATOR_PARSER_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* UE process default hostname */ -#define AS_SIMULATOR_PARSER_DEFAULT_UE_HOSTNAME "localhost" - -/* MME process default hostname */ -#define AS_SIMULATOR_PARSER_DEFAULT_MME_HOSTNAME "localhost" - -/* UE process default port number */ -#define AS_SIMULATOR_PARSER_DEFAULT_UE_PORT_NUMBER "12000" - -/* MME process default port number */ -#define AS_SIMULATOR_PARSER_DEFAULT_MME_PORT_NUMBER "14000" - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void as_simulator_parser_print_usage(void); -int as_simulator_parser_get_options(int argc, const char** argv); - -int as_simulator_parser_get_nb_options(void); -const char* as_simulator_parser_get_uhost(void); -const char* as_simulator_parser_get_uport(void); -const char* as_simulator_parser_get_mhost(void); -const char* as_simulator_parser_get_mport(void); - -#endif /* __AS_SIMULATOR_PARSER_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.c b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.c deleted file mode 100644 index 7c938b786d8d15706f2a76433dc892d342b69275..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.c +++ /dev/null @@ -1,908 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source nas_data.c - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem Non-Access-Stratum data - -Author Frederic Maurel - -Description Defines constants and functions used by the AS simulator - process. - -*****************************************************************************/ - -#include "nas_data.h" - -#include "emm_msgDef.h" -#include "esm_msgDef.h" - -#include "emm_cause.h" -#include "esm_cause.h" - -#include <stdio.h> // snprintf - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -static ssize_t imsiIdentity(char* buffer, size_t len, - const ImsiMobileIdentity_t* ident); -static ssize_t imeiIdentity(char* buffer, size_t len, - const ImeiMobileIdentity_t* ident); -static ssize_t tmsiIdentity(char* buffer, size_t len, - const TmsiMobileIdentity_t* ident); -static ssize_t tmgiIdentity(char* buffer, size_t len, - const TmgiMobileIdentity_t* ident); - -static const char* timerUnit(int unit); - -static ssize_t ipv4Addr(char* buffer, size_t len, const OctetString* addr); -static ssize_t ipv6Addr(char* buffer, size_t len, const OctetString* addr); -static ssize_t ipv4v6Addr(char* buffer, size_t len, const OctetString* addr); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Return EMM message type - * ----------------------------------------------------------------------------- - */ -const char* emmMsgType(int type) -{ - if (type == ATTACH_REQUEST) { - return "ATTACH_REQUEST"; - } else if (type == ATTACH_ACCEPT) { - return "ATTACH_ACCEPT"; - } else if (type == ATTACH_COMPLETE) { - return "ATTACH_COMPLETE"; - } else if (type == ATTACH_REJECT) { - return "ATTACH_REJECT"; - } else if (type == DETACH_REQUEST) { - return "DETACH_REQUEST"; - } else if (type == DETACH_ACCEPT) { - return "DETACH_ACCEPT"; - } else if (type == TRACKING_AREA_UPDATE_REQUEST) { - return "TRACKING_AREA_UPDATE_REQUEST"; - } else if (type == TRACKING_AREA_UPDATE_ACCEPT) { - return "TRACKING_AREA_UPDATE_ACCEPT"; - } else if (type == TRACKING_AREA_UPDATE_COMPLETE) { - return "TRACKING_AREA_UPDATE_COMPLETE"; - } else if (type == TRACKING_AREA_UPDATE_REJECT) { - return "TRACKING_AREA_UPDATE_REJECT"; - } else if (type == EXTENDED_SERVICE_REQUEST) { - return "EXTENDED_SERVICE_REQUEST"; - } else if (type == SERVICE_REJECT) { - return "SERVICE_REJECT"; - } else if (type == GUTI_REALLOCATION_COMMAND) { - return "GUTI_REALLOCATION_COMMAND"; - } else if (type == GUTI_REALLOCATION_COMPLETE) { - return "GUTI_REALLOCATION_COMPLETE"; - } else if (type == AUTHENTICATION_REQUEST) { - return "AUTHENTICATION_REQUEST"; - } else if (type == AUTHENTICATION_RESPONSE) { - return "AUTHENTICATION_RESPONSE"; - } else if (type == AUTHENTICATION_REJECT) { - return "AUTHENTICATION_REJECT"; - } else if (type == AUTHENTICATION_FAILURE) { - return "AUTHENTICATION_FAILURE"; - } else if (type == IDENTITY_REQUEST) { - return "IDENTITY_REQUEST"; - } else if (type == IDENTITY_RESPONSE) { - return "IDENTITY_RESPONSE"; - } else if (type == SECURITY_MODE_COMMAND) { - return "SECURITY_MODE_COMMAND"; - } else if (type == SECURITY_MODE_COMPLETE) { - return "SECURITY_MODE_COMPLETE"; - } else if (type == SECURITY_MODE_REJECT) { - return "SECURITY_MODE_REJECT"; - } else if (type == EMM_STATUS) { - return "EMM_STATUS"; - } else if (type == EMM_INFORMATION) { - return "EMM_INFORMATION"; - } else if (type == DOWNLINK_NAS_TRANSPORT) { - return "DOWNLINK_NAS_TRANSPORT"; - } else if (type == UPLINK_NAS_TRANSPORT) { - return "UPLINK_NAS_TRANSPORT"; - } else if (type == CS_SERVICE_NOTIFICATION) { - return "CS_SERVICE_NOTIFICATION"; - } else if (type == SERVICE_REQUEST) { - return "SERVICE_REQUEST"; - } else { - return "Unknown EMM message type"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return ESM message type - * ----------------------------------------------------------------------------- - */ -const char* esmMsgType(int type) -{ - if (type == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST) { - return "ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST"; - } else if (type == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT) { - return "ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT"; - } else if (type == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT) { - return "ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT"; - } else if (type == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST) { - return "ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST"; - } else if (type == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT) { - return "ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT"; - } else if (type == ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT) { - return "ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT"; - } else if (type == MODIFY_EPS_BEARER_CONTEXT_REQUEST) { - return "MODIFY_EPS_BEARER_CONTEXT_REQUEST"; - } else if (type == MODIFY_EPS_BEARER_CONTEXT_ACCEPT) { - return "MODIFY_EPS_BEARER_CONTEXT_ACCEPT"; - } else if (type == MODIFY_EPS_BEARER_CONTEXT_REJECT) { - return "MODIFY_EPS_BEARER_CONTEXT_REJECT"; - } else if (type == DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST) { - return "DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST"; - } else if (type == DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT) { - return "DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT"; - } else if (type == PDN_CONNECTIVITY_REQUEST) { - return "PDN_CONNECTIVITY_REQUEST"; - } else if (type == PDN_CONNECTIVITY_REJECT) { - return "PDN_CONNECTIVITY_REJECT"; - } else if (type == PDN_DISCONNECT_REQUEST) { - return "PDN_DISCONNECT_REQUEST"; - } else if (type == PDN_DISCONNECT_REJECT) { - return "PDN_DISCONNECT_REJECT"; - } else if (type == BEARER_RESOURCE_ALLOCATION_REQUEST) { - return "BEARER_RESOURCE_ALLOCATION_REQUEST"; - } else if (type == BEARER_RESOURCE_ALLOCATION_REJECT) { - return "BEARER_RESOURCE_ALLOCATION_REJECT"; - } else if (type == BEARER_RESOURCE_MODIFICATION_REQUEST) { - return "BEARER_RESOURCE_MODIFICATION_REQUEST"; - } else if (type == BEARER_RESOURCE_MODIFICATION_REJECT) { - return "BEARER_RESOURCE_MODIFICATION_REJECT"; - } else if (type == ESM_INFORMATION_REQUEST) { - return "ESM_INFORMATION_REQUEST"; - } else if (type == ESM_INFORMATION_RESPONSE) { - return "ESM_INFORMATION_RESPONSE"; - } else if (type == ESM_STATUS) { - return "ESM_STATUS"; - } else { - return "Unknown ESM message type"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return EMM cause code - * ----------------------------------------------------------------------------- - */ -const char* emmCauseCode(EmmCause code) -{ - if (code == EMM_CAUSE_SUCCESS) { - return "SUCCESS"; - } else if (code == EMM_CAUSE_IMSI_UNKNOWN_IN_HSS) { - return "IMSI_UNKNOWN_IN_HSS"; - } else if (code == EMM_CAUSE_ILLEGAL_UE) { - return "ILLEGAL_UE"; - } else if (code == EMM_CAUSE_ILLEGAL_ME) { - return "ILLEGAL_ME"; - } else if (code == EMM_CAUSE_INVALID_UE) { - return "INVALID_UE"; - } else if (code == EMM_CAUSE_IMPLICITLY_DETACHED) { - return "IMPLICITLY_DETACHED"; - } else if (code == EMM_CAUSE_IMEI_NOT_ACCEPTED) { - return "IMEI_NOT_ACCEPTED"; - } else if (code == EMM_CAUSE_EPS_NOT_ALLOWED) { - return "EPS_NOT_ALLOWED"; - } else if (code == EMM_CAUSE_BOTH_NOT_ALLOWED) { - return "BOTH_NOT_ALLOWED"; - } else if (code == EMM_CAUSE_PLMN_NOT_ALLOWED) { - return "PLMN_NOT_ALLOWED"; - } else if (code == EMM_CAUSE_TA_NOT_ALLOWED) { - return "TA_NOT_ALLOWED"; - } else if (code == EMM_CAUSE_ROAMING_NOT_ALLOWED) { - return "ROAMING_NOT_ALLOWED"; - } else if (code == EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN) { - return "EPS_NOT_ALLOWED_IN_PLMN"; - } else if (code == EMM_CAUSE_NO_SUITABLE_CELLS) { - return "NO_SUITABLE_CELLS"; - } else if (code == EMM_CAUSE_CSG_NOT_AUTHORIZED) { - return "CSG_NOT_AUTHORIZED"; - } else if (code == EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN) { - return "NOT_AUTHORIZED_IN_PLMN"; - } else if (code == EMM_CAUSE_NO_EPS_BEARER_CTX_ACTIVE) { - return "NO_EPS_BEARER_CTX_ACTIVE"; - } else if (code == EMM_CAUSE_MSC_NOT_REACHABLE) { - return "MSC_NOT_REACHABLE"; - } else if (code == EMM_CAUSE_NETWORK_FAILURE) { - return "NETWORK_FAILURE"; - } else if (code == EMM_CAUSE_CS_DOMAIN_NOT_AVAILABLE) { - return "CS_DOMAIN_NOT_AVAILABLE"; - } else if (code == EMM_CAUSE_ESM_FAILURE) { - return "ESM_FAILURE"; - } else if (code == EMM_CAUSE_MAC_FAILURE) { - return "MAC_FAILURE"; - } else if (code == EMM_CAUSE_SYNCH_FAILURE) { - return "SYNCH_FAILURE"; - } else if (code == EMM_CAUSE_CONGESTION) { - return "CONGESTION"; - } else if (code == EMM_CAUSE_UE_SECURITY_MISMATCH) { - return "UE_SECURITY_MISMATCH"; - } else if (code == EMM_CAUSE_SECURITY_MODE_REJECTED) { - return "SECURITY_MODE_REJECTED"; - } else if (code == EMM_CAUSE_NON_EPS_AUTH_UNACCEPTABLE) { - return "NON_EPS_AUTH_UNACCEPTABLE"; - } else if (code == EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE) { - return "CS_SERVICE_NOT_AVAILABLE"; - } else if (code == EMM_CAUSE_SEMANTICALLY_INCORRECT) { - return "SEMANTICALLY_INCORRECT"; - } else if (code == EMM_CAUSE_INVALID_MANDATORY_INFO) { - return "INVALID_MANDATORY_INFO"; - } else if (code == EMM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED) { - return "MESSAGE_TYPE_NOT_IMPLEMENTED"; - } else if (code == EMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE) { - return "MESSAGE_TYPE_NOT_COMPATIBLE"; - } else if (code == EMM_CAUSE_IE_NOT_IMPLEMENTED) { - return "IE_NOT_IMPLEMENTED"; - } else if (code == EMM_CAUSE_CONDITIONAL_IE_ERROR) { - return "CONDITIONAL_IE_ERROR"; - } else if (code == EMM_CAUSE_MESSAGE_NOT_COMPATIBLE) { - return "MESSAGE_NOT_COMPATIBLE"; - } else if (code == EMM_CAUSE_PROTOCOL_ERROR) { - return "PROTOCOL_ERROR"; - } else { - return "Unknown EMM cause code"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return EMM cause code - * ----------------------------------------------------------------------------- - */ -const char* esmCauseCode(EsmCause code) -{ - if (code == ESM_CAUSE_SUCCESS) { - return "SUCCESS"; - } else if (code == ESM_CAUSE_OPERATOR_DETERMINED_BARRING) { - return "OPERATOR_DETERMINED_BARRING"; - } else if (code == ESM_CAUSE_INSUFFICIENT_RESOURCES) { - return "INSUFFICIENT_RESOURCES"; - } else if (code == ESM_CAUSE_UNKNOWN_ACCESS_POINT_NAME) { - return "UNKNOWN_ACCESS_POINT_NAME"; - } else if (code == ESM_CAUSE_UNKNOWN_PDN_TYPE) { - return "UNKNOWN_PDN_TYPE"; - } else if (code == ESM_CAUSE_USER_AUTHENTICATION_FAILED) { - return "USER_AUTHENTICATION_FAILED"; - } else if (code == ESM_CAUSE_REQUEST_REJECTED_BY_GW) { - return "REQUEST_REJECTED_BY_GW"; - } else if (code == ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED) { - return "REQUEST_REJECTED_UNSPECIFIED"; - } else if (code == ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED) { - return "SERVICE_OPTION_NOT_SUPPORTED"; - } else if (code == ESM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED) { - return "REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED"; - } else if (code == ESM_CAUSE_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER) { - return "SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER"; - } else if (code == ESM_CAUSE_PTI_ALREADY_IN_USE) { - return "PTI_ALREADY_IN_USE"; - } else if (code == ESM_CAUSE_REGULAR_DEACTIVATION) { - return "REGULAR_DEACTIVATION"; - } else if (code == ESM_CAUSE_EPS_QOS_NOT_ACCEPTED) { - return "EPS_QOS_NOT_ACCEPTED"; - } else if (code == ESM_CAUSE_NETWORK_FAILURE) { - return "NETWORK_FAILURE"; - } else if (code == ESM_CAUSE_REACTIVATION_REQUESTED) { - return "REACTIVATION_REQUESTED"; - } else if (code == ESM_CAUSE_SEMANTIC_ERROR_IN_THE_TFT_OPERATION) { - return "SEMANTIC_ERROR_IN_THE_TFT_OPERATION"; - } else if (code == ESM_CAUSE_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION) { - return "SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION"; - } else if (code == ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY) { - return "INVALID_EPS_BEARER_IDENTITY"; - } else if (code == ESM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER) { - return "SEMANTIC_ERRORS_IN_PACKET_FILTER"; - } else if (code == ESM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTER) { - return "SYNTACTICAL_ERROR_IN_PACKET_FILTER"; - } else if (code == ESM_CAUSE_PTI_MISMATCH) { - return "PTI_MISMATCH"; - } else if (code == ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED) { - return "LAST_PDN_DISCONNECTION_NOT_ALLOWED"; - } else if (code == ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED) { - return "PDN_TYPE_IPV4_ONLY_ALLOWED"; - } else if (code == ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED) { - return "PDN_TYPE_IPV6_ONLY_ALLOWED"; - } else if (code == ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED) { - return "SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED"; - } else if (code == ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED) { - return "ESM_INFORMATION_NOT_RECEIVED"; - } else if (code == ESM_CAUSE_PDN_CONNECTION_DOES_NOT_EXIST) { - return "PDN_CONNECTION_DOES_NOT_EXIST"; - } else if (code == ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_NOT_ALLOWED) { - return "MULTIPLE_PDN_CONNECTIONS_NOT_ALLOWED"; - } else if (code == ESM_CAUSE_COLLISION_WITH_NETWORK_INITIATED_REQUEST) { - return "COLLISION_WITH_NETWORK_INITIATED_REQUEST"; - } else if (code == ESM_CAUSE_UNSUPPORTED_QCI_VALUE) { - return "UNSUPPORTED_QCI_VALUE"; - } else if (code == ESM_CAUSE_BEARER_HANDLING_NOT_SUPPORTED) { - return "BEARER_HANDLING_NOT_SUPPORTED"; - } else if (code == ESM_CAUSE_INVALID_PTI_VALUE) { - return "INVALID_PTI_VALUE"; - } else if (code == ESM_CAUSE_APN_RESTRICTION_VALUE_NOT_COMPATIBLE) { - return "APN_RESTRICTION_VALUE_NOT_COMPATIBLE"; - } else if (code == ESM_CAUSE_SEMANTICALLY_INCORRECT) { - return "SEMANTICALLY_INCORRECT"; - } else if (code == ESM_CAUSE_INVALID_MANDATORY_INFO) { - return "INVALID_MANDATORY_INFO"; - } else if (code == ESM_CAUSE_MESSAGE_TYPE_NOT_IMPLEMENTED) { - return "MESSAGE_TYPE_NOT_IMPLEMENTED"; - } else if (code == ESM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE) { - return "MESSAGE_TYPE_NOT_COMPATIBLE"; - } else if (code == ESM_CAUSE_IE_NOT_IMPLEMENTED) { - return "IE_NOT_IMPLEMENTED"; - } else if (code == ESM_CAUSE_CONDITIONAL_IE_ERROR) { - return "CONDITIONAL_IE_ERROR"; - } else if (code == ESM_CAUSE_MESSAGE_NOT_COMPATIBLE) { - return "MESSAGE_NOT_COMPATIBLE"; - } else if (code == ESM_CAUSE_PROTOCOL_ERROR) { - return "PROTOCOL_ERROR"; - } else { - return "Unknown ESM cause code"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return attach type - * ----------------------------------------------------------------------------- - */ -const char* attachType(const EpsAttachType* type) -{ - if (*type == EPS_ATTACH_TYPE_EPS) { - return "EPS"; - } else if (*type == EPS_ATTACH_TYPE_IMSI) { - return "IMSI"; - } else if (*type == EPS_ATTACH_TYPE_EMERGENCY) { - return "EMERGENCY"; - } else if (*type == EPS_ATTACH_TYPE_RESERVED) { - return "RESERVED"; - } else { - return "Unknown attach type"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return detach type - * ----------------------------------------------------------------------------- - */ -const char* detachType(const DetachType* type) -{ - if (type->switchoff == DETACH_TYPE_NORMAL_DETACH) { - if (type->typeofdetach == DETACH_TYPE_EPS) { - return "Normal EPS"; - } else if (type->typeofdetach == DETACH_TYPE_IMSI) { - return "Normal IMSI"; - } else if (type->typeofdetach == DETACH_TYPE_EPS_IMSI) { - return "Normal EMERGENCY"; - } else if (type->typeofdetach == DETACH_TYPE_RESERVED_1) { - return "Normal RESERVED"; - } else if (type->typeofdetach == DETACH_TYPE_RESERVED_2) { - return "Normal RESERVED"; - } else { - return "Unknown attach type"; - } - } else if (type->switchoff == DETACH_TYPE_SWITCH_OFF) { - if (type->typeofdetach == DETACH_TYPE_EPS) { - return "Switch-off EPS"; - } else if (type->typeofdetach == DETACH_TYPE_IMSI) { - return "Switch-off IMSI"; - } else if (type->typeofdetach == DETACH_TYPE_EPS_IMSI) { - return "Switch-off EMERGENCY"; - } else if (type->typeofdetach == DETACH_TYPE_RESERVED_1) { - return "Switch-off RESERVED"; - } else if (type->typeofdetach == DETACH_TYPE_RESERVED_2) { - return "Switch-off RESERVED"; - } else { - return "Unknown attach type"; - } - } - - return "Unknon switch-off parameter"; -} - -/* - * ----------------------------------------------------------------------------- - * Display EPS mobile identity - * ----------------------------------------------------------------------------- - */ -ssize_t epsIdentity(char* buffer, size_t len, const EpsMobileIdentity* ident) -{ - int index = 0; - - if (ident->imsi.typeofidentity == EPS_MOBILE_IDENTITY_IMSI) { - index += imsiIdentity(buffer + index, len - index, - (ImsiMobileIdentity_t*)(&ident->imsi)); - } else if (ident->imei.typeofidentity == EPS_MOBILE_IDENTITY_IMEI) { - index += imeiIdentity(buffer + index, len - index, - (ImeiMobileIdentity_t*)(&ident->imei)); - } else if (ident->guti.typeofidentity == EPS_MOBILE_IDENTITY_GUTI) { - index += snprintf(buffer + index, len - index, "GUTI = {"); - index += snprintf(buffer + index, len - index, - "plmn = %u%u%u%u%u", - ident->guti.mccdigit1, ident->guti.mccdigit2, - ident->guti.mccdigit3, ident->guti.mncdigit1, - ident->guti.mncdigit2); - - if (ident->guti.mncdigit3 != 0xf) { - index += snprintf(buffer + index, len - index, "%u", - ident->guti.mncdigit3); - } - - index += snprintf(buffer + index, len - index, - ", MMEgid = %u, MMEcode = %u, m_tmsi = %u}", - ident->guti.mmegroupid, ident->guti.mmecode, - ident->guti.mtmsi); - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Display mobile identity - * ----------------------------------------------------------------------------- - */ -ssize_t mobileIdentity(char* buffer, size_t len, const MobileIdentity* ident) -{ - int index = 0; - - if (ident->imsi.typeofidentity == MOBILE_IDENTITY_IMSI) { - index += imsiIdentity(buffer + index, len - index, &ident->imsi); - } else if (ident->imei.typeofidentity == MOBILE_IDENTITY_IMEI) { - index += imeiIdentity(buffer + index, len - index, &ident->imei); - } else if (ident->tmsi.typeofidentity == MOBILE_IDENTITY_TMSI) { - index += tmsiIdentity(buffer + index, len - index, &ident->tmsi); - } else if (ident->tmgi.typeofidentity == MOBILE_IDENTITY_TMGI) { - index += tmgiIdentity(buffer + index, len - index, &ident->tmgi); - } else if (ident->no_id.typeofidentity == MOBILE_IDENTITY_NOT_AVAILABLE) { - index += snprintf(buffer + index, len - index, "NOT AVAILABLE"); - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Return mobile identity type - * ----------------------------------------------------------------------------- - */ -const char* identityType(const IdentityType2* type) -{ - if (*type == IDENTITY_TYPE_2_IMSI) { - return "IMSI"; - } else if (*type == IDENTITY_TYPE_2_IMEI) { - return "IMEI"; - } else if (*type == IDENTITY_TYPE_2_IMEISV) { - return "IMEISV"; - } else if (*type == IDENTITY_TYPE_2_TMSI) { - return "TMSI"; - } else { - return "Unknown identity type"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return PDN request type - * ----------------------------------------------------------------------------- - */ -const char* requestType(const RequestType* type) -{ - if (*type == REQUEST_TYPE_INITIAL_REQUEST) { - return "INITIAL"; - } else if (*type == REQUEST_TYPE_HANDOVER) { - return "HANDOVER"; - } else if (*type == REQUEST_TYPE_UNUSED) { - return "UNUSED"; - } else if (*type == REQUEST_TYPE_EMERGENCY) { - return "EMERGENCY"; - } else { - return "Unknown PDN request type"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return PDN type - * ----------------------------------------------------------------------------- - */ -const char* pdnType(const PdnType* type) -{ - if (*type == PDN_TYPE_IPV4) { - return "IPV4"; - } else if (*type == PDN_TYPE_IPV6) { - return "IPV6"; - } else if (*type == PDN_TYPE_IPV4V6) { - return "IPV4V6"; - } else if (*type == PDN_TYPE_UNUSED) { - return "UNUSED"; - } else { - return "Unknown PDN type"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Display PDN address - * ----------------------------------------------------------------------------- - */ -ssize_t pdnAddress(char* buffer, size_t len, const PdnAddress* addr) -{ - int index = 0; - - switch (addr->pdntypevalue) { - case PDN_VALUE_TYPE_IPV4: - /* Display IPv4 PDN address */ - index += ipv4Addr(buffer + index, len - index, - &addr->pdnaddressinformation); - break; - - case PDN_VALUE_TYPE_IPV6: - /* Display IPv6 suffix */ - index += ipv6Addr(buffer + index, len - index, - &addr->pdnaddressinformation); - break; - - case PDN_VALUE_TYPE_IPV4V6: - /* Display IPv4 PDN address and IPv6 suffix */ - index += ipv4v6Addr(buffer + index, len - index, - &addr->pdnaddressinformation); - break; - - default: - index += snprintf(buffer + index, len - index, "Unknown"); - break; - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Dispay the NAS key set identifier - * ----------------------------------------------------------------------------- - */ -ssize_t nasKeySetIdentifier(char* buffer, size_t len, - const NasKeySetIdentifier* ksi) -{ - int index = 0; - - index += snprintf(buffer + index, len - index, "{%s: %d}", - (ksi->tsc == NAS_KEY_SET_IDENTIFIER_NATIVE)? "NATIVE" : - (ksi->tsc == NAS_KEY_SET_IDENTIFIER_MAPPED)? "MAPPED" : - "Unknown", ksi->naskeysetidentifier); - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Dispay the authentication parameter (RAND, AUTN, RES) - * ----------------------------------------------------------------------------- - */ -ssize_t authenticationParameter(char* buffer, size_t len, const OctetString* param) -{ - int index = 0; - - for (int i = 0; i < param->length; i++) { - index += snprintf(buffer + index, len - index, "%.2hx", - (unsigned char)(param->value[i])); - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Return the NAS ciphering algorithm identifier - * ----------------------------------------------------------------------------- - */ -const char* nasCipheringAlgorithm(const NasSecurityAlgorithms* algo) -{ - if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA0) { - return "EEA0"; - } else if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA1) { - return "128-EEA1"; - } else if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA2) { - return "128-EEA2"; - } else if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA3) { - return "EEA3"; - } else if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA4) { - return "EEA4"; - } else if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA5) { - return "EEA5"; - } else if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA6) { - return "EEA6"; - } else if (algo->typeofcipheringalgorithm == NAS_SECURITY_ALGORITHMS_EEA7) { - return "EEA7"; - } else { - return "Unknown"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Return the NAS integrity algorithm identifier - * ----------------------------------------------------------------------------- - */ -const char* nasIntegrityAlgorithm(const NasSecurityAlgorithms* algo) -{ - if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA0) { - return "EIA0"; - } else if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA1) { - return "128-EIA1"; - } else if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA2) { - return "128-EIA2"; - } else if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA3) { - return "EIA3"; - } else if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA4) { - return "EIA4"; - } else if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA5) { - return "EIA5"; - } else if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA6) { - return "EIA6"; - } else if (algo->typeofintegrityalgorithm == NAS_SECURITY_ALGORITHMS_EIA7) { - return "EIA7"; - } else { - return "Unknown"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Display GPRS timer - * ----------------------------------------------------------------------------- - */ -ssize_t gprsTimer(char* buffer, size_t len, const GprsTimer* timer) -{ - int index = 0; - - if (timer->unit != GPRS_TIMER_UNIT_0S) { - index += snprintf(buffer + index, len - index, - "{Unit = %s, Value = %u}", - timerUnit(timer->unit), timer->timervalue); - } else { - index += snprintf(buffer + index, len - index, "{Deactivated}"); - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Display the content of TAI list - * ----------------------------------------------------------------------------- - */ -ssize_t taiList(char* buffer, size_t len, const TrackingAreaIdentityList* tai) -{ - int index = 0; - - index += snprintf(buffer + index, len - index, "TAI = {%s", - (tai->typeoflist == TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS)? - "One PLMN consecutive TACs" : "Unknown"); - - index += snprintf(buffer + index, len - index, - ", plmn = %u%u%u%u%u", - tai->mccdigit1, tai->mccdigit2, - tai->mccdigit3, tai->mncdigit1, - tai->mncdigit2); - - if (tai->mncdigit3 != 0xf) { - index += snprintf(buffer + index, len - index, "%u", - tai->mncdigit3); - } - - index += snprintf(buffer + index, len - index, - ", n_tacs = %u, tac = 0x%.4x", - /* LW: number of elements is coded as N-1 (0 -> 1 element, 1 -> 2 elements...), - * see 3GPP TS 24.301, section 9.9.3.33.1 */ - tai->numberofelements + 1, - tai->tac); - - index += snprintf(buffer + index, len - index, "}"); - - return (index); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Display the International Mobile Subscriber Identity - * ----------------------------------------------------------------------------- - */ -ssize_t imsiIdentity(char* buffer, size_t len, const ImsiMobileIdentity_t* imsi) -{ - int index = 0; - - if (imsi->oddeven != MOBILE_IDENTITY_EVEN) { - index += snprintf(buffer + index, len - index, - "IMSI = %u%u%u%u%u%u%u%u%u%u%u%u%u%u", - imsi->digit1, imsi->digit2, imsi->digit3, imsi->digit4, - imsi->digit5, imsi->digit6, imsi->digit7, imsi->digit8, - imsi->digit9, imsi->digit10, imsi->digit11, imsi->digit12, - imsi->digit13, imsi->digit14); - } else { - index += snprintf(buffer + index, len - index, - "IMSI = %u%u%u%u%u%u%u%u%u%u%u%u%u", - imsi->digit1, imsi->digit2, imsi->digit3, imsi->digit4, - imsi->digit5, imsi->digit7, imsi->digit8, imsi->digit9, - imsi->digit10, imsi->digit11, imsi->digit12, - imsi->digit13, imsi->digit14); - } - - if (imsi->digit15 != 0xf) { - index += snprintf(buffer + index, len - index, "%u", imsi->digit15); - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Display the International Mobile Equipment Identity - * ----------------------------------------------------------------------------- - */ -ssize_t imeiIdentity(char* buffer, size_t len, const ImeiMobileIdentity_t* imei) -{ - int index = 0; - - if (imei->oddeven != MOBILE_IDENTITY_EVEN) { - index += snprintf(buffer + index, len - index, - "IMEI = %u%u%u%u%u%u%u%u%u%u%u%u%u%u%u", - imei->digit1, imei->digit2, imei->digit3, imei->digit4, - imei->digit5, imei->digit6, imei->digit7, imei->digit8, - imei->digit9, imei->digit10, imei->digit11, imei->digit12, - imei->digit13, imei->digit14, imei->digit15); - } else { - index += snprintf(buffer + index, len - index, - "IMEI = %u%u%u%u%u%u%u%u%u%u%u%u%u%u", - imei->digit1, imei->digit2, imei->digit3, imei->digit4, - imei->digit5, imei->digit6, imei->digit7, imei->digit8, - imei->digit9, imei->digit10, imei->digit11, imei->digit12, - imei->digit13, imei->digit14); - } - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Display the Temporary Mobile Subscriber Identity - * ----------------------------------------------------------------------------- - */ -ssize_t tmsiIdentity(char* buffer, size_t len, const TmsiMobileIdentity_t* tmsi) -{ - int index = 0; - - index += snprintf(buffer + index, len - index, - "TMSI = %u%u%u%u%u%u%u%u%u%u%u%u%u%u", - tmsi->digit2, tmsi->digit3, tmsi->digit4, - tmsi->digit5, tmsi->digit6, tmsi->digit7, tmsi->digit8, - tmsi->digit9, tmsi->digit10, tmsi->digit11, tmsi->digit12, - tmsi->digit13, tmsi->digit14, tmsi->digit15); - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Display the Temporary Mobile Group Identity - * ----------------------------------------------------------------------------- - */ -ssize_t tmgiIdentity(char* buffer, size_t len, const TmgiMobileIdentity_t* tmgi) -{ - int index = 0; - - index += snprintf(buffer + index, len - index, "TMGI = {"); - index += snprintf(buffer + index, len - index, "MBMS service ID = %u", - tmgi->mbmsserviceid); - - if (tmgi->mccmncindication) { - index += snprintf(buffer + index, len - index, ", MCC = %u%u%u", - tmgi->mccdigit1, tmgi->mccdigit2, tmgi->mccdigit3); - index += snprintf(buffer + index, len - index, ", MNC = %u%u", - tmgi->mncdigit1, tmgi->mncdigit2); - - if (tmgi->mncdigit3 != 0xf) { - index += snprintf(buffer + index, len - index, "%u", - tmgi->mncdigit3); - } - } - - if (tmgi->mbmssessionidindication) { - index += snprintf(buffer + index, len - index, ", MBMS session ID = %u", - tmgi->mbmssessionid); - } - - index += snprintf(buffer + index, len - index, "}"); - - return (index); -} - -/* - * ----------------------------------------------------------------------------- - * Return GPRS timer unit - * ----------------------------------------------------------------------------- - */ -const char* timerUnit(int unit) -{ - if (unit == GPRS_TIMER_UNIT_2S) { - return "2 seconds"; - } else if (unit == GPRS_TIMER_UNIT_60S) { - return "Minutes"; - } else if (unit == GPRS_TIMER_UNIT_360S) { - return "Decihours"; - } else if (unit == GPRS_TIMER_UNIT_0S) { - return "Deactivated"; - } else { - return "Unknown timer unit"; - } -} - -/* - * ----------------------------------------------------------------------------- - * Display IPv4 address - * ----------------------------------------------------------------------------- - */ -ssize_t ipv4Addr(char* buffer, size_t len, const OctetString* addr) -{ - return snprintf(buffer, len, "%u.%u.%u.%u", - addr->value[0], addr->value[1], - addr->value[2], addr->value[3]); -} - -/* - * ----------------------------------------------------------------------------- - * Display IPv6 address - * ----------------------------------------------------------------------------- - */ -ssize_t ipv6Addr(char* buffer, size_t len, const OctetString* addr) -{ - return snprintf(buffer, len, "%x%.2x:%x%.2x:%x%.2x:%x%.2x", - addr->value[0], addr->value[1], - addr->value[2], addr->value[3], - addr->value[4], addr->value[5], - addr->value[6], addr->value[7]); -} - -/* - * ----------------------------------------------------------------------------- - * Display IPv4v6 address - * ----------------------------------------------------------------------------- - */ -ssize_t ipv4v6Addr(char* buffer, size_t len, const OctetString* addr) -{ - return snprintf(buffer, len, "%u.%u.%u.%u / %x%.2x:%x%.2x:%x%.2x:%x%.2x", - addr->value[0], addr->value[1], - addr->value[2], addr->value[3], - addr->value[4], addr->value[5], - addr->value[6], addr->value[7], - addr->value[8], addr->value[9], - addr->value[10], addr->value[11]); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.h b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.h deleted file mode 100644 index 86856b5de5adfe496976a7f95ed536b35743be65..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_data.h +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source nas_data.h - -Version 0.1 - -Date 2013/04/11 - -Product Access-Stratum sublayer simulator - -Subsystem Non-Access-Stratum data - -Author Frederic Maurel - -Description Defines constants and functions used by the AS simulator - process. - -*****************************************************************************/ - -#ifndef __NAS_DATA_H__ -#define __NAS_DATA_H__ - -#include "EpsAttachType.h" -#include "DetachType.h" -#include "NasKeySetIdentifier.h" -#include "EpsMobileIdentity.h" -#include "MobileIdentity.h" -#include "IdentityType2.h" -#include "NasRequestType.h" -#include "PdnType.h" -#include "PdnAddress.h" -#include "NasSecurityAlgorithms.h" -#include "GprsTimer.h" -#include "TrackingAreaIdentityList.h" -#include "EmmCause.h" -#include "EsmCause.h" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -const char* emmMsgType(int type); -const char* esmMsgType(int type); - -const char* emmCauseCode(EmmCause code); -const char* esmCauseCode(EsmCause code); - -const char* attachType(const EpsAttachType* type); -const char* detachType(const DetachType* type); - -ssize_t epsIdentity(char* buffer, size_t len, const EpsMobileIdentity* ident); -const char* identityType(const IdentityType2* type); -ssize_t mobileIdentity(char* buffer, size_t len, const MobileIdentity* ident); - -const char* requestType(const RequestType* type); -const char* pdnType(const PdnType* type); -ssize_t pdnAddress(char* buffer, size_t len, const PdnAddress* addr); - -ssize_t nasKeySetIdentifier(char* buffer, size_t len, const NasKeySetIdentifier* ksi); -ssize_t authenticationParameter(char* buffer, size_t len, const OctetString* param); -const char* nasCipheringAlgorithm(const NasSecurityAlgorithms* algo); -const char* nasIntegrityAlgorithm(const NasSecurityAlgorithms* algo); - -ssize_t gprsTimer(char* buffer, size_t len, const GprsTimer* timer); -ssize_t taiList(char* buffer, size_t len, const TrackingAreaIdentityList* tai); - -#endif // __NAS_DATA_H__ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.c b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.c deleted file mode 100644 index 4791764361a39da49133e71de11b716ebe4bb6fa..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.c +++ /dev/null @@ -1,1043 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source nas_process.c - -Version 0.1 - -Date 2013/04/16 - -Product Access-Stratum sublayer simulator - -Subsystem NAS message processing - -Author Frederic Maurel - -Description Defines functions executed by the Access-Stratum sublayer - upon receiving NAS messages. - -*****************************************************************************/ - -#include "nas_process.h" - -#include "nas_data.h" -#include "nas_message.h" - -#include <stdio.h> // snprintf -#include <string.h> // memset - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - *----------------------------------------------------------------------------- - * Functions used to process EPS Mobility Management messages - *----------------------------------------------------------------------------- - */ -static int _nas_process_emm(char* buffer, int length, const EMM_msg* msg); - -static int _attach_request(char* buffer, int length, const attach_request_msg* msg); -static int _attach_accept(char* buffer, int length, const attach_accept_msg* msg); -static int _attach_reject(char* buffer, int length, const attach_reject_msg* msg); -static int _attach_complete(char* buffer, int length, const attach_complete_msg* msg); - -static int _detach_request(char* buffer, int length, const detach_request_msg* msg); -static int _detach_accept(char* buffer, int length, const detach_accept_msg* msg); - -static int _identity_request(char* buffer, int length, const identity_request_msg* msg); -static int _identity_response(char* buffer, int length, const identity_response_msg* msg); - -static int _authentication_request(char* buffer, int length, const authentication_request_msg* msg); -static int _authentication_response(char* buffer, int length, const authentication_response_msg* msg); -static int _authentication_failure(char* buffer, int length, const authentication_failure_msg* msg); -static int _authentication_reject(char* buffer, int length, const authentication_reject_msg* msg); - -static int _security_mode_command(char* buffer, int length, const security_mode_command_msg* msg); -static int _security_mode_complete(char* buffer, int length, const security_mode_complete_msg* msg); -static int _security_mode_reject(char* buffer, int length, const security_mode_reject_msg* msg); - -static int _esm_message_container(char* buffer, int length, const EsmMessageContainer* msg); - -static int _emm_status(char* buffer, int length, const emm_status_msg* msg); - -/* - *----------------------------------------------------------------------------- - * Functions used to process EPS Session Management messages - *----------------------------------------------------------------------------- - */ -static int _nas_process_esm(char* buffer, int length, const ESM_msg* msg); - -static int _pdn_connectivity_request(char* buffer, int length, const pdn_connectivity_request_msg* msg); -static int _pdn_connectivity_reject(char* buffer, int length, const pdn_connectivity_reject_msg* msg); - -static int _pdn_disconnect_request(char* buffer, int length, const pdn_disconnect_request_msg* msg); -static int _pdn_disconnect_reject(char* buffer, int length, const pdn_disconnect_reject_msg* msg); - -static int _activate_default_eps_bearer_context_request(char* buffer, int length, const activate_default_eps_bearer_context_request_msg* msg); -static int _activate_default_eps_bearer_context_accept(char* buffer, int length, const activate_default_eps_bearer_context_accept_msg* msg); -static int _activate_default_eps_bearer_context_reject(char* buffer, int length, const activate_default_eps_bearer_context_reject_msg* msg); - -static int _activate_dedicated_eps_bearer_context_request(char* buffer, int length, const activate_dedicated_eps_bearer_context_request_msg* msg); -static int _activate_dedicated_eps_bearer_context_accept(char* buffer, int length, const activate_dedicated_eps_bearer_context_accept_msg* msg); -static int _activate_dedicated_eps_bearer_context_reject(char* buffer, int length, const activate_dedicated_eps_bearer_context_reject_msg* msg); - -static int _deactivate_eps_bearer_context_request(char* buffer, int length, const deactivate_eps_bearer_context_request_msg* msg); -static int _deactivate_eps_bearer_context_accept(char* buffer, int length, const deactivate_eps_bearer_context_accept_msg* msg); - -static int _esm_status(char* buffer, int length, const esm_status_msg* msg); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/* - *----------------------------------------------------------------------------- - * Process NAS message - *----------------------------------------------------------------------------- - */ -int -nas_process( - char* buffer, - int length, - const char* msg, - int size) -{ - int index = 0; - int bytes; - nas_message_t nas_msg; - - /* Decode NAS message */ - memset(&nas_msg, 0, sizeof(nas_message_t)); - bytes = nas_message_decode(msg, &nas_msg, size); - - if (bytes < 0) { - printf("ERROR\t: %s - Failed to decode NAS message (err=%d)\n", - __FUNCTION__, bytes); - return (RETURNerror); - } - - int protocol_discriminator = nas_msg.header.protocol_discriminator; - - if (protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { - /* Process EPS Mobility Management NAS message */ - index += _nas_process_emm(buffer + index, - length - index, - &nas_msg.plain.emm); - } else if (protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) { - /* Process EPS Session Management NAS message */ - index += _nas_process_esm(buffer + index, - length - index, - &nas_msg.plain.esm); - } else { - printf("ERROR\t: %s - Protocol discriminator is not valid (%d)\n", - __FUNCTION__, protocol_discriminator); - return (RETURNerror); - } - - buffer[index] = '\0'; - - return (bytes); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * ============================================================================= - * Functions used to process EPS Mobility Management messages - * ============================================================================= - */ - -/* - *----------------------------------------------------------------------------- - * Process EPS Mobility Management NAS message - *----------------------------------------------------------------------------- - */ -static int -_nas_process_emm( - char* buffer, - int length, - const EMM_msg* msg) -{ - int index = 0; - const EsmMessageContainer* esm_container = NULL; - - printf("INFO\t: Process %s\n", emmMsgType(msg->header.message_type)); - index += snprintf(buffer + index, length - index, "%s (", - emmMsgType(msg->header.message_type)); - - switch (msg->header.message_type) { - case ATTACH_REQUEST: - esm_container = &msg->attach_request.esmmessagecontainer; - index += _attach_request(buffer + index, length - index, - &msg->attach_request); - break; - - case ATTACH_ACCEPT: - esm_container = &msg->attach_accept.esmmessagecontainer; - index += _attach_accept(buffer + index, length - index, - &msg->attach_accept); - break; - - case ATTACH_REJECT: - esm_container = &msg->attach_reject.esmmessagecontainer; - index += _attach_reject(buffer + index, length - index, - &msg->attach_reject); - break; - - case ATTACH_COMPLETE: - esm_container = &msg->attach_complete.esmmessagecontainer; - index += _attach_complete(buffer + index, length - index, - &msg->attach_complete); - break; - - case DETACH_REQUEST: - index += _detach_request(buffer + index, length - index, - &msg->detach_request); - break; - - case DETACH_ACCEPT: - index += _detach_accept(buffer + index, length - index, - &msg->detach_accept); - break; - - case IDENTITY_REQUEST: - index += _identity_request(buffer + index, length - index, - &msg->identity_request); - break; - - case IDENTITY_RESPONSE: - index += _identity_response(buffer + index, length - index, - &msg->identity_response); - break; - - case AUTHENTICATION_REQUEST: - index += _authentication_request(buffer + index, length - index, - &msg->authentication_request); - break; - - case AUTHENTICATION_RESPONSE: - index += _authentication_response(buffer + index, length - index, - &msg->authentication_response); - break; - - case AUTHENTICATION_FAILURE: - index += _authentication_failure(buffer + index, length - index, - &msg->authentication_failure); - break; - - case AUTHENTICATION_REJECT: - index += _authentication_reject(buffer + index, length - index, - &msg->authentication_reject); - break; - - case SECURITY_MODE_COMMAND: - index += _security_mode_command(buffer + index, length - index, - &msg->security_mode_command); - break; - - case SECURITY_MODE_COMPLETE: - index += _security_mode_complete(buffer + index, length - index, - &msg->security_mode_complete); - break; - - case SECURITY_MODE_REJECT: - index += _security_mode_reject(buffer + index, length - index, - &msg->security_mode_reject); - break; - - case EMM_STATUS: - index += _emm_status(buffer + index, length - index, - &msg->emm_status); - break; - - default: - printf("WARNING\t: %s - EMM NAS message is not valid (0x%x)\n", - __FUNCTION__, msg->header.message_type); - break; - } - - index += snprintf(buffer + index, length - index, ")"); - - /* Process ESM message container */ - if (esm_container) { - index += _esm_message_container(buffer + index, - length - index, - esm_container); - } - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Attach Request - *----------------------------------------------------------------------------- - */ -static int -_attach_request( - char* buffer, - int length, - const attach_request_msg* msg) -{ - int index = 0; - - /* EPS attach type */ - index += snprintf(buffer + index, length - index, "Type = %s", - attachType(&msg->epsattachtype)); - /* NAS key set identifier */ - index += snprintf(buffer + index, length - index, ", KSI = "); - index += nasKeySetIdentifier(buffer + index, length - index, - &msg->naskeysetidentifier); - /* EPS mobile identity */ - index += snprintf(buffer + index, length - index, ", "); - index += epsIdentity(buffer + index, length - index, - &msg->oldgutiorimsi); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Attach Accept - *----------------------------------------------------------------------------- - */ -static int -_attach_accept( - char* buffer, - int length, - const attach_accept_msg* msg) -{ - int index = 0; - -#if 0 - /* T3412 timer value */ - index += snprintf(buffer + index, length - index, "T3412 = "); - index += gprsTimer(buffer + index, length - index, &msg->t3412value); - /* TAI list */ - index += snprintf(buffer + index, length - index, ", "); - index += taiList(buffer + index, length - index, &msg->tailist); -#endif - - /* GUTI */ - if (msg->presencemask & ATTACH_ACCEPT_GUTI_PRESENT) { - index += epsIdentity(buffer + index, length - index, &msg->guti); - } - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Attach Reject - *----------------------------------------------------------------------------- - */ -static int -_attach_reject( - char* buffer, - int length, - const attach_reject_msg* msg) -{ - int index = 0; - - /* EMM cause code */ - index += snprintf(buffer + index, length - index, "EmmCause = %s (%d)", - emmCauseCode(msg->emmcause), msg->emmcause); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Attach Complete - *----------------------------------------------------------------------------- - */ -static int -_attach_complete( - char* buffer, - int length, - const attach_complete_msg* msg) -{ - int index = 0; - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Identity Request - *----------------------------------------------------------------------------- - */ -static int -_identity_request( - char* buffer, - int length, - const identity_request_msg* msg) -{ - int index = 0; - - /* Type of requested identity */ - index += snprintf(buffer + index, length - index, "Type = %s", - identityType(&msg->identitytype)); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Detach Request - *----------------------------------------------------------------------------- - */ -static int -_detach_request( - char* buffer, - int length, - const detach_request_msg* msg) -{ - int index = 0; - - /* EPS attach type */ - index += snprintf(buffer + index, length - index, "Type = %s", - detachType(&msg->detachtype)); - /* NAS key set identifier */ - index += snprintf(buffer + index, length - index, ", KSI = "); - index += nasKeySetIdentifier(buffer + index, length - index, - &msg->naskeysetidentifier); - /* EPS mobile identity */ - index += snprintf(buffer + index, length - index, ", "); - index += epsIdentity(buffer + index, length - index, - &msg->gutiorimsi); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Detach Accept - *----------------------------------------------------------------------------- - */ -static int -_detach_accept( - char* buffer, - int length, - const detach_accept_msg* msg) -{ - int index = 0; - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Identity Response - *----------------------------------------------------------------------------- - */ -static int -_identity_response( - char* buffer, - int length, - const identity_response_msg* msg) -{ - int index = 0; - - /* Mobile identity */ - index += mobileIdentity(buffer + index, length - index, - &msg->mobileidentity); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Authentication Request - *----------------------------------------------------------------------------- - */ -static int -_authentication_request( - char* buffer, - int length, - const authentication_request_msg* msg) -{ - int index = 0; - - /* NAS key set identifier ASME */ - index += snprintf(buffer + index, length - index, "KSIasme = "); - index += nasKeySetIdentifier(buffer + index, length - index, - &msg->naskeysetidentifierasme); - /* Authentication parameter RAND */ - index += snprintf(buffer + index, length - index, "\\nRAND = "); - index += authenticationParameter(buffer + index, length - index, - &msg->authenticationparameterrand.rand); - /* Authentication parameter AUTN */ - index += snprintf(buffer + index, length - index, ", AUTN = "); - index += authenticationParameter(buffer + index, length - index, - &msg->authenticationparameterautn.autn); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Authentication Response - *----------------------------------------------------------------------------- - */ -static int -_authentication_response( - char* buffer, - int length, - const authentication_response_msg* msg) -{ - int index = 0; - - /* Authentication response parameter */ - index += snprintf(buffer + index, length - index, "RES = "); - index += authenticationParameter(buffer + index, length - index, - &msg->authenticationresponseparameter.res); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Authentication Failure - *----------------------------------------------------------------------------- - */ -static int -_authentication_failure( - char* buffer, - int length, - const authentication_failure_msg* msg) -{ - int index = 0; - - /* EMM cause */ - index += snprintf(buffer + index, length - index, "EmmCause = %s (%d)", - emmCauseCode(msg->emmcause), msg->emmcause); - - /* Authenticattion failure parameter */ - if (msg->presencemask & - AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) { - index += snprintf(buffer + index, length - index, "AUTS = "); - index += authenticationParameter(buffer + index, length - index, - &msg->authenticationfailureparameter.auts); - } - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Authentication Reject - *----------------------------------------------------------------------------- - */ -static int -_authentication_reject( - char* buffer, - int length, - const authentication_reject_msg* msg) -{ - int index = 0; - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Security Mode Command - *----------------------------------------------------------------------------- - */ -static int -_security_mode_command( - char* buffer, - int length, - const security_mode_command_msg* msg) -{ - int index = 0; - - /* Selected NAS ciphering algorithm */ - index += snprintf(buffer + index, length - index, "%s (%d)", - nasCipheringAlgorithm(&msg->selectednassecurityalgorithms), - msg->selectednassecurityalgorithms.typeofcipheringalgorithm); - - /* Selected NAS integrity algorithm */ - index += snprintf(buffer + index, length - index, ", %s (%d)", - nasIntegrityAlgorithm(&msg->selectednassecurityalgorithms), - msg->selectednassecurityalgorithms.typeofintegrityalgorithm); - - /* NAS key set identifier */ - index += snprintf(buffer + index, length - index, ", KSI = "); - index += nasKeySetIdentifier(buffer + index, length - index, - &msg->naskeysetidentifier); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Security Mode Complete - *----------------------------------------------------------------------------- - */ -static int -_security_mode_complete( - char* buffer, - int length, - const security_mode_complete_msg* msg) -{ - int index = 0; - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Security Mode Reject - *----------------------------------------------------------------------------- - */ -static int -_security_mode_reject( - char* buffer, - int length, - const security_mode_reject_msg* msg) -{ - int index = 0; - - /* EMM cause code */ - index += snprintf(buffer + index, length - index, "EmmCause = %s (%d)", - emmCauseCode(msg->emmcause), msg->emmcause); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * ESM message container - *----------------------------------------------------------------------------- - */ -static int -_esm_message_container( - char* buffer, - int length, - const EsmMessageContainer* msg) -{ - int index = 0; - int bytes; - - if (msg->esmmessagecontainercontents.length > 0) { - nas_message_t nas_msg; - memset(&nas_msg, 0, sizeof(nas_message_t)); - - /* Decode ESM message container */ - bytes = nas_message_decode((char*)msg->esmmessagecontainercontents.value, - &nas_msg, msg->esmmessagecontainercontents.length); - - if (bytes < 0) { - printf("ERROR\t: %s - Failed to decode ESM message container " - "(err=%d)\n", __FUNCTION__, bytes); - return (0); - } - - index += snprintf(buffer + index, length - index, "\\n + "); - - /* Process EPS Session Management NAS message */ - index += _nas_process_esm(buffer + index, length - index, - &nas_msg.plain.esm); - } - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process EMM Status - *----------------------------------------------------------------------------- - */ -static int -_emm_status( - char* buffer, - int length, - const emm_status_msg* msg) -{ - int index = 0; - - /* EMM cause code */ - index += snprintf(buffer + index, length - index, "EmmCause = %s (%d)", - emmCauseCode(msg->emmcause), msg->emmcause); - - return (index); -} -/* - * ============================================================================= - * Functions used to process EPS Session Management messages - * ============================================================================= - */ - -/* - *----------------------------------------------------------------------------- - * Process EPS Session MAnagement NAS message - *----------------------------------------------------------------------------- - */ -static int -_nas_process_esm( - char* buffer, - int length, - const ESM_msg* msg) -{ - int index = 0; - - printf("INFO\t: Process %s\n", esmMsgType(msg->header.message_type)); - index += snprintf(buffer + index, length - index, "%s (pti=%d, ebi=%d", - esmMsgType(msg->header.message_type), - msg->header.procedure_transaction_identity, - msg->header.eps_bearer_identity); - - switch (msg->header.message_type) { - case PDN_CONNECTIVITY_REQUEST: - index += _pdn_connectivity_request(buffer + index, length - index, - &msg->pdn_connectivity_request); - break; - - case PDN_CONNECTIVITY_REJECT: - index += _pdn_connectivity_reject(buffer + index, length - index, - &msg->pdn_connectivity_reject); - break; - - case PDN_DISCONNECT_REQUEST: - index += _pdn_disconnect_request(buffer + index, length - index, - &msg->pdn_disconnect_request); - break; - - case PDN_DISCONNECT_REJECT: - index += _pdn_disconnect_reject(buffer + index, length - index, - &msg->pdn_disconnect_reject); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: - index += _activate_default_eps_bearer_context_request( - buffer + index, length - index, - &msg->activate_default_eps_bearer_context_request); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - index += _activate_default_eps_bearer_context_accept( - buffer + index, length - index, - &msg->activate_default_eps_bearer_context_accept); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: - index += _activate_default_eps_bearer_context_reject( - buffer + index, length - index, - &msg->activate_default_eps_bearer_context_reject); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST: - index += _activate_dedicated_eps_bearer_context_request( - buffer + index, length - index, - &msg->activate_dedicated_eps_bearer_context_request); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT: - index += _activate_dedicated_eps_bearer_context_accept( - buffer + index, length - index, - &msg->activate_dedicated_eps_bearer_context_accept); - break; - - case ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT: - index += _activate_dedicated_eps_bearer_context_reject( - buffer + index, length - index, - &msg->activate_dedicated_eps_bearer_context_reject); - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST: - index += _deactivate_eps_bearer_context_request(buffer + index, - length - index, - &msg->deactivate_eps_bearer_context_request); - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - index += _deactivate_eps_bearer_context_accept(buffer + index, - length - index, - &msg->deactivate_eps_bearer_context_accept); - break; - - case ESM_STATUS: - index += _esm_status(buffer + index, length - index, - &msg->esm_status); - break; - - default: - printf("WARNING\t: %s - ESM NAS message is not valid (0x%x)\n", - __FUNCTION__, msg->header.message_type); - break; - } - - index += snprintf(buffer + index, length - index, ")"); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process PDN Connectivity Request - *----------------------------------------------------------------------------- - */ -static int -_pdn_connectivity_request( - char* buffer, - int length, - const pdn_connectivity_request_msg* msg) -{ - int index = 0; - - /* PDN request type and PDN type */ - index += snprintf(buffer + index, length - index, - ", RequestType = %s, PdnType = %s", - requestType(&msg->requesttype), - pdnType(&msg->pdntype)); - - /* Access Point Name */ - if (msg->presencemask & PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) { - index += snprintf(buffer + index, length - index, ", APN = %s", - (char*)msg->accesspointname.accesspointnamevalue.value); - } - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process PDN Connectivity Reject - *----------------------------------------------------------------------------- - */ -static int -_pdn_connectivity_reject( - char* buffer, - int length, - const pdn_connectivity_reject_msg* msg) -{ - int index = 0; - - /* ESM cause code */ - index += snprintf(buffer + index, length - index, ", EsmCause = %s (%d)", - esmCauseCode(msg->esmcause), msg->esmcause); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process PDN Disconnect Request - *----------------------------------------------------------------------------- - */ -static int -_pdn_disconnect_request( - char* buffer, - int length, - const pdn_disconnect_request_msg* msg) -{ - int index = 0; - - /* Linked EPS bearer identity */ - index += snprintf(buffer + index, length - index, ", Linked EBI = %d", - msg->linkedepsbeareridentity); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process PDN Disconnect Reject - *----------------------------------------------------------------------------- - */ -static int -_pdn_disconnect_reject( - char* buffer, - int length, - const pdn_disconnect_reject_msg* msg) -{ - int index = 0; - - /* ESM cause code */ - index += snprintf(buffer + index, length - index, ", EsmCause = %s (%d)", - esmCauseCode(msg->esmcause), msg->esmcause); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Activate Default EPS Bearer Context Request - *----------------------------------------------------------------------------- - */ -static int -_activate_default_eps_bearer_context_request( - char* buffer, - int length, - const activate_default_eps_bearer_context_request_msg* msg) -{ - int index = 0; - - /* Access Point Name */ - index += snprintf(buffer + index, length - index, ", APN = %s", - (char*)msg->accesspointname.accesspointnamevalue.value); - - /* PDN address */ - index += snprintf(buffer + index, length - index, ", PDN addr = "); - index += pdnAddress(buffer + index, length - index, &msg->pdnaddress); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Activate Default EPS Bearer Context Accept - *----------------------------------------------------------------------------- - */ -static int -_activate_default_eps_bearer_context_accept( - char* buffer, - int length, - const activate_default_eps_bearer_context_accept_msg* msg) -{ - int index = 0; - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Activate Default EPS Bearer Context Reject - *----------------------------------------------------------------------------- - */ -static int -_activate_default_eps_bearer_context_reject( - char* buffer, - int length, - const activate_default_eps_bearer_context_reject_msg* msg) -{ - int index = 0; - - /* ESM cause code */ - index += snprintf(buffer + index, length - index, ", EsmCause = %s (%d)", - esmCauseCode(msg->esmcause), msg->esmcause); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Activate Dedicated EPS Bearer Context Request - *----------------------------------------------------------------------------- - */ -static int -_activate_dedicated_eps_bearer_context_request( - char* buffer, - int length, - const activate_dedicated_eps_bearer_context_request_msg* msg) -{ - int index = 0; - - /* Linked EPS bearer identity */ - index += snprintf(buffer + index, length - index, ", Linked EBI = %d", - msg->linkedepsbeareridentity); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Activate Dedicated EPS Bearer Context Accept - *----------------------------------------------------------------------------- - */ -static int -_activate_dedicated_eps_bearer_context_accept( - char* buffer, - int length, - const activate_dedicated_eps_bearer_context_accept_msg* msg) -{ - int index = 0; - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Activate Dedicated EPS Bearer Context Reject - *----------------------------------------------------------------------------- - */ -static int -_activate_dedicated_eps_bearer_context_reject( - char* buffer, - int length, - const activate_dedicated_eps_bearer_context_reject_msg* msg) -{ - int index = 0; - - /* ESM cause code */ - index += snprintf(buffer + index, length - index, ", EsmCause = %s (%d)", - esmCauseCode(msg->esmcause), msg->esmcause); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Deactivate EPS Bearer Context Request - *----------------------------------------------------------------------------- - */ -static int _deactivate_eps_bearer_context_request( - char* buffer, - int length, - const deactivate_eps_bearer_context_request_msg* msg) -{ - int index = 0; - - /* ESM cause code */ - index += snprintf(buffer + index, length - index, ", EsmCause = %s (%d)", - esmCauseCode(msg->esmcause), msg->esmcause); - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process Deactivate EPS Bearer Context Accept - *----------------------------------------------------------------------------- - */ -static int -_deactivate_eps_bearer_context_accept( - char* buffer, - int length, - const deactivate_eps_bearer_context_accept_msg* msg) -{ - int index = 0; - - return (index); -} - -/* - *----------------------------------------------------------------------------- - * Process ESM Status - *----------------------------------------------------------------------------- - */ -static int -_esm_status( - char* buffer, - int length, - const esm_status_msg* msg) -{ - int index = 0; - - /* ESM cause code */ - index += snprintf(buffer + index, length - index, ", EsmCause = %s (%d)", - esmCauseCode(msg->esmcause), msg->esmcause); - - return (index); -} - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.h b/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.h deleted file mode 100644 index ed50809ce021a8219ace326e4a03c2257cf19f65..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/as_simulator/nas_process.h +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source nas_process.h - -Version 0.1 - -Date 2013/04/16 - -Product Access-Stratum sublayer simulator - -Subsystem NAS message processing - -Author Frederic Maurel - -Description Defines functions executed by the Access-Stratum sublayer - upon receiving NAS messages. - -*****************************************************************************/ - -#ifndef __NAS_PROCESS_H__ -#define __NAS_PROCESS_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -int nas_process(char* buffer, int length, const char* msg, int size); - -#endif /* __NAS_PROCESS_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/network/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/network/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/Makefile b/openair-cn/NAS/EURECOM-NAS/tst/network/Makefile deleted file mode 100644 index b9075e5c7718649cdd5c224d9b1558bd25a07e1c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/network/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -export PROCESS = MME - -include ../../Makerules -include ../../Makefile.inc - -PROJDIR = $(PWD)/../.. - -export LD_RUN_PATH = $(LIBDIR):$(LIBPROCESS) - -LIBS = -lutil -lapi -lEMMmsg -lESMmsg -lies -lrt -INCLUDES = -I. -I$(SRCDIR) -I$(INCDIR) -I$(UTILDIR) \ - -I$(EMMMSGDIR) -I$(ESMMSGDIR) -I$(IESDIR) - -TARGET = NetworkProcess - -all: $(TARGET) - -%.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET): $(OBJS) - $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) - @$(CP) $@ $(BINDIR) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGET) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/README b/openair-cn/NAS/EURECOM-NAS/tst/network/README deleted file mode 100644 index 25a6de5d147600feaa5b5d0f2edabcf73bb27477..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/network/README +++ /dev/null @@ -1,255 +0,0 @@ -================================================================================ - EURECOM LTE NAS emulation -================================================================================ - -The EURECOM-NAS.tar.bz2 archive contains libraries and binary files used to -execute emulation of the NAS protocol running on the control plane between -the UE and the core network in the Evolved Packet System. - --------------------------------------------------------------------------------- - How to extract files from EURECOM-NAS.tar.bz2 tarball file ? --------------------------------------------------------------------------------- - -> tar xvzf EURECOM-NAS.tar.bz2 - -EURECOM-NAS directory should contain following files: - -> tree -a EURECOM-NAS - -EURECOM-NAS -|-- bin -| |-- .ue.nvram -| |-- .ue_emm.nvram -| |-- .usim.nvram -| |-- NetworkProcess -| |-- UEprocess -| `-- UserProcess -`-- lib - |-- libEMMmsg.a - |-- libEMMmsg.so - |-- libEMMsap.a - |-- libEMMsap.so - |-- libESMmsg.a - |-- libESMmsg.so - |-- libESMsap.a - |-- libESMsap.so - |-- libapi.a - |-- libapi.so - |-- libies.a - |-- libies.so - |-- libutil.a - `-- libutil.so - --------------------------------------------------------------------------------- - EURECOM-NAS/bin directory --------------------------------------------------------------------------------- - -EURECOM-NAS/bin contains binary files. - -UEprocess is an implementation of the NAS protocol running at the UE side. - -NetworkProcess is a simulation of the core network running at the eNodeB -(network registration) and the MME (network attachment and PDN connection). - -UserProcess is a pseudo Connection Manager used to send AT commands to the -UE for testing purpose. - -When starting up, UEprocess reads configuration data from .nvram binary -files used as UE's non-volatile memory. - -.usim.nvram contains data stored into the USIM -.ue.nvram contains data related to the UE identification (IMEI, -manufacturer, model, PIN code) -.ue_emm.nvram contains data related to EPS Mobility Management (IMSI, last -registered PLMN) - --------------------------------------------------------------------------------- - EURECOM-NAS/lib directory --------------------------------------------------------------------------------- - -EURECOM-NAS/lib contains static libraries (lib*.a) and dynamically linked -shared object libraries (lib*.so). - --------------------------------------------------------------------------------- - Environment variables --------------------------------------------------------------------------------- - -Although static libraries are provided, only shared libraries are loaded by -programs at run time. To allow programs to find them all, the environment -variable LD_LIBRARY_PATH must be defined with the path of the EURECOM-NAS/lib -directory. - -> export LD_LIBRARY_PATH=/my-root-directory/EURECOM-NAS/lib:$LD_LIBRARY_PATH - -Where 'my-root-directory' is the absolute path to the directory where is -located the EURECOM-NAS directory. - -By default UEprocess reads UE's and USIM non-volatile data from files -located in the directory from where the program was started. If not found in -the current directory, UEprocess search files into the directories defined -by USIM_DIR and NVRAM_DIR environment variables. - -So if the UEprocess application is not started from the EURECOM-NAS/bin -directory, the environment variables USIM_DIR and NVRAM_DIR must be defined -with the path of the EURECOM-NAS/bin directory. - -> export USIM_DIR=/my-root-directory/EURECOM-NAS/bin -> export NVRAM_DIR=/my-root-directory/EURECOM-NAS/bin - --------------------------------------------------------------------------------- - Application settings --------------------------------------------------------------------------------- - -UserProcess, UEprocess and NetworkProcess applications can be runned locally -on the same host or distributed on several remote machines. - - - +-------------------------------+ - | UserProcess | - | (pseudo Connection Manager) | - +-------------------------------+ - ^ - | /dev/ttyUSBx - | or UDP - AT commands v - +-------------------------------+ - | UEprocess | - | (NAS protocol) | - +-------------------------------+ - ^ - | UDP - NAS messages v - +-------------------------------+ - | Networkprocess | - | (core network simulator) | - +-------------------------------+ - - -UEprocess communicates with UserProcess in two different ways: - - - using tty device file when together connected via USB-to-serial - adaptor cable - - - using UDP socket through the Internet Protocol - -UEprocess connects itself to NetworkProcess using UDP socket only. - --------------------------------------------------------------------------------- - How to run the EURECOM LTE emulation application ? --------------------------------------------------------------------------------- - -Every executables can be started in any order. - -Each executable has an usage menu. - -> EURECOM-NAS/bin/UserProcess --help -Usage: EURECOM-NAS/bin/UserProcess [-host <host>] [-port <port>] [-dev <devpath>] [-params <params>] - <host> Remote hostname (localhost) - <port> Remote port number (10000) - <devpath> Device pathname (NULL) - <params> Device attribute parameters (NULL) - -> EURECOM-NAS/bin/UEprocess --help -Usage: EURECOM-NAS/bin/UEprocess [-ueid <ueid>] [-trace <mask>] [-uhost <uhost>] [-nhost <nhost>] [-uport <uport>] [-nport <nport>] [-dev <devpath>] [-params <params>] - <ueid> UE identifier (1) - <mask> Logging trace level (0) - <uhost> User app layer's hostname (localhost) - <nhost> Network layer's hostname (localhost) - <uport> User app layer's port number (10000) - <nport> Network layer's port number (12000) - <devpath> Device pathname (NULL) - <params> Device attribute parameters (NULL) -Version: exported - 2013-05-30 18:49:43 - -> EURECOM-NAS/bin/NetworkProcess --help -Usage: EURECOM-NAS/bin/NetworkProcess [-host <host>] [-port <port>] - <host> Remote hostname (localhost) - <port> Remote port number (12000) - --------------------------------------------------------------------------------- - Receiving AT commands via serial-USB --------------------------------------------------------------------------------- - -Assuming that UserProcess connects to USB0 and UEprocess connects to USB1 -(they can connect to the same USB device number if they are running on -different hosts). - -1 - Configure and export environment variables: - -> export LD_LIBRARY_PATH=/my-root-directory/EURECOM-NAS/lib:$LD_LIBRARY_PATH -> export USIM_DIR=/my-root-directory/EURECOM-NAS/bin -> export NVRAM_DIR=/my-root-directory/EURECOM-NAS/bin - -2 - Start the pseudo Connection Manager to send AT commands to / receive - responses from USB0 at 9600 bauds rate: - -> ./EURECOM-NAS/bin/UserProcess -dev /dev/ttyUSB0 -params 9600 - -3 - Start the NAS protocol emulation to receive AT command from / send - responses to USB1 at 9600 bauds rate and send/receive NAS messages - to/from the network simulator using default localhost and port number - (1200): - -> ./EURECOM-NAS/bin/UEprocess -trace 2f -dev /dev/ttyUSB1 -params 9600 - -4 - Start the network simulation to send/receive NAS messages to/from the - NAS protocol emulation using default localhost and port number (1200): - -> ./EURECOM-NAS/bin/NetworkProcess - --------------------------------------------------------------------------------- - Receiving AT commands via UDP --------------------------------------------------------------------------------- - -1 - Configure and export environment variables: - -> export LD_LIBRARY_PATH=/my-root-directory/EURECOM-NAS/lib:$LD_LIBRARY_PATH -> export USIM_DIR=/my-root-directory/EURECOM-NAS/bin -> export NVRAM_DIR=/my-root-directory/EURECOM-NAS/bin - -2 - Start the pseudo Connection Manager to send AT commands to / receive - responses from the localhost using default port number (10000): - -> ./EURECOM-NAS/bin/UserProcess - -3 - Start the NAS protocol emulation to receive AT command from / send - responses to the localhost using default port number (10000) and - send/receive NAS messages to/from the network simulator using default - localhost and port number (1200): - -> ./EURECOM-NAS/bin/UEprocess -trace 2f - -4 - Start the network simulation to send/receive NAS messages to/from the - NAS protocol emulation using default localhost and port number (1200): - -> ./EURECOM-NAS/bin/NetworkProcess - --------------------------------------------------------------------------------- - Application output --------------------------------------------------------------------------------- - -UEprocess displays information related to parsing and execution of AT commands -and NAS procedures with following severity levels: - -DEBUG: Used for debug purpose (displayed in green color) -INFO: Informational trace -WARNING: Warning message (displayed in blue color) -ERROR: Error message (displayed in red color) -FUNC: Function's calling tree information at runtime -DUMP: Hex dump of all user and network messages - -The severity level is selected with the command line parameter -trace <sev> -where <sev> is a bitmask of the following hexadecimal values: - -00 - No trace (default) -01 - DEBUG -02 - INFO -04 - WARNING -08 - ERROR -0f - DEBUG + INFO + WARNING + ERROR -10 - FUNC -20 - DUMP -2f - DEBUG + INFO + WARNING + ERROR + DUMP - --------------------------------------------------------------------------------- - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.c b/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.c deleted file mode 100644 index f804e495b7c8315c14d7693ef5de808ad7378a48..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.c +++ /dev/null @@ -1,161 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source network_parser.c - -Version 0.1 - -Date 2012/11/05 - -Product Network Simulator - -Subsystem Command line parser - -Author Frederic Maurel - -Description Command line parser of the Network Simulator process - -*****************************************************************************/ - -#include "network_parser.h" - -#include "util/parser.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * Identifiers of the Network Simulator command line options - */ -enum { - NETWORK_PARSER_HOST, /* Remote hostname */ - NETWORK_PARSER_PORT, /* Remote port number */ - NETWORK_PARSER_NB_OPTIONS -}; - -/* ------------------------------------------------------------------- - * Definition of the internal Network Simulator command line structure - * ------------------------------------------------------------------- - * The command line is defined with a name (default is "NetworkProcess" - * but it will be replaced by the command name actually used at - * runtime), a number of options and the list of options. - * An option is defined with a name, an argument following the name, - * the usage displayed by the usage function and a default value. - */ -static parser_command_line_t networkParserCommandLine = { - "NetworkProcess", /* Command name */ - NETWORK_PARSER_NB_OPTIONS, /* Number of options */ - { /* Command line options */ - {"-host", "<host>", "Remote hostname\t\t", NETWORK_PARSER_DEFAULT_REMOTE_HOSTNAME}, - {"-port", "<port>", "Remote port number\t", NETWORK_PARSER_DEFAULT_REMOTE_PORT_NUMBER}, - } -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: network_parser_print_usage() ** - ** ** - ** Description: Displays the command line options used to run the Network ** - ** Simulator process ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline void network_parser_print_usage(void) -{ - parser_print_usage(&networkParserCommandLine); -} - -/**************************************************************************** - ** ** - ** Name: network_parser_get_options() ** - ** ** - ** Description: Gets the command line options used to run the Network ** - ** Simulator process ** - ** ** - ** Inputs: argc: Number of options ** - ** argv: Pointer to the list of options ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline int network_parser_get_options(int argc, const char** argv) -{ - return parser_get_options(argc, argv, &networkParserCommandLine); -} - -/**************************************************************************** - ** ** - ** Name: network_parser_get_nb_options() ** - ** ** - ** Description: Returns the number of the command line options used to ** - ** run the Network Simulator process ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Number of command line options ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline int network_parser_get_nb_options(void) -{ - return networkParserCommandLine.nb_options; -} - -/**************************************************************************** - ** ** - ** Name: network_parser_get_host() ** - ** ** - ** Description: Returns the value of the remote hostname ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the remote hostname ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline const char* network_parser_get_host(void) -{ - return networkParserCommandLine.options[NETWORK_PARSER_HOST].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: network_parser_get_port() ** - ** ** - ** Description: Returns the value of the remote port number ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the remote port number ** - ** Others: None ** - ** ** - ***************************************************************************/ -inline const char* network_parser_get_port(void) -{ - return networkParserCommandLine.options[NETWORK_PARSER_PORT].pvalue; -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.h b/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.h deleted file mode 100644 index ab158a444dee6222fdb10f9b14ec8a4ef6e5991c..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/network/network_parser.h +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source network_parser.h - -Version 0.1 - -Date 2012/11/05 - -Product Network simulator - -Subsystem Command line parser - -Author Frederic Maurel - -Description Command line parser of the Network Simulator process - -*****************************************************************************/ - -#ifndef __NETWORK_PARSER_H__ -#define __NETWORK_PARSER_H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* The default remote hostname the Network Simulator must connect to */ -#define NETWORK_PARSER_DEFAULT_REMOTE_HOSTNAME "localhost" - -/* The default port number used for the internet service delivered by the - * remote hostname */ -#define NETWORK_PARSER_DEFAULT_REMOTE_PORT_NUMBER "12000" - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void network_parser_print_usage(void); -int network_parser_get_options(int argc, const char** argv); - -int network_parser_get_nb_options(void); -const char* network_parser_get_host(void); -const char* network_parser_get_port(void); - -#endif /* __NETWORK_PARSER_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/network/network_simulator.c b/openair-cn/NAS/EURECOM-NAS/tst/network/network_simulator.c deleted file mode 100644 index 9a49f12547a5eeb15802ba77827d84eca4bdadfe..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/network/network_simulator.c +++ /dev/null @@ -1,1404 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source network_simulator.c - -Version 0.1 - -Date 09/10/2012 - -Product Network simulator - -Subsystem Network simulator main process - -Author Frederic Maurel - -Description Implements the network simulator running at the network - side for NAS_UE testing purpose. - -*****************************************************************************/ - -#include "network_parser.h" - -#include "include/commonDef.h" -#include "util/socket.h" -#include "util/nas_timer.h" -#include "api/network/as_message.h" -#include "api/network/nas_message.h" -#include "emm/msg/emm_cause.h" -#include "esm/msg/esm_cause.h" - -#include "util/nas_log.h" - -#include <stdio.h> // printf, perror -#include <errno.h> // errno -#include <netdb.h> // gai_strerror -#include <stdlib.h> // exit, malloc, rand -#include <signal.h> // sigaction -#include <string.h> // memset, memcpy -#include <unistd.h> // sleep - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * ----------------------------------------------------------------------------- - * Constants - * ----------------------------------------------------------------------------- - */ - -/* Tracking area code */ -#define DEFAULT_TAC 0xCAFE // two byte in hexadecimal format - -/* Cell identity */ -#define DEFAULT_CI 0x01020304 // four byte in hexadecimal format - -/* Reference signal received power */ -#define DEFAULT_RSRP 27 - -/* Reference signal received quality */ -#define DEFAULT_RSRQ 55 - -/* Data bit rates */ -#define BIT_RATE_64K 0x40 -#define BIT_RATE_128K 0x48 -#define BIT_RATE_512K 0x78 -#define BIT_RATE_1024K 0x87 - -/* Eurecom's Access Point Name */ -static const OctetString EURECOM_APN = { - 14, (uint8_t*)("www.eurecom.fr") -}; - -/* PDN IP address */ -//static uint8_t FIRST_PDN_IPV4_ADDRESS[] = {0x0A, 0x03, 0x02, 0x3C}; /* 10.3.2.60 */ -static uint8_t FIRST_PDN_IPV4_ADDRESS[] = { /* 192.168.02.60 */ - 0xC0, 0xA8, 0x02, 0x3C -}; -static uint8_t FIRST_PDN_IPV6_ADDRESS[] = { /* FE80::221:70FF:C0A8:023C/64 */ - 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x02, 0x3C -}; -static uint8_t FIRST_PDN_IPV4V6_ADDRESS[] = { /* 192.168.02.60, FE80::221:70FF:C0A8:023C/64 */ - 0xC0, 0xA8, 0x02, 0x3C, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x02, 0x3C -}; -static const OctetString FIRST_IPV4_PDN = {4, FIRST_PDN_IPV4_ADDRESS}; -static const OctetString FIRST_IPV6_PDN = {8, FIRST_PDN_IPV6_ADDRESS}; -static const OctetString FIRST_IPV4V6_PDN = {12, FIRST_PDN_IPV4V6_ADDRESS}; - -/* Other PDN IP address */ -//static uint8_t OTHER_PDN_IPV4_ADDRESS[] = {0x0A, 0x01, 0x20, 0x37}; /* 10.1.32.55 */ -static uint8_t OTHER_PDN_IPV4_ADDRESS[] = { /* 192.168.12.187 */ - 0xC0, 0xA8, 0x0C, 0xBB -}; -static uint8_t OTHER_PDN_IPV6_ADDRESS[] = { /* FE80::221:70FF:C0A8:CBB/64 */ - 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBB -}; -static uint8_t OTHER_PDN_IPV4V6_ADDRESS[] = { /* 192.168.12.187, FE80::221:70FF:C0A8:0CBB/64 */ - 0xC0, 0xA8, 0x0C, 0xBB, 0x02, 0x21, 0x70, 0xFF, 0xC0, 0xA8, 0x0C, 0xBB -}; -static const OctetString OTHER_IPV4_PDN = {4, OTHER_PDN_IPV4_ADDRESS}; -static const OctetString OTHER_IPV6_PDN = {8, OTHER_PDN_IPV6_ADDRESS}; -static const OctetString OTHER_IPV4V6_PDN = {12, OTHER_PDN_IPV4V6_ADDRESS}; - -/* XXX - Random wait time */ -#define SLEEP_TIME 1 - -/* - * ----------------------------------------------------------------------------- - * Macros - * ----------------------------------------------------------------------------- - */ - -#define PRINT_PLMN_DIGIT(d) if ((d) != 0xf) printf("%u", (d)) -#define PRINT_PLMN(plmn) \ - PRINT_PLMN_DIGIT((plmn).MCCdigit1); \ - PRINT_PLMN_DIGIT((plmn).MCCdigit2); \ - PRINT_PLMN_DIGIT((plmn).MCCdigit3); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit1); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit2); \ - PRINT_PLMN_DIGIT((plmn).MNCdigit3) - -/* - * ----------------------------------------------------------------------------- - * Variables - * ----------------------------------------------------------------------------- - */ - -/* - * String buffer used to send/receive messages to/from the network - */ -#define NETWORK_SIMULATOR_BUFFER_SIZE 1024 -static char _network_simulator_buffer [NETWORK_SIMULATOR_BUFFER_SIZE]; - -/* - * The connection endpoint used for communication with the network - */ -static socket_id_t * _network_simulator_sid; - -/* - * String buffer used to encode/decode ESM messages - */ -#define NETWORK_SIMULATOR_ESM_BUFFER_SIZE 1024 -static uint8_t _network_simulator_esm_buffer[NETWORK_SIMULATOR_ESM_BUFFER_SIZE]; - -/* - * Messages counter - */ -static unsigned int _network_simulator_msg_recv = 0; -static unsigned int _network_simulator_msg_sent = 0; - -/* - * EPS bearer identity - */ -static unsigned int _network_simulator_ebi = EPS_BEARER_IDENTITY_FIRST; - -/* - * Network IP version capability - */ -static const enum -{ - NETWORK_IPV4 = 0, - NETWORK_IPV6, - NETWORK_IPV4V6, - NETWORK_IP_MAX -} -_network_simulator_ip_version = NETWORK_IPV4V6; -static const OctetString* _network_simulator_pdn[NETWORK_IP_MAX][2] = { - /* IPv4 network capability */ - {&FIRST_IPV4_PDN, &OTHER_IPV4_PDN}, - /* IPv6 network capability */ - {&FIRST_IPV6_PDN, &OTHER_IPV6_PDN}, - /* IPv4v6 network capability */ - {&FIRST_IPV4V6_PDN, &OTHER_IPV4V6_PDN}, -}; - -/* - * ----------------------------------------------------------------------------- - * Functions - * ----------------------------------------------------------------------------- - */ - -static int _set_signal_handler(int signal, void (handler)(int)); -static void _signal_handler(int signal_number); -static int _process_message(int msgID, const as_message_t* req); -static int _assign_pdn_address(int ue_pdn_type, int is_initial, int* pdn_type, OctetString* pdn); - -/* Functions used to process messages received from the Access Stratum */ -static int _process_cell_info_req(const cell_info_req_t* req, cell_info_cnf_t* rsp); -static int _process_establish_req(const nas_establish_req_t* req, nas_establish_cnf_t* rsp); -static int _process_ul_info_transfer_req(const ul_info_transfer_req_t* req, ul_info_transfer_cnf_t* cnf, dl_info_transfer_ind_t* ind); - -/* Functions used to process EMM NAS messages */ -static int _process_emm_msg(EMM_msg* msg); -static int _process_attach_request(const attach_request_msg* msg, EMM_msg* rsp, const plmn_t *plmn); -static int _process_attach_complete(const attach_complete_msg* msg); - -/* Functions used to process ESM NAS messages */ -static int _process_esm_msg(ESM_msg* msg); -static int _process_pdn_connectivity_request(const pdn_connectivity_request_msg* msg, ESM_msg* rsp); -static int _process_pdn_disconnect_request(const pdn_disconnect_request_msg* msg, ESM_msg* rsp); -static int _process_activate_default_eps_bearer_context_accept(const activate_default_eps_bearer_context_accept_msg* msg); -static int _process_activate_default_eps_bearer_context_reject(const activate_default_eps_bearer_context_reject_msg* msg); -static int _process_deactivate_eps_bearer_context_accept(const deactivate_eps_bearer_context_accept_msg* msg); - -static void _dump_buffer(const Byte_t* buffer, size_t len) -{ - for (int i = 0; i < len; i++) { - if ( (i%16) == 0 ) printf("\n\t"); - - printf("%.2hx ", buffer[i]); - } - - printf("\n\n"); -} - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/****************************************************************************/ -int main (int argc, const char* argv[]) -{ - /* - * Get the command line options - */ - if ( network_parser_get_options(argc, argv) != RETURNok ) { - network_parser_print_usage(); - exit(EXIT_FAILURE); - } - - const char* host = network_parser_get_host(); - const char* port = network_parser_get_port(); - - nas_log_init(0x2f); - - /* - * Initialize the communication channel to the NAS sublayer - */ - _network_simulator_sid = socket_udp_open(SOCKET_SERVER, host, port); - - if (_network_simulator_sid == NULL) { - const char* error = ( (errno < 0) ? - gai_strerror(errno) : strerror(errno) ); - printf("ERROR\t: socket_udp_open() failed: %s\n", error); - exit(EXIT_FAILURE); - } - - printf("INFO\t: The Network Simulator is now connected to %s/%s (%d)\n", - host, port, socket_get_fd(_network_simulator_sid)); - - /* - * Set up signal handler - */ - (void) _set_signal_handler(SIGINT, _signal_handler); - (void) _set_signal_handler(SIGTERM, _signal_handler); - - /* - * Network simulator main loop - */ - while (TRUE) { - as_message_t msg; - - /* Receive message from the NAS */ - int rbytes = socket_recv(_network_simulator_sid, _network_simulator_buffer, - NETWORK_SIMULATOR_BUFFER_SIZE); - - if (rbytes == RETURNerror) { - perror("ERROR\t: socket_recv() failed"); - continue; - } - - _network_simulator_buffer[rbytes] = '\0'; - - _network_simulator_msg_recv += 1; - - /* Decode the received message */ - int msg_id = as_message_decode(_network_simulator_buffer, &msg, rbytes); - - /* Process the received message */ - int len = _process_message(msg_id, &msg); - - if (len > 0) { - /* XXX - Sleep a random interval of time before continuing */ - sleep(rand()%SLEEP_TIME); - /* Send the response message to the NAS sublayer */ - int sbytes = socket_send(_network_simulator_sid, _network_simulator_buffer, len); - - if (sbytes == RETURNerror) { - perror("ERROR\t: socket_send() failed"); - continue; - } - - _network_simulator_msg_sent += 1; - } - - printf("\nINFO\t: %d messages received, %d messages sent\n", - _network_simulator_msg_recv, _network_simulator_msg_sent); - } - - /* - * Termination cleanup - */ - printf("INFO\t: Closing network socket %d\n", socket_get_fd(_network_simulator_sid)); - socket_close(_network_simulator_sid); - - printf("INFO\t: Network simulator exited\n"); - exit(EXIT_SUCCESS); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * Signal handler setup function - */ -static int _set_signal_handler(int signal, void (handler)(int)) -{ - struct sigaction act; - - /* Initialize signal set */ - (void) memset (&act, 0, sizeof (act)); - (void) sigfillset (&act.sa_mask); - (void) sigdelset (&act.sa_mask, SIGHUP); - (void) sigdelset (&act.sa_mask, SIGINT); - (void) sigdelset (&act.sa_mask, SIGTERM); - (void) sigdelset (&act.sa_mask, SIGILL); - (void) sigdelset (&act.sa_mask, SIGTRAP); - (void) sigdelset (&act.sa_mask, SIGIOT); -#ifndef LINUX - (void) sigdelset (&act.sa_mask, SIGEMT); -#endif - (void) sigdelset (&act.sa_mask, SIGFPE); - (void) sigdelset (&act.sa_mask, SIGBUS); - (void) sigdelset (&act.sa_mask, SIGSEGV); - (void) sigdelset (&act.sa_mask, SIGSYS); - - /* Initialize signal handler */ - act.sa_handler = handler; - - if ( sigaction (signal, &act, 0) < 0 ) { - return RETURNerror; - } - - return RETURNok; -} - -/* - * Signal handler - */ -static void _signal_handler(int signal_number) -{ - printf("\nWARNING\t: Signal %d received\n", signal_number); - printf("INFO\t: Closing network socket %d\n", socket_get_fd(_network_simulator_sid)); - socket_close(_network_simulator_sid); - printf("INFO\t: Network simulator exited\n"); - exit(EXIT_SUCCESS); -} - -/* - * ----------------------------------------------------------------------------- - * Functions used to process messages received from the Access Stratum - * ----------------------------------------------------------------------------- - */ -/* - * Process messages received from the AS sublayer - */ -static int _process_message(int msgID, const as_message_t* req) -{ - as_message_t rsp; - int bytes = 0; - - memset(&rsp, 0, sizeof(as_message_t)); - - switch (msgID) { - case AS_CELL_INFO_REQ: - /* Process cell information request */ - rsp.msgID = _process_cell_info_req(&req->msg.cell_info_req, - &rsp.msg.cell_info_cnf); - break; - - case AS_NAS_ESTABLISH_REQ: - /* Process NAS signalling connection establishment request */ - rsp.msgID = _process_establish_req(&req->msg.nas_establish_req, - &rsp.msg.nas_establish_cnf); - break; - - case AS_UL_INFO_TRANSFER_REQ: - /* Process Uplink information transfer request */ - rsp.msgID = _process_ul_info_transfer_req(&req->msg.ul_info_transfer_req, - &rsp.msg.ul_info_transfer_cnf, - &rsp.msg.dl_info_transfer_ind); - break; - - default: - fprintf(stderr, "WARNING\t: Message type %d is not valid\n", msgID); - break; - } - - if (rsp.msgID == AS_NAS_RELEASE_IND) { - /* NAS signalling connection release */ - rsp.msg.nas_release_ind.cause = AS_DETACH; - printf("\nINFO\t: Send NAS connection release indication: cause = %d\n", - rsp.msg.nas_release_ind.cause); - } - - if (rsp.msgID > 0) { - /* Encode response message */ - bytes = as_message_encode(_network_simulator_buffer, &rsp, - NETWORK_SIMULATOR_BUFFER_SIZE); - } - - return (bytes); -} - -/* - * Process cell information request message - */ -static int _process_cell_info_req(const cell_info_req_t* req, - cell_info_cnf_t* rsp) -{ - printf("\nINFO\t: Received cell selection request: plmnID = "); - PRINT_PLMN(req->plmnID); - printf(", rat = 0x%x\n", req->rat); - - /* Setup cell information confirm message */ - //rsp->errCode = AS_FAILURE; - rsp->errCode = AS_SUCCESS; - rsp->tac = DEFAULT_TAC; - rsp->cellID = DEFAULT_CI; - rsp->rat = AS_EUTRAN; - rsp->rsrp = DEFAULT_RSRP; - rsp->rsrq = DEFAULT_RSRQ; - printf("\nINFO\t: Send cell selection confirm: errCode = %s (%d), " - "tac = 0x%.4x, cellID = 0x%.8x, rat = 0x%x\n", - (rsp->errCode != AS_SUCCESS)? "FAILURE" : "SUCCESS", rsp->errCode, - rsp->tac, rsp->cellID, rsp->rat); - - return (AS_CELL_INFO_CNF); -} - -/* - * Process NAS signalling connection establishment request - */ -static int _process_establish_req(const nas_establish_req_t* req, - nas_establish_cnf_t* rsp) -{ - int rc = RETURNerror; - - printf("\nINFO\t: Received NAS connection establish request: plmnID = "); - PRINT_PLMN(req->plmnID); - printf(", S-TMSI = MMEcode <0x%.2x> M-TMSI <0x%.4x>", - req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi); - printf(", cause = %d, type = %d\n", req->cause, req->type); - - const as_nas_info_t* nas_msg = &req->initialNasMsg; - printf("INFO\t: Initial NAS message (length = %d)\n", nas_msg->length); - _dump_buffer(nas_msg->data, nas_msg->length); - - /* Decode dedicated NAS information data */ - nas_message_t l3_msg; - rc = nas_message_decode((char*)nas_msg->data, &l3_msg, nas_msg->length); - - if (rc < 0) { - /* Transmission failure */ - printf("ERROR\t: Failed to decode NAS message (rc=%d)", rc); - rsp->errCode = AS_FAILURE; - return (AS_NAS_ESTABLISH_CNF); - } - - printf("INFO\t: L3 NAS message = 0x%.2x\n", l3_msg.plain.emm.header.message_type); - printf("INFO\t: Protocol Discriminator = %d\n", l3_msg.header.protocol_discriminator); - printf("INFO\t: Security Header Type = %d\n", l3_msg.header.security_header_type); - printf("INFO\t: EMM message: "); - - switch (l3_msg.plain.emm.header.message_type) { - case ATTACH_REQUEST: - rc = _process_attach_request(&l3_msg.plain.emm.attach_request, - &l3_msg.plain.emm, - &req->plmnID); - break; - - default: - printf("ERROR\t: L3 NAS message 0x%x is not valid\n", - l3_msg.plain.emm.header.message_type); - break; - } - - static int _establish_req_no_response_counter = 0; - - if (_establish_req_no_response_counter > 0) { - sleep(rand()%SLEEP_TIME); - _establish_req_no_response_counter -=1; - /* XXX - Return no any response to initial NAS message request */ - return (0); - } - - - if (rc != RETURNerror) { - int bytes = nas_message_encode(_network_simulator_buffer, &l3_msg, - NETWORK_SIMULATOR_BUFFER_SIZE); - - static int _establish_req_failure_counter = 0; - - if (_establish_req_failure_counter > 0) { - sleep(rand()%SLEEP_TIME); - _establish_req_failure_counter -= 1; - /* XXX - Return transmission failure indication */ - bytes = 0; - } - - if (bytes > 0) { - /* Setup signalling connection establishment confirm message */ - rsp->errCode = AS_SUCCESS; - rsp->nasMsg.data = (Byte_t*)malloc(bytes * sizeof(Byte_t)); - - if (rsp->nasMsg.data) { - rsp->nasMsg.length = bytes; - memcpy((char*)(rsp->nasMsg.data), _network_simulator_buffer, bytes); - } - } else { - /* Transmission failure */ - rsp->errCode = AS_FAILURE; - } - - printf("\nINFO\t: Send NAS connection establish confirm: errCode = %s (%d)\n", - (rsp->errCode != AS_SUCCESS)? "FAILURE" : "SUCCESS", rsp->errCode); - - if (rsp->nasMsg.length > 0) { - printf("INFO\t: NAS message %s (0x%x) (length = %d)\n", - (l3_msg.plain.emm.header.message_type == ATTACH_ACCEPT)? "ATTACH_ACCEPT" : - (l3_msg.plain.emm.header.message_type == ATTACH_REJECT)? "ATTACH_REJECT" : - "Unknown NAS message", l3_msg.plain.emm.header.message_type, - rsp->nasMsg.length); - _dump_buffer(rsp->nasMsg.data, rsp->nasMsg.length); - } - - /* NAS signalling connection confirm */ - rc = AS_NAS_ESTABLISH_CNF; - } else { - /* NAS signalling connection release */ - printf("\nINFO\t: Send NAS connection release indication\n"); - rc = AS_NAS_RELEASE_IND; - } - - return (rc); -} - -/* - * Process Uplink information transfer request - */ -static int _process_ul_info_transfer_req(const ul_info_transfer_req_t* req, - ul_info_transfer_cnf_t* cnf, - dl_info_transfer_ind_t* ind) -{ - int rc = RETURNerror; - int bytes; - - ESM_msg esm_msg; - memset(&esm_msg, 0, sizeof(ESM_msg)); - - printf("\nINFO\t: Received uplink information transfer request: "); - printf("S-TMSI = MMEcode <0x%.2x> M-TMSI <0x%.4x>\n", - req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi); - - const as_nas_info_t* nas_msg = &req->nasMsg; - printf("INFO\t: NAS message (length = %d)\n", nas_msg->length); - _dump_buffer(nas_msg->data, nas_msg->length); - - /* Decode NAS information data */ - nas_message_t l3_msg; - rc = nas_message_decode((char*)nas_msg->data, &l3_msg, nas_msg->length); - - if (rc < 0) { - /* Transmission failure */ - printf("ERROR\t: Failed to decode NAS message (rc=%d)", rc); - cnf->errCode = AS_FAILURE; - return (AS_UL_INFO_TRANSFER_CNF); - } - - if (l3_msg.header.protocol_discriminator != EPS_SESSION_MANAGEMENT_MESSAGE) { - bytes = _process_emm_msg(&l3_msg.plain.emm); - } else { - bytes = _process_esm_msg(&l3_msg.plain.esm); - } - - if (bytes < 0) { - /* Transmission failure indication */ - cnf->errCode = AS_FAILURE; - printf("\nINFO\t: Return transmission failure indication: errCode = %s (%d)\n", - (cnf->errCode != AS_SUCCESS)? "FAILURE" : "SUCCESS", cnf->errCode); - return (AS_UL_INFO_TRANSFER_CNF); - } else if (bytes > 0) { - /* Some data has to be sent back to the UE */ - ind->nasMsg.data = (Byte_t*)malloc(bytes * sizeof(Byte_t)); - - if (ind->nasMsg.data) { - ind->nasMsg.length = bytes; - strncpy((char*)ind->nasMsg.data, - (char*)_network_simulator_esm_buffer, bytes); - } - - /* Downlink data transfer indication */ - printf("INFO\t: Send downlink data transfer indication\n"); - return (AS_DL_INFO_TRANSFER_IND); - } else { - /* Data successfully delivered */ - cnf->errCode = AS_SUCCESS; - printf("\nINFO\t: Send uplink data transfer confirm: errCode = %s (%d)\n", - (cnf->errCode != AS_SUCCESS)? "FAILURE" : "SUCCESS", cnf->errCode); - return (AS_UL_INFO_TRANSFER_CNF); - } -} - -/* - * ----------------------------------------------------------------------------- - * Functions used to process EMM NAS messages - * ----------------------------------------------------------------------------- - */ - -static int _process_emm_msg(EMM_msg* msg) -{ - int bytes = -1; - - printf("INFO\t: EMM message id = 0x%.2x\n", msg->header.message_type); - printf("INFO\t: Protocol Discriminator = %d\n", msg->header.protocol_discriminator); - printf("INFO\t: Security Header Type = %d\n", msg->header.security_header_type); - printf("INFO\t: EMM message: "); - - switch (msg->header.message_type) { - case ATTACH_COMPLETE: - bytes = _process_attach_complete(&msg->attach_complete); - break; - - default: - printf("ERROR\t: EMM message 0x%x is not valid\n", - msg->header.message_type); - break; - } - - return (bytes); -} - -/* - * Process Attach Request EMM message - */ -static int _process_attach_request(const attach_request_msg* msg, EMM_msg* rsp, - const plmn_t *plmn) -{ - int rc = RETURNerror; - int bytes = 0; - - printf("Attach Request\n"); - printf("INFO\t:\tProtocolDiscriminator\t= %d\n", msg->protocoldiscriminator); - printf("INFO\t:\tSecurityHeaderType\t= %d\n", msg->securityheadertype); - printf("INFO\t:\tMessageType\t\t= 0x%.2x\n", msg->messagetype); - printf("INFO\t:\tEpsAttachType\t\t= %d\n", msg->epsattachtype); - printf("INFO\t:\tNasKeySetIdentifier\t= [%d][%d]\n", - msg->naskeysetidentifier.tsc, - msg->naskeysetidentifier.naskeysetidentifier); - - printf("INFO\t:\tEpsMobileIdentity\n"); - - if (msg->oldgutiorimsi.guti.typeofidentity == EPS_MOBILE_IDENTITY_GUTI) { - const GutiEpsMobileIdentity_t* guti = &msg->oldgutiorimsi.guti; - printf("INFO\t:\t oddeven\t\t= %d\n", guti->oddeven); - printf("INFO\t:\t typeofidentity\t= %d (GUTI)\n", guti->typeofidentity); - printf("INFO\t:\t PLMN\t\t= %d%d%d %d%d%.x\n", - guti->mccdigit1, guti->mccdigit2, guti->mccdigit3, - guti->mncdigit1, guti->mncdigit2, guti->mncdigit3); - printf("INFO\t:\t mmegroupid\t\t= 0x%.4x\n", guti->mmegroupid); - printf("INFO\t:\t mmecode\t\t= 0x%.2x\n", guti->mmecode); - printf("INFO\t:\t mtmsi\t\t= 0x%.8x\n", guti->mtmsi); - } else if (msg->oldgutiorimsi.imsi.typeofidentity == EPS_MOBILE_IDENTITY_IMSI) { - const ImeiEpsMobileIdentity_t* imsi = &msg->oldgutiorimsi.imsi; - printf("INFO\t:\t oddeven\t= %d\n", imsi->oddeven); - printf("INFO\t:\t typeofidentity\t= %d (IMSI)\n", imsi->typeofidentity); - printf("INFO\t:\t digit1\t= %d\n", imsi->digit1); - printf("INFO\t:\t digit2\t= %d\n", imsi->digit2); - printf("INFO\t:\t digit3\t= %d\n", imsi->digit3); - printf("INFO\t:\t digit4\t= %d\n", imsi->digit4); - printf("INFO\t:\t digit5\t= %d\n", imsi->digit5); - printf("INFO\t:\t digit6\t= %d\n", imsi->digit6); - printf("INFO\t:\t digit7\t= %d\n", imsi->digit7); - printf("INFO\t:\t digit8\t= %d\n", imsi->digit8); - printf("INFO\t:\t digit9\t= %d\n", imsi->digit9); - printf("INFO\t:\t digit10\t= %d\n", imsi->digit10); - printf("INFO\t:\t digit11\t= %d\n", imsi->digit11); - printf("INFO\t:\t digit12\t= %d\n", imsi->digit12); - printf("INFO\t:\t digit13\t= %d\n", imsi->digit13); - printf("INFO\t:\t digit14\t= %d\n", imsi->digit14); - printf("INFO\t:\t digit15\t= %d\n", imsi->digit15); - } else if (msg->oldgutiorimsi.imei.typeofidentity == EPS_MOBILE_IDENTITY_IMEI) { - const ImeiEpsMobileIdentity_t* imei = &msg->oldgutiorimsi.imei; - printf("INFO\t:\t oddeven\t= %d\n", imei->oddeven); - printf("INFO\t:\t typeofidentity\t= %d (IMEI)\n", imei->typeofidentity); - printf("INFO\t:\t digit1\t= %d\n", imei->digit1); - printf("INFO\t:\t digit2\t= %d\n", imei->digit2); - printf("INFO\t:\t digit3\t= %d\n", imei->digit3); - printf("INFO\t:\t digit4\t= %d\n", imei->digit4); - printf("INFO\t:\t digit5\t= %d\n", imei->digit5); - printf("INFO\t:\t digit6\t= %d\n", imei->digit6); - printf("INFO\t:\t digit7\t= %d\n", imei->digit7); - printf("INFO\t:\t digit8\t= %d\n", imei->digit8); - printf("INFO\t:\t digit9\t= %d\n", imei->digit9); - printf("INFO\t:\t digit10\t= %d\n", imei->digit10); - printf("INFO\t:\t digit11\t= %d\n", imei->digit11); - printf("INFO\t:\t digit12\t= %d\n", imei->digit12); - printf("INFO\t:\t digit13\t= %d\n", imei->digit13); - printf("INFO\t:\t digit14\t= %d\n", imei->digit14); - printf("INFO\t:\t digit15\t= %d\n", imei->digit15); - } - - printf("INFO\t:\tUeNetworkCapability\n"); - printf("INFO\t:\t eea = %d\n", msg->uenetworkcapability.eea); - printf("INFO\t:\t eia = %d\n", msg->uenetworkcapability.eia); - printf("INFO\t:\t uea = %d\n", msg->uenetworkcapability.uea); - printf("INFO\t:\t ucs2 = %d\n", msg->uenetworkcapability.ucs2); - printf("INFO\t:\t uia = %d\n", msg->uenetworkcapability.uia); - printf("INFO\t:\t spare = %d\n", msg->uenetworkcapability.spare); - printf("INFO\t:\t csfb = %d\n", msg->uenetworkcapability.csfb); - printf("INFO\t:\t lpp = %d\n", msg->uenetworkcapability.lpp); - printf("INFO\t:\t lcs = %d\n", msg->uenetworkcapability.lcs); - printf("INFO\t:\t srvcc = %d\n", msg->uenetworkcapability.srvcc); - printf("INFO\t:\t nf = %d\n", msg->uenetworkcapability.nf); - - printf("INFO\t: ESM message container (length = %d)\n", - msg->esmmessagecontainer.esmmessagecontainercontents.length); - _dump_buffer(msg->esmmessagecontainer.esmmessagecontainercontents.value, - msg->esmmessagecontainer.esmmessagecontainercontents.length); - - /* Decode ESM message container */ - ESM_msg esm_msg; - rc = esm_msg_decode(&esm_msg, msg->esmmessagecontainer.esmmessagecontainercontents.value, msg->esmmessagecontainer.esmmessagecontainercontents.length); - - if (rc < 0) { - /* Reject attach request cause = EMM_CAUSE_PROTOCOL_ERROR */ - printf("ERROR\t: Failed to decode ESM message (rc=%d)", rc); - rc = RETURNerror; - } else { - printf("INFO\t: L3 ESM message id = 0x%.2x\n", esm_msg.header.message_type); - printf("INFO\t: Protocol Discriminator = %d\n", esm_msg.header.protocol_discriminator); - printf("INFO\t: EPS Bearer Identity = %d\n", esm_msg.header.eps_bearer_identity); - printf("INFO\t: Procedure Transaction Identity = %d\n", esm_msg.header.procedure_transaction_identity); - printf("INFO\t: ESM message: "); - - /* Process ESM message */ - switch (esm_msg.header.message_type) { - case PDN_CONNECTIVITY_REQUEST: - rc = _process_pdn_connectivity_request(&esm_msg.pdn_connectivity_request, &esm_msg); - break; - - default: - printf("ERROR\t: Received ESM message 0x%x is not valid\n", - esm_msg.header.message_type); - break; - } - } - - /* Setup EMM response message */ - memset(rsp, 0, sizeof(EMM_msg)); - rsp->header.protocol_discriminator = EPS_MOBILITY_MANAGEMENT_MESSAGE; - rsp->header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; - - switch (rc) { - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST: - rsp->header.message_type = ATTACH_ACCEPT; - break; - - case PDN_CONNECTIVITY_REJECT: - rsp->header.message_type = ATTACH_REJECT; - break; - - default: - if (rc != RETURNerror) { - printf("ERROR\t: ESM message 0x%x to be sent is not valid\n", rc); - } - - break; - } - - /* Encode ESM response message */ - if (rc != RETURNerror) { - bytes = esm_msg_encode(&esm_msg, _network_simulator_esm_buffer, - NETWORK_SIMULATOR_ESM_BUFFER_SIZE); - } - - if (rsp->header.message_type != ATTACH_REJECT) { - /* Setup Attach Accept EMM message */ - attach_accept_msg* accept = &rsp->attach_accept; - accept->epsattachresult = EPS_ATTACH_RESULT_EPS; - accept->t3412value.unit = GPRS_TIMER_UNIT_0S; - accept->tailist.typeoflist = 1; /* list of TACs belonging to one PLMN, - * with consecutive TAC values */ - accept->tailist.numberofelements = 4; - accept->tailist.mccdigit1 = plmn->MCCdigit1; - accept->tailist.mccdigit2 = plmn->MCCdigit2; - accept->tailist.mccdigit3 = plmn->MCCdigit3; - accept->tailist.mncdigit1 = plmn->MNCdigit1; - accept->tailist.mncdigit2 = plmn->MNCdigit2; - accept->tailist.mncdigit3 = plmn->MNCdigit3; - accept->tailist.tac = DEFAULT_TAC; - accept->esmmessagecontainer.esmmessagecontainercontents.length = bytes; - accept->esmmessagecontainer.esmmessagecontainercontents.value = _network_simulator_esm_buffer; - } else { - /* Setup Attach Reject EMM message */ - attach_reject_msg* reject = &rsp->attach_reject; - - if (bytes > 0) { - reject->emmcause = EMM_CAUSE_ESM_FAILURE; - reject->presencemask = ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT; - reject->esmmessagecontainer.esmmessagecontainercontents.length = bytes; - reject->esmmessagecontainer.esmmessagecontainercontents.value = _network_simulator_esm_buffer; - } else { - reject->emmcause = EMM_CAUSE_PROTOCOL_ERROR; - //reject->emmcause = EMM_CAUSE_ILLEGAL_UE; - //reject->emmcause = EMM_CAUSE_ILLEGAL_ME; - //reject->emmcause = EMM_CAUSE_EPS_NOT_ALLOWED; - //reject->emmcause = EMM_CAUSE_PLMN_NOT_ALLOWED; - //reject->emmcause = EMM_CAUSE_NOT_AUTHORIZED_IN_PLMN; - //reject->emmcause = EMM_CAUSE_TA_NOT_ALLOWED; - //reject->emmcause = EMM_CAUSE_ROAMING_NOT_ALLOWED; - //reject->emmcause = EMM_CAUSE_EPS_NOT_ALLOWED_IN_PLMN; - //reject->emmcause = EMM_CAUSE_NO_SUITABLE_CELLS; - //reject->emmcause = EMM_CAUSE_CONGESTION; - //reject->emmcause = EMM_CAUSE_CSG_NOT_AUTHORIZED; - } - } - - static int _attach_request_release_counter = 0; - - if (_attach_request_release_counter > 0) { - sleep(rand()%SLEEP_TIME); - _attach_request_release_counter -= 1; - /* XXX - Return NAS signalling connection release indication */ - return (RETURNerror); - } - - return (RETURNok); -} - -/* - * Process Attach Complete EMM message - */ -static int _process_attach_complete(const attach_complete_msg* msg) -{ - int bytes = -1; - - printf("Attach Complete\n"); - printf("INFO\t: ESM message container (length = %d)\n", - msg->esmmessagecontainer.esmmessagecontainercontents.length); - _dump_buffer(msg->esmmessagecontainer.esmmessagecontainercontents.value, - msg->esmmessagecontainer.esmmessagecontainercontents.length); - - /* Decode ESM message container */ - ESM_msg esm_msg; - bytes = esm_msg_decode(&esm_msg, msg->esmmessagecontainer.esmmessagecontainercontents.value, msg->esmmessagecontainer.esmmessagecontainercontents.length); - - if (bytes < 0) { - /* Transmission failure */ - printf("ERROR\t: Transmission failure\n"); - return (bytes); - } - - printf("INFO\t: ESM message id = 0x%.2x\n", esm_msg.header.message_type); - printf("INFO\t: Protocol Discriminator = %d\n", esm_msg.header.protocol_discriminator); - printf("INFO\t: EPS Bearer Identity = %d\n", esm_msg.header.eps_bearer_identity); - printf("INFO\t: Procedure Transaction Identity = %d\n", esm_msg.header.procedure_transaction_identity); - printf("INFO\t: ESM message: "); - - switch (esm_msg.header.message_type) { - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - bytes = _process_activate_default_eps_bearer_context_accept( - &esm_msg.activate_default_eps_bearer_context_accept); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: - bytes = _process_activate_default_eps_bearer_context_reject( - &esm_msg.activate_default_eps_bearer_context_reject); - break; - - default: - printf("ERROR\t: ESM message 0x%x is not valid\n", esm_msg.header.message_type); - break; - } - - static int _attach_complete_failure_counter = 0; - - if (_attach_complete_failure_counter > 0) { - sleep(rand()%SLEEP_TIME); - _attach_complete_failure_counter -= 1; - /* XXX - Return transmission failure indication */ - return (-1); - } - - return (bytes); -} - -/* - * ----------------------------------------------------------------------------- - * Functions used to process ESM NAS messages - * ----------------------------------------------------------------------------- - */ - -static int _process_esm_msg(ESM_msg* msg) -{ - int bytes = 0; - int rc = RETURNerror; - - ESM_msg rsp; - - printf("INFO\t: ESM message id = 0x%.2x\n", msg->header.message_type); - printf("INFO\t: Protocol Discriminator = %d\n", msg->header.protocol_discriminator); - printf("INFO\t: EPS Bearer Identity = %d\n", msg->header.eps_bearer_identity); - printf("INFO\t: Procedure Transaction Identity = %d\n", msg->header.procedure_transaction_identity); - printf("INFO\t: ESM message: "); - - switch (msg->header.message_type) { - case PDN_CONNECTIVITY_REQUEST: - rc = _process_pdn_connectivity_request(&msg->pdn_connectivity_request, - &rsp); - break; - - case PDN_DISCONNECT_REQUEST: - rc = _process_pdn_disconnect_request(&msg->pdn_disconnect_request, - &rsp); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT: - rc = _process_activate_default_eps_bearer_context_accept( - &msg->activate_default_eps_bearer_context_accept); - break; - - case ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT: - rc = _process_activate_default_eps_bearer_context_reject( - &msg->activate_default_eps_bearer_context_reject); - break; - - case DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT: - rc = _process_deactivate_eps_bearer_context_accept( - &msg->deactivate_eps_bearer_context_accept); - break; - - default: - printf("ERROR\t: ESM message 0x%x is not valid\n", - msg->header.message_type); - break; - } - - if (rc > 0) { - /* Encode ESM response message */ - bytes = esm_msg_encode(&rsp, _network_simulator_esm_buffer, - NETWORK_SIMULATOR_ESM_BUFFER_SIZE); - printf("\nINFO\t: Send NAS message %s (0x%x) (length = %d)\n", - (rsp.header.message_type == PDN_CONNECTIVITY_REJECT)? "PDN_CONNECTIVITY_REJECT" : - (rsp.header.message_type == PDN_DISCONNECT_REJECT)? "PDN_DISCONNECT_REJECT" : - (rsp.header.message_type == ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST)? "ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST" : - (rsp.header.message_type == DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST)? "DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST" : - "Unknown NAS message", rsp.header.message_type, bytes); - _dump_buffer(_network_simulator_esm_buffer, bytes); - } - - return (bytes); -} - -/* - * Process PDN Connectivity Request ESM message - */ -static int _process_pdn_connectivity_request(const pdn_connectivity_request_msg* msg, ESM_msg* rsp) -{ - int pti = msg->proceduretransactionidentity; - - /* Get the APN if any */ - OctetString apn = {0, NULL}; - - if (msg->presencemask & PDN_CONNECTIVITY_REQUEST_ACCESS_POINT_NAME_PRESENT) { - const OctetString* apn_value = &msg->accesspointname.accesspointnamevalue; - apn.value = (uint8_t*)malloc(apn_value->length * sizeof(uint8_t)); - - if (apn.value != NULL) { - apn.length = apn_value->length; - apn.value = (uint8_t*)strncpy((char*)apn.value, (char*)apn_value->value, apn.length); - apn.value[apn.length] = '\0'; - } - } - - /* Get the PDN type */ - int requested_pdn_type = msg->pdntype; - - printf("PDN Connectivity Request\n"); - printf("INFO\t:\tProtocolDiscriminator\t\t= %d\n", msg->protocoldiscriminator); - printf("INFO\t:\tEpsBearerIdentity\t\t= %d\n", msg->epsbeareridentity); - printf("INFO\t:\tProcedureTransactionIdentity\t= %d\n", msg->proceduretransactionidentity); - printf("INFO\t:\tMessageType\t\t\t= 0x%.2x\n", msg->messagetype); - printf("INFO\t:\tRequestType\t\t\t= %d\n", msg->requesttype); - printf("INFO\t:\tPdnType\t\t\t\t= %d\n", msg->pdntype); - - if (apn.length > 0) { - printf("INFO\t:\taccesspointname\t\t\t= %s\n", apn.value); - } - - memset(rsp, 0, sizeof(ESM_msg)); - - rsp->header.protocol_discriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - - if (_network_simulator_ebi > EPS_BEARER_IDENTITY_LAST) { - _network_simulator_ebi = EPS_BEARER_IDENTITY_FIRST; - } - - rsp->header.eps_bearer_identity = _network_simulator_ebi++; - rsp->header.procedure_transaction_identity = pti; - - static int _pdn_connectivity_reject_counter = 0; - - if (_pdn_connectivity_reject_counter > 0) { - sleep(rand()%SLEEP_TIME); - _pdn_connectivity_reject_counter -= 1; - /* XXX - Setup PDN connectivity Reject message */ - pdn_connectivity_reject_msg* reject = &rsp->pdn_connectivity_reject; - reject->messagetype = PDN_CONNECTIVITY_REJECT; - reject->esmcause = ESM_CAUSE_PROTOCOL_ERROR; - } else if ( (_network_simulator_ip_version != NETWORK_IPV4V6) && - (_network_simulator_ip_version != requested_pdn_type) ) { - /* Setup PDN connectivity Reject message */ - pdn_connectivity_reject_msg* reject = &rsp->pdn_connectivity_reject; - reject->messagetype = PDN_CONNECTIVITY_REJECT; - - if (_network_simulator_ip_version != NETWORK_IPV4) { - reject->esmcause = ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED; - } else { - reject->esmcause = ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED; - } - } else { - int pdn_type; - int esm_cause; - /* Setup Activate Default EPS Bearer Request message */ - activate_default_eps_bearer_context_request_msg* request = &rsp->activate_default_eps_bearer_context_request; - request->messagetype = ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST; - request->epsqos.qci = 3; /* GBR bearer for playback video */ - request->epsqos.bitRatesPresent = 1; - request->epsqos.bitRates.maxBitRateForUL = BIT_RATE_128K; /* 128K */ - request->epsqos.bitRates.maxBitRateForDL = BIT_RATE_1024K; /* 1M */ - request->epsqos.bitRates.guarBitRateForUL = BIT_RATE_64K; /* 64K */ - request->epsqos.bitRates.guarBitRateForDL = BIT_RATE_512K; /* 512K */ - - /* Assign PDN address */ - if (apn.length > 0) { - request->accesspointname.accesspointnamevalue = apn; - esm_cause = _assign_pdn_address(requested_pdn_type, FALSE, &pdn_type, - &request->pdnaddress.pdnaddressinformation); - } else { - request->accesspointname.accesspointnamevalue = EURECOM_APN; - esm_cause = _assign_pdn_address(requested_pdn_type, TRUE, &pdn_type, - &request->pdnaddress.pdnaddressinformation); - } - - request->pdnaddress.pdntypevalue = pdn_type; - - if (esm_cause != ESM_CAUSE_SUCCESS) { - /* Set ESM cause */ - request->presencemask |= ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_ESM_CAUSE_PRESENT; - request->esmcause = esm_cause; - } - - } - - return (rsp->header.message_type); -} - -/* - * Process PDN Disconnect Request ESM message - */ -static int _process_pdn_disconnect_request(const pdn_disconnect_request_msg* msg, ESM_msg* rsp) -{ - int pti = msg->proceduretransactionidentity; - int ebi = msg->linkedepsbeareridentity; - - printf("PDN Disconnect Request\n"); - printf("INFO\t:\tProtocolDiscriminator\t\t= %d\n", msg->protocoldiscriminator); - printf("INFO\t:\tEpsBearerIdentity\t\t= %d\n", msg->epsbeareridentity); - printf("INFO\t:\tProcedureTransactionIdentity\t= %d\n", msg->proceduretransactionidentity); - printf("INFO\t:\tMessageType\t\t\t= 0x%.2x\n", msg->messagetype); - printf("INFO\t:\tLinkedEpsBearerIdentity\t= %d\n", msg->linkedepsbeareridentity); - - memset(rsp, 0, sizeof(ESM_msg)); - - rsp->header.protocol_discriminator = EPS_SESSION_MANAGEMENT_MESSAGE; - rsp->header.eps_bearer_identity = ebi; - rsp->header.procedure_transaction_identity = pti; - - static int _pdn_disconnect_reject_counter = 0; - - if (_pdn_disconnect_reject_counter > 0) { - sleep(rand()%SLEEP_TIME); - _pdn_disconnect_reject_counter -= 1; - /* XXX - Setup PDN Disconnect Reject message */ - pdn_disconnect_reject_msg* reject = &rsp->pdn_disconnect_reject; - reject->epsbeareridentity = EPS_BEARER_IDENTITY_UNASSIGNED; - reject->messagetype = PDN_DISCONNECT_REJECT; - reject->esmcause = ESM_CAUSE_PROTOCOL_ERROR; - } else { - /* Setup Deactivate EPS Bearer Request message */ - deactivate_eps_bearer_context_request_msg* request = &rsp->deactivate_eps_bearer_context_request; - request->messagetype = DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST; - request->esmcause = ESM_CAUSE_REGULAR_DEACTIVATION; - } - - return (rsp->header.message_type); -} - -/* - * Process Activate Default EPS Bearer Context Accept ESM message - */ -static int _process_activate_default_eps_bearer_context_accept(const activate_default_eps_bearer_context_accept_msg* msg) -{ - printf("Activate Default EPS Bearer Context Accept\n"); - printf("INFO\t:\tProtocolDiscriminator\t\t= %d\n", msg->protocoldiscriminator); - printf("INFO\t:\tEpsBearerIdentity\t\t= %d\n", msg->epsbeareridentity); - printf("INFO\t:\tProcedureTransactionIdentity\t= %d\n", msg->proceduretransactionidentity); - printf("INFO\t:\tMessageType\t\t\t= 0x%.2x\n", msg->messagetype); - - return (0); -} - -/* - * Process Activate Default EPS Bearer Context Reject ESM message - */ -static int _process_activate_default_eps_bearer_context_reject(const activate_default_eps_bearer_context_reject_msg* msg) -{ - printf("Activate Default EPS Bearer Context Reject\n"); - printf("INFO\t:\tProtocolDiscriminator\t\t= %d\n", msg->protocoldiscriminator); - printf("INFO\t:\tEpsBearerIdentity\t\t= %d\n", msg->epsbeareridentity); - printf("INFO\t:\tProcedureTransactionIdentity\t= %d\n", msg->proceduretransactionidentity); - printf("INFO\t:\tMessageType\t\t\t= 0x%.2x\n", msg->messagetype); - printf("INFO\t:\tESM cause\t\t\t= %d\n", msg->esmcause); - - return (0); -} - -/* - * Process Deactivate EPS Bearer Context Accept ESM message - */ -static int _process_deactivate_eps_bearer_context_accept(const deactivate_eps_bearer_context_accept_msg* msg) -{ - printf("Deactivate EPS Bearer Context Accept\n"); - printf("INFO\t:\tProtocolDiscriminator\t\t= %d\n", msg->protocoldiscriminator); - printf("INFO\t:\tEpsBearerIdentity\t\t= %d\n", msg->epsbeareridentity); - printf("INFO\t:\tProcedureTransactionIdentity\t= %d\n", msg->proceduretransactionidentity); - printf("INFO\t:\tMessageType\t\t\t= 0x%.2x\n", msg->messagetype); - - return (0); -} - -/* - * Assign PDN address according to the network IP capability - */ -static int _assign_pdn_address(int ue_pdn_type, int is_initial, int* pdn_type, OctetString* pdn) -{ - if (_network_simulator_ip_version == NETWORK_IPV4) { - /* The network supports IPv4 addressing only */ - *pdn_type = PDN_VALUE_TYPE_IPV4; - *pdn = *_network_simulator_pdn[NETWORK_IPV4][is_initial]; - - if (ue_pdn_type == PDN_TYPE_IPV4V6) { - /* Return ESM cause code #50 */ - return (ESM_CAUSE_PDN_TYPE_IPV4_ONLY_ALLOWED); - } - } else if (_network_simulator_ip_version == NETWORK_IPV6) { - /* The network supports IPv6 addressing only */ - *pdn_type = PDN_VALUE_TYPE_IPV6; - *pdn = *_network_simulator_pdn[NETWORK_IPV6][is_initial]; - - if (ue_pdn_type == PDN_TYPE_IPV4V6) { - /* Return ESM cause code #51 */ - return (ESM_CAUSE_PDN_TYPE_IPV6_ONLY_ALLOWED); - } - } else { - /* The network supports either IPv4 or IPv6 addressing */ - if (ue_pdn_type != PDN_TYPE_IPV4) { - /* Assign IPv6 address */ - *pdn_type = PDN_VALUE_TYPE_IPV6; - *pdn = *_network_simulator_pdn[NETWORK_IPV6][is_initial]; - } else { - /* Assign IPv4 address */ - *pdn_type = PDN_VALUE_TYPE_IPV4; - *pdn = *_network_simulator_pdn[NETWORK_IPV4][is_initial]; - } - - if (ue_pdn_type == PDN_TYPE_IPV4V6) { - *pdn_type = PDN_VALUE_TYPE_IPV4V6; - *pdn = *_network_simulator_pdn[NETWORK_IPV4V6][is_initial]; - /* Return ESM cause code #52 */ - //return (ESM_CAUSE_SINGLE_ADDRESS_BEARERS_ONLY_ALLOWED); - } - } - - return (ESM_CAUSE_SUCCESS); -} - -/* - 07 41 71 0b f6 02 f8 01 01 02 0f 00 00 00 01 05 - 00 00 00 00 00 00 04 02 01 d0 11 52 02 f8 01 00 - - 07 41 71 0b f6 02 f8 01 01 02 0f 00 00 00 01 05 - 00 00 00 00 00 00 04 02 01 d0 11 52 02 f8 01 00 - 01 e0 - */ - -/* - 04 01 04 10 20 8f 10 00 00 00 0f 00 00 00 01 00 - 00 00 1b 00 00 00 07 41 71 0b f6 02 f8 01 01 02 - 0f 00 00 00 01 05 00 00 00 00 00 00 04 02 01 d0 - 11 - - 04 01 04 10 00 00 0f 00 00 00 01 00 00 00 20 8f - 10 00 1b 00 00 00 07 41 71 0b f6 02 f8 01 01 02 - 0f 00 00 00 01 05 00 00 00 00 00 00 04 02 01 d0 - 11 - - 04 01 04 10 00 00 0f 00 00 00 01 00 00 00 20 8f - 10 00 22 00 00 00 07 41 71 0b f6 02 f8 01 01 02 - 0f 00 00 00 01 05 80 80 00 00 00 00 04 02 01 d0 - 31 52 02 f8 01 00 01 e0 - - 04 01 04 10 00 00 0f 00 00 00 01 00 00 00 20 8f - 10 00 28 00 00 00 17 00 00 00 00 00 17 41 01 0b - f6 02 f8 01 01 02 0f 00 00 00 01 05 80 80 00 00 - 00 00 04 02 02 d0 31 52 02 f8 01 00 01 e0 -*/ -/* - U16 msgID = [04 01] - AS_NAS_ESTABLISH_REQ - U8 cause = [04] - NET_ESTABLISH_CAUSE_MO_SIGNAL - U8 type = [10] - NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL - plmn_t plmnID = [20 8f 10] - Byte_t MCCdigit2:4 = [0] - Byte_t MCCdigit1:4 = [2] - Byte_t MNCdigit3:4 = [f] - Byte_t MCCdigit3:4 = [8] - Byte_t MNCdigit2:4 = [0] - Byte_t MNCdigit1:4 = [1] - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 1b] (27 octets) - U8* initialNasMsg = [07 41 71 0b f6 02 f8 01 01 02 0f 00 00 00 01 05] - [00 00 00 00 00 00 04 02 01 d0 11] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [41] - Attach Request - U8:4 NAS KSI = [7] - U8:4 Attach Type = [1] - EPS Mobile Identity = [0b f6 02 f8 01 01 02 0f 00 00 00 01] - Length = [0b] (11 bytes) - U8:4 = 1111 = [f] - U8:1 oddeven = 0 - U8:3 typeofidentity = 110 = [6] - U8:4 mccdigit2 = [0] - U8:4 mccdigit1 = [2] - U8:4 mncdigit3 = [f] - U8:4 mccdigit3 = [8] - U8:4 mncdigit2 = [0] - U8:4 mncdigit1 = [1] - U16 mmegroupid = [01 02] - U8 mmecode = [0f] - U32 mtmsi = [00 00 00 01] - UE network capability = [05 00 00 00 00 00] - Length = [05] (5 bytes) - U8 eea = [00] - U8 eia = [00] - U8 uea = [00] - U8:1 ucs2 = 0 - U8:7 uia = 0000000 = [00] - U8:3 spare = 000 - U8:1 csfb = 0 - U8:1 lpp = 0 - U8:1 lcs = 0 - U8:1 srvcc = 0 - U8:1 nf = 0 = [00] - - ESM message container = [00 04 02 01 d0 11] - Length = [00 04] (4 bytes) - ESM message = [02 01 d0 31] - U8:4 EPS bearer identity = [0] - Not assigned - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [01] - U8 ESM message identifier = [d0] - PDN Connectivity Request - U8:4 Pdn type = [1] - IPv4 - U8:4 Request type = [1] - Initial request -*/ - -/* - 06 01 0f 00 00 00 01 00 00 00 07 00 00 00 07 43 - 00 03 52 00 c2 - - 06 01 00 00 00 00 0f 00 00 00 01 00 00 00 0d 00 - 00 00 27 00 00 00 00 cf 27 43 00 03 52 00 c2 -*/ -/* - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - - U32 Length = [00 00 00 07] (7 octets) - U8* NasMsg = [07 43 00 03 52 00 c2] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [43] - Attach Complete - - ESM message container = [00 03 52 00 c2] - Length = [00 03] (3 bytes) - ESM message = [52 00 c2] - U8:4 EPS bearer identity = [5] - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [00] - Not assigned - U8 ESM message identifier = [c2] - Activate Default EPS Bearer Context Accept - */ - - -/* - 04 08 01 00 00 00 03 00 00 00 07 44 03 - - U16 msgID = [04 08] - AS_NAS_ESTABLISH_CNF - U8 errCode = [01] - AS_SUCCESS - - U32 Length = [00 00 00 03] (3 octets) - U8* initialNasMsg = [07 44 03] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [44] - Attach Reject - U8 EMM cause = [03] - EMM_CAUSE_ILLEGAL_UE - */ - -/* - 06 01 0f 00 00 00 01 00 00 00 17 00 00 00 02 03 - d0 11 28 11 77 77 77 2e 63 6f 6d 34 69 6e 6e 6f - 76 2e 63 6f 6d - - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - U32 Length = [00 00 00 17] (23 octets) - U8* NasMsg = [02 03 d0 11 28 11 77 77 77 2e 63 6f 6d 34 69 6e 6e 6f 76 2e 63 6f 6d] - U8:4 EPS bearer identity = [0] - Unassigned - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [03] - U8 ESM message identifier = [d0] - PDN Connectivity Request -*/ - -/* - 07 04 04 00 00 00 52 03 d1 6f - - U16 msgID = [07 04] - AS_DL_INFO_TRANSFER_IND - U32 Length = [04 00 00 00] (4 octets) - U8* NasMsg = [52 03 d1 6f] - U8:4 EPS bearer identity = [5] - EBI5 - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [03] - U8 ESM message identifier = [d1] - PDN Connectivity Reject - U8 ESM cause = [6f] - Protocol error, unspecified -*/ -/* - 04 08 01 00 00 00 0a 00 00 00 07 44 13 78 00 04 - 01 d1 6f 00 - U16 msgID = [04 08] - AS_NAS_ESTABLISH_CNF - U8 errCode = [01] - AS_SUCCESS - - U32 Length = [00 00 00 0a] (10 octets) - U8* initialNasMsg = [07 44 13 78 00 04 01 d1 6f 00] - U8:4 Security header type = [0] - Not protected - U8:4 Protocol discriminator = [7] - EMM message - U8 EMM message identifier = [44] - Attach Reject - U8 EMM cause = [13] - EMM_CAUSE_ESM_FAILURE (19) - TLV = [78 00 04 01 d1 6f 00] - IEI = 78 - ESM container - Length = [00 04] - 4 octets - [01 d1 6f 00] - U8:4 EPS bearer identity = [0] - U8:4 Protocol discriminator = [1] - ESM message -*/ - -/* - 06 01 00 00 00 00 0f 00 00 00 01 00 00 00 04 00 - 00 00 02 03 d2 06 - U16 msgID = [06 01] - AS_UL_INFO_TRANSFER_REQ - as_stmsi_t s_tmsi - U8 MMEcode = [0f] - U32 m_tmsi = [00 00 00 01] - U32 Length = [00 00 00 04] (4 octets) - U8* NasMsg = [02 03 d2 06] - - U8:4 EPS bearer identity = [0] - Unassigned - U8:4 Protocol discriminator = [2] - ESM message - U8 Procedure Transaction Identity = [03] - U8 ESM message identifier = [d2] - PDN Disconnect Request - U8:4 Linked EPS bearer identity = [6] - EPS bearer identity = 6 -*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/COPYING b/openair-cn/NAS/EURECOM-NAS/tst/user/COPYING deleted file mode 100644 index 94a9ed024d3859793618152ea559a168bbcbb5e2..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/user/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/Makefile b/openair-cn/NAS/EURECOM-NAS/tst/user/Makefile deleted file mode 100644 index 797d0614ab2607975fce4331930c9e0f46406ab6..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/user/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -################################################################################ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom -# -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see <http://www.gnu.org/licenses/>. -# -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@eurecom.fr -# -# Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. -# -################################################################################ -include ../../Makerules -include ../../Makefile.inc - -PROJDIR = $(PWD)/../.. - -export LD_RUN_PATH = $(LIBDIR) - -LIBS = -lutil -lpthread -lrt -INCLUDES = -I. -I$(SRCDIR) - -TARGET = UserProcess - -all: $(TARGET) - -%.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -$(TARGET): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - @$(CP) $(TARGET) $(BINDIR) - -clean: - $(RM) $(OBJS) *.bak *~ - -veryclean: clean - $(RM) $(TARGET) - -depend: - makedepend -- ${CFLAGS} -- ${SRCS} - -# DO NOT DELETE THIS LINE -- make depend depends on it. - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.c b/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.c deleted file mode 100644 index f43639ed73674c589a95351732b546a53cf7df01..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.c +++ /dev/null @@ -1,201 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source user_parser.c - -Version 0.1 - -Date 2012/10/09 - -Product User Simulator - -Subsystem Command line parser - -Author Frederic Maurel - -Description Command line parser of the User Simulator process - -*****************************************************************************/ - -#include "user_parser.h" - -#include "util/parser.h" - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/* - * Identifiers of the User Simulator command line options - */ -enum { - USER_PARSER_HOST, /* Remote hostname */ - USER_PARSER_PORT, /* Remote port number */ - USER_PARSER_DEVPATH, /* Device pathname */ - USER_PARSER_DEVATTR, /* Device attribute parameters */ - USER_PARSER_NB_OPTIONS -}; - -/* ---------------------------------------------------------------- - * Definition of the internal User Simulator command line structure - * ---------------------------------------------------------------- - * The command line is defined with a name (default is "UserProcess" - * but it will be replaced by the command name actually used at - * runtime), a number of options and the list of options. - * An option is defined with a name, an argument following the name, - * the usage displayed by the usage function and a default value. - */ -static parser_command_line_t userParserCommandLine = { - "UserProcess", /* Command name */ - USER_PARSER_NB_OPTIONS, /* Number of options */ - { /* Command line options */ - {"-host", "<host>", "\tRemote hostname\t\t", USER_PARSER_DEFAULT_REMOTE_HOSTNAME}, - {"-port", "<port>", "\tRemote port number\t", USER_PARSER_DEFAULT_REMOTE_PORT_NUMBER}, - {"-dev", "<devpath>", "Device pathname\t\t", "NULL"}, - {"-params", "<params>", "Device attribute parameters", "NULL"}, - } -}; - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: user_parser_print_usage() ** - ** ** - ** Description: Displays the command line options used to run the User ** - ** Simulator process ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: None ** - ** Others: None ** - ** ** - ***************************************************************************/ -void user_parser_print_usage(void) -{ - parser_print_usage(&userParserCommandLine); -} - -/**************************************************************************** - ** ** - ** Name: user_parser_get_options() ** - ** ** - ** Description: Gets the command line options used to run the User ** - ** Simulator process ** - ** ** - ** Inputs: argc: Number of options ** - ** argv: Pointer to the list of options ** - ** Others: None ** - ** ** - ** Outputs: Return: RETURNerror, RETURNok ** - ** Others: None ** - ** ** - ***************************************************************************/ -int user_parser_get_options(int argc, const char** argv) -{ - return parser_get_options(argc, argv, &userParserCommandLine); -} - -/**************************************************************************** - ** ** - ** Name: user_parser_get_nb_options() ** - ** ** - ** Description: Returns the number of the command line options used to ** - ** run the User Simulator process ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Number of command line options ** - ** Others: None ** - ** ** - ***************************************************************************/ -int user_parser_get_nb_options(void) -{ - return userParserCommandLine.nb_options; -} - -/**************************************************************************** - ** ** - ** Name: user_parser_get_host() ** - ** ** - ** Description: Returns the value of the remote hostname ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the remote hostname ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char* user_parser_get_host(void) -{ - return userParserCommandLine.options[USER_PARSER_HOST].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: user_parser_get_port() ** - ** ** - ** Description: Returns the value of the remote port number ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the remote port number ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char* user_parser_get_port(void) -{ - return userParserCommandLine.options[USER_PARSER_PORT].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: user_parser_get_devpath() ** - ** ** - ** Description: Returns the value of the device pathname ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the device pathname ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char* user_parser_get_devpath(void) -{ - return userParserCommandLine.options[USER_PARSER_DEVPATH].pvalue; -} - -/**************************************************************************** - ** ** - ** Name: user_parser_get_devattr() ** - ** ** - ** Description: Returns the value of the device attribute parameters ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: Return: Value of the device attribute parameters ** - ** Others: None ** - ** ** - ***************************************************************************/ -const char* user_parser_get_devattr(void) -{ - return userParserCommandLine.options[USER_PARSER_DEVATTR].pvalue; -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.h b/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.h deleted file mode 100644 index 7c8da2b1a54fc572e2ea72e36ea1bb6420a83577..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/user/user_parser.h +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source user_parser.h - -Version 0.1 - -Date 2012/10/09 - -Product User simulator - -Subsystem Command line parser - -Author Frederic Maurel - -Description Command line parser of the user simulator process - -*****************************************************************************/ - -#ifndef __USER_PARSER_H__ -#define __USER_PARSER__H__ - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/* The default remote hostname the User Simulator must connect to */ -#define USER_PARSER_DEFAULT_REMOTE_HOSTNAME "localhost" - -/* The default port number used for the internet service delivered by the - * remote hostname */ -#define USER_PARSER_DEFAULT_REMOTE_PORT_NUMBER "10000" - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -void user_parser_print_usage(void); -int user_parser_get_options(int argc, const char** argv); - -int user_parser_get_nb_options(void); -const char* user_parser_get_host(void); -const char* user_parser_get_port(void); -const char* user_parser_get_devpath(void); -const char* user_parser_get_devattr(void); - -#endif /* __USER_PARSER_H__*/ diff --git a/openair-cn/NAS/EURECOM-NAS/tst/user/user_simulator.c b/openair-cn/NAS/EURECOM-NAS/tst/user/user_simulator.c deleted file mode 100644 index 8a341bc7a9e02887904825e013e65d4453076335..0000000000000000000000000000000000000000 --- a/openair-cn/NAS/EURECOM-NAS/tst/user/user_simulator.c +++ /dev/null @@ -1,312 +0,0 @@ -/***************************************************************************** - Eurecom OpenAirInterface 3 - Copyright(c) 2012 Eurecom - -Source user_simulator.c - -Version 0.1 - -Date 2012/10/09 - -Product User simulator - -Subsystem User simulator main process - -Author Frederic Maurel - -Description Implements the user simulator running at the user application - layer for NAS testing purpose. - -*****************************************************************************/ - -#include "user_parser.h" - -#include "include/commonDef.h" -#include "util/socket.h" -#include "util/device.h" - -#include <stdio.h> // printf, perror -#include <errno.h> // errno -#include <netdb.h> // gai_strerror -#include <ctype.h> // isspace -#include <stdlib.h> // exit -#include <signal.h> // sigaction -#include <string.h> // memset -#include <pthread.h> -#include <poll.h> - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -#define USER_SIMULATOR_BUFFER_SIZE 1024 - -/* - * String buffer used to send AT commands to the NAS sublayer - */ -static char _user_simulator_send_buffer [USER_SIMULATOR_BUFFER_SIZE]; - -/* - * String buffer used to receive responses from the NAS sublayer - */ -static char _user_simulator_recv_buffer [USER_SIMULATOR_BUFFER_SIZE]; - -/* - * The connection endpoint used for communication with the - * NAS sublayer (see src/api/user/user_api.c) - */ -static struct { - void* endpoint; - void* (*open) (int, const char*, const char*); - int (*getfd)(const void*); - ssize_t (*recv) (void*, char*, size_t); - ssize_t (*send) (const void*, const char*, size_t); - void (*close)(void*); -} _user_simulator_id; -//static socket_id_t * _user_simulator_sid; - -#define USER_OPEN(a, b, c) _user_simulator_id.open(a, b, c) -#define USER_GETFD() _user_simulator_id.getfd(_user_simulator_id.endpoint) -#define USER_RECV(a, b) _user_simulator_id.recv(_user_simulator_id.endpoint, a, b) -#define USER_SEND(a, b) _user_simulator_id.send(_user_simulator_id.endpoint, a, b) -#define USER_CLOSE() _user_simulator_id.close(_user_simulator_id.endpoint) - -static int _set_signal_handler(int signal, void (handler)(int)); -static void _signal_handler(int signal_number); -static void* _receive_thread(void* arg); - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ - -/****************************************************************************/ -int main (int argc, const char* argv[]) -{ - /* - * Get the command line options - */ - if ( user_parser_get_options(argc, argv) != RETURNok ) { - user_parser_print_usage(); - exit(EXIT_FAILURE); - } - - const char* host = user_parser_get_host(); - const char* port = user_parser_get_port(); - const char* devpath = user_parser_get_devpath(); - const char* devattr = user_parser_get_devattr(); - - printf("%s -host %s -port %s -dev %s -params %s\n", - argv[0], host, port, devpath, devattr); - - /* - * Initialize the communication channel to the NAS sublayer - */ - if (devpath) { - /* Initialize device handlers */ - _user_simulator_id.open = device_open; - _user_simulator_id.getfd = device_get_fd; - _user_simulator_id.recv = device_read; - _user_simulator_id.send = device_write; - _user_simulator_id.close = device_close; - - /* Initialize communication channel */ - _user_simulator_id.endpoint = USER_OPEN(DEVICE, devpath, devattr); - - if (_user_simulator_id.endpoint == NULL) { - perror("ERROR\t: Failed to open connection endpoint"); - exit(EXIT_FAILURE); - } - - printf("INFO\t: The User Simulator is now connected to %s (%d)\n", - devpath, USER_GETFD()); - } else { - /* Initialize network socket handlers */ - _user_simulator_id.open = socket_udp_open; - _user_simulator_id.getfd = socket_get_fd; - _user_simulator_id.recv = socket_recv; - _user_simulator_id.send = socket_send; - _user_simulator_id.close = socket_close; - - /* Initialize communication channel */ - _user_simulator_id.endpoint = USER_OPEN(SOCKET_CLIENT, host, port); - - if (_user_simulator_id.endpoint == NULL) { - const char* error = ( (errno < 0) ? - gai_strerror(errno) : strerror(errno) ); - printf("ERROR\t: Failed to open connection endpoint: %s\n", error); - exit(EXIT_FAILURE); - } - - printf("INFO\t: The User Simulator is now connected to %s/%s (%d)\n", - host, port, USER_GETFD()); - } - - - /* - * Set up signal handler - */ - (void) _set_signal_handler(SIGINT, _signal_handler); - (void) _set_signal_handler(SIGTERM, _signal_handler); - - /* - * Create the receiving thread - */ - pthread_attr_t attr; - pthread_t thread_id; - pthread_attr_init(&attr); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - int rc = pthread_create (&thread_id, &attr, _receive_thread, NULL); - - if (rc != 0) { - perror("ERROR\t: pthread_create() failed"); - USER_CLOSE(); - exit(EXIT_FAILURE); - } - - /* - * User simulator main loop - */ - while (TRUE) { - char c; - int len; - - /* Get the AT command */ - printf("AT command (q to quit) > "); - c = getchar(); - - if (c == 'q') break; - - if (c == '\n') continue; - - len = 0; - - while ( (len < USER_SIMULATOR_BUFFER_SIZE - 1) && (c != '\n') ) { - if (!isspace(c)) { - _user_simulator_send_buffer[len++] = c; - } - - c = getchar(); - } - - _user_simulator_send_buffer[len++] = '\r'; - _user_simulator_send_buffer[len] = '\0'; - - /* Send the AT command to the NAS sublayer */ - int sbytes = USER_SEND(_user_simulator_send_buffer, len); - - if (sbytes == RETURNerror) { - perror("ERROR\t: Failed to send data to the NAS sublayer"); - break; - } - -#if 0 - /* Send the AT command one byte at a time (serial port simulation) */ - const char* pbuffer = _user_simulator_send_buffer; - - while (*pbuffer) { - int sbytes = USER_SEND(pbuffer++, 1); - - if (sbytes == RETURNerror) { - perror("ERROR\t: Failed to send data to the NAS sublayer"); - break; - } - - (void)poll(0, 0, 10); - } - -#endif - - (void)poll(0, 0, 100); - } - - /* - * Termination cleanup - */ - printf("INFO\t: Closing user endpoint descriptor %d\n", USER_GETFD()); - USER_CLOSE(); - - printf("INFO\t: User simulator exited\n"); - exit(EXIT_SUCCESS); -} - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/* - * Signal handler setup function - */ -static int _set_signal_handler(int signal, void (handler)(int)) -{ - struct sigaction act; - - /* Initialize signal set */ - (void) memset (&act, 0, sizeof (act)); - (void) sigfillset (&act.sa_mask); - (void) sigdelset (&act.sa_mask, SIGHUP); - (void) sigdelset (&act.sa_mask, SIGINT); - (void) sigdelset (&act.sa_mask, SIGTERM); - (void) sigdelset (&act.sa_mask, SIGILL); - (void) sigdelset (&act.sa_mask, SIGTRAP); - (void) sigdelset (&act.sa_mask, SIGIOT); -#ifndef LINUX - (void) sigdelset (&act.sa_mask, SIGEMT); -#endif - (void) sigdelset (&act.sa_mask, SIGFPE); - (void) sigdelset (&act.sa_mask, SIGBUS); - (void) sigdelset (&act.sa_mask, SIGSEGV); - (void) sigdelset (&act.sa_mask, SIGSYS); - - /* Initialize signal handler */ - act.sa_handler = handler; - - if ( sigaction (signal, &act, 0) < 0 ) { - return RETURNerror; - } - - return RETURNok; -} - -/* - * Signal handler - */ -static void _signal_handler(int signal_number) -{ - printf("\nWARNING\t: Signal %d received\n", signal_number); - printf("INFO\t: Closing user socket %d\n", USER_GETFD()); - USER_CLOSE(); - printf("INFO\t: User simulator exited\n"); - exit(EXIT_SUCCESS); -} - -/* - * Receiving thread - */ -static void* _receive_thread(void* arg) -{ - while (TRUE) { - /* Receive AT response from the NAS sublayer */ - int rbytes = USER_RECV(_user_simulator_recv_buffer, - USER_SIMULATOR_BUFFER_SIZE); - - if (rbytes != 0) { - if (rbytes == RETURNerror) { - perror("ERROR\t: Failed to receive data from the NAS sublayer"); - break; - } - - _user_simulator_recv_buffer[rbytes] = '\0'; - - /* Display AT response */ - printf("%s\n", _user_simulator_recv_buffer); - } - } - - return (NULL); -} -