renamed openair-cn to openair3
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7886 818b1a75-f10b-46b9-bf7c-635c3b92a50f
@@ -0,0 +1,674 @@
|
||||
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>.
|
||||
@@ -0,0 +1,63 @@
|
||||
################################################################################
|
||||
# OpenAirInterface
|
||||
# Copyright(c) 1999 - 2014 Eurecom
|
||||
#
|
||||
# OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# OpenAirInterface is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenAirInterface.The full GNU General Public License is
|
||||
# included in this distribution in the file called "COPYING". If not,
|
||||
# see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Contact Information
|
||||
# OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
# OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
# OpenAirInterface Dev : openair4g-devel@lists.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.
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*****************************************************************************
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*****************************************************************************
|
||||
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__
|
||||
@@ -0,0 +1,70 @@
|
||||
/*****************************************************************************
|
||||
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__*/
|
||||
@@ -0,0 +1,653 @@
|
||||
/*****************************************************************************
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
/*****************************************************************************
|
||||
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 *********************/
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*****************************************************************************
|
||||
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__*/
|
||||
@@ -0,0 +1,908 @@
|
||||
/*****************************************************************************
|
||||
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]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*****************************************************************************
|
||||
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__
|
||||
@@ -0,0 +1,43 @@
|
||||
/*****************************************************************************
|
||||
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__*/
|
||||
@@ -0,0 +1,674 @@
|
||||
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>.
|
||||
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,674 @@
|
||||
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>.
|
||||
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,34 @@
|
||||
================================================================================
|
||||
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.
|
||||
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,354 @@
|
||||
#!/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)
|
||||
@@ -0,0 +1,674 @@
|
||||
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>.
|
||||
@@ -0,0 +1,63 @@
|
||||
################################################################################
|
||||
# OpenAirInterface
|
||||
# Copyright(c) 1999 - 2014 Eurecom
|
||||
#
|
||||
# OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# OpenAirInterface is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenAirInterface.The full GNU General Public License is
|
||||
# included in this distribution in the file called "COPYING". If not,
|
||||
# see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Contact Information
|
||||
# OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
# OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
# OpenAirInterface Dev : openair4g-devel@lists.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.
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
================================================================================
|
||||
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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
/*****************************************************************************
|
||||
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 *********************/
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*****************************************************************************
|
||||
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__*/
|
||||
@@ -0,0 +1,674 @@
|
||||
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>.
|
||||
@@ -0,0 +1,60 @@
|
||||
################################################################################
|
||||
# OpenAirInterface
|
||||
# Copyright(c) 1999 - 2014 Eurecom
|
||||
#
|
||||
# OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# OpenAirInterface is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenAirInterface.The full GNU General Public License is
|
||||
# included in this distribution in the file called "COPYING". If not,
|
||||
# see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Contact Information
|
||||
# OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
# OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
# OpenAirInterface Dev : openair4g-devel@lists.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.
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
/*****************************************************************************
|
||||
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 *********************/
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*****************************************************************************
|
||||
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__*/
|
||||
@@ -0,0 +1,312 @@
|
||||
/*****************************************************************************
|
||||
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);
|
||||
}
|
||||
|
||||